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_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/bundle_installer.h" | 11 #include "chrome/browser/extensions/bundle_installer.h" |
12 #include "chrome/browser/extensions/extension_function.h" | 12 #include "chrome/browser/extensions/extension_function.h" |
13 #include "chrome/browser/extensions/extension_install_ui.h" | 13 #include "chrome/browser/extensions/extension_install_prompt.h" |
14 #include "chrome/browser/extensions/webstore_install_helper.h" | 14 #include "chrome/browser/extensions/webstore_install_helper.h" |
15 #include "chrome/browser/extensions/webstore_installer.h" | 15 #include "chrome/browser/extensions/webstore_installer.h" |
16 #include "chrome/common/net/gaia/google_service_auth_error.h" | 16 #include "chrome/common/net/gaia/google_service_auth_error.h" |
17 #include "content/public/browser/gpu_data_manager_observer.h" | 17 #include "content/public/browser/gpu_data_manager_observer.h" |
18 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
20 | 20 |
21 class ProfileSyncService; | 21 class ProfileSyncService; |
22 | 22 |
23 namespace content { | 23 namespace content { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 // Reads the extension |details| into |items|. | 66 // Reads the extension |details| into |items|. |
67 bool ReadBundleInfo(base::ListValue* details, | 67 bool ReadBundleInfo(base::ListValue* details, |
68 extensions::BundleInstaller::ItemList* items); | 68 extensions::BundleInstaller::ItemList* items); |
69 | 69 |
70 private: | 70 private: |
71 scoped_refptr<extensions::BundleInstaller> bundle_; | 71 scoped_refptr<extensions::BundleInstaller> bundle_; |
72 }; | 72 }; |
73 | 73 |
74 class BeginInstallWithManifestFunction | 74 class BeginInstallWithManifestFunction |
75 : public AsyncExtensionFunction, | 75 : public AsyncExtensionFunction, |
76 public ExtensionInstallUI::Delegate, | 76 public ExtensionInstallPrompt::Delegate, |
77 public WebstoreInstallHelper::Delegate { | 77 public WebstoreInstallHelper::Delegate { |
78 public: | 78 public: |
79 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.beginInstallWithManifest3"); | 79 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.beginInstallWithManifest3"); |
80 | 80 |
81 // 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 |
82 // update the description for the beginInstallWithManifest3 callback in | 82 // update the description for the beginInstallWithManifest3 callback in |
83 // the extension API JSON. | 83 // the extension API JSON. |
84 enum ResultCode { | 84 enum ResultCode { |
85 ERROR_NONE = 0, | 85 ERROR_NONE = 0, |
86 | 86 |
(...skipping 24 matching lines...) Expand all Loading... | |
111 // WebstoreInstallHelper::Delegate: | 111 // WebstoreInstallHelper::Delegate: |
112 virtual void OnWebstoreParseSuccess( | 112 virtual void OnWebstoreParseSuccess( |
113 const std::string& id, | 113 const std::string& id, |
114 const SkBitmap& icon, | 114 const SkBitmap& icon, |
115 base::DictionaryValue* parsed_manifest) OVERRIDE; | 115 base::DictionaryValue* parsed_manifest) OVERRIDE; |
116 virtual void OnWebstoreParseFailure( | 116 virtual void OnWebstoreParseFailure( |
117 const std::string& id, | 117 const std::string& id, |
118 InstallHelperResultCode result_code, | 118 InstallHelperResultCode result_code, |
119 const std::string& error_message) OVERRIDE; | 119 const std::string& error_message) OVERRIDE; |
120 | 120 |
121 // ExtensionInstallUI::Delegate: | 121 // ExtensionInstallPrompt::Delegate: |
122 virtual void InstallUIProceed() OVERRIDE; | 122 virtual void InstallUIProceed() OVERRIDE; |
123 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; | 123 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; |
124 | 124 |
125 protected: | 125 protected: |
126 virtual ~BeginInstallWithManifestFunction(); | 126 virtual ~BeginInstallWithManifestFunction(); |
127 | 127 |
128 // ExtensionFunction: | 128 // ExtensionFunction: |
129 virtual bool RunImpl() OVERRIDE; | 129 virtual bool RunImpl() OVERRIDE; |
130 | 130 |
131 // Sets the result_ as a string based on |code|. | 131 // Sets the result_ as a string based on |code|. |
132 void SetResult(ResultCode code); | 132 void SetResult(ResultCode code); |
133 | 133 |
134 private: | 134 private: |
135 // These store the input parameters to the function. | 135 // These store the input parameters to the function. |
136 std::string id_; | 136 std::string id_; |
137 std::string manifest_; | 137 std::string manifest_; |
138 std::string icon_data_; | 138 std::string icon_data_; |
139 std::string localized_name_; | 139 std::string localized_name_; |
140 bool use_app_installed_bubble_; | 140 bool use_app_installed_bubble_; |
141 | 141 |
142 // 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. |
143 scoped_ptr<base::DictionaryValue> parsed_manifest_; | 143 scoped_ptr<base::DictionaryValue> parsed_manifest_; |
144 SkBitmap icon_; | 144 SkBitmap icon_; |
145 | 145 |
146 // A dummy Extension object we create for the purposes of using | 146 // A dummy Extension object we create for the purposes of using |
147 // ExtensionInstallUI to prompt for confirmation of the install. | 147 // ExtensionInstallPrompt to prompt for confirmation of the install. |
148 scoped_refptr<extensions::Extension> dummy_extension_; | 148 scoped_refptr<extensions::Extension> dummy_extension_; |
149 | 149 |
150 // The class that displays the install prompt. | 150 // The class that displays the install prompt. |
151 scoped_ptr<ExtensionInstallUI> install_ui_; | 151 scoped_ptr<ExtensionInstallPrompt> install_ui_; |
Yoyo Zhou
2012/05/23 23:17:49
nit: rename
Jay Civelli
2012/05/30 20:20:35
Done.
| |
152 }; | 152 }; |
153 | 153 |
154 class CompleteInstallFunction : public SyncExtensionFunction { | 154 class CompleteInstallFunction : public SyncExtensionFunction { |
155 public: | 155 public: |
156 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.completeInstall"); | 156 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.completeInstall"); |
157 | 157 |
158 protected: | 158 protected: |
159 virtual ~CompleteInstallFunction() {} | 159 virtual ~CompleteInstallFunction() {} |
160 | 160 |
161 // ExtensionFunction: | 161 // ExtensionFunction: |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 | 247 |
248 private: | 248 private: |
249 void CreateResult(bool webgl_allowed); | 249 void CreateResult(bool webgl_allowed); |
250 | 250 |
251 // 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 |
252 // GPU info has been collected in a GPU process. | 252 // GPU info has been collected in a GPU process. |
253 static bool IsWebGLAllowed(content::GpuDataManager* manager); | 253 static bool IsWebGLAllowed(content::GpuDataManager* manager); |
254 }; | 254 }; |
255 | 255 |
256 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_ | 256 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_ |
OLD | NEW |