OLD | NEW |
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/bundle_installer.h" | 10 #include "chrome/browser/extensions/bundle_installer.h" |
11 #include "chrome/browser/extensions/extension_function.h" | 11 #include "chrome/browser/extensions/extension_function.h" |
12 #include "chrome/browser/extensions/extension_install_prompt.h" | 12 #include "chrome/browser/extensions/extension_install_prompt.h" |
13 #include "chrome/browser/extensions/webstore_install_helper.h" | 13 #include "chrome/browser/extensions/webstore_install_helper.h" |
14 #include "chrome/browser/extensions/webstore_installer.h" | 14 #include "chrome/browser/extensions/webstore_installer.h" |
15 #include "chrome/browser/signin/signin_tracker.h" | 15 #include "chrome/browser/signin/signin_tracker.h" |
| 16 #include "chrome/common/extensions/api/webstore_private.h" |
16 #include "content/public/browser/gpu_data_manager_observer.h" | 17 #include "content/public/browser/gpu_data_manager_observer.h" |
17 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
19 #include "google_apis/gaia/google_service_auth_error.h" | 20 #include "google_apis/gaia/google_service_auth_error.h" |
20 #include "third_party/skia/include/core/SkBitmap.h" | 21 #include "third_party/skia/include/core/SkBitmap.h" |
21 | 22 |
22 class ProfileSyncService; | 23 class ProfileSyncService; |
23 | 24 |
24 namespace content { | 25 namespace content { |
25 class GpuDataManager; | 26 class GpuDataManager; |
(...skipping 29 matching lines...) Expand all Loading... |
55 virtual void OnBundleInstallCanceled(bool user_initiated) OVERRIDE; | 56 virtual void OnBundleInstallCanceled(bool user_initiated) OVERRIDE; |
56 virtual void OnBundleInstallCompleted() OVERRIDE; | 57 virtual void OnBundleInstallCompleted() OVERRIDE; |
57 | 58 |
58 protected: | 59 protected: |
59 virtual ~WebstorePrivateInstallBundleFunction(); | 60 virtual ~WebstorePrivateInstallBundleFunction(); |
60 | 61 |
61 // ExtensionFunction: | 62 // ExtensionFunction: |
62 virtual bool RunImpl() OVERRIDE; | 63 virtual bool RunImpl() OVERRIDE; |
63 | 64 |
64 // Reads the extension |details| into |items|. | 65 // Reads the extension |details| into |items|. |
65 bool ReadBundleInfo(base::ListValue* details, | 66 bool ReadBundleInfo( |
66 extensions::BundleInstaller::ItemList* items); | 67 const api::webstore_private::InstallBundle::Params& details, |
| 68 extensions::BundleInstaller::ItemList* items); |
67 | 69 |
68 private: | 70 private: |
69 scoped_refptr<extensions::BundleInstaller> bundle_; | 71 scoped_refptr<extensions::BundleInstaller> bundle_; |
70 }; | 72 }; |
71 | 73 |
72 class WebstorePrivateBeginInstallWithManifest3Function | 74 class WebstorePrivateBeginInstallWithManifest3Function |
73 : public AsyncExtensionFunction, | 75 : public AsyncExtensionFunction, |
74 public ExtensionInstallPrompt::Delegate, | 76 public ExtensionInstallPrompt::Delegate, |
75 public WebstoreInstallHelper::Delegate, | 77 public WebstoreInstallHelper::Delegate, |
76 public SigninTracker::Observer { | 78 public SigninTracker::Observer { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 void SetResultCode(ResultCode code); | 140 void SetResultCode(ResultCode code); |
139 | 141 |
140 private: | 142 private: |
141 // SigninTracker::Observer override. | 143 // SigninTracker::Observer override. |
142 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; | 144 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; |
143 virtual void SigninSuccess() OVERRIDE; | 145 virtual void SigninSuccess() OVERRIDE; |
144 | 146 |
145 // Called when signin is complete or not needed. | 147 // Called when signin is complete or not needed. |
146 void SigninCompletedOrNotNeeded(); | 148 void SigninCompletedOrNotNeeded(); |
147 | 149 |
| 150 const char* ResultCodeToString(ResultCode code); |
| 151 |
148 // These store the input parameters to the function. | 152 // These store the input parameters to the function. |
149 std::string id_; | 153 scoped_ptr<api::webstore_private::BeginInstallWithManifest3::Params> params_; |
150 std::string manifest_; | |
151 std::string icon_data_; | |
152 std::string localized_name_; | |
153 bool use_app_installed_bubble_; | |
154 bool enable_launcher_; | |
155 | 154 |
156 // The results of parsing manifest_ and icon_data_ go into these two. | 155 // The results of parsing manifest_ and icon_data_ go into these two. |
157 scoped_ptr<base::DictionaryValue> parsed_manifest_; | 156 scoped_ptr<base::DictionaryValue> parsed_manifest_; |
158 SkBitmap icon_; | 157 SkBitmap icon_; |
159 | 158 |
160 // A dummy Extension object we create for the purposes of using | 159 // A dummy Extension object we create for the purposes of using |
161 // ExtensionInstallPrompt to prompt for confirmation of the install. | 160 // ExtensionInstallPrompt to prompt for confirmation of the install. |
162 scoped_refptr<extensions::Extension> dummy_extension_; | 161 scoped_refptr<extensions::Extension> dummy_extension_; |
163 | 162 |
164 // The class that displays the install prompt. | 163 // The class that displays the install prompt. |
(...skipping 22 matching lines...) Expand all Loading... |
187 virtual ~WebstorePrivateCompleteInstallFunction(); | 186 virtual ~WebstorePrivateCompleteInstallFunction(); |
188 | 187 |
189 // ExtensionFunction: | 188 // ExtensionFunction: |
190 virtual bool RunImpl() OVERRIDE; | 189 virtual bool RunImpl() OVERRIDE; |
191 | 190 |
192 private: | 191 private: |
193 scoped_ptr<WebstoreInstaller::Approval> approval_; | 192 scoped_ptr<WebstoreInstaller::Approval> approval_; |
194 }; | 193 }; |
195 | 194 |
196 class WebstorePrivateEnableAppLauncherFunction | 195 class WebstorePrivateEnableAppLauncherFunction |
197 : public AsyncExtensionFunction { | 196 : public SyncExtensionFunction { |
198 public: | 197 public: |
199 DECLARE_EXTENSION_FUNCTION("webstorePrivate.enableAppLauncher", | 198 DECLARE_EXTENSION_FUNCTION("webstorePrivate.enableAppLauncher", |
200 WEBSTOREPRIVATE_ENABLEAPPLAUNCHER) | 199 WEBSTOREPRIVATE_ENABLEAPPLAUNCHER) |
201 | 200 |
202 WebstorePrivateEnableAppLauncherFunction(); | 201 WebstorePrivateEnableAppLauncherFunction(); |
203 | 202 |
204 protected: | 203 protected: |
205 virtual ~WebstorePrivateEnableAppLauncherFunction(); | 204 virtual ~WebstorePrivateEnableAppLauncherFunction(); |
206 | 205 |
207 // ExtensionFunction: | 206 // ExtensionFunction: |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // ExtensionFunction: | 258 // ExtensionFunction: |
260 virtual bool RunImpl() OVERRIDE; | 259 virtual bool RunImpl() OVERRIDE; |
261 | 260 |
262 private: | 261 private: |
263 void CreateResult(bool webgl_allowed); | 262 void CreateResult(bool webgl_allowed); |
264 | 263 |
265 scoped_refptr<GPUFeatureChecker> feature_checker_; | 264 scoped_refptr<GPUFeatureChecker> feature_checker_; |
266 }; | 265 }; |
267 | 266 |
268 class WebstorePrivateGetIsLauncherEnabledFunction | 267 class WebstorePrivateGetIsLauncherEnabledFunction |
269 : public AsyncExtensionFunction { | 268 : public SyncExtensionFunction { |
270 public: | 269 public: |
271 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getIsLauncherEnabled", | 270 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getIsLauncherEnabled", |
272 WEBSTOREPRIVATE_GETISLAUNCHERENABLED) | 271 WEBSTOREPRIVATE_GETISLAUNCHERENABLED) |
273 | 272 |
274 WebstorePrivateGetIsLauncherEnabledFunction() {} | 273 WebstorePrivateGetIsLauncherEnabledFunction() {} |
275 | 274 |
276 protected: | 275 protected: |
277 virtual ~WebstorePrivateGetIsLauncherEnabledFunction() {} | 276 virtual ~WebstorePrivateGetIsLauncherEnabledFunction() {} |
278 | 277 |
279 // ExtensionFunction: | 278 // ExtensionFunction: |
280 virtual bool RunImpl() OVERRIDE; | 279 virtual bool RunImpl() OVERRIDE; |
281 | 280 |
282 private: | 281 private: |
283 void OnIsLauncherCheckCompleted(bool is_enabled); | 282 void OnIsLauncherCheckCompleted(bool is_enabled); |
284 }; | 283 }; |
285 | 284 |
286 class WebstorePrivateIsInIncognitoModeFunction : public AsyncExtensionFunction { | 285 class WebstorePrivateIsInIncognitoModeFunction : public SyncExtensionFunction { |
287 public: | 286 public: |
288 DECLARE_EXTENSION_FUNCTION("webstorePrivate.isInIncognitoMode", | 287 DECLARE_EXTENSION_FUNCTION("webstorePrivate.isInIncognitoMode", |
289 WEBSTOREPRIVATE_ISININCOGNITOMODEFUNCTION) | 288 WEBSTOREPRIVATE_ISININCOGNITOMODEFUNCTION) |
290 | 289 |
291 WebstorePrivateIsInIncognitoModeFunction() {} | 290 WebstorePrivateIsInIncognitoModeFunction() {} |
292 | 291 |
293 protected: | 292 protected: |
294 virtual ~WebstorePrivateIsInIncognitoModeFunction() {} | 293 virtual ~WebstorePrivateIsInIncognitoModeFunction() {} |
295 | 294 |
296 // ExtensionFunction: | 295 // ExtensionFunction: |
297 virtual bool RunImpl() OVERRIDE; | 296 virtual bool RunImpl() OVERRIDE; |
298 }; | 297 }; |
299 | 298 |
300 } // namespace extensions | 299 } // namespace extensions |
301 | 300 |
302 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H
_ | 301 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H
_ |
OLD | NEW |