| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 // Extra information needed to display an installation or uninstallation | 64 // Extra information needed to display an installation or uninstallation |
| 65 // prompt. Gets populated with raw data and exposes getters for formatted | 65 // prompt. Gets populated with raw data and exposes getters for formatted |
| 66 // strings so that the GTK/views/Cocoa install dialogs don't have to repeat | 66 // strings so that the GTK/views/Cocoa install dialogs don't have to repeat |
| 67 // that logic. | 67 // that logic. |
| 68 class Prompt { | 68 class Prompt { |
| 69 public: | 69 public: |
| 70 explicit Prompt(PromptType type); | 70 explicit Prompt(PromptType type); |
| 71 ~Prompt(); | 71 ~Prompt(); |
| 72 | 72 |
| 73 // Sets the permission list for this prompt. |
| 73 void SetPermissions(const std::vector<string16>& permissions); | 74 void SetPermissions(const std::vector<string16>& permissions); |
| 75 // Sets the permission list details for this prompt. |
| 76 void SetPermissionsDetails(const std::vector<string16>& details); |
| 74 void SetInlineInstallWebstoreData(const std::string& localized_user_count, | 77 void SetInlineInstallWebstoreData(const std::string& localized_user_count, |
| 75 double average_rating, | 78 double average_rating, |
| 76 int rating_count); | 79 int rating_count); |
| 77 void SetOAuthIssueAdvice(const IssueAdviceInfo& issue_advice); | 80 void SetOAuthIssueAdvice(const IssueAdviceInfo& issue_advice); |
| 78 void SetUserNameFromProfile(Profile* profile); | 81 void SetUserNameFromProfile(Profile* profile); |
| 79 | 82 |
| 80 PromptType type() const { return type_; } | 83 PromptType type() const { return type_; } |
| 81 void set_type(PromptType type) { type_ = type; } | 84 void set_type(PromptType type) { type_ = type; } |
| 82 | 85 |
| 83 // Getters for UI element labels. | 86 // Getters for UI element labels. |
| 84 string16 GetDialogTitle() const; | 87 string16 GetDialogTitle() const; |
| 85 string16 GetHeading() const; | 88 string16 GetHeading() const; |
| 86 int GetDialogButtons() const; | 89 int GetDialogButtons() const; |
| 87 bool HasAcceptButtonLabel() const; | 90 bool HasAcceptButtonLabel() const; |
| 88 string16 GetAcceptButtonLabel() const; | 91 string16 GetAcceptButtonLabel() const; |
| 89 bool HasAbortButtonLabel() const; | 92 bool HasAbortButtonLabel() const; |
| 90 string16 GetAbortButtonLabel() const; | 93 string16 GetAbortButtonLabel() const; |
| 91 string16 GetPermissionsHeading() const; | 94 string16 GetPermissionsHeading() const; |
| 92 string16 GetOAuthHeading() const; | 95 string16 GetOAuthHeading() const; |
| 93 string16 GetRetainedFilesHeading() const; | 96 string16 GetRetainedFilesHeading() const; |
| 97 string16 GetRetainedFilesHeadingWithCount() const; |
| 98 |
| 94 bool ShouldShowPermissions() const; | 99 bool ShouldShowPermissions() const; |
| 95 | 100 |
| 96 // Getters for webstore metadata. Only populated when the type is | 101 // Getters for webstore metadata. Only populated when the type is |
| 97 // INLINE_INSTALL_PROMPT. | 102 // INLINE_INSTALL_PROMPT. |
| 98 | 103 |
| 99 // The star display logic replicates the one used by the webstore (from | 104 // The star display logic replicates the one used by the webstore (from |
| 100 // components.ratingutils.setFractionalYellowStars). Callers pass in an | 105 // components.ratingutils.setFractionalYellowStars). Callers pass in an |
| 101 // "appender", which will be repeatedly called back with the star images | 106 // "appender", which will be repeatedly called back with the star images |
| 102 // that they append to the star display area. | 107 // that they append to the star display area. |
| 103 typedef void(*StarAppender)(const gfx::ImageSkia*, void*); | 108 typedef void(*StarAppender)(const gfx::ImageSkia*, void*); |
| 104 void AppendRatingStars(StarAppender appender, void* data) const; | 109 void AppendRatingStars(StarAppender appender, void* data) const; |
| 105 string16 GetRatingCount() const; | 110 string16 GetRatingCount() const; |
| 106 string16 GetUserCount() const; | 111 string16 GetUserCount() const; |
| 107 size_t GetPermissionCount() const; | 112 size_t GetPermissionCount() const; |
| 113 size_t GetPermissionsDetailsCount() const; |
| 108 string16 GetPermission(size_t index) const; | 114 string16 GetPermission(size_t index) const; |
| 115 string16 GetPermissionsDetails(size_t index) const; |
| 109 size_t GetOAuthIssueCount() const; | 116 size_t GetOAuthIssueCount() const; |
| 110 const IssueAdviceInfoEntry& GetOAuthIssue(size_t index) const; | 117 const IssueAdviceInfoEntry& GetOAuthIssue(size_t index) const; |
| 111 size_t GetRetainedFileCount() const; | 118 size_t GetRetainedFileCount() const; |
| 112 string16 GetRetainedFile(size_t index) const; | 119 string16 GetRetainedFile(size_t index) const; |
| 113 | 120 |
| 114 // Populated for BUNDLE_INSTALL_PROMPT. | 121 // Populated for BUNDLE_INSTALL_PROMPT. |
| 115 const extensions::BundleInstaller* bundle() const { return bundle_; } | 122 const extensions::BundleInstaller* bundle() const { return bundle_; } |
| 116 void set_bundle(const extensions::BundleInstaller* bundle) { | 123 void set_bundle(const extensions::BundleInstaller* bundle) { |
| 117 bundle_ = bundle; | 124 bundle_ = bundle; |
| 118 } | 125 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 132 void set_icon(const gfx::Image& icon) { icon_ = icon; } | 139 void set_icon(const gfx::Image& icon) { icon_ = icon; } |
| 133 | 140 |
| 134 private: | 141 private: |
| 135 bool ShouldDisplayRevokeFilesButton() const; | 142 bool ShouldDisplayRevokeFilesButton() const; |
| 136 | 143 |
| 137 PromptType type_; | 144 PromptType type_; |
| 138 | 145 |
| 139 // Permissions that are being requested (may not be all of an extension's | 146 // Permissions that are being requested (may not be all of an extension's |
| 140 // permissions if only additional ones are being requested) | 147 // permissions if only additional ones are being requested) |
| 141 std::vector<string16> permissions_; | 148 std::vector<string16> permissions_; |
| 149 std::vector<string16> details_; |
| 142 | 150 |
| 143 // Descriptions and details for OAuth2 permissions to display to the user. | 151 // Descriptions and details for OAuth2 permissions to display to the user. |
| 144 // These correspond to permission scopes. | 152 // These correspond to permission scopes. |
| 145 IssueAdviceInfo oauth_issue_advice_; | 153 IssueAdviceInfo oauth_issue_advice_; |
| 146 | 154 |
| 147 // User name to be used in Oauth heading label. | 155 // User name to be used in Oauth heading label. |
| 148 string16 oauth_user_name_; | 156 string16 oauth_user_name_; |
| 149 | 157 |
| 150 // The extension or bundle being installed. | 158 // The extension or bundle being installed. |
| 151 const extensions::Extension* extension_; | 159 const extensions::Extension* extension_; |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 // A pre-filled prompt. | 389 // A pre-filled prompt. |
| 382 Prompt prompt_; | 390 Prompt prompt_; |
| 383 | 391 |
| 384 scoped_ptr<OAuth2MintTokenFlow> token_flow_; | 392 scoped_ptr<OAuth2MintTokenFlow> token_flow_; |
| 385 | 393 |
| 386 // Used to show the confirm dialog. | 394 // Used to show the confirm dialog. |
| 387 ShowDialogCallback show_dialog_callback_; | 395 ShowDialogCallback show_dialog_callback_; |
| 388 }; | 396 }; |
| 389 | 397 |
| 390 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ | 398 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
| OLD | NEW |