OLD | NEW |
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 Loading... |
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))); |
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 Loading... |
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 |
OLD | NEW |