Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: chrome/browser/extensions/extension_install_prompt.h

Issue 501273002: Update extension install prompt to reflect withheld permissions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added withheld permissions to install prompt Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 PERMISSIONS_PROMPT, 73 PERMISSIONS_PROMPT,
74 EXTERNAL_INSTALL_PROMPT, 74 EXTERNAL_INSTALL_PROMPT,
75 POST_INSTALL_PERMISSIONS_PROMPT, 75 POST_INSTALL_PERMISSIONS_PROMPT,
76 LAUNCH_PROMPT, 76 LAUNCH_PROMPT,
77 REMOTE_INSTALL_PROMPT, 77 REMOTE_INSTALL_PROMPT,
78 NUM_PROMPT_TYPES 78 NUM_PROMPT_TYPES
79 }; 79 };
80 80
81 enum DetailsType { 81 enum DetailsType {
82 PERMISSIONS_DETAILS = 0, 82 PERMISSIONS_DETAILS = 0,
83 WITHHELD_PERMISSIONS_DETAILS,
83 RETAINED_FILES_DETAILS, 84 RETAINED_FILES_DETAILS,
84 }; 85 };
85 86
86 static std::string PromptTypeToString(PromptType type); 87 static std::string PromptTypeToString(PromptType type);
87 88
88 // Extra information needed to display an installation or uninstallation 89 // Extra information needed to display an installation or uninstallation
89 // prompt. Gets populated with raw data and exposes getters for formatted 90 // prompt. Gets populated with raw data and exposes getters for formatted
90 // strings so that the GTK/views/Cocoa install dialogs don't have to repeat 91 // strings so that the GTK/views/Cocoa install dialogs don't have to repeat
91 // that logic. 92 // that logic.
92 // Ref-counted because we pass around the prompt independent of the full 93 // Ref-counted because we pass around the prompt independent of the full
93 // ExtensionInstallPrompt. 94 // ExtensionInstallPrompt.
94 class Prompt : public base::RefCountedThreadSafe<Prompt> { 95 class Prompt : public base::RefCountedThreadSafe<Prompt> {
95 public: 96 public:
96 explicit Prompt(PromptType type); 97 explicit Prompt(PromptType type);
97 98
98 // Sets the permission list for this prompt. 99 // Sets the permission list for this prompt.
99 void SetPermissions(const std::vector<base::string16>& permissions); 100 void SetPermissions(const std::vector<base::string16>& permissions,
101 bool withheld);
100 // Sets the permission list details for this prompt. 102 // Sets the permission list details for this prompt.
101 void SetPermissionsDetails(const std::vector<base::string16>& details); 103 void SetPermissionsDetails(const std::vector<base::string16>& details,
104 bool withheld);
102 void SetIsShowingDetails(DetailsType type, 105 void SetIsShowingDetails(DetailsType type,
103 size_t index, 106 size_t index,
104 bool is_showing_details); 107 bool is_showing_details);
105 void SetWebstoreData(const std::string& localized_user_count, 108 void SetWebstoreData(const std::string& localized_user_count,
106 bool show_user_count, 109 bool show_user_count,
107 double average_rating, 110 double average_rating,
108 int rating_count); 111 int rating_count);
109 void SetUserNameFromProfile(Profile* profile); 112 void SetUserNameFromProfile(Profile* profile);
110 113
111 PromptType type() const { return type_; } 114 PromptType type() const { return type_; }
112 void set_type(PromptType type) { type_ = type; } 115 void set_type(PromptType type) { type_ = type; }
113 116
114 // Getters for UI element labels. 117 // Getters for UI element labels.
115 base::string16 GetDialogTitle() const; 118 base::string16 GetDialogTitle() const;
116 base::string16 GetHeading() const; 119 base::string16 GetHeading() const;
120 base::string16 GetWithheldHeading() const;
117 int GetDialogButtons() const; 121 int GetDialogButtons() const;
118 bool HasAcceptButtonLabel() const; 122 bool HasAcceptButtonLabel() const;
119 base::string16 GetAcceptButtonLabel() const; 123 base::string16 GetAcceptButtonLabel() const;
120 bool HasAbortButtonLabel() const; 124 bool HasAbortButtonLabel() const;
121 base::string16 GetAbortButtonLabel() const; 125 base::string16 GetAbortButtonLabel() const;
122 base::string16 GetPermissionsHeading() const; 126 base::string16 GetPermissionsHeading() const;
123 base::string16 GetRetainedFilesHeading() const; 127 base::string16 GetRetainedFilesHeading() const;
124 128
125 bool ShouldShowPermissions() const; 129 bool ShouldShowPermissions() const;
126 bool ShouldShowExplanationText() const; 130 bool ShouldShowExplanationText() const;
127 131
128 // Getters for webstore metadata. Only populated when the type is 132 // Getters for webstore metadata. Only populated when the type is
129 // INLINE_INSTALL_PROMPT. 133 // INLINE_INSTALL_PROMPT.
130 134
131 // The star display logic replicates the one used by the webstore (from 135 // The star display logic replicates the one used by the webstore (from
132 // components.ratingutils.setFractionalYellowStars). Callers pass in an 136 // components.ratingutils.setFractionalYellowStars). Callers pass in an
133 // "appender", which will be repeatedly called back with the star images 137 // "appender", which will be repeatedly called back with the star images
134 // that they append to the star display area. 138 // that they append to the star display area.
135 typedef void(*StarAppender)(const gfx::ImageSkia*, void*); 139 typedef void(*StarAppender)(const gfx::ImageSkia*, void*);
136 void AppendRatingStars(StarAppender appender, void* data) const; 140 void AppendRatingStars(StarAppender appender, void* data) const;
137 base::string16 GetRatingCount() const; 141 base::string16 GetRatingCount() const;
138 base::string16 GetUserCount() const; 142 base::string16 GetUserCount() const;
139 size_t GetPermissionCount() const; 143 size_t GetPermissionCount() const;
140 size_t GetPermissionsDetailsCount() const; 144 size_t GetPermissionsDetailsCount() const;
141 base::string16 GetPermission(size_t index) const; 145 base::string16 GetPermission(size_t index) const;
142 base::string16 GetPermissionsDetails(size_t index) const; 146 base::string16 GetPermissionsDetails(size_t index) const;
147 size_t GetWithheldPermissionCount() const;
148 size_t GetWithheldPermissionsDetailsCount() const;
149 base::string16 GetWithheldPermission(size_t index) const;
150 base::string16 GetWithheldPermissionsDetails(size_t index) const;
143 bool GetIsShowingDetails(DetailsType type, size_t index) const; 151 bool GetIsShowingDetails(DetailsType type, size_t index) const;
144 size_t GetRetainedFileCount() const; 152 size_t GetRetainedFileCount() const;
145 base::string16 GetRetainedFile(size_t index) const; 153 base::string16 GetRetainedFile(size_t index) const;
146 154
147 // Populated for BUNDLE_INSTALL_PROMPT. 155 // Populated for BUNDLE_INSTALL_PROMPT.
148 const extensions::BundleInstaller* bundle() const { return bundle_; } 156 const extensions::BundleInstaller* bundle() const { return bundle_; }
149 void set_bundle(const extensions::BundleInstaller* bundle) { 157 void set_bundle(const extensions::BundleInstaller* bundle) {
150 bundle_ = bundle; 158 bundle_ = bundle;
151 } 159 }
152 160
(...skipping 25 matching lines...) Expand all
178 186
179 virtual ~Prompt(); 187 virtual ~Prompt();
180 188
181 bool ShouldDisplayRevokeFilesButton() const; 189 bool ShouldDisplayRevokeFilesButton() const;
182 190
183 PromptType type_; 191 PromptType type_;
184 192
185 // Permissions that are being requested (may not be all of an extension's 193 // Permissions that are being requested (may not be all of an extension's
186 // permissions if only additional ones are being requested) 194 // permissions if only additional ones are being requested)
187 std::vector<base::string16> permissions_; 195 std::vector<base::string16> permissions_;
196 std::vector<base::string16> withheld_permissions_;
188 std::vector<base::string16> details_; 197 std::vector<base::string16> details_;
198 std::vector<base::string16> withheld_details_;
189 std::vector<bool> is_showing_details_for_permissions_; 199 std::vector<bool> is_showing_details_for_permissions_;
200 std::vector<bool> is_showing_details_for_withheld_permissions_;
190 bool is_showing_details_for_retained_files_; 201 bool is_showing_details_for_retained_files_;
191 202
192 // The extension or bundle being installed. 203 // The extension or bundle being installed.
193 const extensions::Extension* extension_; 204 const extensions::Extension* extension_;
194 const extensions::BundleInstaller* bundle_; 205 const extensions::BundleInstaller* bundle_;
195 206
196 // The icon to be displayed. 207 // The icon to be displayed.
197 gfx::Image icon_; 208 gfx::Image icon_;
198 209
199 // These fields are populated only when the prompt type is 210 // These fields are populated only when the prompt type is
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 Delegate* delegate_; 429 Delegate* delegate_;
419 430
420 // A pre-filled prompt. 431 // A pre-filled prompt.
421 scoped_refptr<Prompt> prompt_; 432 scoped_refptr<Prompt> prompt_;
422 433
423 // Used to show the confirm dialog. 434 // Used to show the confirm dialog.
424 ShowDialogCallback show_dialog_callback_; 435 ShowDialogCallback show_dialog_callback_;
425 }; 436 };
426 437
427 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ 438 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698