OLD | NEW |
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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <set> | 11 #include <set> |
11 #include <string> | 12 #include <string> |
12 | 13 |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "base/timer/elapsed_timer.h" | 17 #include "base/timer/elapsed_timer.h" |
18 #include "content/public/browser/web_contents_delegate.h" | 18 #include "content/public/browser/web_contents_delegate.h" |
19 #include "content/public/browser/web_contents_observer.h" | 19 #include "content/public/browser/web_contents_observer.h" |
20 #include "extensions/browser/deferred_start_render_host.h" | 20 #include "extensions/browser/deferred_start_render_host.h" |
21 #include "extensions/browser/extension_function_dispatcher.h" | 21 #include "extensions/browser/extension_function_dispatcher.h" |
22 #include "extensions/browser/extension_registry_observer.h" | 22 #include "extensions/browser/extension_registry_observer.h" |
23 #include "extensions/common/stack_frame.h" | 23 #include "extensions/common/stack_frame.h" |
24 #include "extensions/common/view_type.h" | 24 #include "extensions/common/view_type.h" |
25 | 25 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 // Message handlers. | 159 // Message handlers. |
160 void OnEventAck(int event_id); | 160 void OnEventAck(int event_id); |
161 void OnIncrementLazyKeepaliveCount(); | 161 void OnIncrementLazyKeepaliveCount(); |
162 void OnDecrementLazyKeepaliveCount(); | 162 void OnDecrementLazyKeepaliveCount(); |
163 | 163 |
164 // Records UMA for load events. | 164 // Records UMA for load events. |
165 void RecordStopLoadingUMA(); | 165 void RecordStopLoadingUMA(); |
166 | 166 |
167 // Delegate for functionality that cannot exist in the extensions module. | 167 // Delegate for functionality that cannot exist in the extensions module. |
168 scoped_ptr<ExtensionHostDelegate> delegate_; | 168 std::unique_ptr<ExtensionHostDelegate> delegate_; |
169 | 169 |
170 // The extension that we're hosting in this view. | 170 // The extension that we're hosting in this view. |
171 const Extension* extension_; | 171 const Extension* extension_; |
172 | 172 |
173 // Id of extension that we're hosting in this view. | 173 // Id of extension that we're hosting in this view. |
174 const std::string extension_id_; | 174 const std::string extension_id_; |
175 | 175 |
176 // The browser context that this host is tied to. | 176 // The browser context that this host is tied to. |
177 content::BrowserContext* browser_context_; | 177 content::BrowserContext* browser_context_; |
178 | 178 |
179 // The host for our HTML content. | 179 // The host for our HTML content. |
180 scoped_ptr<content::WebContents> host_contents_; | 180 std::unique_ptr<content::WebContents> host_contents_; |
181 | 181 |
182 // A weak pointer to the current or pending RenderViewHost. We don't access | 182 // A weak pointer to the current or pending RenderViewHost. We don't access |
183 // this through the host_contents because we want to deal with the pending | 183 // this through the host_contents because we want to deal with the pending |
184 // host, so we can send messages to it before it finishes loading. | 184 // host, so we can send messages to it before it finishes loading. |
185 content::RenderViewHost* render_view_host_; | 185 content::RenderViewHost* render_view_host_; |
186 | 186 |
187 // Whether CreateRenderViewNow was called before the extension was ready. | 187 // Whether CreateRenderViewNow was called before the extension was ready. |
188 bool is_render_view_creation_pending_; | 188 bool is_render_view_creation_pending_; |
189 | 189 |
190 // Whether the ExtensionHost has finished loading some content at least once. | 190 // Whether the ExtensionHost has finished loading some content at least once. |
(...skipping 15 matching lines...) Expand all Loading... |
206 | 206 |
207 // Measures how long since the ExtensionHost object was created. This can be | 207 // Measures how long since the ExtensionHost object was created. This can be |
208 // used to measure the responsiveness of UI. For example, it's important to | 208 // used to measure the responsiveness of UI. For example, it's important to |
209 // keep this as low as possible for popups. Contrast this to |load_start_|, | 209 // keep this as low as possible for popups. Contrast this to |load_start_|, |
210 // for which a low value does not necessarily mean a responsive UI, as | 210 // for which a low value does not necessarily mean a responsive UI, as |
211 // ExtensionHosts may sit in an ExtensionHostQueue for a long time. | 211 // ExtensionHosts may sit in an ExtensionHostQueue for a long time. |
212 base::ElapsedTimer create_start_; | 212 base::ElapsedTimer create_start_; |
213 | 213 |
214 // Measures how long since the initial URL started loading. This timer is | 214 // Measures how long since the initial URL started loading. This timer is |
215 // started only once the ExtensionHost has exited the ExtensionHostQueue. | 215 // started only once the ExtensionHost has exited the ExtensionHostQueue. |
216 scoped_ptr<base::ElapsedTimer> load_start_; | 216 std::unique_ptr<base::ElapsedTimer> load_start_; |
217 | 217 |
218 base::ObserverList<ExtensionHostObserver> observer_list_; | 218 base::ObserverList<ExtensionHostObserver> observer_list_; |
219 base::ObserverList<DeferredStartRenderHostObserver> | 219 base::ObserverList<DeferredStartRenderHostObserver> |
220 deferred_start_render_host_observer_list_; | 220 deferred_start_render_host_observer_list_; |
221 | 221 |
222 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); | 222 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); |
223 }; | 223 }; |
224 | 224 |
225 } // namespace extensions | 225 } // namespace extensions |
226 | 226 |
227 #endif // EXTENSIONS_BROWSER_EXTENSION_HOST_H_ | 227 #endif // EXTENSIONS_BROWSER_EXTENSION_HOST_H_ |
OLD | NEW |