OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/boot_times_loader.h" | 5 #include "chrome/browser/chromeos/boot_times_loader.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/ui/browser_list.h" | 26 #include "chrome/browser/ui/browser_list.h" |
27 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
29 #include "content/browser/renderer_host/render_widget_host_view.h" | 29 #include "content/browser/renderer_host/render_widget_host_view.h" |
30 #include "content/browser/tab_contents/tab_contents.h" | 30 #include "content/browser/tab_contents/tab_contents.h" |
31 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
32 #include "content/public/browser/navigation_controller.h" | 32 #include "content/public/browser/navigation_controller.h" |
33 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
34 | 34 |
35 using content::BrowserThread; | 35 using content::BrowserThread; |
| 36 using content::NavigationController; |
36 using content::WebContents; | 37 using content::WebContents; |
37 | 38 |
38 namespace { | 39 namespace { |
39 | 40 |
40 RenderWidgetHost* GetRenderWidgetHost(content::NavigationController* tab) { | 41 RenderWidgetHost* GetRenderWidgetHost(NavigationController* tab) { |
41 WebContents* web_contents = tab->GetWebContents(); | 42 WebContents* web_contents = tab->GetWebContents(); |
42 if (web_contents) { | 43 if (web_contents) { |
43 RenderWidgetHostView* render_widget_host_view = | 44 RenderWidgetHostView* render_widget_host_view = |
44 web_contents->GetRenderWidgetHostView(); | 45 web_contents->GetRenderWidgetHostView(); |
45 if (render_widget_host_view) | 46 if (render_widget_host_view) |
46 return render_widget_host_view->GetRenderWidgetHost(); | 47 return render_widget_host_view->GetRenderWidgetHost(); |
47 } | 48 } |
48 return NULL; | 49 return NULL; |
49 } | 50 } |
50 | 51 |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 content::Details<AuthenticationNotificationDetails> auth_details(details); | 434 content::Details<AuthenticationNotificationDetails> auth_details(details); |
434 if (auth_details->success()) { | 435 if (auth_details->success()) { |
435 AddLoginTimeMarker("Authenticate", true); | 436 AddLoginTimeMarker("Authenticate", true); |
436 RecordCurrentStats(kLoginSuccess); | 437 RecordCurrentStats(kLoginSuccess); |
437 registrar_.Remove(this, chrome::NOTIFICATION_LOGIN_AUTHENTICATION, | 438 registrar_.Remove(this, chrome::NOTIFICATION_LOGIN_AUTHENTICATION, |
438 content::NotificationService::AllSources()); | 439 content::NotificationService::AllSources()); |
439 } | 440 } |
440 break; | 441 break; |
441 } | 442 } |
442 case content::NOTIFICATION_LOAD_START: { | 443 case content::NOTIFICATION_LOAD_START: { |
443 content::NavigationController* tab = | 444 NavigationController* tab = |
444 content::Source<content::NavigationController>(source).ptr(); | 445 content::Source<NavigationController>(source).ptr(); |
445 RenderWidgetHost* rwh = GetRenderWidgetHost(tab); | 446 RenderWidgetHost* rwh = GetRenderWidgetHost(tab); |
446 DCHECK(rwh); | 447 DCHECK(rwh); |
447 AddLoginTimeMarker("TabLoad-Start: " + GetTabUrl(rwh), false); | 448 AddLoginTimeMarker("TabLoad-Start: " + GetTabUrl(rwh), false); |
448 render_widget_hosts_loading_.insert(rwh); | 449 render_widget_hosts_loading_.insert(rwh); |
449 break; | 450 break; |
450 } | 451 } |
451 case content::NOTIFICATION_LOAD_STOP: { | 452 case content::NOTIFICATION_LOAD_STOP: { |
452 content::NavigationController* tab = | 453 NavigationController* tab = |
453 content::Source<content::NavigationController>(source).ptr(); | 454 content::Source<NavigationController>(source).ptr(); |
454 RenderWidgetHost* rwh = GetRenderWidgetHost(tab); | 455 RenderWidgetHost* rwh = GetRenderWidgetHost(tab); |
455 if (render_widget_hosts_loading_.find(rwh) != | 456 if (render_widget_hosts_loading_.find(rwh) != |
456 render_widget_hosts_loading_.end()) { | 457 render_widget_hosts_loading_.end()) { |
457 AddLoginTimeMarker("TabLoad-End: " + GetTabUrl(rwh), false); | 458 AddLoginTimeMarker("TabLoad-End: " + GetTabUrl(rwh), false); |
458 } | 459 } |
459 break; | 460 break; |
460 } | 461 } |
461 case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT: { | 462 case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT: { |
462 RenderWidgetHost* rwh = content::Source<RenderWidgetHost>(source).ptr(); | 463 RenderWidgetHost* rwh = content::Source<RenderWidgetHost>(source).ptr(); |
463 if (render_widget_hosts_loading_.find(rwh) != | 464 if (render_widget_hosts_loading_.find(rwh) != |
464 render_widget_hosts_loading_.end()) { | 465 render_widget_hosts_loading_.end()) { |
465 AddLoginTimeMarker("TabPaint: " + GetTabUrl(rwh), false); | 466 AddLoginTimeMarker("TabPaint: " + GetTabUrl(rwh), false); |
466 LoginDone(); | 467 LoginDone(); |
467 } | 468 } |
468 break; | 469 break; |
469 } | 470 } |
470 case content::NOTIFICATION_WEB_CONTENTS_DESTROYED: { | 471 case content::NOTIFICATION_WEB_CONTENTS_DESTROYED: { |
471 WebContents* web_contents = content::Source<WebContents>(source).ptr(); | 472 WebContents* web_contents = content::Source<WebContents>(source).ptr(); |
472 RenderWidgetHost* render_widget_host = | 473 RenderWidgetHost* render_widget_host = |
473 GetRenderWidgetHost(&web_contents->GetController()); | 474 GetRenderWidgetHost(&web_contents->GetController()); |
474 render_widget_hosts_loading_.erase(render_widget_host); | 475 render_widget_hosts_loading_.erase(render_widget_host); |
475 break; | 476 break; |
476 } | 477 } |
477 default: | 478 default: |
478 break; | 479 break; |
479 } | 480 } |
480 } | 481 } |
481 | 482 |
482 } // namespace chromeos | 483 } // namespace chromeos |
OLD | NEW |