Index: chrome/browser/extensions/base_extension_host.h |
diff --git a/chrome/browser/extensions/base_extension_host.h b/chrome/browser/extensions/base_extension_host.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..971b41bf020def6b0ed55468f89ce7dac9125733 |
--- /dev/null |
+++ b/chrome/browser/extensions/base_extension_host.h |
@@ -0,0 +1,84 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_EXTENSIONS_BASE_EXTENSION_HOST_H_ |
+#define CHROME_BROWSER_EXTENSIONS_BASE_EXTENSION_HOST_H_ |
+#pragma once |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "content/public/common/view_type.h" |
+ |
+#if defined(TOOLKIT_VIEWS) |
+#include "chrome/browser/ui/views/extensions/extension_view.h" |
+#elif defined(OS_MACOSX) |
+#include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" |
+#elif defined(TOOLKIT_GTK) |
+#include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" |
+#elif defined(OS_ANDROID) |
+#include "chrome/browser/ui/android/extensions/extension_view_android.h" |
+#endif |
+ |
+class Browser; |
+ |
+namespace content { |
+class RenderProcessHost; |
+class RenderViewHost; |
+class WebContents; |
+} |
+ |
+// TODO(benwells): Maybe this should be ExtensionHost with |
+// extension type specific functionality delegated out. |
benwells
2012/04/18 08:34:58
Or maybe the ExtensionView stuff should be split
Matt Perry
2012/04/18 19:00:01
The delegate approach actually sounds like a good
|
+class BaseExtensionHost { |
benwells
2012/04/18 12:08:44
If this class stays it could have more basic funct
|
+ public: |
+#if defined(TOOLKIT_VIEWS) |
+ typedef ExtensionView PlatformExtensionView; |
+#elif defined(OS_MACOSX) |
+ typedef ExtensionViewMac PlatformExtensionView; |
+#elif defined(TOOLKIT_GTK) |
+ typedef ExtensionViewGtk PlatformExtensionView; |
+#elif defined(OS_ANDROID) |
+ // Android does not support extensions. |
+ typedef ExtensionViewAndroid PlatformExtensionView; |
+#endif |
+ |
+ virtual ~BaseExtensionHost(); |
+ |
+#if defined(TOOLKIT_VIEWS) |
+ void set_view(PlatformExtensionView* view) { view_.reset(view); } |
+#endif |
+ |
+ const PlatformExtensionView* view() const { |
+#if defined(OS_ANDROID) |
+ NOTREACHED(); |
+#endif |
+ return view_.get(); |
+ } |
+ |
+ PlatformExtensionView* view() { |
+#if defined(OS_ANDROID) |
+ NOTREACHED(); |
+#endif |
+ return view_.get(); |
+ } |
+ |
+ // Create an ExtensionView and tie it to this host and |browser|. Note NULL |
+ // is a valid argument for |browser|. Extension views may be bound to |
+ // tab-contents hosted in ExternalTabContainer objects, which do not |
+ // instantiate Browser objects. |
+ void CreateView(Browser* browser); |
+ |
+ virtual content::WebContents* host_contents() const = 0; |
Matt Perry
2012/04/18 19:00:01
underscore_style() is reserved for lightweight inl
|
+ virtual content::RenderViewHost* render_view_host() const = 0; |
+ virtual content::RenderProcessHost* render_process_host() const = 0; |
+ |
+ virtual content::ViewType extension_host_type() const = 0; |
+ |
+ virtual void CreateRenderViewSoon() = 0; |
+ |
+ private: |
+ // Optional view that shows the rendered content in the UI. |
+ scoped_ptr<BaseExtensionHost::PlatformExtensionView> view_; |
+}; |
+ |
+#endif // CHROME_BROWSER_EXTENSIONS_BASE_EXTENSION_HOST_H_ |