Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / extensions / browser / api / management / management_api_delegate.h
blobf7b15a71e9257174e093df3957e8b3287853b37d
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.
5 #ifndef EXTENSIONS_BROWSER_API_MANAGEMENT_MANAGEMENT_API_DELEGATER_H_
6 #define EXTENSIONS_BROWSER_API_MANAGEMENT_MANAGEMENT_API_DELEGATER_H_
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"
15 namespace content {
16 class BrowserContext;
17 } // namespace content
19 namespace extensions {
21 class Extension;
22 class ExtensionPrefs;
23 class ManagementCreateAppShortcutFunction;
24 class ManagementGenerateAppForLinkFunction;
25 class ManagementGetPermissionWarningsByManifestFunction;
26 class ManagementSetEnabledFunction;
27 class ManagementUninstallFunctionBase;
28 class RequirementsChecker;
30 // Manages the lifetime of the install prompt.
31 class InstallPromptDelegate {
32 public:
33 virtual ~InstallPromptDelegate() {}
36 // Manages the lifetime of the uninstall prompt.
37 class UninstallDialogDelegate {
38 public:
39 virtual ~UninstallDialogDelegate() {}
42 // Manages the lifetime of the bookmark app creation.
43 class AppForLinkDelegate {
44 public:
45 virtual ~AppForLinkDelegate() {}
48 class ManagementAPIDelegate {
49 public:
50 virtual ~ManagementAPIDelegate() {}
52 // Launches the app |extension|. Returns true on success.
53 virtual bool LaunchAppFunctionDelegate(
54 const Extension* extension,
55 content::BrowserContext* context) const = 0;
57 // Forwards the call to extensions::util::IsNewBookmarkAppsEnabled in
58 // chrome.
59 virtual bool IsNewBookmarkAppsEnabled() const = 0;
61 // Forwards the call to extensions::util::CanHostedAppsOpenInWindows in
62 // chrome.
63 virtual bool CanHostedAppsOpenInWindows() const = 0;
65 // Forwards the call to AppLaunchInfo::GetFullLaunchURL in chrome.
66 virtual GURL GetFullLaunchURL(const Extension* extension) const = 0;
68 // Forwards the call to launch_util::GetLaunchType in chrome.
69 virtual LaunchType GetLaunchType(const ExtensionPrefs* prefs,
70 const Extension* extension) const = 0;
72 // Parses the manifest and calls back the
73 // ManagementGetPermissionWarningsByManifestFunction.
74 virtual void GetPermissionWarningsByManifestFunctionDelegate(
75 ManagementGetPermissionWarningsByManifestFunction* function,
76 const std::string& manifest_str) const = 0;
78 // Used to show a dialog prompt in chrome when management.setEnabled extension
79 // function is called.
80 virtual scoped_ptr<InstallPromptDelegate> SetEnabledFunctionDelegate(
81 ManagementSetEnabledFunction* function,
82 const Extension* extension) const = 0;
84 // Returns a new RequirementsChecker.
85 virtual scoped_ptr<RequirementsChecker> CreateRequirementsChecker() const = 0;
87 // Enables the extension identified by |extension_id|.
88 virtual void EnableExtension(content::BrowserContext* context,
89 const std::string& extension_id) const = 0;
91 // Disables the extension identified by |extension_id|.
92 virtual void DisableExtension(
93 content::BrowserContext* context,
94 const std::string& extension_id,
95 Extension::DisableReason disable_reason) const = 0;
97 // Used to show a confirmation dialog when uninstalling |target_extension|.
98 virtual scoped_ptr<UninstallDialogDelegate> UninstallFunctionDelegate(
99 ManagementUninstallFunctionBase* function,
100 const Extension* target_extension,
101 bool show_programmatic_uninstall_ui) const = 0;
103 // Uninstalls the extension.
104 virtual bool UninstallExtension(content::BrowserContext* context,
105 const std::string& transient_extension_id,
106 UninstallReason reason,
107 const base::Closure& deletion_done_callback,
108 base::string16* error) const = 0;
110 // Creates an app shortcut.
111 virtual bool CreateAppShortcutFunctionDelegate(
112 ManagementCreateAppShortcutFunction* function,
113 const Extension* extension) const = 0;
115 // Forwards the call to launch_util::SetLaunchType in chrome.
116 virtual void SetLaunchType(content::BrowserContext* context,
117 const std::string& extension_id,
118 LaunchType launch_type) const = 0;
120 // Creates a bookmark app for |launch_url|.
121 virtual scoped_ptr<AppForLinkDelegate> GenerateAppForLinkFunctionDelegate(
122 ManagementGenerateAppForLinkFunction* function,
123 content::BrowserContext* context,
124 const std::string& title,
125 const GURL& launch_url) const = 0;
127 // Forwards the call to ExtensionIconSource::GetIconURL in chrome.
128 virtual GURL GetIconURL(const Extension* extension,
129 int icon_size,
130 ExtensionIconSet::MatchType match,
131 bool grayscale,
132 bool* exists) const = 0;
135 } // namespace extensions
137 #endif // EXTENSIONS_BROWSER_API_MANAGEMENT_MANAGEMENT_API_DELEGATER_H_