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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 registrar_.Add(this, chrome::NOTIFICATION_TAB_CLOSING, | 585 registrar_.Add(this, chrome::NOTIFICATION_TAB_CLOSING, |
586 content::NotificationService::AllSources()); | 586 content::NotificationService::AllSources()); |
587 registrar_.Add(this, content::NOTIFICATION_LOAD_START, | 587 registrar_.Add(this, content::NOTIFICATION_LOAD_START, |
588 content::NotificationService::AllSources()); | 588 content::NotificationService::AllSources()); |
589 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, | 589 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, |
590 content::NotificationService::AllSources()); | 590 content::NotificationService::AllSources()); |
591 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 591 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
592 content::NotificationService::AllSources()); | 592 content::NotificationService::AllSources()); |
593 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_HANG, | 593 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_HANG, |
594 content::NotificationService::AllSources()); | 594 content::NotificationService::AllSources()); |
595 registrar_.Add(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 595 |
596 content::NotificationService::AllSources()); | 596 omnibox_url_opened_subscription_ = |
| 597 OmniboxEventGlobalTracker::GetInstance()->RegisterCallback( |
| 598 base::Bind(&ChromeMetricsServiceClient::OnURLOpenedFromOmnibox, |
| 599 base::Unretained(this))); |
597 } | 600 } |
598 | 601 |
599 void ChromeMetricsServiceClient::Observe( | 602 void ChromeMetricsServiceClient::Observe( |
600 int type, | 603 int type, |
601 const content::NotificationSource& source, | 604 const content::NotificationSource& source, |
602 const content::NotificationDetails& details) { | 605 const content::NotificationDetails& details) { |
603 DCHECK(thread_checker_.CalledOnValidThread()); | 606 DCHECK(thread_checker_.CalledOnValidThread()); |
604 | 607 |
605 switch (type) { | 608 switch (type) { |
606 case chrome::NOTIFICATION_BROWSER_OPENED: | 609 case chrome::NOTIFICATION_BROWSER_OPENED: |
607 case chrome::NOTIFICATION_BROWSER_CLOSED: | 610 case chrome::NOTIFICATION_BROWSER_CLOSED: |
608 case chrome::NOTIFICATION_OMNIBOX_OPENED_URL: | |
609 case chrome::NOTIFICATION_TAB_PARENTED: | 611 case chrome::NOTIFICATION_TAB_PARENTED: |
610 case chrome::NOTIFICATION_TAB_CLOSING: | 612 case chrome::NOTIFICATION_TAB_CLOSING: |
611 case content::NOTIFICATION_LOAD_STOP: | 613 case content::NOTIFICATION_LOAD_STOP: |
612 case content::NOTIFICATION_LOAD_START: | 614 case content::NOTIFICATION_LOAD_START: |
613 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: | 615 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: |
614 case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: | 616 case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: |
615 metrics_service_->OnApplicationNotIdle(); | 617 metrics_service_->OnApplicationNotIdle(); |
616 break; | 618 break; |
617 | 619 |
618 default: | 620 default: |
619 NOTREACHED(); | 621 NOTREACHED(); |
620 } | 622 } |
621 } | 623 } |
| 624 |
| 625 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { |
| 626 metrics_service_->OnApplicationNotIdle(); |
| 627 } |
OLD | NEW |