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" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 // Clears cached app data so that it will be reloaded if update from app | 93 // Clears cached app data so that it will be reloaded if update from app |
94 // does not finish in this run. | 94 // does not finish in this run. |
95 KioskAppManager::Get()->ClearAppData(app_id_); | 95 KioskAppManager::Get()->ClearAppData(app_id_); |
96 KioskAppManager::Get()->UpdateAppDataFromProfile( | 96 KioskAppManager::Get()->UpdateAppDataFromProfile( |
97 app_id_, profile_, extension); | 97 app_id_, profile_, extension); |
98 | 98 |
99 extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent( | 99 extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent( |
100 profile_, | 100 profile_, |
101 app_id_, | 101 app_id_, |
102 extensions::core_api::runtime::OnRestartRequired::REASON_APP_UPDATE); | 102 extensions::core_api::runtime::ON_RESTART_REQUIRED_REASON_APP_UPDATE); |
103 | 103 |
104 StartAppUpdateRestartTimer(); | 104 StartAppUpdateRestartTimer(); |
105 } | 105 } |
106 | 106 |
107 void KioskAppUpdateService::OnRebootRequested(Reason reason) { | 107 void KioskAppUpdateService::OnRebootRequested(Reason reason) { |
108 extensions::core_api::runtime::OnRestartRequired::Reason restart_reason = | 108 extensions::core_api::runtime::OnRestartRequiredReason restart_reason = |
109 extensions::core_api::runtime::OnRestartRequired::REASON_NONE; | 109 extensions::core_api::runtime::ON_RESTART_REQUIRED_REASON_NONE; |
110 switch (reason) { | 110 switch (reason) { |
111 case REBOOT_REASON_OS_UPDATE: | 111 case REBOOT_REASON_OS_UPDATE: |
112 restart_reason = | 112 restart_reason = |
113 extensions::core_api::runtime::OnRestartRequired::REASON_OS_UPDATE; | 113 extensions::core_api::runtime::ON_RESTART_REQUIRED_REASON_OS_UPDATE; |
114 break; | 114 break; |
115 case REBOOT_REASON_PERIODIC: | 115 case REBOOT_REASON_PERIODIC: |
116 restart_reason = | 116 restart_reason = |
117 extensions::core_api::runtime::OnRestartRequired::REASON_PERIODIC; | 117 extensions::core_api::runtime::ON_RESTART_REQUIRED_REASON_PERIODIC; |
118 break; | 118 break; |
119 default: | 119 default: |
120 NOTREACHED() << "Unknown reboot reason=" << reason; | 120 NOTREACHED() << "Unknown reboot reason=" << reason; |
121 return; | 121 return; |
122 } | 122 } |
123 | 123 |
124 extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent( | 124 extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent( |
125 profile_, app_id_, restart_reason); | 125 profile_, app_id_, restart_reason); |
126 } | 126 } |
127 | 127 |
128 void KioskAppUpdateService::WillDestroyAutomaticRebootManager() { | 128 void KioskAppUpdateService::WillDestroyAutomaticRebootManager() { |
129 automatic_reboot_manager_->RemoveObserver(this); | 129 automatic_reboot_manager_->RemoveObserver(this); |
130 automatic_reboot_manager_ = NULL; | 130 automatic_reboot_manager_ = NULL; |
131 } | 131 } |
132 | 132 |
133 void KioskAppUpdateService::OnKioskAppCacheUpdated(const std::string& app_id) { | 133 void KioskAppUpdateService::OnKioskAppCacheUpdated(const std::string& app_id) { |
134 if (app_id != app_id_) | 134 if (app_id != app_id_) |
135 return; | 135 return; |
136 | 136 |
137 extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent( | 137 extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent( |
138 profile_, | 138 profile_, |
139 app_id_, | 139 app_id_, |
140 extensions::core_api::runtime::OnRestartRequired::REASON_APP_UPDATE); | 140 extensions::core_api::runtime::ON_RESTART_REQUIRED_REASON_APP_UPDATE); |
141 | 141 |
142 StartAppUpdateRestartTimer(); | 142 StartAppUpdateRestartTimer(); |
143 } | 143 } |
144 | 144 |
145 KioskAppUpdateServiceFactory::KioskAppUpdateServiceFactory() | 145 KioskAppUpdateServiceFactory::KioskAppUpdateServiceFactory() |
146 : BrowserContextKeyedServiceFactory( | 146 : BrowserContextKeyedServiceFactory( |
147 "KioskAppUpdateService", | 147 "KioskAppUpdateService", |
148 BrowserContextDependencyManager::GetInstance()) { | 148 BrowserContextDependencyManager::GetInstance()) { |
149 DependsOn( | 149 DependsOn( |
150 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); | 150 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
(...skipping 20 matching lines...) Expand all Loading... |
171 } | 171 } |
172 | 172 |
173 KeyedService* KioskAppUpdateServiceFactory::BuildServiceInstanceFor( | 173 KeyedService* KioskAppUpdateServiceFactory::BuildServiceInstanceFor( |
174 content::BrowserContext* context) const { | 174 content::BrowserContext* context) const { |
175 return new KioskAppUpdateService( | 175 return new KioskAppUpdateService( |
176 Profile::FromBrowserContext(context), | 176 Profile::FromBrowserContext(context), |
177 g_browser_process->platform_part()->automatic_reboot_manager()); | 177 g_browser_process->platform_part()->automatic_reboot_manager()); |
178 } | 178 } |
179 | 179 |
180 } // namespace chromeos | 180 } // namespace chromeos |
OLD | NEW |