Index: apps/shell/browser/shell_runtime_api_delegate.cc |
diff --git a/apps/shell/browser/shell_runtime_api_delegate.cc b/apps/shell/browser/shell_runtime_api_delegate.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..40096b0d0e23edf28752c3b36f978e6549096e4e |
--- /dev/null |
+++ b/apps/shell/browser/shell_runtime_api_delegate.cc |
@@ -0,0 +1,58 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "apps/shell/browser/shell_runtime_api_delegate.h" |
+ |
+#if defined(OS_CHROMEOS) |
+#include "chromeos/dbus/dbus_thread_manager.h" |
+#include "chromeos/dbus/power_manager_client.h" |
+#endif |
+ |
+using extensions::core_api::runtime::GetPlatformInfo::Results::PlatformInfo; |
+ |
+namespace apps { |
+ |
+void ShellRuntimeAPIDelegate::RegisterUpdateObserver( |
+ extensions::UpdateObserver* observer) { |
+} |
+ |
+void ShellRuntimeAPIDelegate::UnregisterUpdateObserver( |
+ extensions::UpdateObserver* observer) { |
+} |
+ |
+base::Version ShellRuntimeAPIDelegate::GetOldExtensionVersion( |
+ const extensions::Extension* extension) { |
+ return base::Version(); |
+} |
+ |
+void ShellRuntimeAPIDelegate::MaybeReloadExtension( |
+ const std::string& extension_id) { |
+} |
+ |
+bool ShellRuntimeAPIDelegate::RequestUpdateCheck( |
+ const std::string& extension_id, |
+ const extensions::RuntimeAPI::UpdateCheckCallback& callback) { |
+ return false; |
+} |
+ |
+void ShellRuntimeAPIDelegate::HandleUninstall(const std::string& extension_id, |
+ const GURL& uninstall_url) { |
+} |
+ |
+bool ShellRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { |
+ info->os = PlatformInfo::OS_CROS_; |
+ return true; |
+} |
+ |
+bool ShellRuntimeAPIDelegate::RequestRestart(std::string* error_message) { |
+// We allow chrome.runtime.restart() to request a device restart on ChromeOS. |
+#if defined(OS_CHROMEOS) |
+ chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
+ return true; |
+#endif |
+ *error_message = "Restart is only supported on ChromeOS."; |
+ return false; |
+} |
+ |
+} // namespace apps |