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_WEBSTORE_STANDALONE_INSTALLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_STANDALONE_INSTALLER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_STANDALONE_INSTALLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_STANDALONE_INSTALLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 // In the very least this should return a dummy WebContents (required | 85 // In the very least this should return a dummy WebContents (required |
86 // by some calls even when no prompt or other UI is shown). A non-dummy | 86 // by some calls even when no prompt or other UI is shown). A non-dummy |
87 // WebContents is required if the prompt returned by CreateInstallPromt() | 87 // WebContents is required if the prompt returned by CreateInstallPromt() |
88 // contains a navigable link(s). Returned WebContents should correspond | 88 // contains a navigable link(s). Returned WebContents should correspond |
89 // to |profile| passed into the constructor. | 89 // to |profile| passed into the constructor. |
90 virtual content::WebContents* GetWebContents() const = 0; | 90 virtual content::WebContents* GetWebContents() const = 0; |
91 | 91 |
92 // Should return an installation prompt with desired properties or NULL if | 92 // Should return an installation prompt with desired properties or NULL if |
93 // no prompt should be shown. | 93 // no prompt should be shown. |
94 virtual scoped_ptr<ExtensionInstallPrompt::Prompt> | 94 virtual scoped_refptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt() |
95 CreateInstallPrompt() const = 0; | 95 const = 0; |
96 | 96 |
97 // Perform all necessary checks to make sure inline install is permitted, | 97 // Perform all necessary checks to make sure inline install is permitted, |
98 // e.g. in the extension's properties in the store. The implementation may | 98 // e.g. in the extension's properties in the store. The implementation may |
99 // choose to ignore such properties. | 99 // choose to ignore such properties. |
100 virtual bool CheckInlineInstallPermitted( | 100 virtual bool CheckInlineInstallPermitted( |
101 const base::DictionaryValue& webstore_data, | 101 const base::DictionaryValue& webstore_data, |
102 std::string* error) const = 0; | 102 std::string* error) const = 0; |
103 | 103 |
104 // Perform all necessary checks to make sure that requestor is allowed to | 104 // Perform all necessary checks to make sure that requestor is allowed to |
105 // initiate this install (e.g. that the requestor's URL matches the verified | 105 // initiate this install (e.g. that the requestor's URL matches the verified |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 void OnWebStoreDataFetcherDone(); | 189 void OnWebStoreDataFetcherDone(); |
190 | 190 |
191 // Input configuration. | 191 // Input configuration. |
192 std::string id_; | 192 std::string id_; |
193 Callback callback_; | 193 Callback callback_; |
194 Profile* profile_; | 194 Profile* profile_; |
195 WebstoreInstaller::InstallSource install_source_; | 195 WebstoreInstaller::InstallSource install_source_; |
196 | 196 |
197 // Installation dialog and its underlying prompt. | 197 // Installation dialog and its underlying prompt. |
198 scoped_ptr<ExtensionInstallPrompt> install_ui_; | 198 scoped_ptr<ExtensionInstallPrompt> install_ui_; |
199 scoped_ptr<ExtensionInstallPrompt::Prompt> install_prompt_; | 199 scoped_refptr<ExtensionInstallPrompt::Prompt> install_prompt_; |
200 | 200 |
201 // For fetching webstore JSON data. | 201 // For fetching webstore JSON data. |
202 scoped_ptr<WebstoreDataFetcher> webstore_data_fetcher_; | 202 scoped_ptr<WebstoreDataFetcher> webstore_data_fetcher_; |
203 | 203 |
204 // Extracted from the webstore JSON data response. | 204 // Extracted from the webstore JSON data response. |
205 std::string localized_name_; | 205 std::string localized_name_; |
206 std::string localized_description_; | 206 std::string localized_description_; |
207 bool show_user_count_; | 207 bool show_user_count_; |
208 std::string localized_user_count_; | 208 std::string localized_user_count_; |
209 double average_rating_; | 209 double average_rating_; |
210 int rating_count_; | 210 int rating_count_; |
211 scoped_ptr<base::DictionaryValue> webstore_data_; | 211 scoped_ptr<base::DictionaryValue> webstore_data_; |
212 scoped_ptr<base::DictionaryValue> manifest_; | 212 scoped_ptr<base::DictionaryValue> manifest_; |
213 SkBitmap icon_; | 213 SkBitmap icon_; |
214 | 214 |
215 // Created by ShowInstallUI() when a prompt is shown (if | 215 // Created by ShowInstallUI() when a prompt is shown (if |
216 // the implementor returns a non-NULL in CreateInstallPrompt()). | 216 // the implementor returns a non-NULL in CreateInstallPrompt()). |
217 scoped_refptr<Extension> localized_extension_for_display_; | 217 scoped_refptr<Extension> localized_extension_for_display_; |
218 | 218 |
219 DISALLOW_IMPLICIT_CONSTRUCTORS(WebstoreStandaloneInstaller); | 219 DISALLOW_IMPLICIT_CONSTRUCTORS(WebstoreStandaloneInstaller); |
220 }; | 220 }; |
221 | 221 |
222 } // namespace extensions | 222 } // namespace extensions |
223 | 223 |
224 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_STANDALONE_INSTALLER_H_ | 224 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_STANDALONE_INSTALLER_H_ |
OLD | NEW |