| 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 EXTENSIONS_BROWSER_EXTENSION_HOST_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 6 #define EXTENSIONS_BROWSER_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/timer/elapsed_timer.h" | 13 #include "base/timer/elapsed_timer.h" |
| 14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
| 16 #include "content/public/browser/web_contents_delegate.h" | 16 #include "content/public/browser/web_contents_delegate.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 namespace extensions { | 31 namespace extensions { |
| 32 class Extension; | 32 class Extension; |
| 33 class ExtensionHostDelegate; | 33 class ExtensionHostDelegate; |
| 34 class WindowController; | 34 class WindowController; |
| 35 | 35 |
| 36 // This class is the browser component of an extension component's RenderView. | 36 // This class is the browser component of an extension component's RenderView. |
| 37 // It handles setting up the renderer process, if needed, with special | 37 // It handles setting up the renderer process, if needed, with special |
| 38 // privileges available to extensions. It may have a view to be shown in the | 38 // privileges available to extensions. It may have a view to be shown in the |
| 39 // browser UI, or it may be hidden. | 39 // browser UI, or it may be hidden. |
| 40 // |
| 41 // If you are adding code that only affects visible extension views (and not |
| 42 // invisible background pages) you should add it to ExtensionViewHost. |
| 40 class ExtensionHost : public content::WebContentsDelegate, | 43 class ExtensionHost : public content::WebContentsDelegate, |
| 41 public content::WebContentsObserver, | 44 public content::WebContentsObserver, |
| 42 public ExtensionFunctionDispatcher::Delegate, | 45 public ExtensionFunctionDispatcher::Delegate, |
| 43 public content::NotificationObserver { | 46 public content::NotificationObserver { |
| 44 public: | 47 public: |
| 45 class ProcessCreationQueue; | 48 class ProcessCreationQueue; |
| 46 | 49 |
| 47 ExtensionHost(const Extension* extension, | 50 ExtensionHost(const Extension* extension, |
| 48 content::SiteInstance* site_instance, | 51 content::SiteInstance* site_instance, |
| 49 const GURL& url, ViewType host_type); | 52 const GURL& url, ViewType host_type); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 content::WebContents* new_contents, | 94 content::WebContents* new_contents, |
| 92 WindowOpenDisposition disposition, | 95 WindowOpenDisposition disposition, |
| 93 const gfx::Rect& initial_pos, | 96 const gfx::Rect& initial_pos, |
| 94 bool user_gesture, | 97 bool user_gesture, |
| 95 bool* was_blocked) OVERRIDE; | 98 bool* was_blocked) OVERRIDE; |
| 96 virtual void CloseContents(content::WebContents* contents) OVERRIDE; | 99 virtual void CloseContents(content::WebContents* contents) OVERRIDE; |
| 97 virtual void RequestMediaAccessPermission( | 100 virtual void RequestMediaAccessPermission( |
| 98 content::WebContents* web_contents, | 101 content::WebContents* web_contents, |
| 99 const content::MediaStreamRequest& request, | 102 const content::MediaStreamRequest& request, |
| 100 const content::MediaResponseCallback& callback) OVERRIDE; | 103 const content::MediaResponseCallback& callback) OVERRIDE; |
| 101 virtual bool PreHandleGestureEvent( | |
| 102 content::WebContents* source, | |
| 103 const blink::WebGestureEvent& event) OVERRIDE; | |
| 104 | 104 |
| 105 // content::NotificationObserver | 105 // content::NotificationObserver |
| 106 virtual void Observe(int type, | 106 virtual void Observe(int type, |
| 107 const content::NotificationSource& source, | 107 const content::NotificationSource& source, |
| 108 const content::NotificationDetails& details) OVERRIDE; | 108 const content::NotificationDetails& details) OVERRIDE; |
| 109 | 109 |
| 110 protected: | 110 protected: |
| 111 content::NotificationRegistrar* registrar() { return ®istrar_; } | 111 content::NotificationRegistrar* registrar() { return ®istrar_; } |
| 112 | 112 |
| 113 // Called after the extension page finishes loading but before the | 113 // Called after the extension page finishes loading but before the |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 ViewType extension_host_type_; | 175 ViewType extension_host_type_; |
| 176 | 176 |
| 177 // Used to measure how long it's been since the host was created. | 177 // Used to measure how long it's been since the host was created. |
| 178 base::ElapsedTimer since_created_; | 178 base::ElapsedTimer since_created_; |
| 179 | 179 |
| 180 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); | 180 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 } // namespace extensions | 183 } // namespace extensions |
| 184 | 184 |
| 185 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 185 #endif // EXTENSIONS_BROWSER_EXTENSION_HOST_H_ |
| OLD | NEW |