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/system/automatic_reboot_manager.h" | 12 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h" |
12 #include "chrome/browser/extensions/api/runtime/runtime_api.h" | 13 #include "chrome/browser/extensions/api/runtime/runtime_api.h" |
13 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
14 #include "chrome/browser/extensions/extension_system.h" | 15 #include "chrome/browser/extensions/extension_system.h" |
15 #include "chrome/browser/extensions/extension_system_factory.h" | 16 #include "chrome/browser/extensions/extension_system_factory.h" |
16 #include "chrome/browser/lifetime/application_lifetime.h" | 17 #include "chrome/browser/lifetime/application_lifetime.h" |
17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
18 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 19 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
19 #include "extensions/common/extension.h" | 20 #include "extensions/common/extension.h" |
20 | 21 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 ExtensionService* service = profile_->GetExtensionService(); | 65 ExtensionService* service = profile_->GetExtensionService(); |
65 if (service) | 66 if (service) |
66 service->RemoveUpdateObserver(this); | 67 service->RemoveUpdateObserver(this); |
67 } | 68 } |
68 | 69 |
69 void KioskAppUpdateService::OnAppUpdateAvailable( | 70 void KioskAppUpdateService::OnAppUpdateAvailable( |
70 const extensions::Extension* extension) { | 71 const extensions::Extension* extension) { |
71 if (extension->id() != app_id_) | 72 if (extension->id() != app_id_) |
72 return; | 73 return; |
73 | 74 |
| 75 // Clears cached app data so that it will be reloaded if update from app |
| 76 // does not finish in this run. |
| 77 KioskAppManager::Get()->ClearAppData(app_id_); |
| 78 KioskAppManager::Get()->UpdateAppDataFromProfile( |
| 79 app_id_, profile_, extension); |
| 80 |
74 extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent( | 81 extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent( |
75 profile_, | 82 profile_, |
76 app_id_, | 83 app_id_, |
77 extensions::api::runtime::OnRestartRequired::REASON_APP_UPDATE); | 84 extensions::api::runtime::OnRestartRequired::REASON_APP_UPDATE); |
78 | 85 |
79 StartAppUpdateRestartTimer(); | 86 StartAppUpdateRestartTimer(); |
80 } | 87 } |
81 | 88 |
82 void KioskAppUpdateService::OnRebootScheduled(Reason reason) { | 89 void KioskAppUpdateService::OnRebootScheduled(Reason reason) { |
83 extensions::api::runtime::OnRestartRequired::Reason restart_reason = | 90 extensions::api::runtime::OnRestartRequired::Reason restart_reason = |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 141 |
135 BrowserContextKeyedService* | 142 BrowserContextKeyedService* |
136 KioskAppUpdateServiceFactory::BuildServiceInstanceFor( | 143 KioskAppUpdateServiceFactory::BuildServiceInstanceFor( |
137 content::BrowserContext* context) const { | 144 content::BrowserContext* context) const { |
138 return new KioskAppUpdateService( | 145 return new KioskAppUpdateService( |
139 Profile::FromBrowserContext(context), | 146 Profile::FromBrowserContext(context), |
140 g_browser_process->platform_part()->automatic_reboot_manager()); | 147 g_browser_process->platform_part()->automatic_reboot_manager()); |
141 } | 148 } |
142 | 149 |
143 } // namespace chromeos | 150 } // namespace chromeos |
OLD | NEW |