| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/perftimer.h" | 13 #include "base/perftimer.h" |
| 14 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 14 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 15 #include "chrome/common/view_type.h" | 15 #include "chrome/common/view_type.h" |
| 16 #include "content/public/browser/javascript_dialogs.h" | 16 #include "content/public/browser/javascript_dialog_manager.h" |
| 17 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
| 19 #include "content/public/browser/web_contents_delegate.h" | 19 #include "content/public/browser/web_contents_delegate.h" |
| 20 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
| 21 | 21 |
| 22 #if defined(TOOLKIT_VIEWS) | 22 #if defined(TOOLKIT_VIEWS) |
| 23 #include "chrome/browser/ui/views/extensions/extension_view_views.h" | 23 #include "chrome/browser/ui/views/extensions/extension_view_views.h" |
| 24 #elif defined(OS_MACOSX) | 24 #elif defined(OS_MACOSX) |
| 25 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" | 25 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" |
| 26 #elif defined(TOOLKIT_GTK) | 26 #elif defined(TOOLKIT_GTK) |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 bool IsRenderViewLive() const; | 117 bool IsRenderViewLive() const; |
| 118 | 118 |
| 119 // Prepares to initializes our RenderViewHost by creating its RenderView and | 119 // Prepares to initializes our RenderViewHost by creating its RenderView and |
| 120 // navigating to this host's url. Uses host_view for the RenderViewHost's view | 120 // navigating to this host's url. Uses host_view for the RenderViewHost's view |
| 121 // (can be NULL). This happens delayed to avoid locking the UI. | 121 // (can be NULL). This happens delayed to avoid locking the UI. |
| 122 void CreateRenderViewSoon(); | 122 void CreateRenderViewSoon(); |
| 123 | 123 |
| 124 // Insert a default style sheet for Extension Infobars. | 124 // Insert a default style sheet for Extension Infobars. |
| 125 void InsertInfobarCSS(); | 125 void InsertInfobarCSS(); |
| 126 | 126 |
| 127 // Notifications from the JavaScriptDialogCreator when a dialog is being | 127 // Notifications from the JavaScriptDialogManager when a dialog is being |
| 128 // opened/closed. | 128 // opened/closed. |
| 129 void WillRunJavaScriptDialog(); | 129 void WillRunJavaScriptDialog(); |
| 130 void DidCloseJavaScriptDialog(); | 130 void DidCloseJavaScriptDialog(); |
| 131 | 131 |
| 132 // content::WebContentsObserver | 132 // content::WebContentsObserver |
| 133 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 133 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 134 virtual void RenderViewCreated( | 134 virtual void RenderViewCreated( |
| 135 content::RenderViewHost* render_view_host) OVERRIDE; | 135 content::RenderViewHost* render_view_host) OVERRIDE; |
| 136 virtual void RenderViewDeleted( | 136 virtual void RenderViewDeleted( |
| 137 content::RenderViewHost* render_view_host) OVERRIDE; | 137 content::RenderViewHost* render_view_host) OVERRIDE; |
| 138 virtual void RenderViewReady() OVERRIDE; | 138 virtual void RenderViewReady() OVERRIDE; |
| 139 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 139 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
| 140 virtual void DocumentAvailableInMainFrame() OVERRIDE; | 140 virtual void DocumentAvailableInMainFrame() OVERRIDE; |
| 141 virtual void DidStopLoading( | 141 virtual void DidStopLoading( |
| 142 content::RenderViewHost* render_view_host) OVERRIDE; | 142 content::RenderViewHost* render_view_host) OVERRIDE; |
| 143 | 143 |
| 144 // content::WebContentsDelegate | 144 // content::WebContentsDelegate |
| 145 virtual content::WebContents* OpenURLFromTab( | 145 virtual content::WebContents* OpenURLFromTab( |
| 146 content::WebContents* source, | 146 content::WebContents* source, |
| 147 const content::OpenURLParams& params) OVERRIDE; | 147 const content::OpenURLParams& params) OVERRIDE; |
| 148 virtual bool PreHandleKeyboardEvent( | 148 virtual bool PreHandleKeyboardEvent( |
| 149 content::WebContents* source, | 149 content::WebContents* source, |
| 150 const content::NativeWebKeyboardEvent& event, | 150 const content::NativeWebKeyboardEvent& event, |
| 151 bool* is_keyboard_shortcut) OVERRIDE; | 151 bool* is_keyboard_shortcut) OVERRIDE; |
| 152 virtual void HandleKeyboardEvent( | 152 virtual void HandleKeyboardEvent( |
| 153 content::WebContents* source, | 153 content::WebContents* source, |
| 154 const content::NativeWebKeyboardEvent& event) OVERRIDE; | 154 const content::NativeWebKeyboardEvent& event) OVERRIDE; |
| 155 virtual void ResizeDueToAutoResize(content::WebContents* source, | 155 virtual void ResizeDueToAutoResize(content::WebContents* source, |
| 156 const gfx::Size& new_size) OVERRIDE; | 156 const gfx::Size& new_size) OVERRIDE; |
| 157 virtual content::JavaScriptDialogCreator* | 157 virtual content::JavaScriptDialogManager* |
| 158 GetJavaScriptDialogCreator() OVERRIDE; | 158 GetJavaScriptDialogManager() OVERRIDE; |
| 159 virtual void RunFileChooser( | 159 virtual void RunFileChooser( |
| 160 content::WebContents* tab, | 160 content::WebContents* tab, |
| 161 const content::FileChooserParams& params) OVERRIDE; | 161 const content::FileChooserParams& params) OVERRIDE; |
| 162 virtual void AddNewContents(content::WebContents* source, | 162 virtual void AddNewContents(content::WebContents* source, |
| 163 content::WebContents* new_contents, | 163 content::WebContents* new_contents, |
| 164 WindowOpenDisposition disposition, | 164 WindowOpenDisposition disposition, |
| 165 const gfx::Rect& initial_pos, | 165 const gfx::Rect& initial_pos, |
| 166 bool user_gesture, | 166 bool user_gesture, |
| 167 bool* was_blocked) OVERRIDE; | 167 bool* was_blocked) OVERRIDE; |
| 168 virtual void CloseContents(content::WebContents* contents) OVERRIDE; | 168 virtual void CloseContents(content::WebContents* contents) OVERRIDE; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 // The profile that this host is tied to. | 223 // The profile that this host is tied to. |
| 224 Profile* profile_; | 224 Profile* profile_; |
| 225 | 225 |
| 226 // Optional view that shows the rendered content in the UI. | 226 // Optional view that shows the rendered content in the UI. |
| 227 scoped_ptr<PlatformExtensionView> view_; | 227 scoped_ptr<PlatformExtensionView> view_; |
| 228 | 228 |
| 229 // Used to create dialog boxes. | 229 // Used to create dialog boxes. |
| 230 // It must outlive host_contents_ as host_contents_ will access it | 230 // It must outlive host_contents_ as host_contents_ will access it |
| 231 // during destruction. | 231 // during destruction. |
| 232 scoped_ptr<content::JavaScriptDialogCreator> dialog_creator_; | 232 scoped_ptr<content::JavaScriptDialogManager> dialog_manager_; |
| 233 | 233 |
| 234 // The host for our HTML content. | 234 // The host for our HTML content. |
| 235 scoped_ptr<content::WebContents> host_contents_; | 235 scoped_ptr<content::WebContents> host_contents_; |
| 236 | 236 |
| 237 // A weak pointer to the current or pending RenderViewHost. We don't access | 237 // A weak pointer to the current or pending RenderViewHost. We don't access |
| 238 // this through the host_contents because we want to deal with the pending | 238 // this through the host_contents because we want to deal with the pending |
| 239 // host, so we can send messages to it before it finishes loading. | 239 // host, so we can send messages to it before it finishes loading. |
| 240 content::RenderViewHost* render_view_host_; | 240 content::RenderViewHost* render_view_host_; |
| 241 | 241 |
| 242 // Whether the RenderWidget has reported that it has stopped loading. | 242 // Whether the RenderWidget has reported that it has stopped loading. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 260 | 260 |
| 261 // Used to measure how long it's been since the host was created. | 261 // Used to measure how long it's been since the host was created. |
| 262 PerfTimer since_created_; | 262 PerfTimer since_created_; |
| 263 | 263 |
| 264 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); | 264 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); |
| 265 }; | 265 }; |
| 266 | 266 |
| 267 } // namespace extensions | 267 } // namespace extensions |
| 268 | 268 |
| 269 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 269 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
| OLD | NEW |