| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/api/runtime/chrome_runtime_api_delegate.h" | 5 #include "chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/extensions/extension_warning_service.h" | 11 #include "chrome/browser/extensions/extension_warning_service.h" |
| 12 #include "chrome/browser/extensions/extension_warning_set.h" | 12 #include "chrome/browser/extensions/extension_warning_set.h" |
| 13 #include "chrome/browser/extensions/updater/extension_updater.h" | 13 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
| 16 #include "chrome/browser/ui/browser_navigator.h" | 16 #include "chrome/browser/ui/browser_navigator.h" |
| 17 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
| 18 #include "components/omaha_query_params/omaha_query_params.h" | 18 #include "components/omaha_query_params/omaha_query_params.h" |
| 19 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
| 20 #include "extensions/browser/extension_system.h" | 20 #include "extensions/browser/extension_system.h" |
| 21 #include "extensions/browser/notification_types.h" | 21 #include "extensions/browser/notification_types.h" |
| 22 #include "extensions/common/api/runtime.h" | 22 #include "extensions/common/api/runtime.h" |
| 23 | 23 |
| 24 #if defined(OS_CHROMEOS) | 24 #if defined(OS_CHROMEOS) |
| 25 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 26 #include "chromeos/dbus/dbus_thread_manager.h" | 25 #include "chromeos/dbus/dbus_thread_manager.h" |
| 27 #include "chromeos/dbus/power_manager_client.h" | 26 #include "chromeos/dbus/power_manager_client.h" |
| 27 #include "components/user_manager/user_manager.h" |
| 28 #endif | 28 #endif |
| 29 | 29 |
| 30 using extensions::Extension; | 30 using extensions::Extension; |
| 31 using extensions::ExtensionSystem; | 31 using extensions::ExtensionSystem; |
| 32 using extensions::ExtensionUpdater; | 32 using extensions::ExtensionUpdater; |
| 33 | 33 |
| 34 using extensions::core_api::runtime::PlatformInfo; | 34 using extensions::core_api::runtime::PlatformInfo; |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } else { | 219 } else { |
| 220 NOTREACHED(); | 220 NOTREACHED(); |
| 221 return false; | 221 return false; |
| 222 } | 222 } |
| 223 | 223 |
| 224 return true; | 224 return true; |
| 225 } | 225 } |
| 226 | 226 |
| 227 bool ChromeRuntimeAPIDelegate::RestartDevice(std::string* error_message) { | 227 bool ChromeRuntimeAPIDelegate::RestartDevice(std::string* error_message) { |
| 228 #if defined(OS_CHROMEOS) | 228 #if defined(OS_CHROMEOS) |
| 229 if (chromeos::UserManager::Get()->IsLoggedInAsKioskApp()) { | 229 if (user_manager::UserManager::Get()->IsLoggedInAsKioskApp()) { |
| 230 chromeos::DBusThreadManager::Get() | 230 chromeos::DBusThreadManager::Get() |
| 231 ->GetPowerManagerClient() | 231 ->GetPowerManagerClient() |
| 232 ->RequestRestart(); | 232 ->RequestRestart(); |
| 233 return true; | 233 return true; |
| 234 } | 234 } |
| 235 #endif | 235 #endif |
| 236 *error_message = "Function available only for ChromeOS kiosk mode."; | 236 *error_message = "Function available only for ChromeOS kiosk mode."; |
| 237 return false; | 237 return false; |
| 238 } | 238 } |
| 239 | 239 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 const UpdateCheckResult& result) { | 271 const UpdateCheckResult& result) { |
| 272 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; | 272 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; |
| 273 pending_update_checks_.erase(extension_id); | 273 pending_update_checks_.erase(extension_id); |
| 274 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); | 274 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); |
| 275 iter != callbacks.end(); | 275 iter != callbacks.end(); |
| 276 ++iter) { | 276 ++iter) { |
| 277 const UpdateCheckCallback& callback = *iter; | 277 const UpdateCheckCallback& callback = *iter; |
| 278 callback.Run(result); | 278 callback.Run(result); |
| 279 } | 279 } |
| 280 } | 280 } |
| OLD | NEW |