Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: extensions/browser/api/runtime/runtime_api_delegate.h

Issue 264743014: Move chrome.runtime to //extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make clang, cros happy Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/runtime/runtime_api_delegate.h
diff --git a/extensions/browser/api/runtime/runtime_api_delegate.h b/extensions/browser/api/runtime/runtime_api_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..dd1b5275183a5b7b4ecd2b298b9349133beb226a
--- /dev/null
+++ b/extensions/browser/api/runtime/runtime_api_delegate.h
@@ -0,0 +1,73 @@
+// 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.
+
+#ifndef EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_API_DELEGATE_H
+#define EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_API_DELEGATE_H
+
+#include "base/callback.h"
+#include "base/version.h"
+#include "extensions/common/api/runtime.h"
+
+class GURL;
+
+namespace extensions {
+
+class Extension;
+class UpdateObserver;
+
+// This is a delegate interface for chrome.runtime API behavior. Clients must
+// vend some implementation of this interface through
+// ExtensionsBrowserClient::CreateRuntimeAPIDelegate.
+class RuntimeAPIDelegate {
+ public:
+ struct UpdateCheckResult {
+ bool success;
+ std::string response;
+ std::string version;
+
+ UpdateCheckResult(bool success,
+ const std::string& response,
+ const std::string& version);
+ };
+
+ virtual ~RuntimeAPIDelegate() {}
+
+ // The callback given to RequestUpdateCheck.
+ typedef base::Callback<void(const UpdateCheckResult&)> UpdateCheckCallback;
+
+ // Registers an UpdateObserver on behalf of the runtime API.
+ virtual void AddUpdateObserver(UpdateObserver* observer) = 0;
+
+ // Unregisters an UpdateObserver on behalf of the runtime API.
+ virtual void RemoveUpdateObserver(UpdateObserver* observer) = 0;
+
+ // Determines an extension's previously installed version if applicable.
+ virtual base::Version GetPreviousExtensionVersion(
+ const Extension* extension) = 0;
+
+ // Reloads an extension.
+ virtual void ReloadExtension(const std::string& extension_id) = 0;
+
+ // Requests an extensions update update check. Returns |false| if updates
+ // are disabled. Otherwise |callback| is called with the result of the
+ // update check.
+ virtual bool CheckForUpdates(const std::string& extension_id,
+ const UpdateCheckCallback& callback) = 0;
+
+ // Navigates the browser to a URL on behalf of the runtime API.
+ virtual void OpenURL(const GURL& uninstall_url) = 0;
+
+ // Populates platform info to be provided by the getPlatformInfo function.
+ // Returns false iff no info is provided.
+ virtual bool GetPlatformInfo(
+ core_api::runtime::GetPlatformInfo::Results::PlatformInfo* info) = 0;
James Cook 2014/05/06 15:57:03 What do you think about forward-declaring this typ
Ken Rockot(use gerrit already) 2014/05/06 17:22:23 Fine by me. I didn't want to because of the horrib
+
+ // Request a restart of the host device. Returns false iff the device
+ // will not be restarted.
+ virtual bool RestartDevice(std::string* error_message) = 0;
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_API_DELEGATE_H

Powered by Google App Engine
This is Rietveld 408576698