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

Unified Diff: chrome/browser/ui/webui/foreign_session_handler.cc

Issue 1148203002: Fix crash when logging in with an open uber page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 500? Created 5 years, 7 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
Index: chrome/browser/ui/webui/foreign_session_handler.cc
diff --git a/chrome/browser/ui/webui/foreign_session_handler.cc b/chrome/browser/ui/webui/foreign_session_handler.cc
index ae6c4a82ef6b5f354179cf6550df38e25e84be9a..ddfd7fad7421a7dcc2c6661aa38548991e56f729 100644
--- a/chrome/browser/ui/webui/foreign_session_handler.cc
+++ b/chrome/browser/ui/webui/foreign_session_handler.cc
@@ -158,7 +158,16 @@ OpenTabsUIDelegate* ForeignSessionHandler::GetOpenTabsUIDelegate(
}
void ForeignSessionHandler::RegisterMessages() {
- Init();
Dan Beam 2015/05/20 18:40:02 only called one place
+ Profile* profile = Profile::FromWebUI(web_ui());
+ ProfileSyncService* service =
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile);
+ registrar_.Add(this, chrome::NOTIFICATION_SYNC_CONFIGURE_DONE,
+ content::Source<ProfileSyncService>(service));
+ registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED,
+ content::Source<Profile>(profile));
+ registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_DISABLED,
+ content::Source<Profile>(profile));
+
web_ui()->RegisterMessageCallback("deleteForeignSession",
base::Bind(&ForeignSessionHandler::HandleDeleteForeignSession,
base::Unretained(this)));
@@ -173,24 +182,10 @@ void ForeignSessionHandler::RegisterMessages() {
base::Unretained(this)));
}
-void ForeignSessionHandler::Init() {
- Profile* profile = Profile::FromWebUI(web_ui());
- ProfileSyncService* service =
- ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile);
- registrar_.Add(this, chrome::NOTIFICATION_SYNC_CONFIGURE_DONE,
- content::Source<ProfileSyncService>(service));
- registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED,
- content::Source<Profile>(profile));
- registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_DISABLED,
- content::Source<Profile>(profile));
-}
-
void ForeignSessionHandler::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- base::ListValue list_value;
Dan Beam 2015/05/20 18:40:02 not needed, declared too high. just axed.
-
switch (type) {
case chrome::NOTIFICATION_FOREIGN_SESSION_DISABLED:
// Tab sync is disabled, so clean up data about collapsed sessions.
@@ -199,14 +194,13 @@ void ForeignSessionHandler::Observe(
// Fall through.
case chrome::NOTIFICATION_SYNC_CONFIGURE_DONE:
case chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED:
- HandleGetForeignSessions(&list_value);
+ HandleGetForeignSessions(nullptr);
break;
default:
NOTREACHED();
}
}
-
bool ForeignSessionHandler::IsTabSyncEnabled() {
Profile* profile = Profile::FromWebUI(web_ui());
ProfileSyncService* service =
@@ -225,7 +219,7 @@ base::string16 ForeignSessionHandler::FormatSessionTime(
}
void ForeignSessionHandler::HandleGetForeignSessions(
- const base::ListValue* args) {
+ const base::ListValue* /*args*/) {
OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(web_ui());
std::vector<const SyncedSession*> sessions;
« chrome/browser/prefs/browser_prefs.cc ('K') | « chrome/browser/ui/webui/foreign_session_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698