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/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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const string16& text, | 100 const string16& text, |
101 views::MenuButtonListener* menu_button_listener) { | 101 views::MenuButtonListener* menu_button_listener) { |
102 views::MenuButton* menu_button = new views::MenuButton( | 102 views::MenuButton* menu_button = new views::MenuButton( |
103 NULL, text, menu_button_listener, true); | 103 NULL, text, menu_button_listener, true); |
104 menu_button->set_border(new InfoBarButtonBorder); | 104 menu_button->set_border(new InfoBarButtonBorder); |
105 menu_button->set_animate_on_state_change(false); | 105 menu_button->set_animate_on_state_change(false); |
106 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 106 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
107 menu_button->set_menu_marker( | 107 menu_button->set_menu_marker( |
108 rb.GetImageNamed(IDR_INFOBARBUTTON_MENU_DROPARROW).ToImageSkia()); | 108 rb.GetImageNamed(IDR_INFOBARBUTTON_MENU_DROPARROW).ToImageSkia()); |
109 menu_button->SetEnabledColor(SK_ColorBLACK); | 109 menu_button->SetEnabledColor(SK_ColorBLACK); |
110 menu_button->SetHighlightColor(SK_ColorBLACK); | |
111 menu_button->SetHoverColor(SK_ColorBLACK); | 110 menu_button->SetHoverColor(SK_ColorBLACK); |
112 menu_button->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); | 111 menu_button->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); |
113 menu_button->set_focusable(true); | 112 menu_button->set_focusable(true); |
114 return menu_button; | 113 return menu_button; |
115 } | 114 } |
116 | 115 |
117 // static | 116 // static |
118 views::TextButton* InfoBarView::CreateTextButton( | 117 views::TextButton* InfoBarView::CreateTextButton( |
119 views::ButtonListener* listener, | 118 views::ButtonListener* listener, |
120 const string16& text, | 119 const string16& text, |
121 bool needs_elevation) { | 120 bool needs_elevation) { |
122 views::TextButton* text_button = new views::TextButton(listener, text); | 121 views::TextButton* text_button = new views::TextButton(listener, text); |
123 text_button->set_border(new InfoBarButtonBorder); | 122 text_button->set_border(new InfoBarButtonBorder); |
124 text_button->set_animate_on_state_change(false); | 123 text_button->set_animate_on_state_change(false); |
125 text_button->SetEnabledColor(SK_ColorBLACK); | 124 text_button->SetEnabledColor(SK_ColorBLACK); |
126 text_button->SetHighlightColor(SK_ColorBLACK); | |
127 text_button->SetHoverColor(SK_ColorBLACK); | 125 text_button->SetHoverColor(SK_ColorBLACK); |
128 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 126 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
129 text_button->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); | 127 text_button->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); |
130 #if defined(OS_WIN) | 128 #if defined(OS_WIN) |
131 if (needs_elevation && | 129 if (needs_elevation && |
132 (base::win::GetVersion() >= base::win::VERSION_VISTA) && | 130 (base::win::GetVersion() >= base::win::VERSION_VISTA) && |
133 base::win::UserAccountControlIsEnabled()) { | 131 base::win::UserAccountControlIsEnabled()) { |
134 SHSTOCKICONINFO icon_info = { sizeof(SHSTOCKICONINFO) }; | 132 SHSTOCKICONINFO icon_info = { sizeof(SHSTOCKICONINFO) }; |
135 // Even with the runtime guard above, we have to use GetProcAddress() here, | 133 // Even with the runtime guard above, we have to use GetProcAddress() here, |
136 // because otherwise the loader will try to resolve the function address on | 134 // because otherwise the loader will try to resolve the function address on |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 // This will trigger some screen readers to read the entire contents of this | 378 // This will trigger some screen readers to read the entire contents of this |
381 // infobar. | 379 // infobar. |
382 if (focused_before && focused_now && !Contains(focused_before) && | 380 if (focused_before && focused_now && !Contains(focused_before) && |
383 Contains(focused_now)) { | 381 Contains(focused_now)) { |
384 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true); | 382 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true); |
385 } | 383 } |
386 } | 384 } |
387 | 385 |
388 void InfoBarView::OnDidChangeFocus(View* focused_before, View* focused_now) { | 386 void InfoBarView::OnDidChangeFocus(View* focused_before, View* focused_now) { |
389 } | 387 } |
OLD | NEW |