| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_HOST_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 struct WebPreferences; | 25 struct WebPreferences; |
| 26 | 26 |
| 27 // This class is the browser component of an extension component's RenderView. | 27 // This class is the browser component of an extension component's RenderView. |
| 28 // It handles setting up the renderer process, if needed, with special | 28 // It handles setting up the renderer process, if needed, with special |
| 29 // privileges available to extensions. It may have a view to be shown in the | 29 // privileges available to extensions. It may have a view to be shown in the |
| 30 // in the browser UI, or it may be hidden. | 30 // in the browser UI, or it may be hidden. |
| 31 class ExtensionHost : public RenderViewHostDelegate, | 31 class ExtensionHost : public RenderViewHostDelegate, |
| 32 public RenderViewHostDelegate::View, | 32 public RenderViewHostDelegate::View, |
| 33 public ExtensionFunctionDispatcher::Delegate { | 33 public ExtensionFunctionDispatcher::Delegate { |
| 34 public: | 34 public: |
| 35 // Enable DOM automation in created render view hosts. |
| 36 static void EnableDOMAutomation() { enable_dom_automation_ = true; } |
| 37 |
| 35 ExtensionHost(Extension* extension, SiteInstance* site_instance, | 38 ExtensionHost(Extension* extension, SiteInstance* site_instance, |
| 36 const GURL& url); | 39 const GURL& url); |
| 37 ~ExtensionHost(); | 40 ~ExtensionHost(); |
| 38 | 41 |
| 39 #if defined(TOOLKIT_VIEWS) | 42 #if defined(TOOLKIT_VIEWS) |
| 40 void set_view(ExtensionView* view) { view_.reset(view); } | 43 void set_view(ExtensionView* view) { view_.reset(view); } |
| 41 ExtensionView* view() const { return view_.get(); } | 44 ExtensionView* view() const { return view_.get(); } |
| 42 #endif | 45 #endif |
| 43 | 46 |
| 44 // Create an ExtensionView and tie it to this host and |browser|. | 47 // Create an ExtensionView and tie it to this host and |browser|. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 virtual void StartDragging(const WebDropData& drop_data); | 100 virtual void StartDragging(const WebDropData& drop_data); |
| 98 virtual void UpdateDragCursor(bool is_drop_target); | 101 virtual void UpdateDragCursor(bool is_drop_target); |
| 99 virtual void GotFocus(); | 102 virtual void GotFocus(); |
| 100 virtual void TakeFocus(bool reverse); | 103 virtual void TakeFocus(bool reverse); |
| 101 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 104 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
| 102 virtual void HandleMouseEvent(); | 105 virtual void HandleMouseEvent(); |
| 103 virtual void HandleMouseLeave(); | 106 virtual void HandleMouseLeave(); |
| 104 virtual void UpdatePreferredWidth(int pref_width); | 107 virtual void UpdatePreferredWidth(int pref_width); |
| 105 | 108 |
| 106 private: | 109 private: |
| 110 // Whether to allow DOM automation for created RenderViewHosts. This is used |
| 111 // for testing. |
| 112 static bool enable_dom_automation_; |
| 113 |
| 107 // ExtensionFunctionDispatcher::Delegate | 114 // ExtensionFunctionDispatcher::Delegate |
| 108 // If this ExtensionHost has a view, this returns the Browser that view is a | 115 // If this ExtensionHost has a view, this returns the Browser that view is a |
| 109 // part of. If this is a global background page, we use the active Browser | 116 // part of. If this is a global background page, we use the active Browser |
| 110 // instead. | 117 // instead. |
| 111 virtual Browser* GetBrowser(); | 118 virtual Browser* GetBrowser(); |
| 112 | 119 |
| 113 // The extension that we're hosting in this view. | 120 // The extension that we're hosting in this view. |
| 114 Extension* extension_; | 121 Extension* extension_; |
| 115 | 122 |
| 116 // The profile that this host is tied to. | 123 // The profile that this host is tied to. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 132 | 139 |
| 133 // The URL being hosted. | 140 // The URL being hosted. |
| 134 GURL url_; | 141 GURL url_; |
| 135 | 142 |
| 136 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; | 143 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; |
| 137 | 144 |
| 138 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); | 145 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); |
| 139 }; | 146 }; |
| 140 | 147 |
| 141 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 148 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
| OLD | NEW |