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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_install_dialog_view.cc

Issue 580363002: Update app info and install prompt UI to show retained devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased to ToT. Created 6 years, 2 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/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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 layout->StartRow(0, column_set_id); 398 layout->StartRow(0, column_set_id);
399 views::Label* permission_label = new views::Label( 399 views::Label* permission_label = new views::Label(
400 l10n_util::GetStringUTF16(IDS_EXTENSION_NO_SPECIAL_PERMISSIONS)); 400 l10n_util::GetStringUTF16(IDS_EXTENSION_NO_SPECIAL_PERMISSIONS));
401 permission_label->SetMultiLine(true); 401 permission_label->SetMultiLine(true);
402 permission_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 402 permission_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
403 permission_label->SizeToFit(left_column_width); 403 permission_label->SizeToFit(left_column_width);
404 layout->AddView(permission_label); 404 layout->AddView(permission_label);
405 } 405 }
406 } 406 }
407 407
408 if (prompt_->GetRetainedFileCount()) { 408 int space_for_files_and_devices = left_column_width;
409 // Slide in under the permissions, if there are any. If there are 409 if (prompt_->GetRetainedFileCount() || prompt_->GetRetainedDeviceCount()) {
410 // either, the retained files prompt stretches all the way to the 410 // Slide in under the permissions, if there are any. If there are either,
411 // right of the dialog. If there are no permissions, the retained 411 // the retained files and devices prompts stretch all the way to the right
412 // files prompt just takes up the left column. 412 // of the dialog. If there are no permissions, the retained files and
413 int space_for_files = left_column_width; 413 // devices prompts just take up the left column.
414
414 if (has_permissions) { 415 if (has_permissions) {
415 space_for_files += kIconSize; 416 space_for_files_and_devices += kIconSize;
416 views::ColumnSet* column_set = layout->AddColumnSet(++column_set_id); 417 views::ColumnSet* column_set = layout->AddColumnSet(++column_set_id);
417 column_set->AddColumn(views::GridLayout::FILL, 418 column_set->AddColumn(views::GridLayout::FILL,
418 views::GridLayout::FILL, 419 views::GridLayout::FILL,
419 1, 420 1,
420 views::GridLayout::USE_PREF, 421 views::GridLayout::USE_PREF,
421 0, // no fixed width 422 0, // no fixed width
422 space_for_files); 423 space_for_files_and_devices);
423 } 424 }
425 }
424 426
427 if (prompt_->GetRetainedFileCount()) {
425 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 428 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
426 429
427 layout->StartRow(0, column_set_id); 430 layout->StartRow(0, column_set_id);
428 views::Label* retained_files_header = NULL; 431 views::Label* retained_files_header =
429 retained_files_header =
430 new views::Label(prompt_->GetRetainedFilesHeading()); 432 new views::Label(prompt_->GetRetainedFilesHeading());
431 retained_files_header->SetMultiLine(true); 433 retained_files_header->SetMultiLine(true);
432 retained_files_header->SetHorizontalAlignment(gfx::ALIGN_LEFT); 434 retained_files_header->SetHorizontalAlignment(gfx::ALIGN_LEFT);
433 retained_files_header->SizeToFit(space_for_files); 435 retained_files_header->SizeToFit(space_for_files_and_devices);
434 layout->AddView(retained_files_header); 436 layout->AddView(retained_files_header);
435 437
436 layout->StartRow(0, column_set_id); 438 layout->StartRow(0, column_set_id);
437 PermissionDetails details; 439 PermissionDetails details;
438 for (size_t i = 0; i < prompt_->GetRetainedFileCount(); ++i) 440 for (size_t i = 0; i < prompt_->GetRetainedFileCount(); ++i) {
439 details.push_back(prompt_->GetRetainedFile(i)); 441 details.push_back(prompt_->GetRetainedFile(i));
442 }
440 ExpandableContainerView* issue_advice_view = 443 ExpandableContainerView* issue_advice_view =
441 new ExpandableContainerView( 444 new ExpandableContainerView(this,
442 this, base::string16(), details, space_for_files, 445 base::string16(),
443 false, true, false); 446 details,
447 space_for_files_and_devices,
448 false,
449 true,
450 false);
444 layout->AddView(issue_advice_view); 451 layout->AddView(issue_advice_view);
445 } 452 }
446 453
454 if (prompt_->GetRetainedDeviceCount()) {
455 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
456
457 layout->StartRow(0, column_set_id);
458 views::Label* retained_devices_header =
459 new views::Label(prompt_->GetRetainedDevicesHeading());
460 retained_devices_header->SetMultiLine(true);
461 retained_devices_header->SetHorizontalAlignment(gfx::ALIGN_LEFT);
462 retained_devices_header->SizeToFit(space_for_files_and_devices);
463 layout->AddView(retained_devices_header);
464
465 layout->StartRow(0, column_set_id);
466 PermissionDetails details;
467 for (size_t i = 0; i < prompt_->GetRetainedDeviceCount(); ++i) {
468 details.push_back(prompt_->GetRetainedDeviceMessageString(i));
469 }
470 ExpandableContainerView* issue_advice_view =
471 new ExpandableContainerView(this,
472 base::string16(),
473 details,
474 space_for_files_and_devices,
475 false,
476 true,
477 false);
478 layout->AddView(issue_advice_view);
479 }
480
447 DCHECK(prompt_->type() >= 0); 481 DCHECK(prompt_->type() >= 0);
448 UMA_HISTOGRAM_ENUMERATION("Extensions.InstallPrompt.Type", 482 UMA_HISTOGRAM_ENUMERATION("Extensions.InstallPrompt.Type",
449 prompt_->type(), 483 prompt_->type(),
450 ExtensionInstallPrompt::NUM_PROMPT_TYPES); 484 ExtensionInstallPrompt::NUM_PROMPT_TYPES);
451 485
452 if (prompt_->ShouldShowPermissions()) { 486 if (prompt_->ShouldShowPermissions()) {
453 if (prompt_->ShouldShowExplanationText()) { 487 if (prompt_->ShouldShowExplanationText()) {
454 views::ColumnSet* column_set = layout->AddColumnSet(++column_set_id); 488 views::ColumnSet* column_set = layout->AddColumnSet(++column_set_id);
455 column_set->AddColumn(views::GridLayout::LEADING, 489 column_set->AddColumn(views::GridLayout::LEADING,
456 views::GridLayout::FILL, 490 views::GridLayout::FILL,
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 void ExpandableContainerView::ExpandWithoutAnimation() { 1154 void ExpandableContainerView::ExpandWithoutAnimation() {
1121 expanded_ = true; 1155 expanded_ = true;
1122 details_view_->AnimateToState(1.0); 1156 details_view_->AnimateToState(1.0);
1123 } 1157 }
1124 1158
1125 // static 1159 // static
1126 ExtensionInstallPrompt::ShowDialogCallback 1160 ExtensionInstallPrompt::ShowDialogCallback
1127 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { 1161 ExtensionInstallPrompt::GetDefaultShowDialogCallback() {
1128 return base::Bind(&ShowExtensionInstallDialogImpl); 1162 return base::Bind(&ShowExtensionInstallDialogImpl);
1129 } 1163 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698