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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP || | 333 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP || |
334 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG || | 334 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG || |
335 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR || | 335 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR || |
336 extension_host_type_ == chrome::VIEW_TYPE_APP_SHELL) { | 336 extension_host_type_ == chrome::VIEW_TYPE_APP_SHELL) { |
337 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) | 337 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) |
338 if (view_.get()) | 338 if (view_.get()) |
339 view_->DidStopLoading(); | 339 view_->DidStopLoading(); |
340 #endif | 340 #endif |
341 } | 341 } |
342 if (notify) { | 342 if (notify) { |
343 content::NotificationService::current()->Notify( | |
344 chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, | |
345 content::Source<Profile>(profile_), | |
346 content::Details<ExtensionHost>(this)); | |
347 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { | 343 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { |
348 UMA_HISTOGRAM_TIMES("Extensions.BackgroundPageLoadTime", | 344 UMA_HISTOGRAM_TIMES("Extensions.BackgroundPageLoadTime", |
349 since_created_.Elapsed()); | 345 since_created_.Elapsed()); |
350 } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG) { | 346 } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG) { |
351 UMA_HISTOGRAM_TIMES("Extensions.DialogLoadTime", | 347 UMA_HISTOGRAM_TIMES("Extensions.DialogLoadTime", |
352 since_created_.Elapsed()); | 348 since_created_.Elapsed()); |
353 } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP) { | 349 } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP) { |
354 UMA_HISTOGRAM_TIMES("Extensions.PopupLoadTime", | 350 UMA_HISTOGRAM_TIMES("Extensions.PopupLoadTime", |
355 since_created_.Elapsed()); | 351 since_created_.Elapsed()); |
356 } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) { | 352 } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) { |
357 UMA_HISTOGRAM_TIMES("Extensions.InfobarLoadTime", | 353 UMA_HISTOGRAM_TIMES("Extensions.InfobarLoadTime", |
358 since_created_.Elapsed()); | 354 since_created_.Elapsed()); |
359 } else if (extension_host_type_ == chrome::VIEW_TYPE_APP_SHELL) { | 355 } else if (extension_host_type_ == chrome::VIEW_TYPE_APP_SHELL) { |
360 UMA_HISTOGRAM_TIMES("Extensions.ShellLoadTime", since_created_.Elapsed()); | 356 UMA_HISTOGRAM_TIMES("Extensions.ShellLoadTime", since_created_.Elapsed()); |
361 } | 357 } |
| 358 |
| 359 // Send the notification last, because it might result in this being |
| 360 // deleted. |
| 361 content::NotificationService::current()->Notify( |
| 362 chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, |
| 363 content::Source<Profile>(profile_), |
| 364 content::Details<ExtensionHost>(this)); |
362 } | 365 } |
363 } | 366 } |
364 | 367 |
365 void ExtensionHost::DocumentAvailableInMainFrame() { | 368 void ExtensionHost::DocumentAvailableInMainFrame() { |
366 // If the document has already been marked as available for this host, then | 369 // If the document has already been marked as available for this host, then |
367 // bail. No need for the redundant setup. http://crbug.com/31170 | 370 // bail. No need for the redundant setup. http://crbug.com/31170 |
368 if (document_element_available_) | 371 if (document_element_available_) |
369 return; | 372 return; |
370 | 373 |
371 document_element_available_ = true; | 374 document_element_available_ = true; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 browser::Navigate(¶ms); | 568 browser::Navigate(¶ms); |
566 } | 569 } |
567 | 570 |
568 | 571 |
569 void ExtensionHost::RenderViewReady() { | 572 void ExtensionHost::RenderViewReady() { |
570 content::NotificationService::current()->Notify( | 573 content::NotificationService::current()->Notify( |
571 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, | 574 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, |
572 content::Source<Profile>(profile_), | 575 content::Source<Profile>(profile_), |
573 content::Details<ExtensionHost>(this)); | 576 content::Details<ExtensionHost>(this)); |
574 } | 577 } |
OLD | NEW |