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

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

Issue 1004123003: Extensions: Switch to new permission message system, part III (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permissions_tests
Patch Set: Mac Created 5 years, 9 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 #include "chrome/browser/extensions/extension_disabled_ui.h" 5 #include "chrome/browser/extensions/extension_disabled_ui.h"
6 6
7 #include <bitset> 7 #include <bitset>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 24 matching lines...) Expand all
35 #include "content/public/browser/notification_source.h" 35 #include "content/public/browser/notification_source.h"
36 #include "extensions/browser/extension_util.h" 36 #include "extensions/browser/extension_util.h"
37 #include "extensions/browser/image_loader.h" 37 #include "extensions/browser/image_loader.h"
38 #include "extensions/browser/notification_types.h" 38 #include "extensions/browser/notification_types.h"
39 #include "extensions/browser/uninstall_reason.h" 39 #include "extensions/browser/uninstall_reason.h"
40 #include "extensions/common/constants.h" 40 #include "extensions/common/constants.h"
41 #include "extensions/common/extension.h" 41 #include "extensions/common/extension.h"
42 #include "extensions/common/extension_icon_set.h" 42 #include "extensions/common/extension_icon_set.h"
43 #include "extensions/common/manifest_handlers/icons_handler.h" 43 #include "extensions/common/manifest_handlers/icons_handler.h"
44 #include "extensions/common/permissions/permission_message_provider.h" 44 #include "extensions/common/permissions/permission_message_provider.h"
45 #include "extensions/common/permissions/permission_set.h"
46 #include "extensions/common/permissions/permissions_data.h" 45 #include "extensions/common/permissions/permissions_data.h"
47 #include "ui/base/l10n/l10n_util.h" 46 #include "ui/base/l10n/l10n_util.h"
48 #include "ui/gfx/geometry/size.h" 47 #include "ui/gfx/geometry/size.h"
49 #include "ui/gfx/image/image.h" 48 #include "ui/gfx/image/image.h"
50 #include "ui/gfx/image/image_skia_operations.h" 49 #include "ui/gfx/image/image_skia_operations.h"
51 50
52 using extensions::Extension; 51 using extensions::Extension;
53 52
54 namespace { 53 namespace {
55 54
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 base::UTF8ToUTF16(extension_->name())); 284 base::UTF8ToUTF16(extension_->name()));
286 } else { 285 } else {
287 return l10n_util::GetStringFUTF16(IDS_EXTENSION_DISABLED_ERROR_TITLE, 286 return l10n_util::GetStringFUTF16(IDS_EXTENSION_DISABLED_ERROR_TITLE,
288 base::UTF8ToUTF16(extension_->name())); 287 base::UTF8ToUTF16(extension_->name()));
289 } 288 }
290 } 289 }
291 290
292 std::vector<base::string16> 291 std::vector<base::string16>
293 ExtensionDisabledGlobalError::GetBubbleViewMessages() { 292 ExtensionDisabledGlobalError::GetBubbleViewMessages() {
294 std::vector<base::string16> messages; 293 std::vector<base::string16> messages;
295 std::vector<base::string16> permission_warnings = 294 extensions::PermissionMessageStrings permission_warnings =
296 extensions::PermissionMessageProvider::Get()->GetLegacyWarningMessages( 295 extensions::PermissionMessageProvider::Get()->GetPermissionMessageStrings(
297 extension_->permissions_data()->active_permissions().get(), 296 extension_->permissions_data()->active_permissions().get(),
298 extension_->GetType()); 297 extension_->GetType());
299 if (is_remote_install_) { 298 if (is_remote_install_) {
300 messages.push_back(l10n_util::GetStringFUTF16( 299 messages.push_back(l10n_util::GetStringFUTF16(
301 extension_->is_app() 300 extension_->is_app()
302 ? IDS_APP_DISABLED_REMOTE_INSTALL_ERROR_LABEL 301 ? IDS_APP_DISABLED_REMOTE_INSTALL_ERROR_LABEL
303 : IDS_EXTENSION_DISABLED_REMOTE_INSTALL_ERROR_LABEL, 302 : IDS_EXTENSION_DISABLED_REMOTE_INSTALL_ERROR_LABEL,
304 base::UTF8ToUTF16(extension_->name()))); 303 base::UTF8ToUTF16(extension_->name())));
305 if (!permission_warnings.empty()) 304 if (!permission_warnings.empty())
306 messages.push_back( 305 messages.push_back(
307 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO)); 306 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO));
308 } else { 307 } else {
309 // TODO(treib): Add an extra message for supervised users. crbug.com/461261 308 // TODO(treib): Add an extra message for supervised users. crbug.com/461261
310 messages.push_back(l10n_util::GetStringFUTF16( 309 messages.push_back(l10n_util::GetStringFUTF16(
311 extension_->is_app() ? IDS_APP_DISABLED_ERROR_LABEL 310 extension_->is_app() ? IDS_APP_DISABLED_ERROR_LABEL
312 : IDS_EXTENSION_DISABLED_ERROR_LABEL, 311 : IDS_EXTENSION_DISABLED_ERROR_LABEL,
313 base::UTF8ToUTF16(extension_->name()))); 312 base::UTF8ToUTF16(extension_->name())));
314 messages.push_back(l10n_util::GetStringUTF16( 313 messages.push_back(l10n_util::GetStringUTF16(
315 IDS_EXTENSION_PROMPT_WILL_NOW_HAVE_ACCESS_TO)); 314 IDS_EXTENSION_PROMPT_WILL_NOW_HAVE_ACCESS_TO));
316 } 315 }
317 for (size_t i = 0; i < permission_warnings.size(); ++i) { 316 for (const extensions::PermissionMessageString& str : permission_warnings) {
318 messages.push_back(l10n_util::GetStringFUTF16( 317 messages.push_back(l10n_util::GetStringFUTF16(
319 IDS_EXTENSION_PERMISSION_LINE, permission_warnings[i])); 318 IDS_EXTENSION_PERMISSION_LINE, str.message));
320 } 319 }
321 return messages; 320 return messages;
322 } 321 }
323 322
324 base::string16 ExtensionDisabledGlobalError::GetBubbleViewAcceptButtonLabel() { 323 base::string16 ExtensionDisabledGlobalError::GetBubbleViewAcceptButtonLabel() {
325 if (extensions::util::IsExtensionSupervised(extension_, 324 if (extensions::util::IsExtensionSupervised(extension_,
326 service_->profile())) { 325 service_->profile())) {
327 // TODO(treib): Probably use a new string here once we get UX design. 326 // TODO(treib): Probably use a new string here once we get UX design.
328 // For now, just re-use an existing string that says "OK". crbug.com/461261 327 // For now, just re-use an existing string that says "OK". crbug.com/461261
329 return l10n_util::GetStringUTF16(IDS_EXTENSION_ALERT_ITEM_OK); 328 return l10n_util::GetStringUTF16(IDS_EXTENSION_ALERT_ITEM_OK);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 void ShowExtensionDisabledDialog(ExtensionService* service, 455 void ShowExtensionDisabledDialog(ExtensionService* service,
457 content::WebContents* web_contents, 456 content::WebContents* web_contents,
458 const Extension* extension) { 457 const Extension* extension) {
459 scoped_ptr<ExtensionInstallPrompt> install_ui( 458 scoped_ptr<ExtensionInstallPrompt> install_ui(
460 new ExtensionInstallPrompt(web_contents)); 459 new ExtensionInstallPrompt(web_contents));
461 // This object manages its own lifetime. 460 // This object manages its own lifetime.
462 new ExtensionDisabledDialogDelegate(service, install_ui.Pass(), extension); 461 new ExtensionDisabledDialogDelegate(service, install_ui.Pass(), extension);
463 } 462 }
464 463
465 } // namespace extensions 464 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698