| 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/kiosk_app_update_service.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_app_update_service.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/app_mode/app_mode_utils.h" | 8 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 10 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
| 11 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 11 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 12 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h" | 12 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h" |
| 13 #include "chrome/browser/extensions/api/runtime/runtime_api.h" | |
| 14 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/lifetime/application_lifetime.h" | 14 #include "chrome/browser/lifetime/application_lifetime.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 17 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 16 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 17 #include "extensions/browser/api/runtime/runtime_api.h" |
| 18 #include "extensions/browser/extension_system.h" | 18 #include "extensions/browser/extension_system.h" |
| 19 #include "extensions/browser/extension_system_provider.h" | 19 #include "extensions/browser/extension_system_provider.h" |
| 20 #include "extensions/browser/extensions_browser_client.h" | 20 #include "extensions/browser/extensions_browser_client.h" |
| 21 #include "extensions/common/extension.h" | 21 #include "extensions/common/extension.h" |
| 22 | 22 |
| 23 namespace chromeos { | 23 namespace chromeos { |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 // How low to wait after an update is available before we force a restart. | 27 // How low to wait after an update is available before we force a restart. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 // Clears cached app data so that it will be reloaded if update from app | 76 // Clears cached app data so that it will be reloaded if update from app |
| 77 // does not finish in this run. | 77 // does not finish in this run. |
| 78 KioskAppManager::Get()->ClearAppData(app_id_); | 78 KioskAppManager::Get()->ClearAppData(app_id_); |
| 79 KioskAppManager::Get()->UpdateAppDataFromProfile( | 79 KioskAppManager::Get()->UpdateAppDataFromProfile( |
| 80 app_id_, profile_, extension); | 80 app_id_, profile_, extension); |
| 81 | 81 |
| 82 extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent( | 82 extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent( |
| 83 profile_, | 83 profile_, |
| 84 app_id_, | 84 app_id_, |
| 85 extensions::api::runtime::OnRestartRequired::REASON_APP_UPDATE); | 85 extensions::core_api::runtime::OnRestartRequired::REASON_APP_UPDATE); |
| 86 | 86 |
| 87 StartAppUpdateRestartTimer(); | 87 StartAppUpdateRestartTimer(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void KioskAppUpdateService::OnRebootScheduled(Reason reason) { | 90 void KioskAppUpdateService::OnRebootScheduled(Reason reason) { |
| 91 extensions::api::runtime::OnRestartRequired::Reason restart_reason = | 91 extensions::core_api::runtime::OnRestartRequired::Reason restart_reason = |
| 92 extensions::api::runtime::OnRestartRequired::REASON_NONE; | 92 extensions::core_api::runtime::OnRestartRequired::REASON_NONE; |
| 93 switch (reason) { | 93 switch (reason) { |
| 94 case REBOOT_REASON_OS_UPDATE: | 94 case REBOOT_REASON_OS_UPDATE: |
| 95 restart_reason = | 95 restart_reason = |
| 96 extensions::api::runtime::OnRestartRequired::REASON_OS_UPDATE; | 96 extensions::core_api::runtime::OnRestartRequired::REASON_OS_UPDATE; |
| 97 break; | 97 break; |
| 98 case REBOOT_REASON_PERIODIC: | 98 case REBOOT_REASON_PERIODIC: |
| 99 restart_reason = | 99 restart_reason = |
| 100 extensions::api::runtime::OnRestartRequired::REASON_PERIODIC; | 100 extensions::core_api::runtime::OnRestartRequired::REASON_PERIODIC; |
| 101 break; | 101 break; |
| 102 default: | 102 default: |
| 103 NOTREACHED() << "Unknown reboot reason=" << reason; | 103 NOTREACHED() << "Unknown reboot reason=" << reason; |
| 104 return; | 104 return; |
| 105 } | 105 } |
| 106 | 106 |
| 107 extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent( | 107 extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent( |
| 108 profile_, app_id_, restart_reason); | 108 profile_, app_id_, restart_reason); |
| 109 } | 109 } |
| 110 | 110 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 142 } |
| 143 | 143 |
| 144 KeyedService* KioskAppUpdateServiceFactory::BuildServiceInstanceFor( | 144 KeyedService* KioskAppUpdateServiceFactory::BuildServiceInstanceFor( |
| 145 content::BrowserContext* context) const { | 145 content::BrowserContext* context) const { |
| 146 return new KioskAppUpdateService( | 146 return new KioskAppUpdateService( |
| 147 Profile::FromBrowserContext(context), | 147 Profile::FromBrowserContext(context), |
| 148 g_browser_process->platform_part()->automatic_reboot_manager()); | 148 g_browser_process->platform_part()->automatic_reboot_manager()); |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace chromeos | 151 } // namespace chromeos |
| OLD | NEW |