OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_VIEWS_KEYBOARD_OVERLAY_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_KEYBOARD_OVERLAY_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_KEYBOARD_OVERLAY_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_KEYBOARD_OVERLAY_DELEGATE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "chrome/browser/ui/webui/web_dialog_delegate.h" | 10 #include "chrome/browser/ui/webui/web_dialog_delegate.h" |
| 11 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" |
11 | 13 |
| 14 class KeyboardOverlayDialogView; |
12 class WebDialogView; | 15 class WebDialogView; |
13 | 16 |
14 class KeyboardOverlayDelegate : public WebDialogDelegate { | 17 class KeyboardOverlayDelegate : public WebDialogDelegate, |
| 18 public content::NotificationObserver { |
15 public: | 19 public: |
16 explicit KeyboardOverlayDelegate(const string16& title); | 20 explicit KeyboardOverlayDelegate(const string16& title); |
17 | 21 |
18 WebDialogView* view() { return view_; } | 22 // Shows the keyboard overlay. |
19 void set_view(WebDialogView* view) { view_ = view; } | 23 void Show(KeyboardOverlayDialogView* view); |
20 | 24 |
21 // Overridden from WebDialogDelegate: | 25 // Overridden from WebDialogDelegate: |
22 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; | 26 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; |
23 | 27 |
24 private: | 28 private: |
25 virtual ~KeyboardOverlayDelegate(); | 29 virtual ~KeyboardOverlayDelegate(); |
26 | 30 |
27 // Overridden from WebDialogDelegate: | 31 // Overridden from WebDialogDelegate: |
28 virtual ui::ModalType GetDialogModalType() const OVERRIDE; | 32 virtual ui::ModalType GetDialogModalType() const OVERRIDE; |
29 virtual string16 GetDialogTitle() const OVERRIDE; | 33 virtual string16 GetDialogTitle() const OVERRIDE; |
30 virtual GURL GetDialogContentURL() const OVERRIDE; | 34 virtual GURL GetDialogContentURL() const OVERRIDE; |
31 virtual void GetWebUIMessageHandlers( | 35 virtual void GetWebUIMessageHandlers( |
32 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; | 36 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; |
33 virtual std::string GetDialogArgs() const OVERRIDE; | 37 virtual std::string GetDialogArgs() const OVERRIDE; |
| 38 virtual void OnDialogShown( |
| 39 content::WebUI* webui, |
| 40 content::RenderViewHost* render_view_host) OVERRIDE; |
34 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; | 41 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; |
35 virtual void OnCloseContents(content::WebContents* source, | 42 virtual void OnCloseContents(content::WebContents* source, |
36 bool* out_close_dialog) OVERRIDE; | 43 bool* out_close_dialog) OVERRIDE; |
37 virtual bool ShouldShowDialogTitle() const OVERRIDE; | 44 virtual bool ShouldShowDialogTitle() const OVERRIDE; |
38 virtual bool HandleContextMenu( | 45 virtual bool HandleContextMenu( |
39 const content::ContextMenuParams& params) OVERRIDE; | 46 const content::ContextMenuParams& params) OVERRIDE; |
40 | 47 |
| 48 // Overridden from content::NotificationObserver: |
| 49 virtual void Observe(int type, |
| 50 const content::NotificationSource& source, |
| 51 const content::NotificationDetails& details) OVERRIDE; |
| 52 |
41 // The dialog title. | 53 // The dialog title. |
42 string16 title_; | 54 string16 title_; |
43 | 55 |
44 // The view associated with this delegate. | 56 // The view associated with this delegate. |
45 // This class does not own the pointer. | 57 // This class does not own the pointer. |
46 WebDialogView* view_; | 58 WebDialogView* view_; |
47 | 59 |
| 60 // Whether the associated web contents has been loaded. |
| 61 bool loaded_; |
| 62 |
| 63 content::NotificationRegistrar registrar_; |
| 64 |
48 DISALLOW_COPY_AND_ASSIGN(KeyboardOverlayDelegate); | 65 DISALLOW_COPY_AND_ASSIGN(KeyboardOverlayDelegate); |
49 }; | 66 }; |
50 | 67 |
51 #endif // CHROME_BROWSER_UI_VIEWS_KEYBOARD_OVERLAY_DELEGATE_H_ | 68 #endif // CHROME_BROWSER_UI_VIEWS_KEYBOARD_OVERLAY_DELEGATE_H_ |
OLD | NEW |