OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/toolbar/toolbar_button.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_button.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
9 #include "grit/theme_resources.h" | 9 #include "grit/theme_resources.h" |
10 #include "grit/ui_strings.h" | 10 #include "grit/ui_strings.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 model_(model), | 25 model_(model), |
26 menu_showing_(false), | 26 menu_showing_(false), |
27 y_position_on_lbuttondown_(0), | 27 y_position_on_lbuttondown_(0), |
28 show_menu_factory_(this) { | 28 show_menu_factory_(this) { |
29 } | 29 } |
30 | 30 |
31 ToolbarButton::~ToolbarButton() { | 31 ToolbarButton::~ToolbarButton() { |
32 } | 32 } |
33 | 33 |
34 void ToolbarButton::Init() { | 34 void ToolbarButton::Init() { |
35 set_focusable(true); | 35 SetFocusable(true); |
36 | 36 |
37 // Provides the hover/pressed style used by buttons in the toolbar. | 37 // Provides the hover/pressed style used by buttons in the toolbar. |
38 views::LabelButtonBorder* border = | 38 views::LabelButtonBorder* border = |
39 new views::LabelButtonBorder(views::Button::STYLE_BUTTON); | 39 new views::LabelButtonBorder(views::Button::STYLE_BUTTON); |
40 const int kHoverImages[] = IMAGE_GRID(IDR_TOOLBAR_BUTTON_HOVER); | 40 const int kHoverImages[] = IMAGE_GRID(IDR_TOOLBAR_BUTTON_HOVER); |
41 border->SetPainter(false, views::Button::STATE_HOVERED, | 41 border->SetPainter(false, views::Button::STATE_HOVERED, |
42 views::Painter::CreateImageGridPainter( | 42 views::Painter::CreateImageGridPainter( |
43 kHoverImages)); | 43 kHoverImages)); |
44 const int kPressedImages[] = IMAGE_GRID(IDR_TOOLBAR_BUTTON_PRESSED); | 44 const int kPressedImages[] = IMAGE_GRID(IDR_TOOLBAR_BUTTON_PRESSED); |
45 border->SetPainter(false, views::Button::STATE_PRESSED, | 45 border->SetPainter(false, views::Button::STATE_PRESSED, |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 231 |
232 // Need to explicitly clear mouse handler so that events get sent | 232 // Need to explicitly clear mouse handler so that events get sent |
233 // properly after the menu finishes running. If we don't do this, then | 233 // properly after the menu finishes running. If we don't do this, then |
234 // the first click to other parts of the UI is eaten. | 234 // the first click to other parts of the UI is eaten. |
235 SetMouseHandler(NULL); | 235 SetMouseHandler(NULL); |
236 | 236 |
237 // Set the state back to normal after the drop down menu is closed. | 237 // Set the state back to normal after the drop down menu is closed. |
238 if (state_ != STATE_DISABLED) | 238 if (state_ != STATE_DISABLED) |
239 SetState(STATE_NORMAL); | 239 SetState(STATE_NORMAL); |
240 } | 240 } |
OLD | NEW |