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

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

Issue 7554008: Removal of Profile from content part 6. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Profile helper function, rebase Created 9 years, 4 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/ntp/foreign_session_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc
index 2fdb70e88496ca5634f11b6f9a8c1a330e84536e..e0e968b182eee3771ef4a65c93fcfdc2a0385aa8 100644
--- a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc
+++ b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc
@@ -71,19 +71,20 @@ void ForeignSessionHandler::Observe(int type,
}
SessionModelAssociator* ForeignSessionHandler::GetModelAssociator() {
- ProfileSyncService* service = web_ui_->GetProfile()->GetProfileSyncService();
+ ProfileSyncService* service =
+ Profile::FromWebUI(web_ui_)->GetProfileSyncService();
if (service == NULL)
return NULL;
+
// We only want to set the model associator if there is one, and it is done
// syncing sessions.
- SessionModelAssociator* model_associator = service->
- GetSessionModelAssociator();
+ SessionModelAssociator* model_associator =
+ service->GetSessionModelAssociator();
if (model_associator == NULL ||
!service->ShouldPushChanges()) {
return NULL;
}
- return web_ui_->GetProfile()->GetProfileSyncService()->
- GetSessionModelAssociator();
+ return model_associator;
}
void ForeignSessionHandler::HandleGetForeignSessions(const ListValue* args) {
@@ -164,6 +165,7 @@ void ForeignSessionHandler::HandleOpenForeignSession(
SessionModelAssociator* associator = GetModelAssociator();
+ Profile* profile = Profile::FromWebUI(web_ui_);
if (tab_id != kInvalidId) {
// We don't actually care about |window_num|, this is just a sanity check.
DCHECK_LT(kInvalidId, window_num);
@@ -172,7 +174,7 @@ void ForeignSessionHandler::HandleOpenForeignSession(
LOG(ERROR) << "Failed to load foreign tab.";
return;
}
- SessionRestore::RestoreForeignSessionTab(web_ui_->GetProfile(), *tab);
+ SessionRestore::RestoreForeignSessionTab(profile, *tab);
} else {
std::vector<SessionWindow*> windows;
// Note: we don't own the ForeignSessions themselves.
@@ -186,10 +188,8 @@ void ForeignSessionHandler::HandleOpenForeignSession(
std::vector<SessionWindow*>::const_iterator iter_end =
((window_num == kInvalidId) ?
std::vector<SessionWindow*>::const_iterator(windows.end()) :
- iter_begin+1);
- SessionRestore::RestoreForeignSessionWindows(web_ui_->GetProfile(),
- iter_begin,
- iter_end);
+ iter_begin + 1);
+ SessionRestore::RestoreForeignSessionWindows(profile, iter_begin, iter_end);
}
}
« no previous file with comments | « chrome/browser/ui/webui/ntp/favicon_webui_handler.cc ('k') | chrome/browser/ui/webui/ntp/most_visited_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698