| 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_INSTALL_PROMPT_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 explicit Prompt(PromptType type); | 82 explicit Prompt(PromptType type); |
| 83 ~Prompt(); | 83 ~Prompt(); |
| 84 | 84 |
| 85 // Sets the permission list for this prompt. | 85 // Sets the permission list for this prompt. |
| 86 void SetPermissions(const std::vector<base::string16>& permissions); | 86 void SetPermissions(const std::vector<base::string16>& permissions); |
| 87 // Sets the permission list details for this prompt. | 87 // Sets the permission list details for this prompt. |
| 88 void SetPermissionsDetails(const std::vector<base::string16>& details); | 88 void SetPermissionsDetails(const std::vector<base::string16>& details); |
| 89 void SetIsShowingDetails(DetailsType type, | 89 void SetIsShowingDetails(DetailsType type, |
| 90 size_t index, | 90 size_t index, |
| 91 bool is_showing_details); | 91 bool is_showing_details); |
| 92 void SetInlineInstallWebstoreData(const std::string& localized_user_count, | 92 void SetWebstoreData(const std::string& localized_user_count, |
| 93 bool show_user_count, | 93 bool show_user_count, |
| 94 double average_rating, | 94 double average_rating, |
| 95 int rating_count); | 95 int rating_count); |
| 96 void SetOAuthIssueAdvice(const IssueAdviceInfo& issue_advice); | 96 void SetOAuthIssueAdvice(const IssueAdviceInfo& issue_advice); |
| 97 void SetUserNameFromProfile(Profile* profile); | 97 void SetUserNameFromProfile(Profile* profile); |
| 98 | 98 |
| 99 PromptType type() const { return type_; } | 99 PromptType type() const { return type_; } |
| 100 void set_type(PromptType type) { type_ = type; } | 100 void set_type(PromptType type) { type_ = type; } |
| 101 | 101 |
| 102 // Getters for UI element labels. | 102 // Getters for UI element labels. |
| 103 base::string16 GetDialogTitle() const; | 103 base::string16 GetDialogTitle() const; |
| 104 base::string16 GetHeading() const; | 104 base::string16 GetHeading() const; |
| 105 int GetDialogButtons() const; | 105 int GetDialogButtons() const; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 148 } |
| 149 | 149 |
| 150 // May be populated for POST_INSTALL_PERMISSIONS_PROMPT. | 150 // May be populated for POST_INSTALL_PERMISSIONS_PROMPT. |
| 151 void set_retained_files(const std::vector<base::FilePath>& retained_files) { | 151 void set_retained_files(const std::vector<base::FilePath>& retained_files) { |
| 152 retained_files_ = retained_files; | 152 retained_files_ = retained_files; |
| 153 } | 153 } |
| 154 | 154 |
| 155 const gfx::Image& icon() const { return icon_; } | 155 const gfx::Image& icon() const { return icon_; } |
| 156 void set_icon(const gfx::Image& icon) { icon_ = icon; } | 156 void set_icon(const gfx::Image& icon) { icon_ = icon; } |
| 157 | 157 |
| 158 bool has_webstore_data() const { return has_webstore_data_; } |
| 159 |
| 158 const ExtensionInstallPromptExperiment* experiment() const { | 160 const ExtensionInstallPromptExperiment* experiment() const { |
| 159 return experiment_; | 161 return experiment_; |
| 160 } | 162 } |
| 161 | |
| 162 void set_experiment(ExtensionInstallPromptExperiment* experiment) { | 163 void set_experiment(ExtensionInstallPromptExperiment* experiment) { |
| 163 experiment_ = experiment; | 164 experiment_ = experiment; |
| 164 } | 165 } |
| 165 | 166 |
| 166 private: | 167 private: |
| 167 bool ShouldDisplayRevokeFilesButton() const; | 168 bool ShouldDisplayRevokeFilesButton() const; |
| 168 | 169 |
| 169 PromptType type_; | 170 PromptType type_; |
| 170 | 171 |
| 171 // Permissions that are being requested (may not be all of an extension's | 172 // Permissions that are being requested (may not be all of an extension's |
| (...skipping 23 matching lines...) Expand all Loading... |
| 195 // Already formatted to be locale-specific. | 196 // Already formatted to be locale-specific. |
| 196 std::string localized_user_count_; | 197 std::string localized_user_count_; |
| 197 // Range is kMinExtensionRating to kMaxExtensionRating | 198 // Range is kMinExtensionRating to kMaxExtensionRating |
| 198 double average_rating_; | 199 double average_rating_; |
| 199 int rating_count_; | 200 int rating_count_; |
| 200 | 201 |
| 201 // Whether we should display the user count (we anticipate this will be | 202 // Whether we should display the user count (we anticipate this will be |
| 202 // false if localized_user_count_ represents the number zero). | 203 // false if localized_user_count_ represents the number zero). |
| 203 bool show_user_count_; | 204 bool show_user_count_; |
| 204 | 205 |
| 206 // Whether or not this prompt has been populated with data from the |
| 207 // webstore. |
| 208 bool has_webstore_data_; |
| 209 |
| 205 std::vector<base::FilePath> retained_files_; | 210 std::vector<base::FilePath> retained_files_; |
| 206 | 211 |
| 207 scoped_refptr<ExtensionInstallPromptExperiment> experiment_; | 212 scoped_refptr<ExtensionInstallPromptExperiment> experiment_; |
| 208 }; | 213 }; |
| 209 | 214 |
| 210 static const int kMinExtensionRating = 0; | 215 static const int kMinExtensionRating = 0; |
| 211 static const int kMaxExtensionRating = 5; | 216 static const int kMaxExtensionRating = 5; |
| 212 | 217 |
| 213 class Delegate { | 218 class Delegate { |
| 214 public: | 219 public: |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 virtual void ConfirmReEnable(Delegate* delegate, | 325 virtual void ConfirmReEnable(Delegate* delegate, |
| 321 const extensions::Extension* extension); | 326 const extensions::Extension* extension); |
| 322 | 327 |
| 323 // This is called by the external install alert UI to verify whether the | 328 // This is called by the external install alert UI to verify whether the |
| 324 // extension should be enabled (external extensions are installed disabled). | 329 // extension should be enabled (external extensions are installed disabled). |
| 325 // | 330 // |
| 326 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. | 331 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. |
| 327 virtual void ConfirmExternalInstall( | 332 virtual void ConfirmExternalInstall( |
| 328 Delegate* delegate, | 333 Delegate* delegate, |
| 329 const extensions::Extension* extension, | 334 const extensions::Extension* extension, |
| 330 const ShowDialogCallback& show_dialog_callback); | 335 const ShowDialogCallback& show_dialog_callback, |
| 336 const Prompt& prompt); |
| 331 | 337 |
| 332 // This is called by the extension permissions API to verify whether an | 338 // This is called by the extension permissions API to verify whether an |
| 333 // extension may be granted additional permissions. | 339 // extension may be granted additional permissions. |
| 334 // | 340 // |
| 335 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. | 341 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. |
| 336 virtual void ConfirmPermissions(Delegate* delegate, | 342 virtual void ConfirmPermissions(Delegate* delegate, |
| 337 const extensions::Extension* extension, | 343 const extensions::Extension* extension, |
| 338 const extensions::PermissionSet* permissions); | 344 const extensions::PermissionSet* permissions); |
| 339 | 345 |
| 340 // This is called by the extension identity API to verify whether an | 346 // This is called by the extension identity API to verify whether an |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 Prompt prompt_; | 434 Prompt prompt_; |
| 429 | 435 |
| 430 scoped_ptr<OAuth2TokenService::Request> login_token_request_; | 436 scoped_ptr<OAuth2TokenService::Request> login_token_request_; |
| 431 scoped_ptr<OAuth2MintTokenFlow> token_flow_; | 437 scoped_ptr<OAuth2MintTokenFlow> token_flow_; |
| 432 | 438 |
| 433 // Used to show the confirm dialog. | 439 // Used to show the confirm dialog. |
| 434 ShowDialogCallback show_dialog_callback_; | 440 ShowDialogCallback show_dialog_callback_; |
| 435 }; | 441 }; |
| 436 | 442 |
| 437 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ | 443 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
| OLD | NEW |