blob: 34dd0ef6dee3856ae3b4792fdcc8633a4c4796de [file] [log] [blame]
license.botbf09a502008-08-24 00:55:551// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
[email protected]c633a492008-11-17 21:32:425#ifndef CHROME_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_
6#define CHROME_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_
initial.commit09911bf2008-07-26 23:55:297
8#include <vector>
9
10#include "chrome/browser/dom_ui/html_dialog_contents.h"
11#include "chrome/common/notification_service.h"
12
13// This class can only be used on the UI thread.
14class ModalHtmlDialogDelegate
15 : public HtmlDialogContentsDelegate,
16 public NotificationObserver {
17 public:
18 ModalHtmlDialogDelegate(const GURL& url,
19 int width, int height,
20 const std::string& json_arguments,
21 IPC::Message* sync_result,
22 WebContents* contents);
23 ~ModalHtmlDialogDelegate();
24
25 // Notification service callback.
26 virtual void Observe(NotificationType type,
27 const NotificationSource& source,
28 const NotificationDetails& details);
29
[email protected]c2dacc92008-10-16 23:51:3830 // views::WindowDelegate implementation:
initial.commit09911bf2008-07-26 23:55:2931 virtual bool IsModal() const;
32
33 // ModalHtmlDialogContents::ModalHTMLDialogContentsDelegate implementation:
34 virtual GURL GetDialogContentURL() const;
35 virtual void GetDialogSize(CSize* size) const;
36 virtual std::string GetDialogArgs() const;
37 virtual void OnDialogClosed(const std::string& json_retval);
38
39 private:
[email protected]c633a492008-11-17 21:32:4240 // Invoked from the destructor or when we receive notification the web
41 // contents has been disconnnected. Removes the observer from the WebContents
42 // and NULLs out contents_.
43 void RemoveObserver();
44
initial.commit09911bf2008-07-26 23:55:2945 // The WebContents that opened the dialog.
46 WebContents* contents_;
47
48 // The parameters needed to display a modal HTML dialog.
49 HtmlDialogContents::HtmlDialogParams params_;
50
51 // Once we get our reply in OnModalDialogResponse we'll need to respond to the
52 // plugin using this |sync_result| pointer so we store it between calls.
53 IPC::Message* sync_response_;
54
[email protected]c633a492008-11-17 21:32:4255 DISALLOW_COPY_AND_ASSIGN(ModalHtmlDialogDelegate);
initial.commit09911bf2008-07-26 23:55:2956};
57
[email protected]c633a492008-11-17 21:32:4258#endif // CHROME_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_