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

Side by Side Diff: chrome/browser/chromeos/app_mode/startup_app_launcher.cc

Issue 43203002: Remove hacks added to workaround a system salt issue for M31 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/settings/device_oauth2_token_service.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/app_mode/startup_app_launcher.h" 5 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/json/json_file_value_serializer.h" 9 #include "base/json/json_file_value_serializer.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 OnLaunchSuccess(); 243 OnLaunchSuccess();
244 } 244 }
245 245
246 void StartupAppLauncher::BeginInstall() { 246 void StartupAppLauncher::BeginInstall() {
247 FOR_EACH_OBSERVER(Observer, observer_list_, OnInstallingApp()); 247 FOR_EACH_OBSERVER(Observer, observer_list_, OnInstallingApp());
248 248
249 DVLOG(1) << "BeginInstall... connection = " 249 DVLOG(1) << "BeginInstall... connection = "
250 << net::NetworkChangeNotifier::GetConnectionType(); 250 << net::NetworkChangeNotifier::GetConnectionType();
251 251
252 if (IsAppInstalled(profile_, app_id_)) { 252 if (IsAppInstalled(profile_, app_id_)) {
253 EnsureSystemSaltIsLoaded(); 253 OnReadyToLaunch();
254 return; 254 return;
255 } 255 }
256 256
257 installer_ = new WebstoreStartupInstaller( 257 installer_ = new WebstoreStartupInstaller(
258 app_id_, 258 app_id_,
259 profile_, 259 profile_,
260 false, 260 false,
261 base::Bind(&StartupAppLauncher::InstallCallback, AsWeakPtr())); 261 base::Bind(&StartupAppLauncher::InstallCallback, AsWeakPtr()));
262 installer_->BeginInstall(); 262 installer_->BeginInstall();
263 } 263 }
264 264
265 void StartupAppLauncher::InstallCallback(bool success, 265 void StartupAppLauncher::InstallCallback(bool success,
266 const std::string& error) { 266 const std::string& error) {
267 installer_ = NULL; 267 installer_ = NULL;
268 if (success) { 268 if (success) {
269 // Finish initialization after the callback returns. 269 // Finish initialization after the callback returns.
270 // So that the app finishes its installation. 270 // So that the app finishes its installation.
271 BrowserThread::PostTask( 271 BrowserThread::PostTask(
272 BrowserThread::UI, 272 BrowserThread::UI,
273 FROM_HERE, 273 FROM_HERE,
274 base::Bind(&StartupAppLauncher::EnsureSystemSaltIsLoaded, 274 base::Bind(&StartupAppLauncher::OnReadyToLaunch,
275 AsWeakPtr())); 275 AsWeakPtr()));
276 return; 276 return;
277 } 277 }
278 278
279 LOG(ERROR) << "App install failed: " << error; 279 LOG(ERROR) << "App install failed: " << error;
280 OnLaunchFailure(KioskAppLaunchError::UNABLE_TO_INSTALL); 280 OnLaunchFailure(KioskAppLaunchError::UNABLE_TO_INSTALL);
281 } 281 }
282 282
283 void StartupAppLauncher::EnsureSystemSaltIsLoaded() {
284 // Defer app launch until system salt is loaded to make sure that identity
285 // api works with the enterprise kiosk app.
286 SystemSaltGetter::Get()->GetSystemSalt(
287 base::Bind(&StartupAppLauncher::OnReadyToLaunch, AsWeakPtr()));
288 }
289
290 void StartupAppLauncher::OnReadyToLaunch(const std::string& system_salt) { 283 void StartupAppLauncher::OnReadyToLaunch(const std::string& system_salt) {
hashimoto 2013/10/25 05:08:01 This argument should be removed.
satorux1 2013/10/25 05:11:21 oops. too early to upload. fixed.
291 if (system_salt.empty()) { 284 if (system_salt.empty()) {
292 LOG(ERROR) << "Could not load system salt."; 285 LOG(ERROR) << "Could not load system salt.";
293 OnLaunchFailure(KioskAppLaunchError::CRYPTOHOMED_NOT_RUNNING); 286 OnLaunchFailure(KioskAppLaunchError::CRYPTOHOMED_NOT_RUNNING);
294 return; 287 return;
295 } 288 }
296 289
297 ready_to_launch_ = true; 290 ready_to_launch_ = true;
298 FOR_EACH_OBSERVER(Observer, observer_list_, OnReadyToLaunch()); 291 FOR_EACH_OBSERVER(Observer, observer_list_, OnReadyToLaunch());
299 } 292 }
300 293
301 void StartupAppLauncher::OnNetworkChanged( 294 void StartupAppLauncher::OnNetworkChanged(
302 net::NetworkChangeNotifier::ConnectionType type) { 295 net::NetworkChangeNotifier::ConnectionType type) {
303 DVLOG(1) << "OnNetworkChanged... connection = " 296 DVLOG(1) << "OnNetworkChanged... connection = "
304 << net::NetworkChangeNotifier::GetConnectionType(); 297 << net::NetworkChangeNotifier::GetConnectionType();
305 if (!net::NetworkChangeNotifier::IsOffline()) { 298 if (!net::NetworkChangeNotifier::IsOffline()) {
306 DVLOG(1) << "Network up and running!"; 299 DVLOG(1) << "Network up and running!";
307 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); 300 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
308 301
309 BeginInstall(); 302 BeginInstall();
310 } else { 303 } else {
311 DVLOG(1) << "Network not running yet!"; 304 DVLOG(1) << "Network not running yet!";
312 } 305 }
313 } 306 }
314 307
315 } // namespace chromeos 308 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/settings/device_oauth2_token_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698