OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_EXTENSIONS_EXTENSION_VIEW_HOST_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_VIEW_HOST_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_VIEW_HOST_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_VIEW_HOST_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "components/web_modal/popup_manager.h" | 9 #include "components/web_modal/popup_manager.h" |
10 #include "components/web_modal/web_contents_modal_dialog_host.h" | 10 #include "components/web_modal/web_contents_modal_dialog_host.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // TODO(gbillock): See if we can remove WebContentsModalDialogManager here. | 28 // TODO(gbillock): See if we can remove WebContentsModalDialogManager here. |
29 class ExtensionViewHost | 29 class ExtensionViewHost |
30 : public ExtensionHost, | 30 : public ExtensionHost, |
31 public web_modal::WebContentsModalDialogManagerDelegate, | 31 public web_modal::WebContentsModalDialogManagerDelegate, |
32 public web_modal::WebContentsModalDialogHost { | 32 public web_modal::WebContentsModalDialogHost { |
33 public: | 33 public: |
34 ExtensionViewHost(const Extension* extension, | 34 ExtensionViewHost(const Extension* extension, |
35 content::SiteInstance* site_instance, | 35 content::SiteInstance* site_instance, |
36 const GURL& url, | 36 const GURL& url, |
37 ViewType host_type); | 37 ViewType host_type); |
38 virtual ~ExtensionViewHost(); | 38 ~ExtensionViewHost() override; |
39 | 39 |
40 ExtensionView* view() { return view_.get(); } | 40 ExtensionView* view() { return view_.get(); } |
41 const ExtensionView* view() const { return view_.get(); } | 41 const ExtensionView* view() const { return view_.get(); } |
42 | 42 |
43 // Create an ExtensionView and tie it to this host and |browser|. Note NULL | 43 // Create an ExtensionView and tie it to this host and |browser|. Note NULL |
44 // is a valid argument for |browser|. Extension views may be bound to | 44 // is a valid argument for |browser|. Extension views may be bound to |
45 // tab-contents hosted in ExternalTabContainer objects, which do not | 45 // tab-contents hosted in ExternalTabContainer objects, which do not |
46 // instantiate Browser objects. | 46 // instantiate Browser objects. |
47 void CreateView(Browser* browser); | 47 void CreateView(Browser* browser); |
48 | 48 |
49 void SetAssociatedWebContents(content::WebContents* web_contents); | 49 void SetAssociatedWebContents(content::WebContents* web_contents); |
50 | 50 |
51 // Handles keyboard events that were not handled by HandleKeyboardEvent(). | 51 // Handles keyboard events that were not handled by HandleKeyboardEvent(). |
52 // Platform specific implementation may override this method to handle the | 52 // Platform specific implementation may override this method to handle the |
53 // event in platform specific way. | 53 // event in platform specific way. |
54 virtual void UnhandledKeyboardEvent( | 54 virtual void UnhandledKeyboardEvent( |
55 content::WebContents* source, | 55 content::WebContents* source, |
56 const content::NativeWebKeyboardEvent& event); | 56 const content::NativeWebKeyboardEvent& event); |
57 | 57 |
58 // ExtensionHost | 58 // ExtensionHost |
59 virtual void OnDidStopLoading() override; | 59 void OnDidStopLoading() override; |
60 virtual void OnDocumentAvailable() override; | 60 void OnDocumentAvailable() override; |
61 virtual void LoadInitialURL() override; | 61 void LoadInitialURL() override; |
62 virtual bool IsBackgroundPage() const override; | 62 bool IsBackgroundPage() const override; |
63 | 63 |
64 // content::WebContentsDelegate | 64 // content::WebContentsDelegate |
65 virtual content::WebContents* OpenURLFromTab( | 65 content::WebContents* OpenURLFromTab( |
66 content::WebContents* source, | 66 content::WebContents* source, |
67 const content::OpenURLParams& params) override; | 67 const content::OpenURLParams& params) override; |
68 virtual bool PreHandleKeyboardEvent( | 68 bool PreHandleKeyboardEvent(content::WebContents* source, |
69 content::WebContents* source, | 69 const content::NativeWebKeyboardEvent& event, |
70 const content::NativeWebKeyboardEvent& event, | 70 bool* is_keyboard_shortcut) override; |
71 bool* is_keyboard_shortcut) override; | 71 void HandleKeyboardEvent( |
72 virtual void HandleKeyboardEvent( | |
73 content::WebContents* source, | 72 content::WebContents* source, |
74 const content::NativeWebKeyboardEvent& event) override; | 73 const content::NativeWebKeyboardEvent& event) override; |
75 virtual bool PreHandleGestureEvent( | 74 bool PreHandleGestureEvent(content::WebContents* source, |
76 content::WebContents* source, | 75 const blink::WebGestureEvent& event) override; |
77 const blink::WebGestureEvent& event) override; | 76 content::ColorChooser* OpenColorChooser( |
78 virtual content::ColorChooser* OpenColorChooser( | |
79 content::WebContents* web_contents, | 77 content::WebContents* web_contents, |
80 SkColor color, | 78 SkColor color, |
81 const std::vector<content::ColorSuggestion>& suggestions) override; | 79 const std::vector<content::ColorSuggestion>& suggestions) override; |
82 virtual void RunFileChooser( | 80 void RunFileChooser(content::WebContents* tab, |
83 content::WebContents* tab, | 81 const content::FileChooserParams& params) override; |
84 const content::FileChooserParams& params) override; | 82 void ResizeDueToAutoResize(content::WebContents* source, |
85 virtual void ResizeDueToAutoResize(content::WebContents* source, | 83 const gfx::Size& new_size) override; |
86 const gfx::Size& new_size) override; | |
87 | 84 |
88 // content::WebContentsObserver | 85 // content::WebContentsObserver |
89 virtual void RenderViewCreated( | 86 void RenderViewCreated(content::RenderViewHost* render_view_host) override; |
90 content::RenderViewHost* render_view_host) override; | |
91 | 87 |
92 // web_modal::WebContentsModalDialogManagerDelegate | 88 // web_modal::WebContentsModalDialogManagerDelegate |
93 virtual web_modal::WebContentsModalDialogHost* | 89 web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost() |
94 GetWebContentsModalDialogHost() override; | 90 override; |
95 virtual bool IsWebContentsVisible( | 91 bool IsWebContentsVisible(content::WebContents* web_contents) override; |
96 content::WebContents* web_contents) override; | |
97 | 92 |
98 // web_modal::WebContentsModalDialogHost | 93 // web_modal::WebContentsModalDialogHost |
99 virtual gfx::NativeView GetHostView() const override; | 94 gfx::NativeView GetHostView() const override; |
100 virtual gfx::Point GetDialogPosition(const gfx::Size& size) override; | 95 gfx::Point GetDialogPosition(const gfx::Size& size) override; |
101 virtual gfx::Size GetMaximumDialogSize() override; | 96 gfx::Size GetMaximumDialogSize() override; |
102 virtual void AddObserver( | 97 void AddObserver(web_modal::ModalDialogHostObserver* observer) override; |
103 web_modal::ModalDialogHostObserver* observer) override; | 98 void RemoveObserver(web_modal::ModalDialogHostObserver* observer) override; |
104 virtual void RemoveObserver( | |
105 web_modal::ModalDialogHostObserver* observer) override; | |
106 | 99 |
107 // extensions::ExtensionFunctionDispatcher::Delegate | 100 // extensions::ExtensionFunctionDispatcher::Delegate |
108 virtual WindowController* GetExtensionWindowController() const override; | 101 WindowController* GetExtensionWindowController() const override; |
109 virtual content::WebContents* GetAssociatedWebContents() const override; | 102 content::WebContents* GetAssociatedWebContents() const override; |
110 virtual content::WebContents* GetVisibleWebContents() const override; | 103 content::WebContents* GetVisibleWebContents() const override; |
111 | 104 |
112 // content::NotificationObserver | 105 // content::NotificationObserver |
113 virtual void Observe(int type, | 106 void Observe(int type, |
114 const content::NotificationSource& source, | 107 const content::NotificationSource& source, |
115 const content::NotificationDetails& details) override; | 108 const content::NotificationDetails& details) override; |
116 | 109 |
117 private: | 110 private: |
118 // Implemented per-platform. Create the platform-specific ExtensionView. | 111 // Implemented per-platform. Create the platform-specific ExtensionView. |
119 static scoped_ptr<ExtensionView> CreateExtensionView(ExtensionViewHost* host, | 112 static scoped_ptr<ExtensionView> CreateExtensionView(ExtensionViewHost* host, |
120 Browser* browser); | 113 Browser* browser); |
121 | 114 |
122 // Insert a default style sheet for Extension Infobars. | 115 // Insert a default style sheet for Extension Infobars. |
123 void InsertInfobarCSS(); | 116 void InsertInfobarCSS(); |
124 | 117 |
125 // Optional view that shows the rendered content in the UI. | 118 // Optional view that shows the rendered content in the UI. |
(...skipping 11 matching lines...) Expand all Loading... |
137 // window's popup manager. Should only be used when the EVH is created without | 130 // window's popup manager. Should only be used when the EVH is created without |
138 // a parent window. | 131 // a parent window. |
139 scoped_ptr<web_modal::PopupManager> popup_manager_; | 132 scoped_ptr<web_modal::PopupManager> popup_manager_; |
140 | 133 |
141 DISALLOW_COPY_AND_ASSIGN(ExtensionViewHost); | 134 DISALLOW_COPY_AND_ASSIGN(ExtensionViewHost); |
142 }; | 135 }; |
143 | 136 |
144 } // namespace extensions | 137 } // namespace extensions |
145 | 138 |
146 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_VIEW_HOST_H_ | 139 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_VIEW_HOST_H_ |
OLD | NEW |