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

Side by Side Diff: chrome/browser/sessions/chrome_tab_restore_service_client.cc

Issue 2468723003: Move session service and supervised users to buildflags. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/search/search_unittest.cc ('k') | chrome/browser/sessions/session_tab_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sessions/chrome_tab_restore_service_client.h" 5 #include "chrome/browser/sessions/chrome_tab_restore_service_client.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sessions/session_service.h" 9 #include "chrome/browser/sessions/session_service.h"
10 #include "chrome/browser/sessions/session_service_factory.h" 10 #include "chrome/browser/sessions/session_service_factory.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 base::FilePath ChromeTabRestoreServiceClient::GetPathToSaveTo() { 115 base::FilePath ChromeTabRestoreServiceClient::GetPathToSaveTo() {
116 return profile_->GetPath(); 116 return profile_->GetPath();
117 } 117 }
118 118
119 GURL ChromeTabRestoreServiceClient::GetNewTabURL() { 119 GURL ChromeTabRestoreServiceClient::GetNewTabURL() {
120 return GURL(chrome::kChromeUINewTabURL); 120 return GURL(chrome::kChromeUINewTabURL);
121 } 121 }
122 122
123 bool ChromeTabRestoreServiceClient::HasLastSession() { 123 bool ChromeTabRestoreServiceClient::HasLastSession() {
124 #if defined(ENABLE_SESSION_SERVICE) 124 #if BUILDFLAG(ENABLE_SESSION_SERVICE)
125 SessionService* session_service = 125 SessionService* session_service =
126 SessionServiceFactory::GetForProfile(profile_); 126 SessionServiceFactory::GetForProfile(profile_);
127 Profile::ExitType exit_type = profile_->GetLastSessionExitType(); 127 Profile::ExitType exit_type = profile_->GetLastSessionExitType();
128 // The previous session crashed and wasn't restored, or was a forced 128 // The previous session crashed and wasn't restored, or was a forced
129 // shutdown. Both of which won't have notified us of the browser close so 129 // shutdown. Both of which won't have notified us of the browser close so
130 // that we need to load the windows from session service (which will have 130 // that we need to load the windows from session service (which will have
131 // saved them). 131 // saved them).
132 return (!profile_->restored_last_session() && session_service && 132 return (!profile_->restored_last_session() && session_service &&
133 (exit_type == Profile::EXIT_CRASHED || 133 (exit_type == Profile::EXIT_CRASHED ||
134 exit_type == Profile::EXIT_SESSION_ENDED)); 134 exit_type == Profile::EXIT_SESSION_ENDED));
135 #else 135 #else
136 return false; 136 return false;
137 #endif 137 #endif
138 } 138 }
139 139
140 void ChromeTabRestoreServiceClient::GetLastSession( 140 void ChromeTabRestoreServiceClient::GetLastSession(
141 const sessions::GetLastSessionCallback& callback, 141 const sessions::GetLastSessionCallback& callback,
142 base::CancelableTaskTracker* tracker) { 142 base::CancelableTaskTracker* tracker) {
143 DCHECK(HasLastSession()); 143 DCHECK(HasLastSession());
144 #if defined(ENABLE_SESSION_SERVICE) 144 #if BUILDFLAG(ENABLE_SESSION_SERVICE)
145 SessionServiceFactory::GetForProfile(profile_) 145 SessionServiceFactory::GetForProfile(profile_)
146 ->GetLastSession(callback, tracker); 146 ->GetLastSession(callback, tracker);
147 #endif 147 #endif
148 } 148 }
149 149
150 void ChromeTabRestoreServiceClient::OnTabRestored(const GURL& url) { 150 void ChromeTabRestoreServiceClient::OnTabRestored(const GURL& url) {
151 RecordAppLaunch(profile_, url); 151 RecordAppLaunch(profile_, url);
152 } 152 }
OLDNEW
« no previous file with comments | « chrome/browser/search/search_unittest.cc ('k') | chrome/browser/sessions/session_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698