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

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

Issue 389613006: Prevent duplicate concurrent installs of the same extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed rebase Created 6 years, 5 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 <string> 8 #include <string>
9 9
10 #include "chrome/browser/extensions/active_install_data.h"
10 #include "chrome/browser/extensions/bundle_installer.h" 11 #include "chrome/browser/extensions/bundle_installer.h"
11 #include "chrome/browser/extensions/chrome_extension_function.h" 12 #include "chrome/browser/extensions/chrome_extension_function.h"
12 #include "chrome/browser/extensions/extension_install_prompt.h" 13 #include "chrome/browser/extensions/extension_install_prompt.h"
13 #include "chrome/browser/extensions/webstore_install_helper.h" 14 #include "chrome/browser/extensions/webstore_install_helper.h"
14 #include "chrome/browser/extensions/webstore_install_result.h" 15 #include "chrome/browser/extensions/webstore_install_result.h"
15 #include "chrome/browser/extensions/webstore_installer.h" 16 #include "chrome/browser/extensions/webstore_installer.h"
16 #include "chrome/browser/signin/signin_manager_factory.h" 17 #include "chrome/browser/signin/signin_manager_factory.h"
17 #include "chrome/common/extensions/api/webstore_private.h" 18 #include "chrome/common/extensions/api/webstore_private.h"
18 #include "components/signin/core/browser/signin_tracker.h" 19 #include "components/signin/core/browser/signin_tracker.h"
19 #include "content/public/browser/gpu_data_manager_observer.h" 20 #include "content/public/browser/gpu_data_manager_observer.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 165
165 // A dummy Extension object we create for the purposes of using 166 // A dummy Extension object we create for the purposes of using
166 // ExtensionInstallPrompt to prompt for confirmation of the install. 167 // ExtensionInstallPrompt to prompt for confirmation of the install.
167 scoped_refptr<extensions::Extension> dummy_extension_; 168 scoped_refptr<extensions::Extension> dummy_extension_;
168 169
169 // The class that displays the install prompt. 170 // The class that displays the install prompt.
170 scoped_ptr<ExtensionInstallPrompt> install_prompt_; 171 scoped_ptr<ExtensionInstallPrompt> install_prompt_;
171 172
172 scoped_ptr<SigninTracker> signin_tracker_; 173 scoped_ptr<SigninTracker> signin_tracker_;
173 174
175 scoped_ptr<ScopedActiveInstall> scoped_active_install_;
176
174 // The authuser query parameter value which should be used with CRX download 177 // The authuser query parameter value which should be used with CRX download
175 // requests. This is empty if authuser should not be set on download requests. 178 // requests. This is empty if authuser should not be set on download requests.
176 std::string authuser_; 179 std::string authuser_;
177 }; 180 };
178 181
179 class WebstorePrivateCompleteInstallFunction 182 class WebstorePrivateCompleteInstallFunction
180 : public ChromeAsyncExtensionFunction, 183 : public ChromeAsyncExtensionFunction,
181 public WebstoreInstaller::Delegate { 184 public WebstoreInstaller::Delegate {
182 public: 185 public:
183 DECLARE_EXTENSION_FUNCTION("webstorePrivate.completeInstall", 186 DECLARE_EXTENSION_FUNCTION("webstorePrivate.completeInstall",
184 WEBSTOREPRIVATE_COMPLETEINSTALL) 187 WEBSTOREPRIVATE_COMPLETEINSTALL)
185 188
186 WebstorePrivateCompleteInstallFunction(); 189 WebstorePrivateCompleteInstallFunction();
187 190
188 // WebstoreInstaller::Delegate: 191 // WebstoreInstaller::Delegate:
189 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; 192 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE;
190 virtual void OnExtensionInstallFailure( 193 virtual void OnExtensionInstallFailure(
191 const std::string& id, 194 const std::string& id,
192 const std::string& error, 195 const std::string& error,
193 WebstoreInstaller::FailureReason reason) OVERRIDE; 196 WebstoreInstaller::FailureReason reason) OVERRIDE;
194 197
195 protected: 198 protected:
196 virtual ~WebstorePrivateCompleteInstallFunction(); 199 virtual ~WebstorePrivateCompleteInstallFunction();
197 200
198 // ExtensionFunction: 201 // ExtensionFunction:
199 virtual bool RunAsync() OVERRIDE; 202 virtual bool RunAsync() OVERRIDE;
200 203
201 private: 204 private:
202 scoped_ptr<WebstoreInstaller::Approval> approval_; 205 scoped_ptr<WebstoreInstaller::Approval> approval_;
206 scoped_ptr<ScopedActiveInstall> scoped_active_install_;
203 207
204 void OnInstallSuccess(const std::string& id); 208 void OnInstallSuccess(const std::string& id);
205 }; 209 };
206 210
207 class WebstorePrivateEnableAppLauncherFunction 211 class WebstorePrivateEnableAppLauncherFunction
208 : public ChromeSyncExtensionFunction { 212 : public ChromeSyncExtensionFunction {
209 public: 213 public:
210 DECLARE_EXTENSION_FUNCTION("webstorePrivate.enableAppLauncher", 214 DECLARE_EXTENSION_FUNCTION("webstorePrivate.enableAppLauncher",
211 WEBSTOREPRIVATE_ENABLEAPPLAUNCHER) 215 WEBSTOREPRIVATE_ENABLEAPPLAUNCHER)
212 216
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 protected: 383 protected:
380 virtual ~WebstorePrivateGetEphemeralAppsEnabledFunction(); 384 virtual ~WebstorePrivateGetEphemeralAppsEnabledFunction();
381 385
382 // ExtensionFunction: 386 // ExtensionFunction:
383 virtual bool RunSync() OVERRIDE; 387 virtual bool RunSync() OVERRIDE;
384 }; 388 };
385 389
386 } // namespace extensions 390 } // namespace extensions
387 391
388 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H _ 392 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698