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 #include "chrome/browser/ui/views/extensions/extension_install_dialog_view.h" | 5 #include "chrome/browser/ui/views/extensions/extension_install_dialog_view.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
453 // Inline explanations are expanded by default if there is | 453 // Inline explanations are expanded by default if there is |
454 // no "Show details" link. | 454 // no "Show details" link. |
455 if (!prompt->experiment()->show_details_link()) | 455 if (!prompt->experiment()->show_details_link()) |
456 container->ExpandWithoutAnimation(); | 456 container->ExpandWithoutAnimation(); |
457 layout->StartRow(0, column_set_id); | 457 layout->StartRow(0, column_set_id); |
458 layout->AddView(container); | 458 layout->AddView(container); |
459 inline_explanations_.push_back(container); | 459 inline_explanations_.push_back(container); |
460 } | 460 } |
461 } | 461 } |
462 } | 462 } |
463 } else { | 463 } |
gpdavis
2014/08/29 01:12:16
This is ugly. Since this constructor is over 300
| |
464 if (prompt->GetWithheldPermissionCount() > 0) { | |
465 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | |
466 if (is_inline_install()) { | |
467 layout->StartRow(0, column_set_id); | |
468 layout->AddView(new views::Separator(views::Separator::HORIZONTAL), | |
469 3, | |
470 1, | |
471 views::GridLayout::FILL, | |
472 views::GridLayout::FILL); | |
473 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | |
474 } | |
475 | |
476 layout->StartRow(0, column_set_id); | |
477 views::Label* permissions_header = | |
478 new views::Label(prompt->GetWithheldHeading()); | |
479 permissions_header->SetMultiLine(true); | |
480 permissions_header->SetHorizontalAlignment(gfx::ALIGN_LEFT); | |
481 permissions_header->SizeToFit(left_column_width); | |
482 layout->AddView(permissions_header); | |
483 | |
484 for (size_t i = 0; i < prompt->GetWithheldPermissionCount(); ++i) { | |
485 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | |
486 layout->StartRow(0, column_set_id); | |
487 views::Label* permission_label = | |
488 new views::Label(prompt->GetWithheldPermission(i)); | |
489 | |
490 const SkColor kTextHighlight = SK_ColorRED; | |
491 const SkColor kBackgroundHighlight = SkColorSetRGB(0xFB, 0xF7, 0xA3); | |
492 if (prompt->experiment()->ShouldHighlightText( | |
493 prompt->GetWithheldPermission(i))) { | |
494 permission_label->SetAutoColorReadabilityEnabled(false); | |
495 permission_label->SetEnabledColor(kTextHighlight); | |
496 } else if (prompt->experiment()->ShouldHighlightBackground( | |
497 prompt->GetWithheldPermission(i))) { | |
498 permission_label->SetLineHeight(18); | |
499 permission_label->set_background( | |
500 views::Background::CreateSolidBackground(kBackgroundHighlight)); | |
501 } | |
502 | |
503 permission_label->SetMultiLine(true); | |
504 permission_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | |
505 | |
506 if (prompt->experiment()->show_checkboxes()) { | |
507 permission_label->SizeToFit(left_column_width); | |
508 layout->AddView(new CheckboxedView(permission_label, this)); | |
509 ++unchecked_boxes_; | |
510 } else { | |
511 permission_label->SizeToFit(left_column_width - kBulletWidth); | |
512 layout->AddView(new BulletedView(permission_label)); | |
513 } | |
514 | |
515 // If we have more details to provide, show them in collapsed form. | |
516 if (!prompt->GetWithheldPermissionsDetails(i).empty()) { | |
517 layout->StartRow(0, column_set_id); | |
518 PermissionDetails details; | |
519 details.push_back(PrepareForDisplay( | |
520 prompt->GetWithheldPermissionsDetails(i), false)); | |
521 ExpandableContainerView* details_container = | |
522 new ExpandableContainerView(this, | |
523 base::string16(), | |
524 details, | |
525 left_column_width, | |
526 true, | |
527 true, | |
528 false); | |
529 layout->AddView(details_container); | |
530 } | |
531 | |
532 if (prompt->experiment()->should_show_inline_explanations()) { | |
533 base::string16 explanation = | |
534 prompt->experiment()->GetInlineExplanation( | |
535 prompt->GetWithheldPermission(i)); | |
536 if (!explanation.empty()) { | |
537 PermissionDetails details; | |
538 details.push_back(explanation); | |
539 ExpandableContainerView* container = | |
540 new ExpandableContainerView(this, | |
541 base::string16(), | |
542 details, | |
543 left_column_width, | |
544 false, | |
545 false, | |
546 true); | |
547 // Inline explanations are expanded by default if there is | |
548 // no "Show details" link. | |
549 if (!prompt->experiment()->show_details_link()) | |
550 container->ExpandWithoutAnimation(); | |
551 layout->StartRow(0, column_set_id); | |
552 layout->AddView(container); | |
553 inline_explanations_.push_back(container); | |
554 } | |
555 } | |
556 } | |
557 } | |
558 | |
559 if (prompt->GetWithheldPermissionCount() == 0 && | |
560 prompt->GetPermissionCount() == 0) { | |
464 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 561 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
465 layout->StartRow(0, column_set_id); | 562 layout->StartRow(0, column_set_id); |
466 views::Label* permission_label = new views::Label( | 563 views::Label* permission_label = new views::Label( |
467 l10n_util::GetStringUTF16(IDS_EXTENSION_NO_SPECIAL_PERMISSIONS)); | 564 l10n_util::GetStringUTF16(IDS_EXTENSION_NO_SPECIAL_PERMISSIONS)); |
468 permission_label->SetMultiLine(true); | 565 permission_label->SetMultiLine(true); |
469 permission_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 566 permission_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
470 permission_label->SizeToFit(left_column_width); | 567 permission_label->SizeToFit(left_column_width); |
471 layout->AddView(permission_label); | 568 layout->AddView(permission_label); |
472 } | 569 } |
473 } | 570 } |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1067 void ExpandableContainerView::ExpandWithoutAnimation() { | 1164 void ExpandableContainerView::ExpandWithoutAnimation() { |
1068 expanded_ = true; | 1165 expanded_ = true; |
1069 details_view_->AnimateToState(1.0); | 1166 details_view_->AnimateToState(1.0); |
1070 } | 1167 } |
1071 | 1168 |
1072 // static | 1169 // static |
1073 ExtensionInstallPrompt::ShowDialogCallback | 1170 ExtensionInstallPrompt::ShowDialogCallback |
1074 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { | 1171 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { |
1075 return base::Bind(&ShowExtensionInstallDialogImpl); | 1172 return base::Bind(&ShowExtensionInstallDialogImpl); |
1076 } | 1173 } |
OLD | NEW |