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

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

Issue 1012823002: Revert of Make LoadMonitoringExtensionHostQueue remove itself as an ExtensionHost observer at the... (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
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 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 ExtensionHost(const Extension* extension, 52 ExtensionHost(const Extension* extension,
53 content::SiteInstance* site_instance, 53 content::SiteInstance* site_instance,
54 const GURL& url, ViewType host_type); 54 const GURL& url, ViewType host_type);
55 ~ExtensionHost() override; 55 ~ExtensionHost() override;
56 56
57 const Extension* extension() const { return extension_; } 57 const Extension* extension() const { return extension_; }
58 const std::string& extension_id() const { return extension_id_; } 58 const std::string& extension_id() const { return extension_id_; }
59 content::WebContents* host_contents() const { return host_contents_.get(); } 59 content::WebContents* host_contents() const { return host_contents_.get(); }
60 content::RenderViewHost* render_view_host() const; 60 content::RenderViewHost* render_view_host() const;
61 content::RenderProcessHost* render_process_host() const; 61 content::RenderProcessHost* render_process_host() const;
62 bool has_loaded_once() const { return has_loaded_once_; } 62 bool did_stop_loading() const { return did_stop_loading_; }
63 bool document_element_available() const { 63 bool document_element_available() const {
64 return document_element_available_; 64 return document_element_available_;
65 } 65 }
66 66
67 content::BrowserContext* browser_context() { return browser_context_; } 67 content::BrowserContext* browser_context() { return browser_context_; }
68 68
69 ViewType extension_host_type() const { return extension_host_type_; } 69 ViewType extension_host_type() const { return extension_host_type_; }
70 const GURL& GetURL() const; 70 const GURL& GetURL() const;
71 71
72 // Returns true if the render view is initialized and didn't crash. 72 // Returns true if the render view is initialized and didn't crash.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 const GURL& security_origin, 124 const GURL& security_origin,
125 content::MediaStreamType type) override; 125 content::MediaStreamType type) override;
126 bool IsNeverVisible(content::WebContents* web_contents) override; 126 bool IsNeverVisible(content::WebContents* web_contents) override;
127 127
128 // ExtensionRegistryObserver: 128 // ExtensionRegistryObserver:
129 void OnExtensionUnloaded(content::BrowserContext* browser_context, 129 void OnExtensionUnloaded(content::BrowserContext* browser_context,
130 const Extension* extension, 130 const Extension* extension,
131 UnloadedExtensionInfo::Reason reason) override; 131 UnloadedExtensionInfo::Reason reason) override;
132 132
133 protected: 133 protected:
134 // Called each time this ExtensionHost completes a load finishes loading, 134 // Called after the extension page finishes loading but before the
135 // before any stop-loading notifications or observer methods are called. 135 // EXTENSION_HOST_DID_STOP_LOADING notification is sent.
136 virtual void OnDidStopLoading(); 136 virtual void OnDidStopLoading();
137 137
138 // Navigates to the initial page. 138 // Navigates to the initial page.
139 virtual void LoadInitialURL(); 139 virtual void LoadInitialURL();
140 140
141 // Returns true if we're hosting a background page. 141 // Returns true if we're hosting a background page.
142 virtual bool IsBackgroundPage() const; 142 virtual bool IsBackgroundPage() const;
143 143
144 private: 144 private:
145 // DeferredStartRenderHost: 145 // DeferredStartRenderHost:
146 void CreateRenderViewNow() override; 146 void CreateRenderViewNow() override;
147 void AddDeferredStartRenderHostObserver( 147 void AddDeferredStartRenderHostObserver(
148 DeferredStartRenderHostObserver* observer) override; 148 DeferredStartRenderHostObserver* observer) override;
149 void RemoveDeferredStartRenderHostObserver( 149 void RemoveDeferredStartRenderHostObserver(
150 DeferredStartRenderHostObserver* observer) override; 150 DeferredStartRenderHostObserver* observer) override;
151 151
152 // Message handlers. 152 // Message handlers.
153 void OnRequest(const ExtensionHostMsg_Request_Params& params); 153 void OnRequest(const ExtensionHostMsg_Request_Params& params);
154 void OnEventAck(int event_id); 154 void OnEventAck(int event_id);
155 void OnIncrementLazyKeepaliveCount(); 155 void OnIncrementLazyKeepaliveCount();
156 void OnDecrementLazyKeepaliveCount(); 156 void OnDecrementLazyKeepaliveCount();
157 157
158 // Records UMA for load events.
159 void RecordStopLoadingUMA();
160
161 // Delegate for functionality that cannot exist in the extensions module. 158 // Delegate for functionality that cannot exist in the extensions module.
162 scoped_ptr<ExtensionHostDelegate> delegate_; 159 scoped_ptr<ExtensionHostDelegate> delegate_;
163 160
164 // The extension that we're hosting in this view. 161 // The extension that we're hosting in this view.
165 const Extension* extension_; 162 const Extension* extension_;
166 163
167 // Id of extension that we're hosting in this view. 164 // Id of extension that we're hosting in this view.
168 const std::string extension_id_; 165 const std::string extension_id_;
169 166
170 // The browser context that this host is tied to. 167 // The browser context that this host is tied to.
171 content::BrowserContext* browser_context_; 168 content::BrowserContext* browser_context_;
172 169
173 // The host for our HTML content. 170 // The host for our HTML content.
174 scoped_ptr<content::WebContents> host_contents_; 171 scoped_ptr<content::WebContents> host_contents_;
175 172
176 // A weak pointer to the current or pending RenderViewHost. We don't access 173 // A weak pointer to the current or pending RenderViewHost. We don't access
177 // this through the host_contents because we want to deal with the pending 174 // this through the host_contents because we want to deal with the pending
178 // host, so we can send messages to it before it finishes loading. 175 // host, so we can send messages to it before it finishes loading.
179 content::RenderViewHost* render_view_host_; 176 content::RenderViewHost* render_view_host_;
180 177
181 // Whether the ExtensionHost has finished loading some content at least once. 178 // Whether the RenderWidget has reported that it has stopped loading.
182 // There may be subsequent loads - such as reloads and navigations - and this 179 bool did_stop_loading_;
183 // will not affect its value (it will remain true).
184 bool has_loaded_once_;
185 180
186 // True if the main frame has finished parsing. 181 // True if the main frame has finished parsing.
187 bool document_element_available_; 182 bool document_element_available_;
188 183
189 // The original URL of the page being hosted. 184 // The original URL of the page being hosted.
190 GURL initial_url_; 185 GURL initial_url_;
191 186
192 // 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.
193 std::set<int> unacked_messages_; 188 std::set<int> unacked_messages_;
194 189
195 ExtensionFunctionDispatcher extension_function_dispatcher_; 190 ExtensionFunctionDispatcher extension_function_dispatcher_;
196 191
197 // The type of view being hosted. 192 // The type of view being hosted.
198 ViewType extension_host_type_; 193 ViewType extension_host_type_;
199 194
200 // Measures how long since the initial URL started loading. 195 // Measures how long since the initial URL started loading.
201 scoped_ptr<base::ElapsedTimer> load_start_; 196 scoped_ptr<base::ElapsedTimer> load_start_;
202 197
203 ObserverList<ExtensionHostObserver> observer_list_; 198 ObserverList<ExtensionHostObserver> observer_list_;
204 ObserverList<DeferredStartRenderHostObserver> 199 ObserverList<DeferredStartRenderHostObserver>
205 deferred_start_render_host_observer_list_; 200 deferred_start_render_host_observer_list_;
206 201
207 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); 202 DISALLOW_COPY_AND_ASSIGN(ExtensionHost);
208 }; 203 };
209 204
210 } // namespace extensions 205 } // namespace extensions
211 206
212 #endif // EXTENSIONS_BROWSER_EXTENSION_HOST_H_ 207 #endif // EXTENSIONS_BROWSER_EXTENSION_HOST_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_view_views.cc ('k') | extensions/browser/extension_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698