| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 this, &KioskAppUpdateService::ForceAppUpdateRestart); | 56 this, &KioskAppUpdateService::ForceAppUpdateRestart); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void KioskAppUpdateService::ForceAppUpdateRestart() { | 59 void KioskAppUpdateService::ForceAppUpdateRestart() { |
| 60 // Force a chrome restart (not a logout or reboot) by closing all browsers. | 60 // Force a chrome restart (not a logout or reboot) by closing all browsers. |
| 61 LOG(WARNING) << "Force closing all browsers to update kiosk app."; | 61 LOG(WARNING) << "Force closing all browsers to update kiosk app."; |
| 62 chrome::CloseAllBrowsersAndQuit(); | 62 chrome::CloseAllBrowsersAndQuit(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void KioskAppUpdateService::Shutdown() { | 65 void KioskAppUpdateService::Shutdown() { |
| 66 ExtensionService* service = profile_->GetExtensionService(); | 66 ExtensionService* service = |
| 67 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 67 if (service) | 68 if (service) |
| 68 service->RemoveUpdateObserver(this); | 69 service->RemoveUpdateObserver(this); |
| 69 } | 70 } |
| 70 | 71 |
| 71 void KioskAppUpdateService::OnAppUpdateAvailable( | 72 void KioskAppUpdateService::OnAppUpdateAvailable( |
| 72 const extensions::Extension* extension) { | 73 const extensions::Extension* extension) { |
| 73 if (extension->id() != app_id_) | 74 if (extension->id() != app_id_) |
| 74 return; | 75 return; |
| 75 | 76 |
| 76 // Clears cached app data so that it will be reloaded if update from app | 77 // Clears cached app data so that it will be reloaded if update from app |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 143 } |
| 143 | 144 |
| 144 KeyedService* KioskAppUpdateServiceFactory::BuildServiceInstanceFor( | 145 KeyedService* KioskAppUpdateServiceFactory::BuildServiceInstanceFor( |
| 145 content::BrowserContext* context) const { | 146 content::BrowserContext* context) const { |
| 146 return new KioskAppUpdateService( | 147 return new KioskAppUpdateService( |
| 147 Profile::FromBrowserContext(context), | 148 Profile::FromBrowserContext(context), |
| 148 g_browser_process->platform_part()->automatic_reboot_manager()); | 149 g_browser_process->platform_part()->automatic_reboot_manager()); |
| 149 } | 150 } |
| 150 | 151 |
| 151 } // namespace chromeos | 152 } // namespace chromeos |
| OLD | NEW |