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

Side by Side Diff: chrome/browser/ui/views/infobars/infobar_view.cc

Issue 8439015: Make infobar controls focusable by default. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/infobars/infobar_view.h" 5 #include "chrome/browser/ui/views/infobars/infobar_view.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #endif 9 #endif
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 views::Link* InfoBarView::CreateLink(const string16& text, 88 views::Link* InfoBarView::CreateLink(const string16& text,
89 views::LinkListener* listener) const { 89 views::LinkListener* listener) const {
90 views::Link* link = new views::Link; 90 views::Link* link = new views::Link;
91 link->SetText(text); 91 link->SetText(text);
92 link->SetFont( 92 link->SetFont(
93 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont)); 93 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont));
94 link->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 94 link->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
95 link->set_listener(listener); 95 link->set_listener(listener);
96 link->SetBackgroundColor(background()->get_color()); 96 link->SetBackgroundColor(background()->get_color());
97 link->set_focusable(true);
97 return link; 98 return link;
98 } 99 }
99 100
100 // static 101 // static
101 views::MenuButton* InfoBarView::CreateMenuButton( 102 views::MenuButton* InfoBarView::CreateMenuButton(
102 const string16& text, 103 const string16& text,
103 views::ViewMenuDelegate* menu_delegate) { 104 views::ViewMenuDelegate* menu_delegate) {
104 views::MenuButton* menu_button = new views::MenuButton( 105 views::MenuButton* menu_button = new views::MenuButton(
105 NULL, text, menu_delegate, true); 106 NULL, text, menu_delegate, true);
106 menu_button->set_border(new InfoBarButtonBorder); 107 menu_button->set_border(new InfoBarButtonBorder);
107 menu_button->set_animate_on_state_change(false); 108 menu_button->set_animate_on_state_change(false);
108 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 109 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
109 menu_button->set_menu_marker( 110 menu_button->set_menu_marker(
110 rb.GetBitmapNamed(IDR_INFOBARBUTTON_MENU_DROPARROW)); 111 rb.GetBitmapNamed(IDR_INFOBARBUTTON_MENU_DROPARROW));
111 menu_button->SetEnabledColor(SK_ColorBLACK); 112 menu_button->SetEnabledColor(SK_ColorBLACK);
112 menu_button->SetHighlightColor(SK_ColorBLACK); 113 menu_button->SetHighlightColor(SK_ColorBLACK);
113 menu_button->SetHoverColor(SK_ColorBLACK); 114 menu_button->SetHoverColor(SK_ColorBLACK);
114 menu_button->SetFont(rb.GetFont(ResourceBundle::MediumFont)); 115 menu_button->SetFont(rb.GetFont(ResourceBundle::MediumFont));
116 menu_button->set_focusable(true);
115 return menu_button; 117 return menu_button;
116 } 118 }
117 119
118 // static 120 // static
119 views::TextButton* InfoBarView::CreateTextButton( 121 views::TextButton* InfoBarView::CreateTextButton(
120 views::ButtonListener* listener, 122 views::ButtonListener* listener,
121 const string16& text, 123 const string16& text,
122 bool needs_elevation) { 124 bool needs_elevation) {
123 views::TextButton* text_button = new views::TextButton(listener, text); 125 views::TextButton* text_button = new views::TextButton(listener, text);
124 text_button->set_border(new InfoBarButtonBorder); 126 text_button->set_border(new InfoBarButtonBorder);
(...skipping 19 matching lines...) Expand all
144 &icon_info))) { 146 &icon_info))) {
145 scoped_ptr<SkBitmap> icon(IconUtil::CreateSkBitmapFromHICON( 147 scoped_ptr<SkBitmap> icon(IconUtil::CreateSkBitmapFromHICON(
146 icon_info.hIcon, gfx::Size(GetSystemMetrics(SM_CXSMICON), 148 icon_info.hIcon, gfx::Size(GetSystemMetrics(SM_CXSMICON),
147 GetSystemMetrics(SM_CYSMICON)))); 149 GetSystemMetrics(SM_CYSMICON))));
148 if (icon.get()) 150 if (icon.get())
149 text_button->SetIcon(*icon); 151 text_button->SetIcon(*icon);
150 DestroyIcon(icon_info.hIcon); 152 DestroyIcon(icon_info.hIcon);
151 } 153 }
152 } 154 }
153 #endif 155 #endif
156 text_button->set_focusable(true);
154 return text_button; 157 return text_button;
155 } 158 }
156 159
157 void InfoBarView::Layout() { 160 void InfoBarView::Layout() {
158 // Calculate the fill and stroke paths. We do this here, rather than in 161 // Calculate the fill and stroke paths. We do this here, rather than in
159 // PlatformSpecificRecalculateHeight(), because this is also reached when our 162 // PlatformSpecificRecalculateHeight(), because this is also reached when our
160 // width is changed, which affects both paths. 163 // width is changed, which affects both paths.
161 stroke_path_.rewind(); 164 stroke_path_.rewind();
162 fill_path_.rewind(); 165 fill_path_.rewind();
163 const InfoBarContainer::Delegate* delegate = container_delegate(); 166 const InfoBarContainer::Delegate* delegate = container_delegate();
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 377
375 void InfoBarView::FocusWillChange(View* focused_before, View* focused_now) { 378 void InfoBarView::FocusWillChange(View* focused_before, View* focused_now) {
376 // This will trigger some screen readers to read the entire contents of this 379 // This will trigger some screen readers to read the entire contents of this
377 // infobar. 380 // infobar.
378 if (focused_before && focused_now && !Contains(focused_before) && 381 if (focused_before && focused_now && !Contains(focused_before) &&
379 Contains(focused_now) && GetWidget()) { 382 Contains(focused_now) && GetWidget()) {
380 GetWidget()->NotifyAccessibilityEvent( 383 GetWidget()->NotifyAccessibilityEvent(
381 this, ui::AccessibilityTypes::EVENT_ALERT, true); 384 this, ui::AccessibilityTypes::EVENT_ALERT, true);
382 } 385 }
383 } 386 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/extension_infobar.cc ('k') | views/controls/button/text_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698