Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: extensions/browser/extension_host.h

Issue 182253010: Register a Service Worker when an extension is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to r261176 Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 EXTENSIONS_BROWSER_EXTENSION_HOST_H_ 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_HOST_H_
6 #define EXTENSIONS_BROWSER_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
(...skipping 29 matching lines...) Expand all
40 // 40 //
41 // If you are adding code that only affects visible extension views (and not 41 // If you are adding code that only affects visible extension views (and not
42 // invisible background pages) you should add it to ExtensionViewHost. 42 // invisible background pages) you should add it to ExtensionViewHost.
43 class ExtensionHost : public content::WebContentsDelegate, 43 class ExtensionHost : public content::WebContentsDelegate,
44 public content::WebContentsObserver, 44 public content::WebContentsObserver,
45 public ExtensionFunctionDispatcher::Delegate, 45 public ExtensionFunctionDispatcher::Delegate,
46 public content::NotificationObserver { 46 public content::NotificationObserver {
47 public: 47 public:
48 class ProcessCreationQueue; 48 class ProcessCreationQueue;
49 49
50 ExtensionHost(const Extension* extension, 50 ExtensionHost(const Extension* extension,
scheib 2014/04/24 22:11:39 Planning to keep the use of ExtensionHost for serv
51 content::SiteInstance* site_instance, 51 content::SiteInstance* site_instance,
52 const GURL& url, ViewType host_type); 52 const GURL& url, ViewType host_type);
53 virtual ~ExtensionHost(); 53 virtual ~ExtensionHost();
54 54
55 const Extension* extension() const { return extension_; } 55 const Extension* extension() const { return extension_; }
56 const std::string& extension_id() const { return extension_id_; } 56 const std::string& extension_id() const { return extension_id_; }
57 content::WebContents* host_contents() const { return host_contents_.get(); } 57 content::WebContents* host_contents() const { return host_contents_.get(); }
58 content::RenderViewHost* render_view_host() const; 58 content::RenderViewHost* render_view_host() const;
scheib 2014/04/24 22:11:39 Extension with a ServiceWorker won't have a Render
59 content::RenderProcessHost* render_process_host() const; 59 content::RenderProcessHost* render_process_host() const;
60 bool did_stop_loading() const { return did_stop_loading_; } 60 bool did_stop_loading() const { return did_stop_loading_; }
61 bool document_element_available() const { 61 bool document_element_available() const {
62 return document_element_available_; 62 return document_element_available_;
63 } 63 }
64 64
65 content::BrowserContext* browser_context() { return browser_context_; } 65 content::BrowserContext* browser_context() { return browser_context_; }
66 66
67 ViewType extension_host_type() const { return extension_host_type_; } 67 ViewType extension_host_type() const { return extension_host_type_; }
68 const GURL& GetURL() const; 68 const GURL& GetURL() const;
69 69
70 // Returns true if the render view is initialized and didn't crash. 70 // Returns true if the render view is initialized and didn't crash.
71 bool IsRenderViewLive() const; 71 bool IsRenderViewLive() const;
72 72
73 // Prepares to initializes our RenderViewHost by creating its RenderView and 73 // Prepares to initializes our RenderViewHost by creating its RenderView and
74 // navigating to this host's url. Uses host_view for the RenderViewHost's view 74 // navigating to this host's url. Uses host_view for the RenderViewHost's view
75 // (can be NULL). This happens delayed to avoid locking the UI. 75 // (can be NULL). This happens delayed to avoid locking the UI.
76 void CreateRenderViewSoon(); 76 void CreateRenderViewSoon(const base::Closure& continuation);
77 77
78 // content::WebContentsObserver 78 // content::WebContentsObserver
79 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 79 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
80 virtual void RenderViewCreated( 80 virtual void RenderViewCreated(
81 content::RenderViewHost* render_view_host) OVERRIDE; 81 content::RenderViewHost* render_view_host) OVERRIDE;
82 virtual void RenderViewDeleted( 82 virtual void RenderViewDeleted(
83 content::RenderViewHost* render_view_host) OVERRIDE; 83 content::RenderViewHost* render_view_host) OVERRIDE;
84 virtual void RenderViewReady() OVERRIDE; 84 virtual void RenderViewReady() OVERRIDE;
85 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; 85 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE;
86 virtual void DocumentAvailableInMainFrame() OVERRIDE; 86 virtual void DocumentAvailableInMainFrame() OVERRIDE;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 content::NotificationRegistrar registrar_; 170 content::NotificationRegistrar registrar_;
171 171
172 ExtensionFunctionDispatcher extension_function_dispatcher_; 172 ExtensionFunctionDispatcher extension_function_dispatcher_;
173 173
174 // The type of view being hosted. 174 // The type of view being hosted.
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 // Called when the RenderView is created.
181 std::vector<base::Closure> when_render_view_created_;
182
180 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); 183 DISALLOW_COPY_AND_ASSIGN(ExtensionHost);
181 }; 184 };
182 185
183 } // namespace extensions 186 } // namespace extensions
184 187
185 #endif // EXTENSIONS_BROWSER_EXTENSION_HOST_H_ 188 #endif // EXTENSIONS_BROWSER_EXTENSION_HOST_H_
OLDNEW
« no previous file with comments | « content/renderer/service_worker/embedded_worker_dispatcher.cc ('k') | extensions/browser/extension_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698