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

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

Issue 2807653002: Ensure default dialog button focus remains after a dialog update. (Closed)
Patch Set: Using a view deletion observer to track focus. Created 3 years, 7 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 <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 constexpr int kPermissionsLeftColumnWidth = 250; 73 constexpr int kPermissionsLeftColumnWidth = 250;
74 74
75 // Width of the left column of the dialog when the extension requests no 75 // Width of the left column of the dialog when the extension requests no
76 // permissions. 76 // permissions.
77 constexpr int kNoPermissionsLeftColumnWidth = 200; 77 constexpr int kNoPermissionsLeftColumnWidth = 200;
78 78
79 // Width of the left column for external install prompts. The text is long in 79 // Width of the left column for external install prompts. The text is long in
80 // this case, so make it wider than normal. 80 // this case, so make it wider than normal.
81 constexpr int kExternalInstallLeftColumnWidth = 350; 81 constexpr int kExternalInstallLeftColumnWidth = 350;
82 82
83 // Time delay before the install button is enabled after initial display.
84 int g_install_delay_in_ms = 500;
Devlin 2017/05/17 18:13:49 nit: no need to change this, so let's not (to avoi
ackermanb 2017/05/17 22:03:49 I just moved it up a couple of lines because it wa
85
83 // Get the appropriate indentation for an item if its parent is using bullet 86 // Get the appropriate indentation for an item if its parent is using bullet
84 // points. If the parent is using bullets for its items, then a padding of one 87 // points. If the parent is using bullets for its items, then a padding of one
85 // unit will make the child item (which has no bullet) look like a sibling of 88 // unit will make the child item (which has no bullet) look like a sibling of
86 // its parent. Therefore increase the indentation by one more unit to show that 89 // its parent. Therefore increase the indentation by one more unit to show that
87 // it is in fact a child item (with no missing bullet) and not a sibling. 90 // it is in fact a child item (with no missing bullet) and not a sibling.
88 int GetLeftPaddingForBulletedItems(bool parent_bulleted) { 91 int GetLeftPaddingForBulletedItems(bool parent_bulleted) {
89 return LayoutDelegate::Get()->GetMetric( 92 return LayoutDelegate::Get()->GetMetric(
90 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING) * 93 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING) *
91 (parent_bulleted ? 2 : 1); 94 (parent_bulleted ? 2 : 1);
92 } 95 }
93 96
94 // Time delay before the install button is enabled after initial display.
95 int g_install_delay_in_ms = 500;
96
97 void AddResourceIcon(const gfx::ImageSkia* skia_image, void* data) { 97 void AddResourceIcon(const gfx::ImageSkia* skia_image, void* data) {
98 views::View* parent = static_cast<views::View*>(data); 98 views::View* parent = static_cast<views::View*>(data);
99 views::ImageView* image_view = new views::ImageView(); 99 views::ImageView* image_view = new views::ImageView();
100 image_view->SetImage(*skia_image); 100 image_view->SetImage(*skia_image);
101 parent->AddChildView(image_view); 101 parent->AddChildView(image_view);
102 } 102 }
103 103
104 // Creates a string for displaying |message| to the user. If it has to look 104 // Creates a string for displaying |message| to the user. If it has to look
105 // like a entry in a bullet point list, one is added. 105 // like a entry in a bullet point list, one is added.
106 base::string16 PrepareForDisplay(const base::string16& message, 106 base::string16 PrepareForDisplay(const base::string16& message,
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 gfx::ImageSkia icon = gfx::CreateVectorIcon( 790 gfx::ImageSkia icon = gfx::CreateVectorIcon(
791 expanded ? kCaretUpIcon : kCaretDownIcon, gfx::kChromeIconGrey); 791 expanded ? kCaretUpIcon : kCaretDownIcon, gfx::kChromeIconGrey);
792 arrow_toggle_->SetImage(views::Button::STATE_NORMAL, &icon); 792 arrow_toggle_->SetImage(views::Button::STATE_NORMAL, &icon);
793 } 793 }
794 794
795 // static 795 // static
796 ExtensionInstallPrompt::ShowDialogCallback 796 ExtensionInstallPrompt::ShowDialogCallback
797 ExtensionInstallPrompt::GetViewsShowDialogCallback() { 797 ExtensionInstallPrompt::GetViewsShowDialogCallback() {
798 return base::Bind(&ShowExtensionInstallDialogImpl); 798 return base::Bind(&ShowExtensionInstallDialogImpl);
799 } 799 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698