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

Side by Side Diff: chrome/browser/extensions/api/dashboard_private/dashboard_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_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 11 matching lines...) Expand all
22 namespace chrome { 22 namespace chrome {
23 class BitmapFetcher; 23 class BitmapFetcher;
24 } // namespace chrome 24 } // namespace chrome
25 25
26 namespace extensions { 26 namespace extensions {
27 27
28 class Extension; 28 class Extension;
29 29
30 class DashboardPrivateShowPermissionPromptForDelegatedInstallFunction 30 class DashboardPrivateShowPermissionPromptForDelegatedInstallFunction
31 : public UIThreadExtensionFunction, 31 : public UIThreadExtensionFunction,
32 public ExtensionInstallPrompt::Delegate,
33 public WebstoreInstallHelper::Delegate { 32 public WebstoreInstallHelper::Delegate {
34 public: 33 public:
35 DECLARE_EXTENSION_FUNCTION( 34 DECLARE_EXTENSION_FUNCTION(
36 "dashboardPrivate.showPermissionPromptForDelegatedInstall", 35 "dashboardPrivate.showPermissionPromptForDelegatedInstall",
37 DASHBOARDPRIVATE_SHOWPERMISSIONPROMPTFORDELEGATEDINSTALL) 36 DASHBOARDPRIVATE_SHOWPERMISSIONPROMPTFORDELEGATEDINSTALL)
38 37
39 DashboardPrivateShowPermissionPromptForDelegatedInstallFunction(); 38 DashboardPrivateShowPermissionPromptForDelegatedInstallFunction();
40 39
41 private: 40 private:
42 using Params = 41 using Params =
43 api::dashboard_private::ShowPermissionPromptForDelegatedInstall::Params; 42 api::dashboard_private::ShowPermissionPromptForDelegatedInstall::Params;
44 43
45 ~DashboardPrivateShowPermissionPromptForDelegatedInstallFunction() override; 44 ~DashboardPrivateShowPermissionPromptForDelegatedInstallFunction() override;
46 45
47 // ExtensionFunction: 46 // ExtensionFunction:
48 ExtensionFunction::ResponseAction Run() override; 47 ExtensionFunction::ResponseAction Run() override;
49 48
50 // WebstoreInstallHelper::Delegate: 49 // WebstoreInstallHelper::Delegate:
51 void OnWebstoreParseSuccess(const std::string& id, 50 void OnWebstoreParseSuccess(const std::string& id,
52 const SkBitmap& icon, 51 const SkBitmap& icon,
53 base::DictionaryValue* parsed_manifest) override; 52 base::DictionaryValue* parsed_manifest) override;
54 void OnWebstoreParseFailure(const std::string& id, 53 void OnWebstoreParseFailure(const std::string& id,
55 InstallHelperResultCode result, 54 InstallHelperResultCode result,
56 const std::string& error_message) override; 55 const std::string& error_message) override;
57 56
58 // ExtensionInstallPrompt::Delegate: 57 void OnInstallPromptDone(ExtensionInstallPrompt::Result result);
59 void InstallUIProceed() override;
60 void InstallUIAbort(bool user_initiated) override;
61 58
62 ExtensionFunction::ResponseValue BuildResponse( 59 ExtensionFunction::ResponseValue BuildResponse(
63 api::dashboard_private::Result result, 60 api::dashboard_private::Result result,
64 const std::string& error); 61 const std::string& error);
65 scoped_ptr<base::ListValue> CreateResults( 62 scoped_ptr<base::ListValue> CreateResults(
66 api::dashboard_private::Result result) const; 63 api::dashboard_private::Result result) const;
67 64
68 const Params::Details& details() const { return params_->details; } 65 const Params::Details& details() const { return params_->details; }
69 66
70 scoped_ptr<Params> params_; 67 scoped_ptr<Params> params_;
71 68
72 // A dummy Extension object we create for the purposes of using 69 // A dummy Extension object we create for the purposes of using
73 // ExtensionInstallPrompt to prompt for confirmation of the install. 70 // ExtensionInstallPrompt to prompt for confirmation of the install.
74 scoped_refptr<Extension> dummy_extension_; 71 scoped_refptr<Extension> dummy_extension_;
75 72
76 scoped_ptr<ExtensionInstallPrompt> install_prompt_; 73 scoped_ptr<ExtensionInstallPrompt> install_prompt_;
74
75 DISALLOW_COPY_AND_ASSIGN(
Avi (use Gerrit) 2015/12/29 03:10:45 #include "base/macros.h"
Devlin 2016/01/04 22:59:22 Done.
76 DashboardPrivateShowPermissionPromptForDelegatedInstallFunction);
77 }; 77 };
78 78
79 class DashboardPrivateShowPermissionPromptForDelegatedBundleInstallFunction 79 class DashboardPrivateShowPermissionPromptForDelegatedBundleInstallFunction
80 : public UIThreadExtensionFunction, 80 : public UIThreadExtensionFunction,
81 public chrome::BitmapFetcherDelegate { 81 public chrome::BitmapFetcherDelegate {
82 public: 82 public:
83 DECLARE_EXTENSION_FUNCTION( 83 DECLARE_EXTENSION_FUNCTION(
84 "dashboardPrivate.showPermissionPromptForDelegatedBundleInstall", 84 "dashboardPrivate.showPermissionPromptForDelegatedBundleInstall",
85 DASHBOARDPRIVATE_SHOWPERMISSIONPROMPTFORDELEGATEDBUNDLEINSTALL) 85 DASHBOARDPRIVATE_SHOWPERMISSIONPROMPTFORDELEGATEDBUNDLEINSTALL)
86 86
(...skipping 21 matching lines...) Expand all
108 scoped_ptr<Params> params_; 108 scoped_ptr<Params> params_;
109 109
110 scoped_ptr<extensions::BundleInstaller> bundle_; 110 scoped_ptr<extensions::BundleInstaller> bundle_;
111 scoped_ptr<chrome::BitmapFetcher> icon_fetcher_; 111 scoped_ptr<chrome::BitmapFetcher> icon_fetcher_;
112 }; 112 };
113 113
114 } // namespace extensions 114 } // namespace extensions
115 115
116 #endif // CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API _H_ 116 #endif // CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API _H_
117 117
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698