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

Side by Side Diff: chrome/browser/extensions/external_install_error.cc

Issue 501273002: Update extension install prompt to reflect withheld permissions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Prompt and Updater changes 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/extensions/external_install_error.h" 5 #include "chrome/browser/extensions/external_install_error.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 gfx::Size(extension_misc::EXTENSION_ICON_SMALL, 196 gfx::Size(extension_misc::EXTENSION_ICON_SMALL,
197 extension_misc::EXTENSION_ICON_SMALL))); 197 extension_misc::EXTENSION_ICON_SMALL)));
198 } 198 }
199 199
200 base::string16 ExternalInstallBubbleAlert::GetBubbleViewTitle() { 200 base::string16 ExternalInstallBubbleAlert::GetBubbleViewTitle() {
201 return prompt_->GetDialogTitle(); 201 return prompt_->GetDialogTitle();
202 } 202 }
203 203
204 std::vector<base::string16> 204 std::vector<base::string16>
205 ExternalInstallBubbleAlert::GetBubbleViewMessages() { 205 ExternalInstallBubbleAlert::GetBubbleViewMessages() {
206 ExtensionInstallPrompt::PermissionsType regular_permissions =
207 ExtensionInstallPrompt::PermissionsType::REGULAR_PERMISSIONS;
208 ExtensionInstallPrompt::PermissionsType withheld_permissions =
209 ExtensionInstallPrompt::PermissionsType::WITHHELD_PERMISSIONS;
210
206 std::vector<base::string16> messages; 211 std::vector<base::string16> messages;
207 messages.push_back(prompt_->GetHeading()); 212 messages.push_back(prompt_->GetHeading());
208 if (prompt_->GetPermissionCount()) { 213 if (prompt_->GetPermissionCount(regular_permissions)) {
209 messages.push_back(prompt_->GetPermissionsHeading()); 214 messages.push_back(prompt_->GetPermissionsHeading(regular_permissions));
210 for (size_t i = 0; i < prompt_->GetPermissionCount(); ++i) { 215 for (size_t i = 0; i < prompt_->GetPermissionCount(regular_permissions);
216 ++i) {
211 messages.push_back(l10n_util::GetStringFUTF16( 217 messages.push_back(l10n_util::GetStringFUTF16(
212 IDS_EXTENSION_PERMISSION_LINE, prompt_->GetPermission(i))); 218 IDS_EXTENSION_PERMISSION_LINE,
219 prompt_->GetPermission(i, regular_permissions)));
220 }
221 }
222 if (prompt_->GetPermissionCount(withheld_permissions)) {
223 messages.push_back(prompt_->GetPermissionsHeading(withheld_permissions));
224 for (size_t i = 0; i < prompt_->GetPermissionCount(withheld_permissions);
225 ++i) {
226 messages.push_back(l10n_util::GetStringFUTF16(
227 IDS_EXTENSION_PERMISSION_LINE,
228 prompt_->GetPermission(i, withheld_permissions)));
gpdavis 2014/09/08 20:07:05 Do you think this warrants some sort of loop to re
Devlin 2014/09/09 15:53:21 Yeah, I was wondering if it would... but I think i
gpdavis 2014/09/09 17:32:41 Sweet.
213 } 229 }
214 } 230 }
215 // TODO(yoz): OAuth issue advice? 231 // TODO(yoz): OAuth issue advice?
216 return messages; 232 return messages;
217 } 233 }
218 234
219 base::string16 ExternalInstallBubbleAlert::GetBubbleViewAcceptButtonLabel() { 235 base::string16 ExternalInstallBubbleAlert::GetBubbleViewAcceptButtonLabel() {
220 return prompt_->GetAcceptButtonLabel(); 236 return prompt_->GetAcceptButtonLabel();
221 } 237 }
222 238
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 if (browser) 395 if (browser)
380 global_error_->ShowBubbleView(browser); 396 global_error_->ShowBubbleView(browser);
381 } else { 397 } else {
382 DCHECK(alert_type_ == MENU_ALERT); 398 DCHECK(alert_type_ == MENU_ALERT);
383 global_error_.reset(new ExternalInstallMenuAlert(this)); 399 global_error_.reset(new ExternalInstallMenuAlert(this));
384 error_service_->AddGlobalError(global_error_.get()); 400 error_service_->AddGlobalError(global_error_.get());
385 } 401 }
386 } 402 }
387 403
388 } // namespace extensions 404 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_install_prompt_unittest.cc ('k') | chrome/browser/extensions/permissions_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698