| 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/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 this, &KioskAppUpdateService::ForceRestart); | 57 this, &KioskAppUpdateService::ForceRestart); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void KioskAppUpdateService::ForceRestart() { | 60 void KioskAppUpdateService::ForceRestart() { |
| 61 // Force a chrome restart (not a logout or reboot) by closing all browsers. | 61 // Force a chrome restart (not a logout or reboot) by closing all browsers. |
| 62 LOG(WARNING) << "Force closing all browsers to update kiosk app."; | 62 LOG(WARNING) << "Force closing all browsers to update kiosk app."; |
| 63 chrome::CloseAllBrowsers(); | 63 chrome::CloseAllBrowsers(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 KioskAppUpdateServiceFactory::KioskAppUpdateServiceFactory() | 66 KioskAppUpdateServiceFactory::KioskAppUpdateServiceFactory() |
| 67 : ProfileKeyedServiceFactory("KioskAppUpdateService", | 67 : BrowserContextKeyedServiceFactory( |
| 68 ProfileDependencyManager::GetInstance()) { | 68 "KioskAppUpdateService", |
| 69 BrowserContextDependencyManager::GetInstance()) { |
| 69 DependsOn(extensions::ExtensionSystemFactory::GetInstance()); | 70 DependsOn(extensions::ExtensionSystemFactory::GetInstance()); |
| 70 } | 71 } |
| 71 | 72 |
| 72 KioskAppUpdateServiceFactory::~KioskAppUpdateServiceFactory() { | 73 KioskAppUpdateServiceFactory::~KioskAppUpdateServiceFactory() { |
| 73 } | 74 } |
| 74 | 75 |
| 75 // static | 76 // static |
| 76 KioskAppUpdateService* KioskAppUpdateServiceFactory::GetForProfile( | 77 KioskAppUpdateService* KioskAppUpdateServiceFactory::GetForProfile( |
| 77 Profile* profile) { | 78 Profile* profile) { |
| 78 // This should never be called unless we are running in forced app mode. | 79 // This should never be called unless we are running in forced app mode. |
| 79 DCHECK(chrome::IsRunningInForcedAppMode()); | 80 DCHECK(chrome::IsRunningInForcedAppMode()); |
| 80 if (!chrome::IsRunningInForcedAppMode()) | 81 if (!chrome::IsRunningInForcedAppMode()) |
| 81 return NULL; | 82 return NULL; |
| 82 | 83 |
| 83 return static_cast<KioskAppUpdateService*>( | 84 return static_cast<KioskAppUpdateService*>( |
| 84 GetInstance()->GetServiceForProfile(profile, true)); | 85 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 85 } | 86 } |
| 86 | 87 |
| 87 // static | 88 // static |
| 88 KioskAppUpdateServiceFactory* KioskAppUpdateServiceFactory::GetInstance() { | 89 KioskAppUpdateServiceFactory* KioskAppUpdateServiceFactory::GetInstance() { |
| 89 return Singleton<KioskAppUpdateServiceFactory>::get(); | 90 return Singleton<KioskAppUpdateServiceFactory>::get(); |
| 90 } | 91 } |
| 91 | 92 |
| 92 ProfileKeyedService* KioskAppUpdateServiceFactory::BuildServiceInstanceFor( | 93 BrowserContextKeyedService* |
| 94 KioskAppUpdateServiceFactory::BuildServiceInstanceFor( |
| 93 content::BrowserContext* profile) const { | 95 content::BrowserContext* profile) const { |
| 94 return new KioskAppUpdateService(static_cast<Profile*>(profile)); | 96 return new KioskAppUpdateService(static_cast<Profile*>(profile)); |
| 95 } | 97 } |
| 96 | 98 |
| 97 } // namespace chromeos | 99 } // namespace chromeos |
| OLD | NEW |