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

Side by Side Diff: chrome/browser/extensions/extension_webstore_private_api.h

Issue 10071035: RefCounted types should not have public destructors, chrome/browser/extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fix Created 8 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 | Annotate | Revision Log
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_EXTENSION_WEBSTORE_PRIVATE_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 30 matching lines...) Expand all
41 // Gets the pending approval for the |extension_id| in |profile|. Pending 41 // Gets the pending approval for the |extension_id| in |profile|. Pending
42 // approvals are held between the calls to beginInstallWithManifest and 42 // approvals are held between the calls to beginInstallWithManifest and
43 // completeInstall. This should only be used for testing. 43 // completeInstall. This should only be used for testing.
44 static scoped_ptr<WebstoreInstaller::Approval> PopApprovalForTesting( 44 static scoped_ptr<WebstoreInstaller::Approval> PopApprovalForTesting(
45 Profile* profile, const std::string& extension_id); 45 Profile* profile, const std::string& extension_id);
46 }; 46 };
47 47
48 class InstallBundleFunction : public AsyncExtensionFunction, 48 class InstallBundleFunction : public AsyncExtensionFunction,
49 public extensions::BundleInstaller::Delegate { 49 public extensions::BundleInstaller::Delegate {
50 public: 50 public:
51 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.installBundle");
52
51 InstallBundleFunction(); 53 InstallBundleFunction();
52 54
53 // BundleInstaller::Delegate implementation. 55 // BundleInstaller::Delegate:
54 virtual void OnBundleInstallApproved() OVERRIDE; 56 virtual void OnBundleInstallApproved() OVERRIDE;
55 virtual void OnBundleInstallCanceled(bool user_initiated) OVERRIDE; 57 virtual void OnBundleInstallCanceled(bool user_initiated) OVERRIDE;
56 virtual void OnBundleInstallCompleted() OVERRIDE; 58 virtual void OnBundleInstallCompleted() OVERRIDE;
57 59
58 protected: 60 protected:
59 virtual ~InstallBundleFunction(); 61 virtual ~InstallBundleFunction();
62
63 // ExtensionFunction:
60 virtual bool RunImpl() OVERRIDE; 64 virtual bool RunImpl() OVERRIDE;
61 65
62 // Reads the extension |details| into |items|. 66 // Reads the extension |details| into |items|.
63 bool ReadBundleInfo(base::ListValue* details, 67 bool ReadBundleInfo(base::ListValue* details,
64 extensions::BundleInstaller::ItemList* items); 68 extensions::BundleInstaller::ItemList* items);
65 69
66 private: 70 private:
67 scoped_refptr<extensions::BundleInstaller> bundle_; 71 scoped_refptr<extensions::BundleInstaller> bundle_;
68 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.installBundle");
69 }; 72 };
70 73
71 class BeginInstallWithManifestFunction 74 class BeginInstallWithManifestFunction
72 : public AsyncExtensionFunction, 75 : public AsyncExtensionFunction,
73 public ExtensionInstallUI::Delegate, 76 public ExtensionInstallUI::Delegate,
74 public WebstoreInstallHelper::Delegate { 77 public WebstoreInstallHelper::Delegate {
75 public: 78 public:
76 BeginInstallWithManifestFunction(); 79 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.beginInstallWithManifest3");
77 80
78 // Result codes for the return value. If you change this, make sure to 81 // Result codes for the return value. If you change this, make sure to
79 // update the description for the beginInstallWithManifest3 callback in 82 // update the description for the beginInstallWithManifest3 callback in
80 // the extension API JSON. 83 // the extension API JSON.
81 enum ResultCode { 84 enum ResultCode {
82 ERROR_NONE = 0, 85 ERROR_NONE = 0,
83 86
84 // An unspecified error occurred. 87 // An unspecified error occurred.
85 UNKNOWN_ERROR, 88 UNKNOWN_ERROR,
86 89
87 // The user cancelled the confirmation dialog instead of accepting it. 90 // The user cancelled the confirmation dialog instead of accepting it.
88 USER_CANCELLED, 91 USER_CANCELLED,
89 92
90 // The manifest failed to parse correctly. 93 // The manifest failed to parse correctly.
91 MANIFEST_ERROR, 94 MANIFEST_ERROR,
92 95
93 // There was a problem parsing the base64 encoded icon data. 96 // There was a problem parsing the base64 encoded icon data.
94 ICON_ERROR, 97 ICON_ERROR,
95 98
96 // The extension id was invalid. 99 // The extension id was invalid.
97 INVALID_ID, 100 INVALID_ID,
98 101
99 // The page does not have permission to call this function. 102 // The page does not have permission to call this function.
100 PERMISSION_DENIED, 103 PERMISSION_DENIED,
101 104
102 // Invalid icon url. 105 // Invalid icon url.
103 INVALID_ICON_URL 106 INVALID_ICON_URL
104 }; 107 };
105 108
106 // Implementing WebstoreInstallHelper::Delegate interface. 109 BeginInstallWithManifestFunction();
110
111 // WebstoreInstallHelper::Delegate:
107 virtual void OnWebstoreParseSuccess( 112 virtual void OnWebstoreParseSuccess(
108 const std::string& id, 113 const std::string& id,
109 const SkBitmap& icon, 114 const SkBitmap& icon,
110 base::DictionaryValue* parsed_manifest) OVERRIDE; 115 base::DictionaryValue* parsed_manifest) OVERRIDE;
111 virtual void OnWebstoreParseFailure( 116 virtual void OnWebstoreParseFailure(
112 const std::string& id, 117 const std::string& id,
113 InstallHelperResultCode result_code, 118 InstallHelperResultCode result_code,
114 const std::string& error_message) OVERRIDE; 119 const std::string& error_message) OVERRIDE;
115 120
116 // Implementing ExtensionInstallUI::Delegate interface. 121 // ExtensionInstallUI::Delegate:
117 virtual void InstallUIProceed() OVERRIDE; 122 virtual void InstallUIProceed() OVERRIDE;
118 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; 123 virtual void InstallUIAbort(bool user_initiated) OVERRIDE;
119 124
120 protected: 125 protected:
121 virtual ~BeginInstallWithManifestFunction(); 126 virtual ~BeginInstallWithManifestFunction();
127
128 // ExtensionFunction:
122 virtual bool RunImpl() OVERRIDE; 129 virtual bool RunImpl() OVERRIDE;
123 130
124 // Sets the result_ as a string based on |code|. 131 // Sets the result_ as a string based on |code|.
125 void SetResult(ResultCode code); 132 void SetResult(ResultCode code);
126 133
127 private: 134 private:
128 // These store the input parameters to the function. 135 // These store the input parameters to the function.
129 std::string id_; 136 std::string id_;
130 std::string manifest_; 137 std::string manifest_;
131 std::string icon_data_; 138 std::string icon_data_;
132 std::string localized_name_; 139 std::string localized_name_;
133 bool use_app_installed_bubble_; 140 bool use_app_installed_bubble_;
134 141
135 // The results of parsing manifest_ and icon_data_ go into these two. 142 // The results of parsing manifest_ and icon_data_ go into these two.
136 scoped_ptr<base::DictionaryValue> parsed_manifest_; 143 scoped_ptr<base::DictionaryValue> parsed_manifest_;
137 SkBitmap icon_; 144 SkBitmap icon_;
138 145
139 // A dummy Extension object we create for the purposes of using 146 // A dummy Extension object we create for the purposes of using
140 // ExtensionInstallUI to prompt for confirmation of the install. 147 // ExtensionInstallUI to prompt for confirmation of the install.
141 scoped_refptr<Extension> dummy_extension_; 148 scoped_refptr<Extension> dummy_extension_;
142 149
143 // The class that displays the install prompt. 150 // The class that displays the install prompt.
144 scoped_ptr<ExtensionInstallUI> install_ui_; 151 scoped_ptr<ExtensionInstallUI> install_ui_;
145
146 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.beginInstallWithManifest3");
147 }; 152 };
148 153
149 class CompleteInstallFunction : public SyncExtensionFunction { 154 class CompleteInstallFunction : public SyncExtensionFunction {
155 public:
156 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.completeInstall");
157
158 protected:
159 virtual ~CompleteInstallFunction() {}
160
161 // ExtensionFunction:
150 virtual bool RunImpl() OVERRIDE; 162 virtual bool RunImpl() OVERRIDE;
151 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.completeInstall");
152 }; 163 };
153 164
154 class SilentlyInstallFunction : public AsyncExtensionFunction, 165 class SilentlyInstallFunction : public AsyncExtensionFunction,
155 public WebstoreInstallHelper::Delegate, 166 public WebstoreInstallHelper::Delegate,
156 public WebstoreInstaller::Delegate { 167 public WebstoreInstaller::Delegate {
157 public: 168 public:
169 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.silentlyInstall");
170
158 SilentlyInstallFunction(); 171 SilentlyInstallFunction();
159 172
160 // WebstoreInstallHelper::Delegate implementation. 173 // WebstoreInstallHelper::Delegate:
161 virtual void OnWebstoreParseSuccess( 174 virtual void OnWebstoreParseSuccess(
162 const std::string& id, 175 const std::string& id,
163 const SkBitmap& icon, 176 const SkBitmap& icon,
164 base::DictionaryValue* parsed_manifest) OVERRIDE; 177 base::DictionaryValue* parsed_manifest) OVERRIDE;
165 virtual void OnWebstoreParseFailure( 178 virtual void OnWebstoreParseFailure(
166 const std::string& id, 179 const std::string& id,
167 InstallHelperResultCode result_code, 180 InstallHelperResultCode result_code,
168 const std::string& error_message) OVERRIDE; 181 const std::string& error_message) OVERRIDE;
169 182
170 // WebstoreInstaller::Delegate implementation. 183 // WebstoreInstaller::Delegate:
171 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; 184 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE;
172 virtual void OnExtensionInstallFailure(const std::string& id, 185 virtual void OnExtensionInstallFailure(const std::string& id,
173 const std::string& error) OVERRIDE; 186 const std::string& error) OVERRIDE;
174 187
175 protected: 188 protected:
176 virtual ~SilentlyInstallFunction(); 189 virtual ~SilentlyInstallFunction();
190
191 // ExtensionFunction:
177 virtual bool RunImpl() OVERRIDE; 192 virtual bool RunImpl() OVERRIDE;
178 193
179 private: 194 private:
180 std::string id_; 195 std::string id_;
181 std::string manifest_; 196 std::string manifest_;
182 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.silentlyInstall");
183 }; 197 };
184 198
185 class GetBrowserLoginFunction : public SyncExtensionFunction { 199 class GetBrowserLoginFunction : public SyncExtensionFunction {
200 public:
201 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.getBrowserLogin");
202
203 protected:
204 virtual ~GetBrowserLoginFunction() {}
205
206 // ExtensionFunction:
186 virtual bool RunImpl() OVERRIDE; 207 virtual bool RunImpl() OVERRIDE;
187 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.getBrowserLogin");
188 }; 208 };
189 209
190 class GetStoreLoginFunction : public SyncExtensionFunction { 210 class GetStoreLoginFunction : public SyncExtensionFunction {
211 public:
212 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.getStoreLogin");
213
214 protected:
215 virtual ~GetStoreLoginFunction() {}
216
217 // ExtensionFunction:
191 virtual bool RunImpl() OVERRIDE; 218 virtual bool RunImpl() OVERRIDE;
192 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.getStoreLogin");
193 }; 219 };
194 220
195 class SetStoreLoginFunction : public SyncExtensionFunction { 221 class SetStoreLoginFunction : public SyncExtensionFunction {
222 public:
223 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.setStoreLogin");
224
225 protected:
226 virtual ~SetStoreLoginFunction() {}
227
228 // ExtensionFunction:
196 virtual bool RunImpl() OVERRIDE; 229 virtual bool RunImpl() OVERRIDE;
197 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.setStoreLogin");
198 }; 230 };
199 231
200 class GetWebGLStatusFunction : public AsyncExtensionFunction, 232 class GetWebGLStatusFunction : public AsyncExtensionFunction,
201 public content::GpuDataManagerObserver { 233 public content::GpuDataManagerObserver {
202 public: 234 public:
235 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.getWebGLStatus");
236
203 GetWebGLStatusFunction(); 237 GetWebGLStatusFunction();
204 238
205 // Implementing GpuDataManagerObserver interface. 239 // content::GpuDataManagerObserver:
206 virtual void OnGpuInfoUpdate() OVERRIDE; 240 virtual void OnGpuInfoUpdate() OVERRIDE;
207 241
208 protected: 242 protected:
209 virtual ~GetWebGLStatusFunction(); 243 virtual ~GetWebGLStatusFunction();
244
245 // ExtensionFunction:
210 virtual bool RunImpl() OVERRIDE; 246 virtual bool RunImpl() OVERRIDE;
211 247
212 private: 248 private:
213 void CreateResult(bool webgl_allowed); 249 void CreateResult(bool webgl_allowed);
214 250
215 // A false return value is always valid, but a true one is only valid if full 251 // A false return value is always valid, but a true one is only valid if full
216 // GPU info has been collected in a GPU process. 252 // GPU info has been collected in a GPU process.
217 static bool IsWebGLAllowed(content::GpuDataManager* manager); 253 static bool IsWebGLAllowed(content::GpuDataManager* manager);
218
219 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.getWebGLStatus");
220 }; 254 };
221 255
222 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_ 256 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698