Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 31 ToolbarButton::~ToolbarButton() { | 31 ToolbarButton::~ToolbarButton() { |
| 32 } | 32 } |
| 33 | 33 |
| 34 void ToolbarButton::Init() { | 34 void ToolbarButton::Init() { |
| 35 SetFocusable(false); | 35 SetFocusable(false); |
| 36 SetAccessibilityFocusable(true); | 36 SetAccessibilityFocusable(true); |
| 37 | 37 |
| 38 // Provides the hover/pressed style used by buttons in the toolbar. | 38 // Provides the hover/pressed style used by buttons in the toolbar. |
| 39 views::LabelButtonBorder* border = | 39 views::LabelButtonBorder* border = |
| 40 new views::LabelButtonBorder(views::Button::STYLE_TEXTBUTTON); | 40 new views::LabelButtonBorder(views::Button::STYLE_TEXTBUTTON); |
| 41 const int kHoverImages[] = IMAGE_GRID(IDR_TOOLBAR_BUTTON_HOVER); | |
|
msw
2013/12/17 01:02:36
If this is ok, we'll also need to remove the IDRs
| |
| 42 border->SetPainter(false, views::Button::STATE_HOVERED, | |
| 43 views::Painter::CreateImageGridPainter( | |
| 44 kHoverImages)); | |
| 45 const int kPressedImages[] = IMAGE_GRID(IDR_TOOLBAR_BUTTON_PRESSED); | |
| 46 border->SetPainter(false, views::Button::STATE_PRESSED, | |
| 47 views::Painter::CreateImageGridPainter( | |
| 48 kPressedImages)); | |
| 49 set_border(border); | 41 set_border(border); |
| 50 } | 42 } |
| 51 | 43 |
| 52 void ToolbarButton::ClearPendingMenu() { | 44 void ToolbarButton::ClearPendingMenu() { |
| 53 show_menu_factory_.InvalidateWeakPtrs(); | 45 show_menu_factory_.InvalidateWeakPtrs(); |
| 54 } | 46 } |
| 55 | 47 |
| 56 bool ToolbarButton::IsMenuShowing() const { | 48 bool ToolbarButton::IsMenuShowing() const { |
| 57 return menu_showing_; | 49 return menu_showing_; |
| 58 } | 50 } |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 | 222 |
| 231 // Need to explicitly clear mouse handler so that events get sent | 223 // Need to explicitly clear mouse handler so that events get sent |
| 232 // properly after the menu finishes running. If we don't do this, then | 224 // properly after the menu finishes running. If we don't do this, then |
| 233 // the first click to other parts of the UI is eaten. | 225 // the first click to other parts of the UI is eaten. |
| 234 SetMouseHandler(NULL); | 226 SetMouseHandler(NULL); |
| 235 | 227 |
| 236 // Set the state back to normal after the drop down menu is closed. | 228 // Set the state back to normal after the drop down menu is closed. |
| 237 if (state_ != STATE_DISABLED) | 229 if (state_ != STATE_DISABLED) |
| 238 SetState(STATE_NORMAL); | 230 SetState(STATE_NORMAL); |
| 239 } | 231 } |
| OLD | NEW |