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

Side by Side Diff: extensions/browser/api/management/management_api_delegate.h

Issue 696543002: Move the chrome.management API to extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
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_MANAGEMENT_MANAGEMENT_API_DELEGATER_H_
6 #define EXTENSIONS_BROWSER_API_MANAGEMENT_MANAGEMENT_API_DELEGATER_H_
7
8 #include "base/callback.h"
9 #include "extensions/browser/uninstall_reason.h"
10 #include "extensions/common/constants.h"
11 #include "extensions/common/extension.h"
12 #include "extensions/common/extension_icon_set.h"
13 #include "url/gurl.h"
14
15 namespace content {
16 class BrowserContext;
17 } // namespace content
18
19 namespace extensions {
20
21 class Extension;
22 class ExtensionPrefs;
23 class ManagementCreateAppShortcutFunction;
24 class ManagementGenerateAppForLinkFunction;
25 class ManagementGetPermissionWarningsByManifestFunction;
26 class ManagementSetEnabledFunction;
27 class ManagementUninstallFunctionBase;
28
29 // Manages the lifetime of the install prompt.
30 class InstallPromptDelegate {
31 public:
32 virtual ~InstallPromptDelegate() {}
33 };
34
35 // Manages the lifetime of the uninstall prompt.
36 class UninstallDialogDelegate {
37 public:
38 virtual ~UninstallDialogDelegate() {}
39 };
40
41 // Manages the lifetime of the bookmark app creation.
42 class AppForLinkDelegate {
43 public:
44 virtual ~AppForLinkDelegate() {}
45 };
46
47 class ManagementAPIDelegate {
48 public:
49 virtual ~ManagementAPIDelegate() {}
50
51 // Launches the app |extension|. Returns true on success.
52 virtual bool LaunchAppFunctionDelegate(
53 const Extension* extension,
54 content::BrowserContext* context) const = 0;
55
56 // Forwards the call to extensions::util::IsStreamlinedHostedAppsEnabled in
57 // chrome.
58 virtual bool IsStreamlinedHostedAppsEnabled() const = 0;
59
60 // Forwards the call to AppLaunchInfo::GetFullLaunchURL in chrome.
61 virtual GURL GetFullLaunchURL(const Extension* extension) const = 0;
62
63 // Forwards the call to launch_util::GetLaunchType in chrome.
64 virtual LaunchType GetLaunchType(const ExtensionPrefs* prefs,
65 const Extension* extension) const = 0;
66
67 // Parses the manifest and calls back the
68 // ManagementGetPermissionWarningsByManifestFunction.
69 virtual void GetPermissionWarningsByManifestFunctionDelegate(
70 ManagementGetPermissionWarningsByManifestFunction* function,
71 const std::string& manifest_str) const = 0;
72
73 // Used to show a dialog prompt in chrome when management.setEnabled extension
74 // function is called.
75 virtual scoped_ptr<InstallPromptDelegate> SetEnabledFunctionDelegate(
76 ManagementSetEnabledFunction* function,
77 const Extension* extension) const = 0;
78
79 // Enables the extension identified by |extension_id|.
80 virtual void EnableExtension(content::BrowserContext* context,
81 const std::string& extension_id) const = 0;
82
83 // Disables the extension identified by |extension_id|.
84 virtual void DisableExtension(
85 content::BrowserContext* context,
86 const std::string& extension_id,
87 Extension::DisableReason disable_reason) const = 0;
88
89 // Used to show a confirmation dialog when uninstalling |target_extension_id|.
90 virtual scoped_ptr<UninstallDialogDelegate> UninstallFunctionDelegate(
91 ManagementUninstallFunctionBase* function,
92 const std::string& target_extension_id) const = 0;
93
94 // Uninstalls the extension.
95 virtual bool UninstallExtension(content::BrowserContext* context,
96 const std::string& transient_extension_id,
97 UninstallReason reason,
98 const base::Closure& deletion_done_callback,
99 base::string16* error) const = 0;
100
101 // Creates an app shortcut.
102 virtual bool CreateAppShortcutFunctionDelegate(
103 ManagementCreateAppShortcutFunction* function,
104 const Extension* extension) const = 0;
105
106 // Forwards the call to launch_util::SetLaunchType in chrome.
107 virtual void SetLaunchType(content::BrowserContext* context,
108 const std::string& extension_id,
109 LaunchType launch_type) const = 0;
110
111 // Creates a bookmark app for |launch_url|.
112 virtual scoped_ptr<AppForLinkDelegate> GenerateAppForLinkFunctionDelegate(
113 ManagementGenerateAppForLinkFunction* function,
114 content::BrowserContext* context,
115 const std::string& title,
116 const GURL& launch_url) const = 0;
117
118 // Forwards the call to ExtensionIconSource::GetIconURL in chrome.
119 virtual GURL GetIconURL(const Extension* extension,
120 int icon_size,
121 ExtensionIconSet::MatchType match,
122 bool grayscale,
123 bool* exists) const = 0;
124 };
125
126 } // namespace extensions
127
128 #endif // EXTENSIONS_BROWSER_API_MANAGEMENT_MANAGEMENT_API_DELEGATER_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/management/management_api_constants.cc ('k') | extensions/browser/api/runtime/runtime_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698