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

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

Issue 1534123002: [Extensions] Migrate ExtensionInstallPrompt::Delegate to be a callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 28 matching lines...) Expand all
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 scoped_ptr<WebstoreInstaller::Approval> PopApprovalForTesting(
44 Profile* profile, const std::string& extension_id); 44 Profile* profile, const std::string& extension_id);
45 }; 45 };
46 46
47 class WebstorePrivateBeginInstallWithManifest3Function 47 class WebstorePrivateBeginInstallWithManifest3Function
48 : public UIThreadExtensionFunction, 48 : public UIThreadExtensionFunction,
49 public ExtensionInstallPrompt::Delegate,
50 public WebstoreInstallHelper::Delegate { 49 public WebstoreInstallHelper::Delegate {
51 public: 50 public:
52 DECLARE_EXTENSION_FUNCTION("webstorePrivate.beginInstallWithManifest3", 51 DECLARE_EXTENSION_FUNCTION("webstorePrivate.beginInstallWithManifest3",
53 WEBSTOREPRIVATE_BEGININSTALLWITHMANIFEST3) 52 WEBSTOREPRIVATE_BEGININSTALLWITHMANIFEST3)
54 53
55 WebstorePrivateBeginInstallWithManifest3Function(); 54 WebstorePrivateBeginInstallWithManifest3Function();
56 55
57 private: 56 private:
58 using Params = api::webstore_private::BeginInstallWithManifest3::Params; 57 using Params = api::webstore_private::BeginInstallWithManifest3::Params;
59 58
60 ~WebstorePrivateBeginInstallWithManifest3Function() override; 59 ~WebstorePrivateBeginInstallWithManifest3Function() override;
61 60
62 // ExtensionFunction: 61 // ExtensionFunction:
63 ExtensionFunction::ResponseAction Run() override; 62 ExtensionFunction::ResponseAction Run() override;
64 63
65 // WebstoreInstallHelper::Delegate: 64 // WebstoreInstallHelper::Delegate:
66 void OnWebstoreParseSuccess(const std::string& id, 65 void OnWebstoreParseSuccess(const std::string& id,
67 const SkBitmap& icon, 66 const SkBitmap& icon,
68 base::DictionaryValue* parsed_manifest) override; 67 base::DictionaryValue* parsed_manifest) override;
69 void OnWebstoreParseFailure(const std::string& id, 68 void OnWebstoreParseFailure(const std::string& id,
70 InstallHelperResultCode result, 69 InstallHelperResultCode result,
71 const std::string& error_message) override; 70 const std::string& error_message) override;
72 71
73 // ExtensionInstallPrompt::Delegate: 72 void OnInstallPromptDone(ExtensionInstallPrompt::Result result);
74 void InstallUIProceed() override; 73
75 void InstallUIAbort(bool user_initiated) override; 74 void HandleInstallProceed();
75 void HandleInstallAbort(bool user_initiated);
76 76
77 ExtensionFunction::ResponseValue BuildResponse( 77 ExtensionFunction::ResponseValue BuildResponse(
78 api::webstore_private::Result result, 78 api::webstore_private::Result result,
79 const std::string& error); 79 const std::string& error);
80 scoped_ptr<base::ListValue> CreateResults( 80 scoped_ptr<base::ListValue> CreateResults(
81 api::webstore_private::Result result) const; 81 api::webstore_private::Result result) const;
82 82
83 const Params::Details& details() const { return params_->details; } 83 const Params::Details& details() const { return params_->details; }
84 84
85 ChromeExtensionFunctionDetails chrome_details_; 85 ChromeExtensionFunctionDetails chrome_details_;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 private: 317 private:
318 ~WebstorePrivateGetEphemeralAppsEnabledFunction() override; 318 ~WebstorePrivateGetEphemeralAppsEnabledFunction() override;
319 319
320 // ExtensionFunction: 320 // ExtensionFunction:
321 ExtensionFunction::ResponseAction Run() override; 321 ExtensionFunction::ResponseAction Run() override;
322 }; 322 };
323 323
324 } // namespace extensions 324 } // namespace extensions
325 325
326 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H _ 326 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698