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

Side by Side Diff: chrome/browser/extensions/api/webstore_private/webstore_private_api.h

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header 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 CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 10
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h" 11 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h"
12 #include "chrome/browser/extensions/active_install_data.h" 12 #include "chrome/browser/extensions/active_install_data.h"
13 #include "chrome/browser/extensions/bundle_installer.h" 13 #include "chrome/browser/extensions/bundle_installer.h"
14 #include "chrome/browser/extensions/chrome_extension_function_details.h" 14 #include "chrome/browser/extensions/chrome_extension_function_details.h"
15 #include "chrome/browser/extensions/extension_install_prompt.h" 15 #include "chrome/browser/extensions/extension_install_prompt.h"
16 #include "chrome/browser/extensions/webstore_install_helper.h" 16 #include "chrome/browser/extensions/webstore_install_helper.h"
17 #include "chrome/browser/extensions/webstore_installer.h" 17 #include "chrome/browser/extensions/webstore_installer.h"
18 #include "chrome/common/extensions/api/webstore_private.h" 18 #include "chrome/common/extensions/api/webstore_private.h"
19 #include "chrome/common/extensions/webstore_install_result.h" 19 #include "chrome/common/extensions/webstore_install_result.h"
20 #include "extensions/browser/extension_function.h" 20 #include "extensions/browser/extension_function.h"
(...skipping 12 matching lines...) Expand all
33 33
34 class WebstorePrivateApi { 34 class WebstorePrivateApi {
35 public: 35 public:
36 // Allows you to override the WebstoreInstaller delegate for testing. 36 // Allows you to override the WebstoreInstaller delegate for testing.
37 static void SetWebstoreInstallerDelegateForTesting( 37 static void SetWebstoreInstallerDelegateForTesting(
38 WebstoreInstaller::Delegate* delegate); 38 WebstoreInstaller::Delegate* delegate);
39 39
40 // Gets the pending approval for the |extension_id| in |profile|. Pending 40 // Gets the pending approval for the |extension_id| in |profile|. Pending
41 // approvals are held between the calls to beginInstallWithManifest and 41 // approvals are held between the calls to beginInstallWithManifest and
42 // completeInstall. This should only be used for testing. 42 // completeInstall. This should only be used for testing.
43 static scoped_ptr<WebstoreInstaller::Approval> PopApprovalForTesting( 43 static std::unique_ptr<WebstoreInstaller::Approval> PopApprovalForTesting(
44 Profile* profile, const std::string& extension_id); 44 Profile* profile,
45 const std::string& extension_id);
45 }; 46 };
46 47
47 class WebstorePrivateBeginInstallWithManifest3Function 48 class WebstorePrivateBeginInstallWithManifest3Function
48 : public UIThreadExtensionFunction, 49 : public UIThreadExtensionFunction,
49 public WebstoreInstallHelper::Delegate { 50 public WebstoreInstallHelper::Delegate {
50 public: 51 public:
51 DECLARE_EXTENSION_FUNCTION("webstorePrivate.beginInstallWithManifest3", 52 DECLARE_EXTENSION_FUNCTION("webstorePrivate.beginInstallWithManifest3",
52 WEBSTOREPRIVATE_BEGININSTALLWITHMANIFEST3) 53 WEBSTOREPRIVATE_BEGININSTALLWITHMANIFEST3)
53 54
54 WebstorePrivateBeginInstallWithManifest3Function(); 55 WebstorePrivateBeginInstallWithManifest3Function();
(...skipping 15 matching lines...) Expand all
70 const std::string& error_message) override; 71 const std::string& error_message) override;
71 72
72 void OnInstallPromptDone(ExtensionInstallPrompt::Result result); 73 void OnInstallPromptDone(ExtensionInstallPrompt::Result result);
73 74
74 void HandleInstallProceed(); 75 void HandleInstallProceed();
75 void HandleInstallAbort(bool user_initiated); 76 void HandleInstallAbort(bool user_initiated);
76 77
77 ExtensionFunction::ResponseValue BuildResponse( 78 ExtensionFunction::ResponseValue BuildResponse(
78 api::webstore_private::Result result, 79 api::webstore_private::Result result,
79 const std::string& error); 80 const std::string& error);
80 scoped_ptr<base::ListValue> CreateResults( 81 std::unique_ptr<base::ListValue> CreateResults(
81 api::webstore_private::Result result) const; 82 api::webstore_private::Result result) const;
82 83
83 const Params::Details& details() const { return params_->details; } 84 const Params::Details& details() const { return params_->details; }
84 85
85 ChromeExtensionFunctionDetails chrome_details_; 86 ChromeExtensionFunctionDetails chrome_details_;
86 87
87 scoped_ptr<Params> params_; 88 std::unique_ptr<Params> params_;
88 89
89 scoped_ptr<ScopedActiveInstall> scoped_active_install_; 90 std::unique_ptr<ScopedActiveInstall> scoped_active_install_;
90 91
91 scoped_ptr<base::DictionaryValue> parsed_manifest_; 92 std::unique_ptr<base::DictionaryValue> parsed_manifest_;
92 SkBitmap icon_; 93 SkBitmap icon_;
93 94
94 // A dummy Extension object we create for the purposes of using 95 // A dummy Extension object we create for the purposes of using
95 // ExtensionInstallPrompt to prompt for confirmation of the install. 96 // ExtensionInstallPrompt to prompt for confirmation of the install.
96 scoped_refptr<Extension> dummy_extension_; 97 scoped_refptr<Extension> dummy_extension_;
97 98
98 scoped_ptr<ExtensionInstallPrompt> install_prompt_; 99 std::unique_ptr<ExtensionInstallPrompt> install_prompt_;
99 }; 100 };
100 101
101 class WebstorePrivateCompleteInstallFunction 102 class WebstorePrivateCompleteInstallFunction
102 : public UIThreadExtensionFunction, 103 : public UIThreadExtensionFunction,
103 public WebstoreInstaller::Delegate { 104 public WebstoreInstaller::Delegate {
104 public: 105 public:
105 DECLARE_EXTENSION_FUNCTION("webstorePrivate.completeInstall", 106 DECLARE_EXTENSION_FUNCTION("webstorePrivate.completeInstall",
106 WEBSTOREPRIVATE_COMPLETEINSTALL) 107 WEBSTOREPRIVATE_COMPLETEINSTALL)
107 108
108 WebstorePrivateCompleteInstallFunction(); 109 WebstorePrivateCompleteInstallFunction();
109 110
110 private: 111 private:
111 ~WebstorePrivateCompleteInstallFunction() override; 112 ~WebstorePrivateCompleteInstallFunction() override;
112 113
113 // ExtensionFunction: 114 // ExtensionFunction:
114 ExtensionFunction::ResponseAction Run() override; 115 ExtensionFunction::ResponseAction Run() override;
115 116
116 // WebstoreInstaller::Delegate: 117 // WebstoreInstaller::Delegate:
117 void OnExtensionInstallSuccess(const std::string& id) override; 118 void OnExtensionInstallSuccess(const std::string& id) override;
118 void OnExtensionInstallFailure( 119 void OnExtensionInstallFailure(
119 const std::string& id, 120 const std::string& id,
120 const std::string& error, 121 const std::string& error,
121 WebstoreInstaller::FailureReason reason) override; 122 WebstoreInstaller::FailureReason reason) override;
122 123
123 void OnInstallSuccess(const std::string& id); 124 void OnInstallSuccess(const std::string& id);
124 125
125 ChromeExtensionFunctionDetails chrome_details_; 126 ChromeExtensionFunctionDetails chrome_details_;
126 127
127 scoped_ptr<WebstoreInstaller::Approval> approval_; 128 std::unique_ptr<WebstoreInstaller::Approval> approval_;
128 scoped_ptr<ScopedActiveInstall> scoped_active_install_; 129 std::unique_ptr<ScopedActiveInstall> scoped_active_install_;
129 }; 130 };
130 131
131 class WebstorePrivateInstallBundleFunction 132 class WebstorePrivateInstallBundleFunction
132 : public UIThreadExtensionFunction, 133 : public UIThreadExtensionFunction,
133 public chrome::BitmapFetcherDelegate { 134 public chrome::BitmapFetcherDelegate {
134 public: 135 public:
135 DECLARE_EXTENSION_FUNCTION("webstorePrivate.installBundle", 136 DECLARE_EXTENSION_FUNCTION("webstorePrivate.installBundle",
136 WEBSTOREPRIVATE_INSTALLBUNDLE) 137 WEBSTOREPRIVATE_INSTALLBUNDLE)
137 138
138 WebstorePrivateInstallBundleFunction(); 139 WebstorePrivateInstallBundleFunction();
139 140
140 private: 141 private:
141 using Params = api::webstore_private::InstallBundle::Params; 142 using Params = api::webstore_private::InstallBundle::Params;
142 143
143 ~WebstorePrivateInstallBundleFunction() override; 144 ~WebstorePrivateInstallBundleFunction() override;
144 145
145 // ExtensionFunction: 146 // ExtensionFunction:
146 ExtensionFunction::ResponseAction Run() override; 147 ExtensionFunction::ResponseAction Run() override;
147 148
148 // chrome::BitmapFetcherDelegate: 149 // chrome::BitmapFetcherDelegate:
149 void OnFetchComplete(const GURL& url, const SkBitmap* bitmap) override; 150 void OnFetchComplete(const GURL& url, const SkBitmap* bitmap) override;
150 151
151 void OnInstallApproval(BundleInstaller::ApprovalState state); 152 void OnInstallApproval(BundleInstaller::ApprovalState state);
152 void OnInstallComplete(); 153 void OnInstallComplete();
153 154
154 const Params::Details& details() const { return params_->details; } 155 const Params::Details& details() const { return params_->details; }
155 156
156 ChromeExtensionFunctionDetails chrome_details_; 157 ChromeExtensionFunctionDetails chrome_details_;
157 158
158 scoped_ptr<Params> params_; 159 std::unique_ptr<Params> params_;
159 160
160 scoped_ptr<extensions::BundleInstaller> bundle_; 161 std::unique_ptr<extensions::BundleInstaller> bundle_;
161 scoped_ptr<chrome::BitmapFetcher> icon_fetcher_; 162 std::unique_ptr<chrome::BitmapFetcher> icon_fetcher_;
162 }; 163 };
163 164
164 class WebstorePrivateEnableAppLauncherFunction 165 class WebstorePrivateEnableAppLauncherFunction
165 : public UIThreadExtensionFunction { 166 : public UIThreadExtensionFunction {
166 public: 167 public:
167 DECLARE_EXTENSION_FUNCTION("webstorePrivate.enableAppLauncher", 168 DECLARE_EXTENSION_FUNCTION("webstorePrivate.enableAppLauncher",
168 WEBSTOREPRIVATE_ENABLEAPPLAUNCHER) 169 WEBSTOREPRIVATE_ENABLEAPPLAUNCHER)
169 170
170 WebstorePrivateEnableAppLauncherFunction(); 171 WebstorePrivateEnableAppLauncherFunction();
171 172
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 private: 318 private:
318 ~WebstorePrivateGetEphemeralAppsEnabledFunction() override; 319 ~WebstorePrivateGetEphemeralAppsEnabledFunction() override;
319 320
320 // ExtensionFunction: 321 // ExtensionFunction:
321 ExtensionFunction::ResponseAction Run() override; 322 ExtensionFunction::ResponseAction Run() override;
322 }; 323 };
323 324
324 } // namespace extensions 325 } // namespace extensions
325 326
326 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H _ 327 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698