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 | 20 |
20 namespace chromeos { | 21 namespace chromeos { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 ExtensionService* service = profile_->GetExtensionService(); | 64 ExtensionService* service = profile_->GetExtensionService(); |
64 if (service) | 65 if (service) |
65 service->RemoveUpdateObserver(this); | 66 service->RemoveUpdateObserver(this); |
66 } | 67 } |
67 | 68 |
68 void KioskAppUpdateService::OnAppUpdateAvailable(const std::string& app_id) { | 69 void KioskAppUpdateService::OnAppUpdateAvailable(const std::string& app_id) { |
69 DCHECK(!app_id_.empty()); | 70 DCHECK(!app_id_.empty()); |
70 if (app_id != app_id_) | 71 if (app_id != app_id_) |
71 return; | 72 return; |
72 | 73 |
| 74 // Clears cached app data so that it will be reloaded if update from app |
| 75 // does not finish in this run. |
| 76 KioskAppManager::Get()->ClearAppData(app_id_); |
| 77 |
73 extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent( | 78 extensions::RuntimeEventRouter::DispatchOnRestartRequiredEvent( |
74 profile_, | 79 profile_, |
75 app_id_, | 80 app_id_, |
76 extensions::api::runtime::OnRestartRequired::REASON_APP_UPDATE); | 81 extensions::api::runtime::OnRestartRequired::REASON_APP_UPDATE); |
77 | 82 |
78 StartAppUpdateRestartTimer(); | 83 StartAppUpdateRestartTimer(); |
79 } | 84 } |
80 | 85 |
81 void KioskAppUpdateService::OnRebootScheduled(Reason reason) { | 86 void KioskAppUpdateService::OnRebootScheduled(Reason reason) { |
82 extensions::api::runtime::OnRestartRequired::Reason restart_reason = | 87 extensions::api::runtime::OnRestartRequired::Reason restart_reason = |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 138 |
134 BrowserContextKeyedService* | 139 BrowserContextKeyedService* |
135 KioskAppUpdateServiceFactory::BuildServiceInstanceFor( | 140 KioskAppUpdateServiceFactory::BuildServiceInstanceFor( |
136 content::BrowserContext* context) const { | 141 content::BrowserContext* context) const { |
137 return new KioskAppUpdateService( | 142 return new KioskAppUpdateService( |
138 Profile::FromBrowserContext(context), | 143 Profile::FromBrowserContext(context), |
139 g_browser_process->platform_part()->automatic_reboot_manager()); | 144 g_browser_process->platform_part()->automatic_reboot_manager()); |
140 } | 145 } |
141 | 146 |
142 } // namespace chromeos | 147 } // namespace chromeos |
OLD | NEW |