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 22 matching lines...) Expand all Loading... |
33 // in the browser UI, or it may be hidden. | 33 // in the browser UI, or it may be hidden. |
34 class ExtensionHost : public RenderViewHostDelegate, | 34 class ExtensionHost : public RenderViewHostDelegate, |
35 public RenderViewHostDelegate::View, | 35 public RenderViewHostDelegate::View, |
36 public ExtensionFunctionDispatcher::Delegate, | 36 public ExtensionFunctionDispatcher::Delegate, |
37 public NotificationObserver { | 37 public NotificationObserver { |
38 public: | 38 public: |
39 // Enable DOM automation in created render view hosts. | 39 // Enable DOM automation in created render view hosts. |
40 static void EnableDOMAutomation() { enable_dom_automation_ = true; } | 40 static void EnableDOMAutomation() { enable_dom_automation_ = true; } |
41 | 41 |
42 ExtensionHost(Extension* extension, SiteInstance* site_instance, | 42 ExtensionHost(Extension* extension, SiteInstance* site_instance, |
43 const GURL& url); | 43 const GURL& url, ViewType::Type host_type); |
44 ~ExtensionHost(); | 44 ~ExtensionHost(); |
45 | 45 |
46 #if defined(TOOLKIT_VIEWS) | 46 #if defined(TOOLKIT_VIEWS) |
47 void set_view(ExtensionView* view) { view_.reset(view); } | 47 void set_view(ExtensionView* view) { view_.reset(view); } |
48 ExtensionView* view() const { return view_.get(); } | 48 ExtensionView* view() const { return view_.get(); } |
49 #elif defined(OS_LINUX) | 49 #elif defined(OS_LINUX) |
50 ExtensionViewGtk* view() const { return view_.get(); } | 50 ExtensionViewGtk* view() const { return view_.get(); } |
51 #else | 51 #else |
52 // TODO(port): implement | 52 // TODO(port): implement |
53 void* view() const { return NULL; } | 53 void* view() const { return NULL; } |
(...skipping 23 matching lines...) Expand all Loading... |
77 void NavigateToURL(const GURL& url); | 77 void NavigateToURL(const GURL& url); |
78 | 78 |
79 // Restarts extension's renderer process. Can be called only if the renderer | 79 // Restarts extension's renderer process. Can be called only if the renderer |
80 // process crashed. | 80 // process crashed. |
81 void RecoverCrashedExtension(); | 81 void RecoverCrashedExtension(); |
82 | 82 |
83 // RenderViewHostDelegate implementation. | 83 // RenderViewHostDelegate implementation. |
84 virtual RenderViewHostDelegate::View* GetViewDelegate(); | 84 virtual RenderViewHostDelegate::View* GetViewDelegate(); |
85 virtual const GURL& GetURL() const { return url_; } | 85 virtual const GURL& GetURL() const { return url_; } |
86 virtual void RenderViewCreated(RenderViewHost* render_view_host); | 86 virtual void RenderViewCreated(RenderViewHost* render_view_host); |
| 87 virtual ViewType::Type GetRenderViewType() const; |
| 88 virtual int GetBrowserWindowID() const; |
87 virtual void RenderViewGone(RenderViewHost* render_view_host); | 89 virtual void RenderViewGone(RenderViewHost* render_view_host); |
88 virtual void DidNavigate(RenderViewHost* render_view_host, | 90 virtual void DidNavigate(RenderViewHost* render_view_host, |
89 const ViewHostMsg_FrameNavigate_Params& params); | 91 const ViewHostMsg_FrameNavigate_Params& params); |
90 virtual void DidStopLoading(RenderViewHost* render_view_host); | 92 virtual void DidStopLoading(RenderViewHost* render_view_host); |
91 virtual void DocumentAvailableInMainFrame(RenderViewHost* render_view_host); | 93 virtual void DocumentAvailableInMainFrame(RenderViewHost* render_view_host); |
92 | 94 |
93 virtual WebPreferences GetWebkitPrefs(); | 95 virtual WebPreferences GetWebkitPrefs(); |
94 virtual void ProcessDOMUIMessage(const std::string& message, | 96 virtual void ProcessDOMUIMessage(const std::string& message, |
95 const std::string& content, | 97 const std::string& content, |
96 int request_id, | 98 int request_id, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // True if the main frame has finished parsing. | 172 // True if the main frame has finished parsing. |
171 bool document_element_available_; | 173 bool document_element_available_; |
172 | 174 |
173 // The URL being hosted. | 175 // The URL being hosted. |
174 GURL url_; | 176 GURL url_; |
175 | 177 |
176 NotificationRegistrar registrar_; | 178 NotificationRegistrar registrar_; |
177 | 179 |
178 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; | 180 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; |
179 | 181 |
| 182 // Only EXTENSION_TOOLSTRIP and EXTENSION_BACKGROUND_PAGE are used here, |
| 183 // others are not hostd by ExtensionHost. |
| 184 ViewType::Type extension_host_type_; |
| 185 |
180 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); | 186 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); |
181 }; | 187 }; |
182 | 188 |
183 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 189 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
OLD | NEW |