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 "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 ink_drop_delegate_(new views::ButtonInkDropDelegate(this, this)), | 40 ink_drop_delegate_(new views::ButtonInkDropDelegate(this, this)), |
41 show_menu_factory_(this) { | 41 show_menu_factory_(this) { |
42 set_ink_drop_delegate(ink_drop_delegate_.get()); | 42 set_ink_drop_delegate(ink_drop_delegate_.get()); |
43 set_has_ink_drop_action_on_click(true); | 43 set_has_ink_drop_action_on_click(true); |
44 set_context_menu_controller(this); | 44 set_context_menu_controller(this); |
45 } | 45 } |
46 | 46 |
47 ToolbarButton::~ToolbarButton() {} | 47 ToolbarButton::~ToolbarButton() {} |
48 | 48 |
49 void ToolbarButton::Init() { | 49 void ToolbarButton::Init() { |
50 SetFocusable(false); | 50 SetFocusBehavior(views::View::FocusBehavior::ACCESSIBLE_ONLY); |
51 SetAccessibilityFocusable(true); | |
52 image()->EnableCanvasFlippingForRTLUI(true); | 51 image()->EnableCanvasFlippingForRTLUI(true); |
53 } | 52 } |
54 | 53 |
55 void ToolbarButton::ClearPendingMenu() { | 54 void ToolbarButton::ClearPendingMenu() { |
56 show_menu_factory_.InvalidateWeakPtrs(); | 55 show_menu_factory_.InvalidateWeakPtrs(); |
57 } | 56 } |
58 | 57 |
59 bool ToolbarButton::IsMenuShowing() const { | 58 bool ToolbarButton::IsMenuShowing() const { |
60 return menu_showing_; | 59 return menu_showing_; |
61 } | 60 } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 // Set the state back to normal after the drop down menu is closed. | 252 // Set the state back to normal after the drop down menu is closed. |
254 if (state() != STATE_DISABLED) | 253 if (state() != STATE_DISABLED) |
255 SetState(STATE_NORMAL); | 254 SetState(STATE_NORMAL); |
256 | 255 |
257 menu_model_adapter_.reset(); | 256 menu_model_adapter_.reset(); |
258 } | 257 } |
259 | 258 |
260 const char* ToolbarButton::GetClassName() const { | 259 const char* ToolbarButton::GetClassName() const { |
261 return "ToolbarButton"; | 260 return "ToolbarButton"; |
262 } | 261 } |
OLD | NEW |