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

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

Issue 964193002: Cleanup/ Remove deprecated extension notification from ExtensionHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « chrome/browser/extensions/extension_view_host.cc ('k') | extensions/browser/extension_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector>
11 10
12 #include "base/logging.h" 11 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
14 #include "base/observer_list.h" 13 #include "base/observer_list.h"
15 #include "base/timer/elapsed_timer.h" 14 #include "base/timer/elapsed_timer.h"
16 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h"
18 #include "content/public/browser/web_contents_delegate.h" 15 #include "content/public/browser/web_contents_delegate.h"
19 #include "content/public/browser/web_contents_observer.h" 16 #include "content/public/browser/web_contents_observer.h"
20 #include "extensions/browser/deferred_start_render_host.h" 17 #include "extensions/browser/deferred_start_render_host.h"
21 #include "extensions/browser/extension_function_dispatcher.h" 18 #include "extensions/browser/extension_function_dispatcher.h"
19 #include "extensions/browser/extension_registry_observer.h"
22 #include "extensions/common/stack_frame.h" 20 #include "extensions/common/stack_frame.h"
23 #include "extensions/common/view_type.h" 21 #include "extensions/common/view_type.h"
24 22
25 class PrefsTabHelper; 23 class PrefsTabHelper;
26 24
27 namespace content { 25 namespace content {
28 class BrowserContext; 26 class BrowserContext;
29 class RenderProcessHost; 27 class RenderProcessHost;
30 class RenderWidgetHostView; 28 class RenderWidgetHostView;
31 class SiteInstance; 29 class SiteInstance;
(...skipping 10 matching lines...) Expand all
42 // It handles setting up the renderer process, if needed, with special 40 // It handles setting up the renderer process, if needed, with special
43 // privileges available to extensions. It may have a view to be shown in the 41 // privileges available to extensions. It may have a view to be shown in the
44 // browser UI, or it may be hidden. 42 // browser UI, or it may be hidden.
45 // 43 //
46 // If you are adding code that only affects visible extension views (and not 44 // If you are adding code that only affects visible extension views (and not
47 // invisible background pages) you should add it to ExtensionViewHost. 45 // invisible background pages) you should add it to ExtensionViewHost.
48 class ExtensionHost : public DeferredStartRenderHost, 46 class ExtensionHost : public DeferredStartRenderHost,
49 public content::WebContentsDelegate, 47 public content::WebContentsDelegate,
50 public content::WebContentsObserver, 48 public content::WebContentsObserver,
51 public ExtensionFunctionDispatcher::Delegate, 49 public ExtensionFunctionDispatcher::Delegate,
52 public content::NotificationObserver { 50 public ExtensionRegistryObserver {
53 public: 51 public:
54 ExtensionHost(const Extension* extension, 52 ExtensionHost(const Extension* extension,
55 content::SiteInstance* site_instance, 53 content::SiteInstance* site_instance,
56 const GURL& url, ViewType host_type); 54 const GURL& url, ViewType host_type);
57 ~ExtensionHost() override; 55 ~ExtensionHost() override;
58 56
59 const Extension* extension() const { return extension_; } 57 const Extension* extension() const { return extension_; }
60 const std::string& extension_id() const { return extension_id_; } 58 const std::string& extension_id() const { return extension_id_; }
61 content::WebContents* host_contents() const { return host_contents_.get(); } 59 content::WebContents* host_contents() const { return host_contents_.get(); }
62 content::RenderViewHost* render_view_host() const; 60 content::RenderViewHost* render_view_host() const;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 void CloseContents(content::WebContents* contents) override; 118 void CloseContents(content::WebContents* contents) override;
121 void RequestMediaAccessPermission( 119 void RequestMediaAccessPermission(
122 content::WebContents* web_contents, 120 content::WebContents* web_contents,
123 const content::MediaStreamRequest& request, 121 const content::MediaStreamRequest& request,
124 const content::MediaResponseCallback& callback) override; 122 const content::MediaResponseCallback& callback) override;
125 bool CheckMediaAccessPermission(content::WebContents* web_contents, 123 bool CheckMediaAccessPermission(content::WebContents* web_contents,
126 const GURL& security_origin, 124 const GURL& security_origin,
127 content::MediaStreamType type) override; 125 content::MediaStreamType type) override;
128 bool IsNeverVisible(content::WebContents* web_contents) override; 126 bool IsNeverVisible(content::WebContents* web_contents) override;
129 127
130 // content::NotificationObserver: 128 // ExtensionRegistryObserver:
131 void Observe(int type, 129 void OnExtensionUnloaded(content::BrowserContext* browser_context,
132 const content::NotificationSource& source, 130 const Extension* extension,
133 const content::NotificationDetails& details) override; 131 UnloadedExtensionInfo::Reason reason) override;
134 132
135 protected: 133 protected:
136 content::NotificationRegistrar* registrar() { return &registrar_; }
137
138 // Called after the extension page finishes loading but before the 134 // Called after the extension page finishes loading but before the
139 // EXTENSION_HOST_DID_STOP_LOADING notification is sent. 135 // EXTENSION_HOST_DID_STOP_LOADING notification is sent.
140 virtual void OnDidStopLoading(); 136 virtual void OnDidStopLoading();
141 137
142 // Navigates to the initial page. 138 // Navigates to the initial page.
143 virtual void LoadInitialURL(); 139 virtual void LoadInitialURL();
144 140
145 // Returns true if we're hosting a background page. 141 // Returns true if we're hosting a background page.
146 virtual bool IsBackgroundPage() const; 142 virtual bool IsBackgroundPage() const;
147 143
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 180
185 // True if the main frame has finished parsing. 181 // True if the main frame has finished parsing.
186 bool document_element_available_; 182 bool document_element_available_;
187 183
188 // The original URL of the page being hosted. 184 // The original URL of the page being hosted.
189 GURL initial_url_; 185 GURL initial_url_;
190 186
191 // Messages sent out to the renderer that have not been acknowledged yet. 187 // Messages sent out to the renderer that have not been acknowledged yet.
192 std::set<int> unacked_messages_; 188 std::set<int> unacked_messages_;
193 189
194 content::NotificationRegistrar registrar_;
195
196 ExtensionFunctionDispatcher extension_function_dispatcher_; 190 ExtensionFunctionDispatcher extension_function_dispatcher_;
197 191
198 // The type of view being hosted. 192 // The type of view being hosted.
199 ViewType extension_host_type_; 193 ViewType extension_host_type_;
200 194
201 // Measures how long since the initial URL started loading. 195 // Measures how long since the initial URL started loading.
202 scoped_ptr<base::ElapsedTimer> load_start_; 196 scoped_ptr<base::ElapsedTimer> load_start_;
203 197
204 ObserverList<ExtensionHostObserver> observer_list_; 198 ObserverList<ExtensionHostObserver> observer_list_;
205 ObserverList<DeferredStartRenderHostObserver> 199 ObserverList<DeferredStartRenderHostObserver>
206 deferred_start_render_host_observer_list_; 200 deferred_start_render_host_observer_list_;
207 201
208 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); 202 DISALLOW_COPY_AND_ASSIGN(ExtensionHost);
209 }; 203 };
210 204
211 } // namespace extensions 205 } // namespace extensions
212 206
213 #endif // EXTENSIONS_BROWSER_EXTENSION_HOST_H_ 207 #endif // EXTENSIONS_BROWSER_EXTENSION_HOST_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_view_host.cc ('k') | extensions/browser/extension_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698