| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "apps/shell/browser/shell_runtime_api_delegate.h" | |
| 6 | |
| 7 #include "extensions/common/api/runtime.h" | |
| 8 | |
| 9 #if defined(OS_CHROMEOS) | |
| 10 #include "chromeos/dbus/dbus_thread_manager.h" | |
| 11 #include "chromeos/dbus/power_manager_client.h" | |
| 12 #endif | |
| 13 | |
| 14 using extensions::core_api::runtime::PlatformInfo; | |
| 15 | |
| 16 namespace apps { | |
| 17 | |
| 18 ShellRuntimeAPIDelegate::ShellRuntimeAPIDelegate() { | |
| 19 } | |
| 20 | |
| 21 ShellRuntimeAPIDelegate::~ShellRuntimeAPIDelegate() { | |
| 22 } | |
| 23 | |
| 24 void ShellRuntimeAPIDelegate::AddUpdateObserver( | |
| 25 extensions::UpdateObserver* observer) { | |
| 26 } | |
| 27 | |
| 28 void ShellRuntimeAPIDelegate::RemoveUpdateObserver( | |
| 29 extensions::UpdateObserver* observer) { | |
| 30 } | |
| 31 | |
| 32 base::Version ShellRuntimeAPIDelegate::GetPreviousExtensionVersion( | |
| 33 const extensions::Extension* extension) { | |
| 34 return base::Version(); | |
| 35 } | |
| 36 | |
| 37 void ShellRuntimeAPIDelegate::ReloadExtension(const std::string& extension_id) { | |
| 38 } | |
| 39 | |
| 40 bool ShellRuntimeAPIDelegate::CheckForUpdates( | |
| 41 const std::string& extension_id, | |
| 42 const UpdateCheckCallback& callback) { | |
| 43 return false; | |
| 44 } | |
| 45 | |
| 46 void ShellRuntimeAPIDelegate::OpenURL(const GURL& uninstall_url) { | |
| 47 } | |
| 48 | |
| 49 bool ShellRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { | |
| 50 #if defined(OS_CHROMEOS) | |
| 51 info->os = PlatformInfo::OS_CROS_; | |
| 52 #elif defined(OS_LINUX) | |
| 53 info->os = PlatformInfo::OS_LINUX_; | |
| 54 #endif | |
| 55 return true; | |
| 56 } | |
| 57 | |
| 58 bool ShellRuntimeAPIDelegate::RestartDevice(std::string* error_message) { | |
| 59 // We allow chrome.runtime.restart() to request a device restart on ChromeOS. | |
| 60 #if defined(OS_CHROMEOS) | |
| 61 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | |
| 62 return true; | |
| 63 #endif | |
| 64 *error_message = "Restart is only supported on ChromeOS."; | |
| 65 return false; | |
| 66 } | |
| 67 | |
| 68 } // namespace apps | |
| OLD | NEW |