Chromium Code Reviews| 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 #include "chrome/browser/metrics/chrome_metrics_service_client.h" | 5 #include "chrome/browser/metrics/chrome_metrics_service_client.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 581 registrar_.Add(this, chrome::NOTIFICATION_TAB_CLOSING, | 581 registrar_.Add(this, chrome::NOTIFICATION_TAB_CLOSING, |
| 582 content::NotificationService::AllSources()); | 582 content::NotificationService::AllSources()); |
| 583 registrar_.Add(this, content::NOTIFICATION_LOAD_START, | 583 registrar_.Add(this, content::NOTIFICATION_LOAD_START, |
| 584 content::NotificationService::AllSources()); | 584 content::NotificationService::AllSources()); |
| 585 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, | 585 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, |
| 586 content::NotificationService::AllSources()); | 586 content::NotificationService::AllSources()); |
| 587 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 587 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
| 588 content::NotificationService::AllSources()); | 588 content::NotificationService::AllSources()); |
| 589 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_HANG, | 589 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_HANG, |
| 590 content::NotificationService::AllSources()); | 590 content::NotificationService::AllSources()); |
| 591 registrar_.Add(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 591 |
| 592 content::NotificationService::AllSources()); | 592 omnibox_url_opened_subscription_ = |
| 593 OmniboxEventGlobalTracker::GetInstance()->RegisterCallback( | |
| 594 base::Bind(&ChromeMetricsServiceClient::OnURLOpenedFromOmnibox, | |
| 595 base::Unretained(this))); | |
| 593 } | 596 } |
| 594 | 597 |
| 595 void ChromeMetricsServiceClient::Observe( | 598 void ChromeMetricsServiceClient::Observe( |
| 596 int type, | 599 int type, |
| 597 const content::NotificationSource& source, | 600 const content::NotificationSource& source, |
| 598 const content::NotificationDetails& details) { | 601 const content::NotificationDetails& details) { |
| 599 DCHECK(thread_checker_.CalledOnValidThread()); | 602 DCHECK(thread_checker_.CalledOnValidThread()); |
| 600 | 603 |
| 601 switch (type) { | 604 switch (type) { |
| 602 case chrome::NOTIFICATION_BROWSER_OPENED: | 605 case chrome::NOTIFICATION_BROWSER_OPENED: |
| 603 case chrome::NOTIFICATION_BROWSER_CLOSED: | 606 case chrome::NOTIFICATION_BROWSER_CLOSED: |
| 604 case chrome::NOTIFICATION_OMNIBOX_OPENED_URL: | |
| 605 case chrome::NOTIFICATION_TAB_PARENTED: | 607 case chrome::NOTIFICATION_TAB_PARENTED: |
| 606 case chrome::NOTIFICATION_TAB_CLOSING: | 608 case chrome::NOTIFICATION_TAB_CLOSING: |
| 607 case content::NOTIFICATION_LOAD_STOP: | 609 case content::NOTIFICATION_LOAD_STOP: |
| 608 case content::NOTIFICATION_LOAD_START: | 610 case content::NOTIFICATION_LOAD_START: |
| 609 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: | 611 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: |
| 610 case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: | 612 case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: |
| 611 metrics_service_->OnApplicationNotIdle(); | 613 OnApplicationNotIdle(); |
| 612 break; | 614 break; |
| 613 | 615 |
| 614 default: | 616 default: |
| 615 NOTREACHED(); | 617 NOTREACHED(); |
| 616 } | 618 } |
| 617 } | 619 } |
| 620 | |
| 621 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { | |
| 622 OnApplicationNotIdle(); | |
| 623 } | |
| 624 | |
| 625 void ChromeMetricsServiceClient::OnApplicationNotIdle() { | |
| 626 metrics_service_->OnApplicationNotIdle(); | |
|
Alexei Svitkine (slow)
2015/08/07 14:57:37
Nit: Since its body is a 1-liner, doesn't seem wor
blundell
2015/08/17 09:24:01
Done.
| |
| 627 } | |
| OLD | NEW |