Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 ->RemoveObserver(this); | 89 ->RemoveObserver(this); |
| 90 extensions::InstallTrackerFactory::GetForBrowserContext(profile_) | 90 extensions::InstallTrackerFactory::GetForBrowserContext(profile_) |
| 91 ->RemoveObserver(this); | 91 ->RemoveObserver(this); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void StartupAppLauncher::Initialize() { | 94 void StartupAppLauncher::Initialize() { |
| 95 StartLoadingOAuthFile(); | 95 StartLoadingOAuthFile(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void StartupAppLauncher::ContinueWithNetworkReady() { | 98 void StartupAppLauncher::ContinueWithNetworkReady() { |
| 99 if (!network_ready_handled_) { | 99 if (network_ready_handled_) |
| 100 network_ready_handled_ = true; | 100 return; |
| 101 // The network might not be ready when KioskAppManager tries to update | 101 |
| 102 // external cache initially. Update the external cache now that the network | 102 network_ready_handled_ = true; |
| 103 // is ready for sure. | 103 |
| 104 wait_for_crx_update_ = true; | 104 if (!delegate_->ShouldUpdateCacheOnNetworkReady()) { |
| 105 KioskAppManager::Get()->UpdateExternalCache(); | 105 BeginInstall(); |
|
xiyuan
2017/01/30 23:13:06
Should we skip all installation stuff and jump to
tbarzic
2017/01/30 23:45:21
I'm slightly concerned that in certain situations
xiyuan
2017/01/30 23:49:44
Good point. BeginInstall() it is then.
tbarzic
2017/01/30 23:55:02
Actually, we should only end up in that state if t
xiyuan
2017/01/30 23:59:48
SG.
| |
| 106 return; | |
| 106 } | 107 } |
| 108 | |
| 109 // The network might not be ready when KioskAppManager tries to update | |
| 110 // external cache initially. Update the external cache now that the network | |
| 111 // is ready for sure. | |
| 112 wait_for_crx_update_ = true; | |
| 113 KioskAppManager::Get()->UpdateExternalCache(); | |
| 107 } | 114 } |
| 108 | 115 |
| 109 void StartupAppLauncher::StartLoadingOAuthFile() { | 116 void StartupAppLauncher::StartLoadingOAuthFile() { |
| 110 delegate_->OnLoadingOAuthFile(); | 117 delegate_->OnLoadingOAuthFile(); |
| 111 | 118 |
| 112 KioskOAuthParams* auth_params = new KioskOAuthParams(); | 119 KioskOAuthParams* auth_params = new KioskOAuthParams(); |
| 113 BrowserThread::PostBlockingPoolTaskAndReply( | 120 BrowserThread::PostBlockingPoolTaskAndReply( |
| 114 FROM_HERE, | 121 FROM_HERE, |
| 115 base::Bind(&StartupAppLauncher::LoadOAuthFileOnBlockingPool, | 122 base::Bind(&StartupAppLauncher::LoadOAuthFileOnBlockingPool, |
| 116 auth_params), | 123 auth_params), |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 } | 271 } |
| 265 OnLaunchFailure(KioskAppLaunchError::UNABLE_TO_LAUNCH); | 272 OnLaunchFailure(KioskAppLaunchError::UNABLE_TO_LAUNCH); |
| 266 } | 273 } |
| 267 } | 274 } |
| 268 | 275 |
| 269 void StartupAppLauncher::MaybeCheckExtensionUpdate() { | 276 void StartupAppLauncher::MaybeCheckExtensionUpdate() { |
| 270 extensions::ExtensionUpdater* updater = | 277 extensions::ExtensionUpdater* updater = |
| 271 extensions::ExtensionSystem::Get(profile_) | 278 extensions::ExtensionSystem::Get(profile_) |
| 272 ->extension_service() | 279 ->extension_service() |
| 273 ->updater(); | 280 ->updater(); |
| 274 if (!delegate_->IsNetworkReady() || !updater || | 281 if (!delegate_->IsNetworkReady() || |
| 282 !delegate_->ShouldUpdateCacheOnNetworkReady() || !updater || | |
| 275 PrimaryAppHasPendingUpdate()) { | 283 PrimaryAppHasPendingUpdate()) { |
| 276 MaybeLaunchApp(); | 284 MaybeLaunchApp(); |
| 277 return; | 285 return; |
| 278 } | 286 } |
| 279 | 287 |
| 280 extension_update_found_ = false; | 288 extension_update_found_ = false; |
| 281 registrar_.Add(this, extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND, | 289 registrar_.Add(this, extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND, |
| 282 content::NotificationService::AllSources()); | 290 content::NotificationService::AllSources()); |
| 283 | 291 |
| 284 // Enforce an immediate version update check for all extensions before | 292 // Enforce an immediate version update check for all extensions before |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 557 // Skip copying meta data from the current installed primary app when | 565 // Skip copying meta data from the current installed primary app when |
| 558 // there is a pending update. | 566 // there is a pending update. |
| 559 if (PrimaryAppHasPendingUpdate()) | 567 if (PrimaryAppHasPendingUpdate()) |
| 560 return; | 568 return; |
| 561 | 569 |
| 562 KioskAppManager::Get()->ClearAppData(app_id_); | 570 KioskAppManager::Get()->ClearAppData(app_id_); |
| 563 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); | 571 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); |
| 564 } | 572 } |
| 565 | 573 |
| 566 } // namespace chromeos | 574 } // namespace chromeos |
| OLD | NEW |