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

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

Issue 948413005: [Extensions] Make chrome://extensions use management.uninstall (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 5 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXTENSIONS_BROWSER_API_MANAGEMENT_MANAGEMENT_API_H_ 5 #ifndef EXTENSIONS_BROWSER_API_MANAGEMENT_MANAGEMENT_API_H_
6 #define EXTENSIONS_BROWSER_API_MANAGEMENT_MANAGEMENT_API_H_ 6 #define EXTENSIONS_BROWSER_API_MANAGEMENT_MANAGEMENT_API_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/scoped_observer.h" 9 #include "base/scoped_observer.h"
10 #include "components/keyed_service/core/keyed_service.h" 10 #include "components/keyed_service/core/keyed_service.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 private: 123 private:
124 void OnRequirementsChecked(const std::vector<std::string>& requirements); 124 void OnRequirementsChecked(const std::vector<std::string>& requirements);
125 125
126 std::string extension_id_; 126 std::string extension_id_;
127 127
128 scoped_ptr<InstallPromptDelegate> install_prompt_; 128 scoped_ptr<InstallPromptDelegate> install_prompt_;
129 129
130 scoped_ptr<RequirementsChecker> requirements_checker_; 130 scoped_ptr<RequirementsChecker> requirements_checker_;
131 }; 131 };
132 132
133 class ManagementUninstallFunctionBase : public AsyncManagementFunction { 133 class ManagementUninstallFunctionBase : public UIThreadExtensionFunction {
134 public: 134 public:
135 ManagementUninstallFunctionBase(); 135 ManagementUninstallFunctionBase();
136 136
137 static void SetAutoConfirmForTest(bool should_proceed); 137 static void SetAutoConfirmForTest(bool should_proceed);
138 138
139 void ExtensionUninstallAccepted(); 139 void ExtensionUninstallAccepted();
140 void ExtensionUninstallCanceled(); 140 void ExtensionUninstallCanceled();
141 141
142 protected: 142 protected:
143 ~ManagementUninstallFunctionBase() override; 143 ~ManagementUninstallFunctionBase() override;
144 144 ResponseAction Uninstall(const std::string& extension_id,
145 bool Uninstall(const std::string& extension_id, bool show_confirm_dialog); 145 bool show_confirm_dialog);
146 146
147 private: 147 private:
148 // If should_uninstall is true, this method does the actual uninstall. 148 // If should_uninstall is true, this method does the actual uninstall.
149 // If |show_uninstall_dialog|, then this function will be called by one of the 149 // If |show_uninstall_dialog|, then this function will be called by one of the
150 // Accepted/Canceled callbacks. Otherwise, it's called directly from RunAsync. 150 // Accepted/Canceled callbacks. Otherwise, it's called directly from RunAsync.
151 void Finish(bool should_uninstall); 151 void Finish(bool should_uninstall);
152 152
153 std::string extension_id_; 153 std::string target_extension_id_;
154 154
155 scoped_ptr<UninstallDialogDelegate> uninstall_dialog_; 155 scoped_ptr<UninstallDialogDelegate> uninstall_dialog_;
156 }; 156 };
157 157
158 class ManagementUninstallFunction : public ManagementUninstallFunctionBase { 158 class ManagementUninstallFunction : public ManagementUninstallFunctionBase {
159 public: 159 public:
160 DECLARE_EXTENSION_FUNCTION("management.uninstall", MANAGEMENT_UNINSTALL) 160 DECLARE_EXTENSION_FUNCTION("management.uninstall", MANAGEMENT_UNINSTALL)
161
162 ManagementUninstallFunction(); 161 ManagementUninstallFunction();
163 162
164 private: 163 private:
165 ~ManagementUninstallFunction() override; 164 ~ManagementUninstallFunction() override;
166 165 ResponseAction Run() override;
167 bool RunAsync() override;
168 }; 166 };
169 167
170 class ManagementUninstallSelfFunction : public ManagementUninstallFunctionBase { 168 class ManagementUninstallSelfFunction : public ManagementUninstallFunctionBase {
171 public: 169 public:
172 DECLARE_EXTENSION_FUNCTION("management.uninstallSelf", 170 DECLARE_EXTENSION_FUNCTION("management.uninstallSelf",
173 MANAGEMENT_UNINSTALLSELF); 171 MANAGEMENT_UNINSTALLSELF);
174
175 ManagementUninstallSelfFunction(); 172 ManagementUninstallSelfFunction();
176 173
177 private: 174 private:
178 ~ManagementUninstallSelfFunction() override; 175 ~ManagementUninstallSelfFunction() override;
179 176 ResponseAction Run() override;
180 bool RunAsync() override;
181 }; 177 };
182 178
183 class ManagementCreateAppShortcutFunction : public AsyncManagementFunction { 179 class ManagementCreateAppShortcutFunction : public AsyncManagementFunction {
184 public: 180 public:
185 DECLARE_EXTENSION_FUNCTION("management.createAppShortcut", 181 DECLARE_EXTENSION_FUNCTION("management.createAppShortcut",
186 MANAGEMENT_CREATEAPPSHORTCUT); 182 MANAGEMENT_CREATEAPPSHORTCUT);
187 183
188 ManagementCreateAppShortcutFunction(); 184 ManagementCreateAppShortcutFunction();
189 185
190 void OnCloseShortcutPrompt(bool created); 186 void OnCloseShortcutPrompt(bool created);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 scoped_ptr<ManagementEventRouter> management_event_router_; 285 scoped_ptr<ManagementEventRouter> management_event_router_;
290 286
291 scoped_ptr<ManagementAPIDelegate> delegate_; 287 scoped_ptr<ManagementAPIDelegate> delegate_;
292 288
293 DISALLOW_COPY_AND_ASSIGN(ManagementAPI); 289 DISALLOW_COPY_AND_ASSIGN(ManagementAPI);
294 }; 290 };
295 291
296 } // namespace extensions 292 } // namespace extensions
297 293
298 #endif // EXTENSIONS_BROWSER_API_MANAGEMENT_MANAGEMENT_API_H_ 294 #endif // EXTENSIONS_BROWSER_API_MANAGEMENT_MANAGEMENT_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698