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 #include "chrome/browser/extensions/extension_host.h" | 5 #include "chrome/browser/extensions/extension_host.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 render_view_host_ = host_contents_->GetRenderViewHost(); | 152 render_view_host_ = host_contents_->GetRenderViewHost(); |
153 | 153 |
154 // Listen for when an extension is unloaded from the same profile, as it may | 154 // Listen for when an extension is unloaded from the same profile, as it may |
155 // be the same extension that this points to. | 155 // be the same extension that this points to. |
156 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 156 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
157 content::Source<Profile>(profile_)); | 157 content::Source<Profile>(profile_)); |
158 } | 158 } |
159 | 159 |
160 ExtensionHost::~ExtensionHost() { | 160 ExtensionHost::~ExtensionHost() { |
161 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE && | 161 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE && |
162 extension_->has_lazy_background_page()) { | 162 extension_ && extension_->has_lazy_background_page()) { |
163 UMA_HISTOGRAM_LONG_TIMES("Extensions.EventPageActiveTime", | 163 UMA_HISTOGRAM_LONG_TIMES("Extensions.EventPageActiveTime", |
164 since_created_.Elapsed()); | 164 since_created_.Elapsed()); |
165 } | 165 } |
166 content::NotificationService::current()->Notify( | 166 content::NotificationService::current()->Notify( |
167 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 167 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
168 content::Source<Profile>(profile_), | 168 content::Source<Profile>(profile_), |
169 content::Details<ExtensionHost>(this)); | 169 content::Details<ExtensionHost>(this)); |
170 ProcessCreationQueue::GetInstance()->Remove(this); | 170 ProcessCreationQueue::GetInstance()->Remove(this); |
171 } | 171 } |
172 | 172 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG || | 343 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG || |
344 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR || | 344 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR || |
345 extension_host_type_ == chrome::VIEW_TYPE_PANEL) { | 345 extension_host_type_ == chrome::VIEW_TYPE_PANEL) { |
346 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) | 346 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) |
347 if (view()) | 347 if (view()) |
348 view()->DidStopLoading(); | 348 view()->DidStopLoading(); |
349 #endif | 349 #endif |
350 } | 350 } |
351 if (notify) { | 351 if (notify) { |
352 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { | 352 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { |
353 if (extension_->has_lazy_background_page()) { | 353 if (extension_ && extension_->has_lazy_background_page()) { |
354 UMA_HISTOGRAM_TIMES("Extensions.EventPageLoadTime", | 354 UMA_HISTOGRAM_TIMES("Extensions.EventPageLoadTime", |
355 since_created_.Elapsed()); | 355 since_created_.Elapsed()); |
356 } else { | 356 } else { |
357 UMA_HISTOGRAM_TIMES("Extensions.BackgroundPageLoadTime", | 357 UMA_HISTOGRAM_TIMES("Extensions.BackgroundPageLoadTime", |
358 since_created_.Elapsed()); | 358 since_created_.Elapsed()); |
359 } | 359 } |
360 } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG) { | 360 } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG) { |
361 UMA_HISTOGRAM_TIMES("Extensions.DialogLoadTime", | 361 UMA_HISTOGRAM_TIMES("Extensions.DialogLoadTime", |
362 since_created_.Elapsed()); | 362 since_created_.Elapsed()); |
363 } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP) { | 363 } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP) { |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 params.user_gesture = user_gesture; | 600 params.user_gesture = user_gesture; |
601 browser::Navigate(¶ms); | 601 browser::Navigate(¶ms); |
602 } | 602 } |
603 | 603 |
604 void ExtensionHost::RenderViewReady() { | 604 void ExtensionHost::RenderViewReady() { |
605 content::NotificationService::current()->Notify( | 605 content::NotificationService::current()->Notify( |
606 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, | 606 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, |
607 content::Source<Profile>(profile_), | 607 content::Source<Profile>(profile_), |
608 content::Details<ExtensionHost>(this)); | 608 content::Details<ExtensionHost>(this)); |
609 } | 609 } |
OLD | NEW |