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

Side by Side Diff: chrome/browser/extensions/api/dashboard_private/dashboard_private_api.h

Issue 1268853003: Move webstorePrivate DelegatedInstall functions into new dashboardPrivate API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/dashboard_private/dashboard_private_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API_H_
7
8 #include <string>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h"
12 #include "chrome/browser/extensions/bundle_installer.h"
13 #include "chrome/browser/extensions/chrome_extension_function_details.h"
14 #include "chrome/browser/extensions/extension_install_prompt.h"
15 #include "chrome/browser/extensions/webstore_install_helper.h"
16 #include "chrome/common/extensions/api/dashboard_private.h"
17 #include "extensions/browser/extension_function.h"
18 #include "third_party/skia/include/core/SkBitmap.h"
19
20 class GURL;
21
22 namespace chrome {
23 class BitmapFetcher;
24 } // namespace chrome
25
26 namespace extensions {
27
28 class Extension;
29
30 class DashboardPrivateShowPermissionPromptForDelegatedInstallFunction
31 : public UIThreadExtensionFunction,
32 public ExtensionInstallPrompt::Delegate,
33 public WebstoreInstallHelper::Delegate {
34 public:
35 DECLARE_EXTENSION_FUNCTION(
36 "dashboardPrivate.showPermissionPromptForDelegatedInstall",
37 DASHBOARDPRIVATE_SHOWPERMISSIONPROMPTFORDELEGATEDINSTALL)
38
39 DashboardPrivateShowPermissionPromptForDelegatedInstallFunction();
40
41 private:
42 using Params =
43 api::dashboard_private::ShowPermissionPromptForDelegatedInstall::Params;
44
45 ~DashboardPrivateShowPermissionPromptForDelegatedInstallFunction() override;
46
47 // ExtensionFunction:
48 ExtensionFunction::ResponseAction Run() override;
49
50 // WebstoreInstallHelper::Delegate:
51 void OnWebstoreParseSuccess(const std::string& id,
52 const SkBitmap& icon,
53 base::DictionaryValue* parsed_manifest) override;
54 void OnWebstoreParseFailure(const std::string& id,
55 InstallHelperResultCode result,
56 const std::string& error_message) override;
57
58 // ExtensionInstallPrompt::Delegate:
59 void InstallUIProceed() override;
60 void InstallUIAbort(bool user_initiated) override;
61
62 ExtensionFunction::ResponseValue BuildResponse(
63 api::dashboard_private::Result result,
64 const std::string& error);
65 scoped_ptr<base::ListValue> CreateResults(
66 api::dashboard_private::Result result) const;
67
68 const Params::Details& details() const { return params_->details; }
69
70 scoped_ptr<Params> params_;
71
72 // A dummy Extension object we create for the purposes of using
73 // ExtensionInstallPrompt to prompt for confirmation of the install.
74 scoped_refptr<Extension> dummy_extension_;
75
76 scoped_ptr<ExtensionInstallPrompt> install_prompt_;
77 };
78
79 class DashboardPrivateShowPermissionPromptForDelegatedBundleInstallFunction
80 : public UIThreadExtensionFunction,
81 public chrome::BitmapFetcherDelegate {
82 public:
83 DECLARE_EXTENSION_FUNCTION(
84 "dashboardPrivate.showPermissionPromptForDelegatedBundleInstall",
85 DASHBOARDPRIVATE_SHOWPERMISSIONPROMPTFORDELEGATEDBUNDLEINSTALL)
86
87 DashboardPrivateShowPermissionPromptForDelegatedBundleInstallFunction();
88
89 private:
90 using Params = api::dashboard_private::
91 ShowPermissionPromptForDelegatedBundleInstall::Params;
92
93 ~DashboardPrivateShowPermissionPromptForDelegatedBundleInstallFunction()
94 override;
95
96 // ExtensionFunction:
97 ExtensionFunction::ResponseAction Run() override;
98
99 // chrome::BitmapFetcherDelegate:
100 void OnFetchComplete(const GURL& url, const SkBitmap* bitmap) override;
101
102 void OnInstallApproval(BundleInstaller::ApprovalState state);
103
104 const Params::Details& details() const { return params_->details; }
105
106 ChromeExtensionFunctionDetails chrome_details_;
107
108 scoped_ptr<Params> params_;
109
110 scoped_ptr<extensions::BundleInstaller> bundle_;
111 scoped_ptr<chrome::BitmapFetcher> icon_fetcher_;
112 };
113
114 } // namespace extensions
115
116 #endif // CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API _H_
117
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/dashboard_private/dashboard_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698