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

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

Issue 8391004: Add webstorePrivate API for installing bundles of extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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/extension_function.h" 11 #include "chrome/browser/extensions/extension_function.h"
12 #include "chrome/browser/extensions/extension_install_ui.h" 12 #include "chrome/browser/extensions/extension_install_ui.h"
13 #include "chrome/browser/extensions/webstore_bundle.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/public/browser/notification_observer.h" 17 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h" 18 #include "content/public/browser/notification_registrar.h"
18 19
19 class ProfileSyncService; 20 class ProfileSyncService;
20 21
21 class WebstorePrivateApi { 22 class WebstorePrivateApi {
22 public: 23 public:
23 // Allows you to set the ProfileSyncService the function will use for 24 // Allows you to set the ProfileSyncService the function will use for
24 // testing purposes. 25 // testing purposes.
25 static void SetTestingProfileSyncService(ProfileSyncService* service); 26 static void SetTestingProfileSyncService(ProfileSyncService* service);
26 27
27 // Allows you to override the WebstoreInstaller delegate for testing. 28 // Allows you to override the WebstoreInstaller delegate for testing.
28 static void SetWebstoreInstallerDelegateForTesting( 29 static void SetWebstoreInstallerDelegateForTesting(
29 WebstoreInstaller::Delegate* delegate); 30 WebstoreInstaller::Delegate* delegate);
30 }; 31 };
31 32
33 class InstallBundleFunction : public AsyncExtensionFunction,
34 public WebstoreBundle::Delegate {
35 public:
36 InstallBundleFunction();
37
38 // Result codes for the return value. If you change this, make sure to
39 // update the description for the beginInstallBundle callback in
40 // extension_api.json.
41 enum ErrorCode {
42 ERROR_NONE = 0,
43
44 // An unspecified error occurred.
45 UNKNOWN_ERROR,
46
47 // The user cancelled the confirmation dialog instead of accepting it.
48 USER_CANCELLED,
49
50 // The page does not have permission to call this function.
51 PERMISSION_DENIED,
52 };
53
54 virtual void OnBundleInstallApproved() OVERRIDE;
55 virtual void OnBundleInstallCanceled(bool user_initiated) OVERRIDE;
56 virtual void OnBundleInstallCompleted() OVERRIDE;
57
58 protected:
59 virtual ~InstallBundleFunction();
60 virtual bool RunImpl() OVERRIDE;
61
62 // Reads the extension details from |extensions| into |items|.
63 bool ReadBundleInfo(base::ListValue* extensions,
64 WebstoreBundle::ItemList* items);
65
66 // Sets the result_ as a string based on |code|.
67 void SetResult(ErrorCode code);
68
69 private:
70 scoped_refptr<WebstoreBundle> bundle_;
71 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.installBundle");
72 };
73
32 class BeginInstallWithManifestFunction 74 class BeginInstallWithManifestFunction
33 : public AsyncExtensionFunction, 75 : public AsyncExtensionFunction,
34 public ExtensionInstallUI::Delegate, 76 public ExtensionInstallUI::Delegate,
35 public WebstoreInstallHelper::Delegate { 77 public WebstoreInstallHelper::Delegate {
36 public: 78 public:
37 BeginInstallWithManifestFunction(); 79 BeginInstallWithManifestFunction();
38 80
39 // 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
40 // update the description for the beginInstallWithManifest3 callback in 82 // update the description for the beginInstallWithManifest3 callback in
41 // extension_api.json. 83 // extension_api.json.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 virtual bool RunImpl(); 160 virtual bool RunImpl();
119 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.getStoreLogin"); 161 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.getStoreLogin");
120 }; 162 };
121 163
122 class SetStoreLoginFunction : public SyncExtensionFunction { 164 class SetStoreLoginFunction : public SyncExtensionFunction {
123 virtual bool RunImpl(); 165 virtual bool RunImpl();
124 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.setStoreLogin"); 166 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.setStoreLogin");
125 }; 167 };
126 168
127 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_ 169 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_install_ui.cc ('k') | chrome/browser/extensions/extension_webstore_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698