Chromium Code Reviews| 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" |
| 11 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 11 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
| 12 #include "extensions/browser/extension_host.h" | 12 #include "extensions/browser/extension_host.h" |
| 13 | 13 |
| 14 class Browser; | 14 class Browser; |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class SiteInstance; | 17 class SiteInstance; |
| 18 class WebContents; | 18 class WebContents; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace extensions { | 21 namespace extensions { |
| 22 | 22 |
| 23 class ExtensionView; | 23 class ExtensionView; |
| 24 | 24 |
| 25 // The ExtensionHost for an extension that backs a view in the browser UI. For | 25 // The ExtensionHost for an extension that backs a view in the browser UI. For |
| 26 // example, this could be an extension popup, infobar or dialog, but not a | 26 // example, this could be an extension popup, infobar or dialog, but not a |
|
Peter Kasting
2015/02/13 02:45:44
Presumably the infobar part of this comment should
Devlin
2015/02/13 21:18:33
Done.
| |
| 27 // background page. | 27 // background page. |
| 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, |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 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 void OnDidStopLoading() override; | 59 void OnDidStopLoading() override; |
| 60 void OnDocumentAvailable() override; | |
| 61 void LoadInitialURL() override; | 60 void LoadInitialURL() override; |
| 62 bool IsBackgroundPage() const override; | 61 bool IsBackgroundPage() const override; |
| 63 | 62 |
| 64 // content::WebContentsDelegate | 63 // content::WebContentsDelegate |
| 65 content::WebContents* OpenURLFromTab( | 64 content::WebContents* OpenURLFromTab( |
| 66 content::WebContents* source, | 65 content::WebContents* source, |
| 67 const content::OpenURLParams& params) override; | 66 const content::OpenURLParams& params) override; |
| 68 bool PreHandleKeyboardEvent(content::WebContents* source, | 67 bool PreHandleKeyboardEvent(content::WebContents* source, |
| 69 const content::NativeWebKeyboardEvent& event, | 68 const content::NativeWebKeyboardEvent& event, |
| 70 bool* is_keyboard_shortcut) override; | 69 bool* is_keyboard_shortcut) override; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 void Observe(int type, | 105 void Observe(int type, |
| 107 const content::NotificationSource& source, | 106 const content::NotificationSource& source, |
| 108 const content::NotificationDetails& details) override; | 107 const content::NotificationDetails& details) override; |
| 109 | 108 |
| 110 private: | 109 private: |
| 111 // Implemented per-platform. Create the platform-specific ExtensionView. | 110 // Implemented per-platform. Create the platform-specific ExtensionView. |
| 112 static scoped_ptr<ExtensionView> CreateExtensionView(ExtensionViewHost* host, | 111 static scoped_ptr<ExtensionView> CreateExtensionView(ExtensionViewHost* host, |
| 113 Browser* browser); | 112 Browser* browser); |
| 114 | 113 |
| 115 // Insert a default style sheet for Extension Infobars. | 114 // Insert a default style sheet for Extension Infobars. |
| 116 void InsertInfobarCSS(); | 115 void InsertInfobarCSS(); |
|
Peter Kasting
2015/02/13 02:45:44
This is dead now and should be deleted.
Devlin
2015/02/13 21:18:33
Done.
| |
| 117 | 116 |
| 118 // Optional view that shows the rendered content in the UI. | 117 // Optional view that shows the rendered content in the UI. |
| 119 scoped_ptr<ExtensionView> view_; | 118 scoped_ptr<ExtensionView> view_; |
| 120 | 119 |
| 121 // The relevant WebContents associated with this ExtensionViewHost, if any. | 120 // The relevant WebContents associated with this ExtensionViewHost, if any. |
| 122 content::WebContents* associated_web_contents_; | 121 content::WebContents* associated_web_contents_; |
| 123 | 122 |
| 124 // Observer to detect when the associated web contents is destroyed. | 123 // Observer to detect when the associated web contents is destroyed. |
| 125 class AssociatedWebContentsObserver; | 124 class AssociatedWebContentsObserver; |
| 126 scoped_ptr<AssociatedWebContentsObserver> associated_web_contents_observer_; | 125 scoped_ptr<AssociatedWebContentsObserver> associated_web_contents_observer_; |
| 127 | 126 |
| 128 // Manage popups overlaying the WebContents in this EVH. | 127 // Manage popups overlaying the WebContents in this EVH. |
| 129 // TODO(gbillock): should usually not be used -- instead use the parent | 128 // TODO(gbillock): should usually not be used -- instead use the parent |
| 130 // window's popup manager. Should only be used when the EVH is created without | 129 // window's popup manager. Should only be used when the EVH is created without |
| 131 // a parent window. | 130 // a parent window. |
| 132 scoped_ptr<web_modal::PopupManager> popup_manager_; | 131 scoped_ptr<web_modal::PopupManager> popup_manager_; |
| 133 | 132 |
| 134 DISALLOW_COPY_AND_ASSIGN(ExtensionViewHost); | 133 DISALLOW_COPY_AND_ASSIGN(ExtensionViewHost); |
| 135 }; | 134 }; |
| 136 | 135 |
| 137 } // namespace extensions | 136 } // namespace extensions |
| 138 | 137 |
| 139 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_VIEW_HOST_H_ | 138 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_VIEW_HOST_H_ |
| OLD | NEW |