OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/kiosk_mode/kiosk_mode_screensaver.h" | 5 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h" |
6 | 6 |
7 #include "ash/screensaver/screensaver_view.h" | 7 #include "ash/screensaver/screensaver_view.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/wm/user_activity_detector.h" | 9 #include "ash/wm/user_activity_detector.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 15 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
16 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 16 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
17 #include "chrome/browser/chromeos/login/user_manager.h" | 17 #include "chrome/browser/chromeos/login/user_manager.h" |
18 #include "chrome/browser/chromeos/login/webui_login_display_host.h" | 18 #include "chrome/browser/chromeos/login/webui_login_display_host.h" |
19 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
| 20 #include "chrome/browser/extensions/extension_system.h" |
20 #include "chrome/browser/extensions/sandboxed_unpacker.h" | 21 #include "chrome/browser/extensions/sandboxed_unpacker.h" |
21 #include "chrome/browser/policy/app_pack_updater.h" | 22 #include "chrome/browser/policy/app_pack_updater.h" |
22 #include "chrome/browser/policy/browser_policy_connector.h" | 23 #include "chrome/browser/policy/browser_policy_connector.h" |
23 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 24 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
24 #include "chrome/common/chrome_notification_types.h" | 25 #include "chrome/common/chrome_notification_types.h" |
25 #include "chrome/common/extensions/extension.h" | 26 #include "chrome/common/extensions/extension.h" |
26 #include "chrome/common/extensions/extension_file_util.h" | 27 #include "chrome/common/extensions/extension_file_util.h" |
27 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
28 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
29 | 30 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 173 } |
173 | 174 |
174 void KioskModeScreensaver::ScreensaverPathCallback( | 175 void KioskModeScreensaver::ScreensaverPathCallback( |
175 const FilePath& screensaver_crx) { | 176 const FilePath& screensaver_crx) { |
176 if (screensaver_crx.empty()) | 177 if (screensaver_crx.empty()) |
177 return; | 178 return; |
178 | 179 |
179 Profile* default_profile = ProfileManager::GetDefaultProfile(); | 180 Profile* default_profile = ProfileManager::GetDefaultProfile(); |
180 if (!default_profile) | 181 if (!default_profile) |
181 return; | 182 return; |
182 FilePath extensions_dir = | 183 FilePath extensions_dir = extensions::ExtensionSystem::Get(default_profile)-> |
183 default_profile->GetExtensionService()->install_directory(); | 184 extension_service()->install_directory(); |
184 scoped_refptr<SandboxedUnpacker> screensaver_unpacker( | 185 scoped_refptr<SandboxedUnpacker> screensaver_unpacker( |
185 new SandboxedUnpacker( | 186 new SandboxedUnpacker( |
186 screensaver_crx, | 187 screensaver_crx, |
187 true, | 188 true, |
188 Extension::COMPONENT, | 189 Extension::COMPONENT, |
189 Extension::NO_FLAGS, | 190 Extension::NO_FLAGS, |
190 extensions_dir, | 191 extensions_dir, |
191 content::BrowserThread::GetMessageLoopProxyForThread( | 192 content::BrowserThread::GetMessageLoopProxyForThread( |
192 content::BrowserThread::FILE), | 193 content::BrowserThread::FILE), |
193 new ScreensaverUnpackerClient( | 194 new ScreensaverUnpackerClient( |
(...skipping 18 matching lines...) Expand all Loading... |
212 | 213 |
213 // If the user is already logged in, don't need to display the screensaver. | 214 // If the user is already logged in, don't need to display the screensaver. |
214 if (chromeos::UserManager::Get()->IsUserLoggedIn()) | 215 if (chromeos::UserManager::Get()->IsUserLoggedIn()) |
215 return; | 216 return; |
216 | 217 |
217 ash::Shell::GetInstance()->user_activity_detector()->AddObserver(this); | 218 ash::Shell::GetInstance()->user_activity_detector()->AddObserver(this); |
218 | 219 |
219 Profile* default_profile = ProfileManager::GetDefaultProfile(); | 220 Profile* default_profile = ProfileManager::GetDefaultProfile(); |
220 // Add the extension to the extension service and display the screensaver. | 221 // Add the extension to the extension service and display the screensaver. |
221 if (default_profile) { | 222 if (default_profile) { |
222 default_profile->GetExtensionService()->AddExtension(extension); | 223 extensions::ExtensionSystem::Get(default_profile)->extension_service()-> |
| 224 AddExtension(extension); |
223 ash::ShowScreensaver(extension->GetFullLaunchURL()); | 225 ash::ShowScreensaver(extension->GetFullLaunchURL()); |
224 } else { | 226 } else { |
225 LOG(ERROR) << "Couldn't get default profile. Unable to load screensaver!"; | 227 LOG(ERROR) << "Couldn't get default profile. Unable to load screensaver!"; |
226 ShutdownKioskModeScreensaver(); | 228 ShutdownKioskModeScreensaver(); |
227 } | 229 } |
228 } | 230 } |
229 | 231 |
230 void KioskModeScreensaver::OnUserActivity() { | 232 void KioskModeScreensaver::OnUserActivity() { |
231 // We don't want to handle further user notifications; we'll either login | 233 // We don't want to handle further user notifications; we'll either login |
232 // the user and close out or or at least close the screensaver. | 234 // the user and close out or or at least close the screensaver. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 272 |
271 g_kiosk_mode_screensaver = new KioskModeScreensaver(); | 273 g_kiosk_mode_screensaver = new KioskModeScreensaver(); |
272 } | 274 } |
273 | 275 |
274 void ShutdownKioskModeScreensaver() { | 276 void ShutdownKioskModeScreensaver() { |
275 delete g_kiosk_mode_screensaver; | 277 delete g_kiosk_mode_screensaver; |
276 g_kiosk_mode_screensaver = NULL; | 278 g_kiosk_mode_screensaver = NULL; |
277 } | 279 } |
278 | 280 |
279 } // namespace chromeos | 281 } // namespace chromeos |
OLD | NEW |