Chromium Code Reviews| 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..a5304e9f0cf2f85293743f18650b1aca119d3a3a |
| --- /dev/null |
| +++ b/apps/shell/browser/shell_runtime_api_delegate.cc |
| @@ -0,0 +1,56 @@ |
| +// 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" |
| + |
|
James Cook
2014/05/06 15:57:03
#include PlatformInfo since you use it
Ken Rockot(use gerrit already)
2014/05/06 17:22:23
Done.
|
| +#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::AddUpdateObserver( |
| + extensions::UpdateObserver* observer) { |
| +} |
| + |
| +void ShellRuntimeAPIDelegate::RemoveUpdateObserver( |
| + extensions::UpdateObserver* observer) { |
| +} |
| + |
| +base::Version ShellRuntimeAPIDelegate::GetPreviousExtensionVersion( |
| + const extensions::Extension* extension) { |
| + return base::Version(); |
| +} |
| + |
| +void ShellRuntimeAPIDelegate::ReloadExtension(const std::string& extension_id) { |
| +} |
| + |
| +bool ShellRuntimeAPIDelegate::CheckForUpdates( |
| + const std::string& extension_id, |
| + const UpdateCheckCallback& callback) { |
| + return false; |
| +} |
| + |
| +void ShellRuntimeAPIDelegate::OpenURL(const GURL& uninstall_url) { |
| +} |
| + |
| +bool ShellRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { |
| + info->os = PlatformInfo::OS_CROS_; |
|
James Cook
2014/05/06 15:57:03
Maybe ifdef OS_CHROMEOS and otherwise return Linux
Ken Rockot(use gerrit already)
2014/05/06 17:22:23
Done.
|
| + return true; |
| +} |
| + |
| +bool ShellRuntimeAPIDelegate::RestartDevice(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 |