diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-13 15:40:09 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-13 15:40:09 +0000 |
commit | 534e54bfc89ebbdbb345c3b643dc20b2643f1fee (patch) | |
tree | 5fcb98f948baf24f15b7c4c136a71df6b85cc1bc /chrome/browser/metrics_service.cc | |
parent | 8988699d12335b2830dbc4e167244bc0244c97cd (diff) | |
download | chromium_src-534e54bfc89ebbdbb345c3b643dc20b2643f1fee.zip chromium_src-534e54bfc89ebbdbb345c3b643dc20b2643f1fee.tar.gz chromium_src-534e54bfc89ebbdbb345c3b643dc20b2643f1fee.tar.bz2 |
First, this removes the dependency of NavigationController on the
SessionService. There were already some notifications that could be used to
tell what's going on, and I filled out the rest. I moved some notifications from
various places to the NavigationController.
In ssl_blocking_page, I removed a notification because it also calls
DidNavigateToEntry which does the notification (we got duplicate calls before).
In browser.cc I removed the tab parented notification since this is already
called by NavigationController::SetWindowID.
I removed some obsolete notifications and associated structures, especially in
history (like HOST_DELETED that was never issued).
I renamed the window_map_ in the MetricsService becuase it was actually a map
of controllers and Windows.
This also reorders the navigation_types header file to try to bring some order
to it.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@807 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/metrics_service.cc')
-rw-r--r-- | chrome/browser/metrics_service.cc | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/chrome/browser/metrics_service.cc b/chrome/browser/metrics_service.cc index 85690a8..524b4eb 100644 --- a/chrome/browser/metrics_service.cc +++ b/chrome/browser/metrics_service.cc @@ -429,7 +429,7 @@ void MetricsService::Observe(NotificationType type, LogWindowChange(type, source, details); break; - case NOTIFY_TAB_APPENDED: + case NOTIFY_TAB_PARENTED: case NOTIFY_TAB_CLOSING: LogWindowChange(type, source, details); break; @@ -678,7 +678,7 @@ void MetricsService::ListenerRegistration(bool start_listening) { AddOrRemoveObserver(this, NOTIFY_BROWSER_OPENED, start_listening); AddOrRemoveObserver(this, NOTIFY_BROWSER_CLOSED, start_listening); AddOrRemoveObserver(this, NOTIFY_USER_ACTION, start_listening); - AddOrRemoveObserver(this, NOTIFY_TAB_APPENDED, start_listening); + AddOrRemoveObserver(this, NOTIFY_TAB_PARENTED, start_listening); AddOrRemoveObserver(this, NOTIFY_TAB_CLOSING, start_listening); AddOrRemoveObserver(this, NOTIFY_LOAD_START, start_listening); AddOrRemoveObserver(this, NOTIFY_LOAD_STOP, start_listening); @@ -1176,36 +1176,30 @@ void MetricsService::GetSettingsFromConfigNode(xmlNodePtr config_node) { void MetricsService::LogWindowChange(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - int window_id = -1; - int parent_id = -1; - uintptr_t window_key = source.map_key(); + int controller_id = -1; + uintptr_t window_or_tab = source.map_key(); MetricsLog::WindowEventType window_type; // Note: since we stop all logging when a single OTR session is active, it is // possible that we start getting notifications about a window that we don't // know about. - if (window_map_.find(window_key) == window_map_.end()) { - window_id = next_window_id_++; - window_map_[window_key] = window_id; + if (window_map_.find(window_or_tab) == window_map_.end()) { + controller_id = next_window_id_++; + window_map_[window_or_tab] = controller_id; } else { - window_id = window_map_[window_key]; - } - - DCHECK(window_id != -1); - - if (type == NOTIFY_TAB_APPENDED) { - parent_id = window_map_[details.map_key()]; + controller_id = window_map_[window_or_tab]; } + DCHECK(controller_id != -1); switch (type) { - case NOTIFY_TAB_APPENDED: + case NOTIFY_TAB_PARENTED: case NOTIFY_BROWSER_OPENED: window_type = MetricsLog::WINDOW_CREATE; break; case NOTIFY_TAB_CLOSING: case NOTIFY_BROWSER_CLOSED: - window_map_.erase(window_map_.find(window_key)); + window_map_.erase(window_map_.find(window_or_tab)); window_type = MetricsLog::WINDOW_DESTROY; break; @@ -1214,7 +1208,8 @@ void MetricsService::LogWindowChange(NotificationType type, break; } - current_log_->RecordWindowEvent(window_type, window_id, parent_id); + // TODO(brettw) we should have some kind of ID for the parent. + current_log_->RecordWindowEvent(window_type, controller_id, 0); } void MetricsService::LogLoadComplete(NotificationType type, @@ -1224,10 +1219,8 @@ void MetricsService::LogLoadComplete(NotificationType type, return; const Details<LoadNotificationDetails> load_details(details); - - int window_id = - window_map_[reinterpret_cast<uintptr_t>(load_details->controller())]; - current_log_->RecordLoadEvent(window_id, + int controller_id = window_map_[details.map_key()]; + current_log_->RecordLoadEvent(controller_id, load_details->url(), load_details->origin(), load_details->session_index(), |