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

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

Issue 9414013: Add a webstore API for installing bundles of extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 10 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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
11 #include "chrome/browser/extensions/api/webstore/bundle_installer.h"
11 #include "chrome/browser/extensions/extension_function.h" 12 #include "chrome/browser/extensions/extension_function.h"
12 #include "chrome/browser/extensions/extension_install_ui.h" 13 #include "chrome/browser/extensions/extension_install_ui.h"
13 #include "chrome/browser/extensions/webstore_install_helper.h" 14 #include "chrome/browser/extensions/webstore_install_helper.h"
14 #include "chrome/browser/extensions/webstore_installer.h" 15 #include "chrome/browser/extensions/webstore_installer.h"
15 #include "chrome/common/net/gaia/google_service_auth_error.h" 16 #include "chrome/common/net/gaia/google_service_auth_error.h"
16 #include "content/browser/gpu/gpu_data_manager.h" 17 #include "content/browser/gpu/gpu_data_manager.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 20
20 class ProfileSyncService; 21 class ProfileSyncService;
21 22
22 class WebstorePrivateApi { 23 class WebstorePrivateApi {
23 public: 24 public:
24 // Allows you to set the ProfileSyncService the function will use for 25 // Allows you to set the ProfileSyncService the function will use for
25 // testing purposes. 26 // testing purposes.
26 static void SetTestingProfileSyncService(ProfileSyncService* service); 27 static void SetTestingProfileSyncService(ProfileSyncService* service);
27 28
28 // Allows you to override the WebstoreInstaller delegate for testing. 29 // Allows you to override the WebstoreInstaller delegate for testing.
29 static void SetWebstoreInstallerDelegateForTesting( 30 static void SetWebstoreInstallerDelegateForTesting(
30 WebstoreInstaller::Delegate* delegate); 31 WebstoreInstaller::Delegate* delegate);
31 32
32 // If |allow| is true, then the extension IDs used by the SilentlyInstall 33 // If |allow| is true, then the extension IDs used by the SilentlyInstall
33 // apitest will be trusted. 34 // apitest will be trusted.
34 static void SetTrustTestIDsForTesting(bool allow); 35 static void SetTrustTestIDsForTesting(bool allow);
35 }; 36 };
36 37
38 class InstallBundleFunction : public AsyncExtensionFunction,
39 public webstore::BundleInstaller::Delegate {
40 public:
41 InstallBundleFunction();
42
43 // BundleInstaller::Delegate implementation.
44 virtual void OnBundleInstallApproved() OVERRIDE;
45 virtual void OnBundleInstallCanceled(bool user_initiated) OVERRIDE;
46 virtual void OnBundleInstallCompleted() OVERRIDE;
47
48 protected:
49 virtual ~InstallBundleFunction();
50 virtual bool RunImpl() OVERRIDE;
51
52 // Reads the extension |details| into |items|.
53 bool ReadBundleInfo(base::ListValue* details,
54 webstore::ItemList* items);
55
56 private:
57 scoped_refptr<webstore::BundleInstaller> bundle_;
58 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.installBundle");
59 };
60
37 class BeginInstallWithManifestFunction 61 class BeginInstallWithManifestFunction
38 : public AsyncExtensionFunction, 62 : public AsyncExtensionFunction,
39 public ExtensionInstallUI::Delegate, 63 public ExtensionInstallUI::Delegate,
40 public WebstoreInstallHelper::Delegate { 64 public WebstoreInstallHelper::Delegate {
41 public: 65 public:
42 BeginInstallWithManifestFunction(); 66 BeginInstallWithManifestFunction();
43 67
44 // Result codes for the return value. If you change this, make sure to 68 // Result codes for the return value. If you change this, make sure to
45 // update the description for the beginInstallWithManifest3 callback in 69 // update the description for the beginInstallWithManifest3 callback in
46 // the extension API JSON. 70 // the extension API JSON.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 void CreateResult(bool webgl_allowed); 200 void CreateResult(bool webgl_allowed);
177 201
178 // A false return value is always valid, but a true one is only valid if full 202 // A false return value is always valid, but a true one is only valid if full
179 // GPU info has been collected in a GPU process. 203 // GPU info has been collected in a GPU process.
180 static bool IsWebGLAllowed(GpuDataManager* manager); 204 static bool IsWebGLAllowed(GpuDataManager* manager);
181 205
182 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.getWebGLStatus"); 206 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.getWebGLStatus");
183 }; 207 };
184 208
185 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_ 209 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698