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

Unified Diff: chrome/browser/ui/browser_init.cc

Issue 6901031: Profile shouldn't own Session/TabRestore services. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again and hope upload works this time Created 9 years, 8 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/ui/browser.cc ('k') | chrome/browser/ui/cocoa/history_menu_bridge.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_init.cc
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc
index d9d657fc44e6a751370e48782867f23bc94c5717..133c6f885fcda3d5bd28470e50aa82e822585494 100644
--- a/chrome/browser/ui/browser_init.cc
+++ b/chrome/browser/ui/browser_init.cc
@@ -40,6 +40,7 @@
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/sessions/session_restore.h"
#include "chrome/browser/sessions/session_service.h"
+#include "chrome/browser/sessions/session_service_factory.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
#include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h"
@@ -854,13 +855,15 @@ void BrowserInit::LaunchWithProfile::ProcessLaunchURLs(
return;
}
- if (!process_startup &&
- (profile_->GetSessionService() &&
- profile_->GetSessionService()->RestoreIfNecessary(urls_to_open))) {
- // We're already running and session restore wanted to run. This can happen
- // at various points, such as if there is only an app window running and the
- // user double clicked the chrome icon. Return so we don't open the urls.
- return;
+ if (!process_startup) {
+ SessionService* service = SessionServiceFactory::GetForProfile(profile_);
+ if (service && service->RestoreIfNecessary(urls_to_open)) {
+ // We're already running and session restore wanted to run. This can
+ // happen at various points, such as if there is only an app window
+ // running and the user double clicked the chrome icon. Return so we don't
+ // open the urls.
+ return;
+ }
}
// Session restore didn't occur, open the urls.
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/cocoa/history_menu_bridge.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698