OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |