Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Unified Diff: chrome/browser/sessions/session_service.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sessions/session_service.h ('k') | chrome/browser/sessions/session_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/session_service.cc
===================================================================
--- chrome/browser/sessions/session_service.cc (revision 91968)
+++ chrome/browser/sessions/session_service.cc (working copy)
@@ -28,6 +28,7 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
#include "content/browser/tab_contents/navigation_details.h"
#include "content/browser/tab_contents/navigation_entry.h"
@@ -445,10 +446,11 @@
bool had_commands = !pending_commands().empty();
BaseSessionService::Save();
if (had_commands) {
- RecordSessionUpdateHistogramData(NotificationType::SESSION_SERVICE_SAVED,
+ RecordSessionUpdateHistogramData(
+ chrome::NOTIFICATION_SESSION_SERVICE_SAVED,
&last_updated_save_time_);
NotificationService::current()->Notify(
- NotificationType::SESSION_SERVICE_SAVED,
+ chrome::NOTIFICATION_SESSION_SERVICE_SAVED,
Source<Profile>(profile()),
NotificationService::NoDetails());
}
@@ -456,21 +458,21 @@
void SessionService::Init() {
// Register for the notifications we're interested in.
- registrar_.Add(this, NotificationType::TAB_PARENTED,
+ registrar_.Add(this, content::NOTIFICATION_TAB_PARENTED,
NotificationService::AllSources());
- registrar_.Add(this, NotificationType::TAB_CLOSED,
+ registrar_.Add(this, content::NOTIFICATION_TAB_CLOSED,
NotificationService::AllSources());
- registrar_.Add(this, NotificationType::NAV_LIST_PRUNED,
+ registrar_.Add(this, content::NOTIFICATION_NAV_LIST_PRUNED,
NotificationService::AllSources());
- registrar_.Add(this, NotificationType::NAV_ENTRY_CHANGED,
+ registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_CHANGED,
NotificationService::AllSources());
- registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED,
+ registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
NotificationService::AllSources());
- registrar_.Add(this, NotificationType::BROWSER_OPENED,
+ registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
NotificationService::AllSources());
- registrar_.Add(this,
- NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED,
- NotificationService::AllSources());
+ registrar_.Add(
+ this, chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED,
+ NotificationService::AllSources());
}
bool SessionService::RestoreIfNecessary(const std::vector<GURL>& urls_to_open,
@@ -503,12 +505,12 @@
return false;
}
-void SessionService::Observe(NotificationType type,
+void SessionService::Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) {
// All of our messages have the NavigationController as the source.
- switch (type.value) {
- case NotificationType::BROWSER_OPENED: {
+ switch (type) {
+ case chrome::NOTIFICATION_BROWSER_OPENED: {
Browser* browser = Source<Browser>(source).ptr();
if (browser->profile() != profile() ||
!should_track_changes_for_browser_type(browser->type())) {
@@ -520,7 +522,7 @@
break;
}
- case NotificationType::TAB_PARENTED: {
+ case content::NOTIFICATION_TAB_PARENTED: {
TabContentsWrapper* tab = Source<TabContentsWrapper>(source).ptr();
SetTabWindow(tab->restore_tab_helper()->window_id(),
tab->restore_tab_helper()->session_id());
@@ -533,7 +535,7 @@
break;
}
- case NotificationType::TAB_CLOSED: {
+ case content::NOTIFICATION_TAB_CLOSED: {
TabContentsWrapper* tab =
TabContentsWrapper::GetCurrentWrapperForContents(
Source<NavigationController>(source).ptr()->tab_contents());
@@ -542,12 +544,12 @@
TabClosed(tab->restore_tab_helper()->window_id(),
tab->restore_tab_helper()->session_id(),
tab->tab_contents()->closed_by_user_gesture());
- RecordSessionUpdateHistogramData(NotificationType::TAB_CLOSED,
+ RecordSessionUpdateHistogramData(content::NOTIFICATION_TAB_CLOSED,
&last_updated_tab_closed_time_);
break;
}
- case NotificationType::NAV_LIST_PRUNED: {
+ case content::NOTIFICATION_NAV_LIST_PRUNED: {
TabContentsWrapper* tab =
TabContentsWrapper::GetCurrentWrapperForContents(
Source<NavigationController>(source).ptr()->tab_contents());
@@ -565,12 +567,12 @@
tab->restore_tab_helper()->session_id(),
tab->controller().entry_count());
}
- RecordSessionUpdateHistogramData(NotificationType::NAV_LIST_PRUNED,
+ RecordSessionUpdateHistogramData(content::NOTIFICATION_NAV_LIST_PRUNED,
&last_updated_nav_list_pruned_time_);
break;
}
- case NotificationType::NAV_ENTRY_CHANGED: {
+ case content::NOTIFICATION_NAV_ENTRY_CHANGED: {
TabContentsWrapper* tab =
TabContentsWrapper::GetCurrentWrapperForContents(
Source<NavigationController>(source).ptr()->tab_contents());
@@ -584,7 +586,7 @@
break;
}
- case NotificationType::NAV_ENTRY_COMMITTED: {
+ case content::NOTIFICATION_NAV_ENTRY_COMMITTED: {
TabContentsWrapper* tab =
TabContentsWrapper::GetCurrentWrapperForContents(
Source<NavigationController>(source).ptr()->tab_contents());
@@ -602,13 +604,14 @@
Details<content::LoadCommittedDetails> changed(details);
if (changed->type == NavigationType::NEW_PAGE ||
changed->type == NavigationType::EXISTING_PAGE) {
- RecordSessionUpdateHistogramData(NotificationType::NAV_ENTRY_COMMITTED,
+ RecordSessionUpdateHistogramData(
+ content::NOTIFICATION_NAV_ENTRY_COMMITTED,
&last_updated_nav_entry_commit_time_);
}
break;
}
- case NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED: {
+ case chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED: {
ExtensionTabHelper* extension_tab_helper =
Source<ExtensionTabHelper>(source).ptr();
if (extension_tab_helper->extension_app()) {
@@ -1351,7 +1354,7 @@
}
}
-void SessionService::RecordSessionUpdateHistogramData(NotificationType type,
+void SessionService::RecordSessionUpdateHistogramData(int type,
base::TimeTicks* last_updated_time) {
if (!last_updated_time->is_null()) {
base::TimeDelta delta = base::TimeTicks::Now() - *last_updated_time;
@@ -1361,20 +1364,20 @@
if (delta >= save_delay_in_mins_) {
use_long_period = true;
}
- switch (type.value) {
- case NotificationType::SESSION_SERVICE_SAVED :
+ switch (type) {
+ case chrome::NOTIFICATION_SESSION_SERVICE_SAVED :
RecordUpdatedSaveTime(delta, use_long_period);
RecordUpdatedSessionNavigationOrTab(delta, use_long_period);
break;
- case NotificationType::TAB_CLOSED:
+ case content::NOTIFICATION_TAB_CLOSED:
RecordUpdatedTabClosed(delta, use_long_period);
RecordUpdatedSessionNavigationOrTab(delta, use_long_period);
break;
- case NotificationType::NAV_LIST_PRUNED:
+ case content::NOTIFICATION_NAV_LIST_PRUNED:
RecordUpdatedNavListPruned(delta, use_long_period);
RecordUpdatedSessionNavigationOrTab(delta, use_long_period);
break;
- case NotificationType::NAV_ENTRY_COMMITTED:
+ case content::NOTIFICATION_NAV_ENTRY_COMMITTED:
RecordUpdatedNavEntryCommit(delta, use_long_period);
RecordUpdatedSessionNavigationOrTab(delta, use_long_period);
break;
« no previous file with comments | « chrome/browser/sessions/session_service.h ('k') | chrome/browser/sessions/session_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698