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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 #ifndef EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_API_DELEGATE_H
6 #define EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_API_DELEGATE_H
7
8 #include "base/callback.h"
9 #include "base/version.h"
10 #include "extensions/common/api/runtime.h"
11
12 class GURL;
13
14 namespace extensions {
15
16 class Extension;
17 class UpdateObserver;
18
19 // This is a delegate interface for chrome.runtime API behavior. Clients must
20 // vend some implementation of this interface through
21 // ExtensionsBrowserClient::CreateRuntimeAPIDelegate.
22 class RuntimeAPIDelegate {
23 public:
24 struct UpdateCheckResult {
25 bool success;
26 std::string response;
27 std::string version;
28
29 UpdateCheckResult(bool success,
30 const std::string& response,
31 const std::string& version);
32 };
33
34 virtual ~RuntimeAPIDelegate() {}
35
36 // The callback given to RequestUpdateCheck.
37 typedef base::Callback<void(const UpdateCheckResult&)> UpdateCheckCallback;
38
39 // Registers an UpdateObserver on behalf of the runtime API.
40 virtual void AddUpdateObserver(UpdateObserver* observer) = 0;
41
42 // Unregisters an UpdateObserver on behalf of the runtime API.
43 virtual void RemoveUpdateObserver(UpdateObserver* observer) = 0;
44
45 // Determines an extension's previously installed version if applicable.
46 virtual base::Version GetPreviousExtensionVersion(
47 const Extension* extension) = 0;
48
49 // Reloads an extension.
50 virtual void ReloadExtension(const std::string& extension_id) = 0;
51
52 // Requests an extensions update update check. Returns |false| if updates
53 // are disabled. Otherwise |callback| is called with the result of the
54 // update check.
55 virtual bool CheckForUpdates(const std::string& extension_id,
56 const UpdateCheckCallback& callback) = 0;
57
58 // Navigates the browser to a URL on behalf of the runtime API.
59 virtual void OpenURL(const GURL& uninstall_url) = 0;
60
61 // Populates platform info to be provided by the getPlatformInfo function.
62 // Returns false iff no info is provided.
63 virtual bool GetPlatformInfo(
64 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
65
66 // Request a restart of the host device. Returns false iff the device
67 // will not be restarted.
68 virtual bool RestartDevice(std::string* error_message) = 0;
69 };
70
71 } // namespace extensions
72
73 #endif // EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_API_DELEGATE_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698