Index: chrome/browser/metrics/metrics_service.cc |
=================================================================== |
--- chrome/browser/metrics/metrics_service.cc (revision 271740) |
+++ chrome/browser/metrics/metrics_service.cc (working copy) |
@@ -188,11 +188,11 @@ |
#include "chrome/browser/metrics/compression_utils.h" |
#include "chrome/browser/metrics/metrics_log.h" |
#include "chrome/browser/metrics/metrics_state_manager.h" |
+#include "chrome/browser/metrics/omnibox_metrics_provider.h" |
#include "chrome/browser/metrics/time_ticks_experiment_win.h" |
#include "chrome/browser/metrics/tracking_synchronizer.h" |
#include "chrome/browser/net/http_pipelining_compatibility_client.h" |
#include "chrome/browser/net/network_stats.h" |
-#include "chrome/browser/omnibox/omnibox_log.h" |
#include "chrome/browser/ui/browser_otr_state.h" |
#include "chrome/common/chrome_constants.h" |
#include "chrome/common/chrome_switches.h" |
@@ -477,6 +477,10 @@ |
DCHECK(IsSingleThreaded()); |
DCHECK(state_manager_); |
+ // TODO(asvitkine): Move this out of MetricsService. |
+ RegisterMetricsProvider( |
+ scoped_ptr<metrics::MetricsProvider>(new OmniboxMetricsProvider)); |
+ |
BrowserChildProcessObserver::Add(this); |
} |
@@ -639,19 +643,14 @@ |
DCHECK(log_manager_.current_log()); |
DCHECK(IsSingleThreaded()); |
- // Check for notifications related to core stability metrics, or that are |
- // just triggers to end idle mode. Anything else should be added in the later |
- // switch statement, where they take effect only if general metrics should be |
- // logged. |
- bool handled = false; |
switch (type) { |
case chrome::NOTIFICATION_BROWSER_OPENED: |
case chrome::NOTIFICATION_BROWSER_CLOSED: |
+ case chrome::NOTIFICATION_OMNIBOX_OPENED_URL: |
case chrome::NOTIFICATION_TAB_PARENTED: |
case chrome::NOTIFICATION_TAB_CLOSING: |
case content::NOTIFICATION_LOAD_STOP: |
// These notifications are used only to break out of idle mode. |
- handled = true; |
break; |
case content::NOTIFICATION_LOAD_START: { |
@@ -659,7 +658,6 @@ |
content::Source<content::NavigationController>(source).ptr(); |
content::WebContents* web_contents = controller->GetWebContents(); |
LogLoadStarted(web_contents); |
- handled = true; |
break; |
} |
@@ -672,39 +670,18 @@ |
content::Source<content::RenderProcessHost>(source).ptr(); |
LogRendererCrash( |
host, process_details->status, process_details->exit_code); |
- handled = true; |
break; |
} |
case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: |
LogRendererHang(); |
- handled = true; |
break; |
default: |
- // Everything else is handled after the early return check below. |
+ NOTREACHED(); |
break; |
} |
- // If it wasn't one of the stability-related notifications, and event |
- // logging isn't suppressed, handle it. |
- if (!handled && ShouldLogEvents()) { |
- switch (type) { |
- case chrome::NOTIFICATION_OMNIBOX_OPENED_URL: { |
- MetricsLog* current_log = |
- static_cast<MetricsLog*>(log_manager_.current_log()); |
- DCHECK(current_log); |
- current_log->RecordOmniboxOpenedURL( |
- *content::Details<OmniboxLog>(details).ptr()); |
- break; |
- } |
- |
- default: |
- NOTREACHED(); |
- break; |
- } |
- } |
- |
HandleIdleSinceLastTransmission(false); |
} |