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

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: 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..5fac95a7c74461ab5d984cfe8b05be3572f77f29 100644
--- a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc
+++ b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
#include "chrome/common/chrome_notification_types.h"
+#include "content/browser/tab_contents/tab_contents.h"
#include "content/common/notification_details.h"
#include "content/common/notification_service.h"
#include "chrome/common/url_constants.h"
@@ -71,19 +72,21 @@ void ForeignSessionHandler::Observe(int type,
}
SessionModelAssociator* ForeignSessionHandler::GetModelAssociator() {
- ProfileSyncService* service = web_ui_->GetProfile()->GetProfileSyncService();
+ Profile* profile =
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
+ ProfileSyncService* service = profile->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 +167,8 @@ void ForeignSessionHandler::HandleOpenForeignSession(
SessionModelAssociator* associator = GetModelAssociator();
+ Profile* profile =
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
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 +177,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 +191,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);
}
}

Powered by Google App Engine
This is Rietveld 408576698