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

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

Issue 1902873002: Convert //extensions/browser/api from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/macros.h" 9 #include "base/macros.h"
10 #include "base/scoped_observer.h" 10 #include "base/scoped_observer.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 bool RunSync() override; 80 bool RunSync() override;
81 }; 81 };
82 82
83 class ManagementGetPermissionWarningsByManifestFunction 83 class ManagementGetPermissionWarningsByManifestFunction
84 : public AsyncExtensionFunction { 84 : public AsyncExtensionFunction {
85 public: 85 public:
86 DECLARE_EXTENSION_FUNCTION("management.getPermissionWarningsByManifest", 86 DECLARE_EXTENSION_FUNCTION("management.getPermissionWarningsByManifest",
87 MANAGEMENT_GETPERMISSIONWARNINGSBYMANIFEST); 87 MANAGEMENT_GETPERMISSIONWARNINGSBYMANIFEST);
88 88
89 // Called when utility process finishes. 89 // Called when utility process finishes.
90 void OnParseSuccess(scoped_ptr<base::Value> value); 90 void OnParseSuccess(std::unique_ptr<base::Value> value);
91 void OnParseFailure(const std::string& error); 91 void OnParseFailure(const std::string& error);
92 92
93 protected: 93 protected:
94 ~ManagementGetPermissionWarningsByManifestFunction() override {} 94 ~ManagementGetPermissionWarningsByManifestFunction() override {}
95 95
96 // ExtensionFunction: 96 // ExtensionFunction:
97 bool RunAsync() override; 97 bool RunAsync() override;
98 }; 98 };
99 99
100 class ManagementLaunchAppFunction : public ManagementFunction { 100 class ManagementLaunchAppFunction : public ManagementFunction {
(...skipping 19 matching lines...) Expand all
120 // ExtensionFunction: 120 // ExtensionFunction:
121 ResponseAction Run() override; 121 ResponseAction Run() override;
122 122
123 private: 123 private:
124 void OnInstallPromptDone(bool did_accept); 124 void OnInstallPromptDone(bool did_accept);
125 125
126 void OnRequirementsChecked(const std::vector<std::string>& requirements); 126 void OnRequirementsChecked(const std::vector<std::string>& requirements);
127 127
128 std::string extension_id_; 128 std::string extension_id_;
129 129
130 scoped_ptr<InstallPromptDelegate> install_prompt_; 130 std::unique_ptr<InstallPromptDelegate> install_prompt_;
131 131
132 scoped_ptr<RequirementsChecker> requirements_checker_; 132 std::unique_ptr<RequirementsChecker> requirements_checker_;
133 }; 133 };
134 134
135 class ManagementUninstallFunctionBase : public UIThreadExtensionFunction { 135 class ManagementUninstallFunctionBase : public UIThreadExtensionFunction {
136 public: 136 public:
137 ManagementUninstallFunctionBase(); 137 ManagementUninstallFunctionBase();
138 138
139 void OnExtensionUninstallDialogClosed(bool did_start_uninstall, 139 void OnExtensionUninstallDialogClosed(bool did_start_uninstall,
140 const base::string16& error); 140 const base::string16& error);
141 141
142 protected: 142 protected:
143 ~ManagementUninstallFunctionBase() override; 143 ~ManagementUninstallFunctionBase() override;
144 ResponseAction Uninstall(const std::string& extension_id, 144 ResponseAction Uninstall(const std::string& extension_id,
145 bool show_confirm_dialog); 145 bool show_confirm_dialog);
146 146
147 private: 147 private:
148 // Uninstalls the extension without showing the dialog. 148 // Uninstalls the extension without showing the dialog.
149 void UninstallExtension(); 149 void UninstallExtension();
150 150
151 // Finishes and responds to the extension. 151 // Finishes and responds to the extension.
152 void Finish(bool did_start_uninstall, const std::string& error); 152 void Finish(bool did_start_uninstall, const std::string& error);
153 153
154 std::string target_extension_id_; 154 std::string target_extension_id_;
155 155
156 scoped_ptr<UninstallDialogDelegate> uninstall_dialog_; 156 std::unique_ptr<UninstallDialogDelegate> uninstall_dialog_;
157 }; 157 };
158 158
159 class ManagementUninstallFunction : public ManagementUninstallFunctionBase { 159 class ManagementUninstallFunction : public ManagementUninstallFunctionBase {
160 public: 160 public:
161 DECLARE_EXTENSION_FUNCTION("management.uninstall", MANAGEMENT_UNINSTALL) 161 DECLARE_EXTENSION_FUNCTION("management.uninstall", MANAGEMENT_UNINSTALL)
162 ManagementUninstallFunction(); 162 ManagementUninstallFunction();
163 163
164 private: 164 private:
165 ~ManagementUninstallFunction() override; 165 ~ManagementUninstallFunction() override;
166 ResponseAction Run() override; 166 ResponseAction Run() override;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 void FinishCreateBookmarkApp(const Extension* extension, 215 void FinishCreateBookmarkApp(const Extension* extension,
216 const WebApplicationInfo& web_app_info); 216 const WebApplicationInfo& web_app_info);
217 217
218 protected: 218 protected:
219 ~ManagementGenerateAppForLinkFunction() override; 219 ~ManagementGenerateAppForLinkFunction() override;
220 220
221 bool RunAsync() override; 221 bool RunAsync() override;
222 222
223 private: 223 private:
224 scoped_ptr<AppForLinkDelegate> app_for_link_delegate_; 224 std::unique_ptr<AppForLinkDelegate> app_for_link_delegate_;
225 }; 225 };
226 226
227 class ManagementEventRouter : public ExtensionRegistryObserver { 227 class ManagementEventRouter : public ExtensionRegistryObserver {
228 public: 228 public:
229 explicit ManagementEventRouter(content::BrowserContext* context); 229 explicit ManagementEventRouter(content::BrowserContext* context);
230 ~ManagementEventRouter() override; 230 ~ManagementEventRouter() override;
231 231
232 private: 232 private:
233 // ExtensionRegistryObserver implementation. 233 // ExtensionRegistryObserver implementation.
234 void OnExtensionLoaded(content::BrowserContext* browser_context, 234 void OnExtensionLoaded(content::BrowserContext* browser_context,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 friend class BrowserContextKeyedAPIFactory<ManagementAPI>; 278 friend class BrowserContextKeyedAPIFactory<ManagementAPI>;
279 279
280 content::BrowserContext* browser_context_; 280 content::BrowserContext* browser_context_;
281 281
282 // BrowserContextKeyedAPI implementation. 282 // BrowserContextKeyedAPI implementation.
283 static const char* service_name() { return "ManagementAPI"; } 283 static const char* service_name() { return "ManagementAPI"; }
284 static const bool kServiceIsNULLWhileTesting = true; 284 static const bool kServiceIsNULLWhileTesting = true;
285 static const bool kServiceRedirectedInIncognito = true; 285 static const bool kServiceRedirectedInIncognito = true;
286 286
287 // Created lazily upon OnListenerAdded. 287 // Created lazily upon OnListenerAdded.
288 scoped_ptr<ManagementEventRouter> management_event_router_; 288 std::unique_ptr<ManagementEventRouter> management_event_router_;
289 289
290 scoped_ptr<ManagementAPIDelegate> delegate_; 290 std::unique_ptr<ManagementAPIDelegate> delegate_;
291 291
292 DISALLOW_COPY_AND_ASSIGN(ManagementAPI); 292 DISALLOW_COPY_AND_ASSIGN(ManagementAPI);
293 }; 293 };
294 294
295 } // namespace extensions 295 } // namespace extensions
296 296
297 #endif // EXTENSIONS_BROWSER_API_MANAGEMENT_MANAGEMENT_API_H_ 297 #endif // EXTENSIONS_BROWSER_API_MANAGEMENT_MANAGEMENT_API_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/idle/idle_manager.cc ('k') | extensions/browser/api/management/management_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698