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

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

Issue 12089037: Add management.uninstallSelf to API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync Created 7 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/management/management_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" 9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
10 #include "chrome/browser/extensions/event_router.h" 10 #include "chrome/browser/extensions/event_router.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 virtual void InstallUIProceed() OVERRIDE; 114 virtual void InstallUIProceed() OVERRIDE;
115 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; 115 virtual void InstallUIAbort(bool user_initiated) OVERRIDE;
116 116
117 private: 117 private:
118 std::string extension_id_; 118 std::string extension_id_;
119 119
120 // Used for prompting to re-enable items with permissions escalation updates. 120 // Used for prompting to re-enable items with permissions escalation updates.
121 scoped_ptr<ExtensionInstallPrompt> install_prompt_; 121 scoped_ptr<ExtensionInstallPrompt> install_prompt_;
122 }; 122 };
123 123
124 class ManagementUninstallFunction : public AsyncManagementFunction, 124 class ManagementUninstallFunctionBase : public AsyncManagementFunction,
125 public ExtensionUninstallDialog::Delegate { 125 public ExtensionUninstallDialog::Delegate {
126 public: 126 public:
127 DECLARE_EXTENSION_FUNCTION("management.uninstall", MANAGEMENT_UNINSTALL) 127 ManagementUninstallFunctionBase();
128 128
129 ManagementUninstallFunction();
130 static void SetAutoConfirmForTest(bool should_proceed); 129 static void SetAutoConfirmForTest(bool should_proceed);
131 130
132 // ExtensionUninstallDialog::Delegate implementation. 131 // ExtensionUninstallDialog::Delegate implementation.
133 virtual void ExtensionUninstallAccepted() OVERRIDE; 132 virtual void ExtensionUninstallAccepted() OVERRIDE;
134 virtual void ExtensionUninstallCanceled() OVERRIDE; 133 virtual void ExtensionUninstallCanceled() OVERRIDE;
135 134
135 protected:
136 virtual ~ManagementUninstallFunctionBase();
137
138 bool Uninstall(const std::string& extension_id, bool show_confirm_dialog);
136 private: 139 private:
137 virtual ~ManagementUninstallFunction();
138
139 virtual bool RunImpl() OVERRIDE;
140 140
141 // If should_uninstall is true, this method does the actual uninstall. 141 // If should_uninstall is true, this method does the actual uninstall.
142 // If |show_uninstall_dialog|, then this function will be called by one of the 142 // If |show_uninstall_dialog|, then this function will be called by one of the
143 // Accepted/Canceled callbacks. Otherwise, it's called directly from RunImpl. 143 // Accepted/Canceled callbacks. Otherwise, it's called directly from RunImpl.
144 void Finish(bool should_uninstall); 144 void Finish(bool should_uninstall);
145 145
146 std::string extension_id_; 146 std::string extension_id_;
147 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; 147 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_;
148 }; 148 };
149 149
150 class ManagementUninstallFunction : public ManagementUninstallFunctionBase {
151 public:
152 DECLARE_EXTENSION_FUNCTION("management.uninstall", MANAGEMENT_UNINSTALL)
153
154 ManagementUninstallFunction();
155
156 private:
157 virtual ~ManagementUninstallFunction();
158
159 virtual bool RunImpl() OVERRIDE;
160 };
161
162 class ManagementUninstallSelfFunction : public ManagementUninstallFunctionBase {
163 public:
164 DECLARE_EXTENSION_FUNCTION("management.uninstallSelf",
165 MANAGEMENT_UNINSTALLSELF);
166
167 ManagementUninstallSelfFunction();
168
169 private:
170 virtual ~ManagementUninstallSelfFunction();
171
172 virtual bool RunImpl() OVERRIDE;
173 };
174
150 class ManagementEventRouter : public content::NotificationObserver { 175 class ManagementEventRouter : public content::NotificationObserver {
151 public: 176 public:
152 explicit ManagementEventRouter(Profile* profile); 177 explicit ManagementEventRouter(Profile* profile);
153 virtual ~ManagementEventRouter(); 178 virtual ~ManagementEventRouter();
154 179
155 private: 180 private:
156 // content::NotificationObserver implementation. 181 // content::NotificationObserver implementation.
157 virtual void Observe(int type, 182 virtual void Observe(int type,
158 const content::NotificationSource& source, 183 const content::NotificationSource& source,
159 const content::NotificationDetails& details) OVERRIDE; 184 const content::NotificationDetails& details) OVERRIDE;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 219
195 // Created lazily upon OnListenerAdded. 220 // Created lazily upon OnListenerAdded.
196 scoped_ptr<ManagementEventRouter> management_event_router_; 221 scoped_ptr<ManagementEventRouter> management_event_router_;
197 222
198 DISALLOW_COPY_AND_ASSIGN(ManagementAPI); 223 DISALLOW_COPY_AND_ASSIGN(ManagementAPI);
199 }; 224 };
200 225
201 } // namespace extensions 226 } // namespace extensions
202 227
203 #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ 228 #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/management/management_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698