| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 public base::SupportsWeakPtr<ExtensionInstallPrompt> { | 48 public base::SupportsWeakPtr<ExtensionInstallPrompt> { |
| 49 public: | 49 public: |
| 50 enum PromptType { | 50 enum PromptType { |
| 51 UNSET_PROMPT_TYPE = -1, | 51 UNSET_PROMPT_TYPE = -1, |
| 52 INSTALL_PROMPT = 0, | 52 INSTALL_PROMPT = 0, |
| 53 INLINE_INSTALL_PROMPT, | 53 INLINE_INSTALL_PROMPT, |
| 54 BUNDLE_INSTALL_PROMPT, | 54 BUNDLE_INSTALL_PROMPT, |
| 55 RE_ENABLE_PROMPT, | 55 RE_ENABLE_PROMPT, |
| 56 PERMISSIONS_PROMPT, | 56 PERMISSIONS_PROMPT, |
| 57 EXTERNAL_INSTALL_PROMPT, | 57 EXTERNAL_INSTALL_PROMPT, |
| 58 POST_INSTALL_PERMISSIONS_PROMPT, |
| 58 NUM_PROMPT_TYPES | 59 NUM_PROMPT_TYPES |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 // Extra information needed to display an installation or uninstallation | 62 // Extra information needed to display an installation or uninstallation |
| 62 // prompt. Gets populated with raw data and exposes getters for formatted | 63 // prompt. Gets populated with raw data and exposes getters for formatted |
| 63 // strings so that the GTK/views/Cocoa install dialogs don't have to repeat | 64 // strings so that the GTK/views/Cocoa install dialogs don't have to repeat |
| 64 // that logic. | 65 // that logic. |
| 65 class Prompt { | 66 class Prompt { |
| 66 public: | 67 public: |
| 67 explicit Prompt(PromptType type); | 68 explicit Prompt(PromptType type); |
| 68 ~Prompt(); | 69 ~Prompt(); |
| 69 | 70 |
| 70 void SetPermissions(const std::vector<string16>& permissions); | 71 void SetPermissions(const std::vector<string16>& permissions); |
| 71 void SetInlineInstallWebstoreData(const std::string& localized_user_count, | 72 void SetInlineInstallWebstoreData(const std::string& localized_user_count, |
| 72 double average_rating, | 73 double average_rating, |
| 73 int rating_count); | 74 int rating_count); |
| 74 void SetOAuthIssueAdvice(const IssueAdviceInfo& issue_advice); | 75 void SetOAuthIssueAdvice(const IssueAdviceInfo& issue_advice); |
| 75 void SetUserNameFromProfile(Profile* profile); | 76 void SetUserNameFromProfile(Profile* profile); |
| 76 | 77 |
| 77 PromptType type() const { return type_; } | 78 PromptType type() const { return type_; } |
| 78 void set_type(PromptType type) { type_ = type; } | 79 void set_type(PromptType type) { type_ = type; } |
| 79 | 80 |
| 80 // Getters for UI element labels. | 81 // Getters for UI element labels. |
| 81 string16 GetDialogTitle() const; | 82 string16 GetDialogTitle() const; |
| 82 string16 GetHeading() const; | 83 string16 GetHeading() const; |
| 84 int GetDialogButtons() const; |
| 83 string16 GetAcceptButtonLabel() const; | 85 string16 GetAcceptButtonLabel() const; |
| 84 bool HasAbortButtonLabel() const; | 86 bool HasAbortButtonLabel() const; |
| 85 string16 GetAbortButtonLabel() const; | 87 string16 GetAbortButtonLabel() const; |
| 86 string16 GetPermissionsHeading() const; | 88 string16 GetPermissionsHeading() const; |
| 87 string16 GetOAuthHeading() const; | 89 string16 GetOAuthHeading() const; |
| 88 | 90 |
| 89 // Getters for webstore metadata. Only populated when the type is | 91 // Getters for webstore metadata. Only populated when the type is |
| 90 // INLINE_INSTALL_PROMPT. | 92 // INLINE_INSTALL_PROMPT. |
| 91 | 93 |
| 92 // The star display logic replicates the one used by the webstore (from | 94 // The star display logic replicates the one used by the webstore (from |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 const extensions::PermissionSet* permissions); | 274 const extensions::PermissionSet* permissions); |
| 273 | 275 |
| 274 // This is called by the extension identity API to verify whether an | 276 // This is called by the extension identity API to verify whether an |
| 275 // extension can be granted an OAuth2 token. | 277 // extension can be granted an OAuth2 token. |
| 276 // | 278 // |
| 277 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. | 279 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. |
| 278 virtual void ConfirmIssueAdvice(Delegate* delegate, | 280 virtual void ConfirmIssueAdvice(Delegate* delegate, |
| 279 const extensions::Extension* extension, | 281 const extensions::Extension* extension, |
| 280 const IssueAdviceInfo& issue_advice); | 282 const IssueAdviceInfo& issue_advice); |
| 281 | 283 |
| 284 // This is called by the app handler launcher to review what permissions the |
| 285 // extension or app currently has. |
| 286 // |
| 287 // This *WILL* call Abort() on |delegate|. |
| 288 virtual void ReviewPermissions(Delegate* delegate, |
| 289 const extensions::Extension* extension); |
| 290 |
| 282 // Installation was successful. This is declared virtual for testing. | 291 // Installation was successful. This is declared virtual for testing. |
| 283 virtual void OnInstallSuccess(const extensions::Extension* extension, | 292 virtual void OnInstallSuccess(const extensions::Extension* extension, |
| 284 SkBitmap* icon); | 293 SkBitmap* icon); |
| 285 | 294 |
| 286 // Installation failed. This is declared virtual for testing. | 295 // Installation failed. This is declared virtual for testing. |
| 287 virtual void OnInstallFailure(const extensions::CrxInstallerError& error); | 296 virtual void OnInstallFailure(const extensions::CrxInstallerError& error); |
| 288 | 297 |
| 289 protected: | 298 protected: |
| 290 friend class extensions::ExtensionWebstorePrivateApiTest; | 299 friend class extensions::ExtensionWebstorePrivateApiTest; |
| 291 friend class WebstoreStandaloneInstallUnpackFailureTest; | 300 friend class WebstoreStandaloneInstallUnpackFailureTest; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 // A pre-filled prompt. | 357 // A pre-filled prompt. |
| 349 Prompt prompt_; | 358 Prompt prompt_; |
| 350 | 359 |
| 351 scoped_ptr<OAuth2MintTokenFlow> token_flow_; | 360 scoped_ptr<OAuth2MintTokenFlow> token_flow_; |
| 352 | 361 |
| 353 // Used to show the confirm dialog. | 362 // Used to show the confirm dialog. |
| 354 ShowDialogCallback show_dialog_callback_; | 363 ShowDialogCallback show_dialog_callback_; |
| 355 }; | 364 }; |
| 356 | 365 |
| 357 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ | 366 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
| OLD | NEW |