| 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/web_contents_modal_dialog_host.h" | 10 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 10 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 11 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
| 11 #include "extensions/browser/extension_host.h" | 12 #include "extensions/browser/extension_host.h" |
| 12 | 13 |
| 13 #if defined(TOOLKIT_VIEWS) | 14 #if defined(TOOLKIT_VIEWS) |
| 14 #include "chrome/browser/ui/views/extensions/extension_view_views.h" | 15 #include "chrome/browser/ui/views/extensions/extension_view_views.h" |
| 15 #elif defined(OS_MACOSX) | 16 #elif defined(OS_MACOSX) |
| 16 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" | 17 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" |
| 17 #elif defined(OS_ANDROID) | 18 #elif defined(OS_ANDROID) |
| 18 #include "chrome/browser/ui/android/extensions/extension_view_android.h" | 19 #include "chrome/browser/ui/android/extensions/extension_view_android.h" |
| 19 #endif | 20 #endif |
| 20 | 21 |
| 21 class Browser; | 22 class Browser; |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 class SiteInstance; | 25 class SiteInstance; |
| 25 class WebContents; | 26 class WebContents; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace extensions { | 29 namespace extensions { |
| 29 | 30 |
| 30 // The ExtensionHost for an extension that backs a view in the browser UI. For | 31 // The ExtensionHost for an extension that backs a view in the browser UI. For |
| 31 // example, this could be an extension popup, infobar or dialog, but not a | 32 // example, this could be an extension popup, infobar or dialog, but not a |
| 32 // background page. | 33 // background page. |
| 34 // TODO(gbillock): See if we can remove WebContentsModalDialogManager here. |
| 33 class ExtensionViewHost | 35 class ExtensionViewHost |
| 34 : public ExtensionHost, | 36 : public ExtensionHost, |
| 35 public web_modal::WebContentsModalDialogManagerDelegate, | 37 public web_modal::WebContentsModalDialogManagerDelegate, |
| 36 public web_modal::WebContentsModalDialogHost { | 38 public web_modal::WebContentsModalDialogHost { |
| 37 public: | 39 public: |
| 38 ExtensionViewHost(const Extension* extension, | 40 ExtensionViewHost(const Extension* extension, |
| 39 content::SiteInstance* site_instance, | 41 content::SiteInstance* site_instance, |
| 40 const GURL& url, | 42 const GURL& url, |
| 41 ViewType host_type); | 43 ViewType host_type); |
| 42 virtual ~ExtensionViewHost(); | 44 virtual ~ExtensionViewHost(); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // Optional view that shows the rendered content in the UI. | 137 // Optional view that shows the rendered content in the UI. |
| 136 scoped_ptr<PlatformExtensionView> view_; | 138 scoped_ptr<PlatformExtensionView> view_; |
| 137 | 139 |
| 138 // The relevant WebContents associated with this ExtensionViewHost, if any. | 140 // The relevant WebContents associated with this ExtensionViewHost, if any. |
| 139 content::WebContents* associated_web_contents_; | 141 content::WebContents* associated_web_contents_; |
| 140 | 142 |
| 141 // Observer to detect when the associated web contents is destroyed. | 143 // Observer to detect when the associated web contents is destroyed. |
| 142 class AssociatedWebContentsObserver; | 144 class AssociatedWebContentsObserver; |
| 143 scoped_ptr<AssociatedWebContentsObserver> associated_web_contents_observer_; | 145 scoped_ptr<AssociatedWebContentsObserver> associated_web_contents_observer_; |
| 144 | 146 |
| 147 // Manage popups overlaying the WebContents in this EVH. |
| 148 // TODO(gbillock): should usually not be used -- instead use the parent |
| 149 // window's popup manager. Should only be used when the EVH is created without |
| 150 // a parent window. |
| 151 scoped_ptr<web_modal::PopupManager> popup_manager_; |
| 152 |
| 145 DISALLOW_COPY_AND_ASSIGN(ExtensionViewHost); | 153 DISALLOW_COPY_AND_ASSIGN(ExtensionViewHost); |
| 146 }; | 154 }; |
| 147 | 155 |
| 148 } // namespace extensions | 156 } // namespace extensions |
| 149 | 157 |
| 150 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_VIEW_HOST_H_ | 158 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_VIEW_HOST_H_ |
| OLD | NEW |