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

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

Issue 340003002: Revert of views: Move MenuButton from TextButton to LabelButton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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/infobars/infobar_view.h" 5 #include "chrome/browser/ui/views/infobars/infobar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/ui/views/infobars/infobar_background.h" 11 #include "chrome/browser/ui/views/infobars/infobar_background.h"
12 #include "components/infobars/core/infobar_delegate.h" 12 #include "components/infobars/core/infobar_delegate.h"
13 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
14 #include "grit/theme_resources.h" 14 #include "grit/theme_resources.h"
15 #include "grit/ui_resources.h" 15 #include "grit/ui_resources.h"
16 #include "third_party/skia/include/effects/SkGradientShader.h" 16 #include "third_party/skia/include/effects/SkGradientShader.h"
17 #include "ui/accessibility/ax_view_state.h" 17 #include "ui/accessibility/ax_view_state.h"
18 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/resource/resource_bundle.h" 19 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/gfx/canvas.h" 20 #include "ui/gfx/canvas.h"
21 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
22 #include "ui/views/controls/button/image_button.h" 22 #include "ui/views/controls/button/image_button.h"
23 #include "ui/views/controls/button/label_button.h" 23 #include "ui/views/controls/button/label_button.h"
24 #include "ui/views/controls/button/label_button_border.h" 24 #include "ui/views/controls/button/label_button_border.h"
25 #include "ui/views/controls/button/menu_button.h" 25 #include "ui/views/controls/button/menu_button.h"
26 #include "ui/views/controls/button/text_button.h"
27 #include "ui/views/controls/image_view.h" 26 #include "ui/views/controls/image_view.h"
28 #include "ui/views/controls/label.h" 27 #include "ui/views/controls/label.h"
29 #include "ui/views/controls/link.h" 28 #include "ui/views/controls/link.h"
30 #include "ui/views/controls/menu/menu_runner.h" 29 #include "ui/views/controls/menu/menu_runner.h"
31 #include "ui/views/layout/layout_constants.h" 30 #include "ui/views/layout/layout_constants.h"
32 #include "ui/views/widget/widget.h" 31 #include "ui/views/widget/widget.h"
33 #include "ui/views/window/non_client_view.h" 32 #include "ui/views/window/non_client_view.h"
34 33
35 34
36 // Helpers -------------------------------------------------------------------- 35 // Helpers --------------------------------------------------------------------
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 menu_button_border->set_pushed_painter( 122 menu_button_border->set_pushed_painter(
124 views::Painter::CreateImageGridPainter(kPushedImageSet)); 123 views::Painter::CreateImageGridPainter(kPushedImageSet));
125 124
126 views::MenuButton* menu_button = new views::MenuButton( 125 views::MenuButton* menu_button = new views::MenuButton(
127 NULL, text, menu_button_listener, true); 126 NULL, text, menu_button_listener, true);
128 menu_button->SetBorder(menu_button_border.PassAs<views::Border>()); 127 menu_button->SetBorder(menu_button_border.PassAs<views::Border>());
129 menu_button->set_animate_on_state_change(false); 128 menu_button->set_animate_on_state_change(false);
130 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 129 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
131 menu_button->set_menu_marker( 130 menu_button->set_menu_marker(
132 rb.GetImageNamed(IDR_INFOBARBUTTON_MENU_DROPARROW).ToImageSkia()); 131 rb.GetImageNamed(IDR_INFOBARBUTTON_MENU_DROPARROW).ToImageSkia());
133 menu_button->SetTextColor(views::Button::STATE_NORMAL, SK_ColorBLACK); 132 menu_button->SetEnabledColor(SK_ColorBLACK);
134 menu_button->SetTextColor(views::Button::STATE_HOVERED, SK_ColorBLACK); 133 menu_button->SetHoverColor(SK_ColorBLACK);
135 menu_button->SetFontList(rb.GetFontList(ui::ResourceBundle::MediumFont)); 134 menu_button->SetFontList(rb.GetFontList(ui::ResourceBundle::MediumFont));
136 menu_button->SizeToPreferredSize(); 135 menu_button->SizeToPreferredSize();
137 menu_button->SetFocusable(true); 136 menu_button->SetFocusable(true);
138 return menu_button; 137 return menu_button;
139 } 138 }
140 139
141 // static 140 // static
142 views::LabelButton* InfoBarView::CreateLabelButton( 141 views::LabelButton* InfoBarView::CreateLabelButton(
143 views::ButtonListener* listener, 142 views::ButtonListener* listener,
144 const base::string16& text) { 143 const base::string16& text) {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) { 414 void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) {
416 views::ExternalFocusTracker::OnWillChangeFocus(focused_before, focused_now); 415 views::ExternalFocusTracker::OnWillChangeFocus(focused_before, focused_now);
417 416
418 // This will trigger some screen readers to read the entire contents of this 417 // This will trigger some screen readers to read the entire contents of this
419 // infobar. 418 // infobar.
420 if (focused_before && focused_now && !Contains(focused_before) && 419 if (focused_before && focused_now && !Contains(focused_before) &&
421 Contains(focused_now)) { 420 Contains(focused_now)) {
422 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 421 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
423 } 422 }
424 } 423 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/extension_infobar.cc ('k') | chrome/browser/ui/views/location_bar/location_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698