OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_ |
6 #define CHROME_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_ | 6 #define CHROME_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
| 10 #include "base/gfx/size.h" |
10 #include "chrome/browser/dom_ui/html_dialog_contents.h" | 11 #include "chrome/browser/dom_ui/html_dialog_contents.h" |
11 #include "chrome/common/notification_observer.h" | 12 #include "chrome/common/notification_observer.h" |
12 | 13 |
13 // This class can only be used on the UI thread. | 14 // This class can only be used on the UI thread. |
14 class ModalHtmlDialogDelegate | 15 class ModalHtmlDialogDelegate |
15 : public HtmlDialogContentsDelegate, | 16 : public HtmlDialogContentsDelegate, |
16 public NotificationObserver { | 17 public NotificationObserver { |
17 public: | 18 public: |
18 ModalHtmlDialogDelegate(const GURL& url, | 19 ModalHtmlDialogDelegate(const GURL& url, |
19 int width, int height, | 20 int width, int height, |
20 const std::string& json_arguments, | 21 const std::string& json_arguments, |
21 IPC::Message* sync_result, | 22 IPC::Message* sync_result, |
22 WebContents* contents); | 23 WebContents* contents); |
23 ~ModalHtmlDialogDelegate(); | 24 ~ModalHtmlDialogDelegate(); |
24 | 25 |
25 // Notification service callback. | 26 // Notification service callback. |
26 virtual void Observe(NotificationType type, | 27 virtual void Observe(NotificationType type, |
27 const NotificationSource& source, | 28 const NotificationSource& source, |
28 const NotificationDetails& details); | 29 const NotificationDetails& details); |
29 | 30 |
30 // HTMLDialogContentsDelegate implementation: | 31 // HTMLDialogContentsDelegate implementation: |
31 virtual bool IsDialogModal() const; | 32 virtual bool IsDialogModal() const; |
32 virtual std::wstring GetDialogTitle() const { return L"Google Gears"; } | 33 virtual std::wstring GetDialogTitle() const { return L"Google Gears"; } |
33 virtual GURL GetDialogContentURL() const; | 34 virtual GURL GetDialogContentURL() const; |
34 virtual void GetDialogSize(CSize* size) const; | 35 virtual void GetDialogSize(gfx::Size* size) const; |
35 virtual std::string GetDialogArgs() const; | 36 virtual std::string GetDialogArgs() const; |
36 virtual void OnDialogClosed(const std::string& json_retval); | 37 virtual void OnDialogClosed(const std::string& json_retval); |
37 | 38 |
38 private: | 39 private: |
39 // Invoked from the destructor or when we receive notification the web | 40 // Invoked from the destructor or when we receive notification the web |
40 // contents has been disconnnected. Removes the observer from the WebContents | 41 // contents has been disconnnected. Removes the observer from the WebContents |
41 // and NULLs out contents_. | 42 // and NULLs out contents_. |
42 void RemoveObserver(); | 43 void RemoveObserver(); |
43 | 44 |
44 // The WebContents that opened the dialog. | 45 // The WebContents that opened the dialog. |
45 WebContents* contents_; | 46 WebContents* contents_; |
46 | 47 |
47 // The parameters needed to display a modal HTML dialog. | 48 // The parameters needed to display a modal HTML dialog. |
48 HtmlDialogContents::HtmlDialogParams params_; | 49 HtmlDialogContents::HtmlDialogParams params_; |
49 | 50 |
50 // Once we get our reply in OnModalDialogResponse we'll need to respond to the | 51 // Once we get our reply in OnModalDialogResponse we'll need to respond to the |
51 // plugin using this |sync_result| pointer so we store it between calls. | 52 // plugin using this |sync_result| pointer so we store it between calls. |
52 IPC::Message* sync_response_; | 53 IPC::Message* sync_response_; |
53 | 54 |
54 DISALLOW_COPY_AND_ASSIGN(ModalHtmlDialogDelegate); | 55 DISALLOW_COPY_AND_ASSIGN(ModalHtmlDialogDelegate); |
55 }; | 56 }; |
56 | 57 |
57 #endif // CHROME_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_ | 58 #endif // CHROME_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H_ |
OLD | NEW |