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