| 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/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 30 #include "ui/views/widget/widget.h" | 30 #include "ui/views/widget/widget.h" | 
| 31 | 31 | 
| 32 ToolbarButton::ToolbarButton(Profile* profile, | 32 ToolbarButton::ToolbarButton(Profile* profile, | 
| 33                              views::ButtonListener* listener, | 33                              views::ButtonListener* listener, | 
| 34                              ui::MenuModel* model) | 34                              ui::MenuModel* model) | 
| 35     : views::LabelButton(listener, base::string16()), | 35     : views::LabelButton(listener, base::string16()), | 
| 36       profile_(profile), | 36       profile_(profile), | 
| 37       model_(model), | 37       model_(model), | 
| 38       menu_showing_(false), | 38       menu_showing_(false), | 
| 39       y_position_on_lbuttondown_(0), | 39       y_position_on_lbuttondown_(0), | 
| 40       ink_drop_delegate_(new views::ButtonInkDropDelegate(this, this)), |  | 
| 41       show_menu_factory_(this) { | 40       show_menu_factory_(this) { | 
| 42   set_ink_drop_delegate(ink_drop_delegate_.get()); | 41   set_ink_drop_delegate( | 
|  | 42       base::WrapUnique(new views::ButtonInkDropDelegate(this, this))); | 
| 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   if (ui::MaterialDesignController::IsModeMaterial()) | 
|  | 46     SetFocusPainter(nullptr); | 
| 45 } | 47 } | 
| 46 | 48 | 
| 47 ToolbarButton::~ToolbarButton() {} | 49 ToolbarButton::~ToolbarButton() {} | 
| 48 | 50 | 
| 49 void ToolbarButton::Init() { | 51 void ToolbarButton::Init() { | 
| 50   SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); | 52   SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); | 
| 51   image()->EnableCanvasFlippingForRTLUI(true); | 53   image()->EnableCanvasFlippingForRTLUI(true); | 
| 52 } | 54 } | 
| 53 | 55 | 
| 54 void ToolbarButton::ClearPendingMenu() { | 56 void ToolbarButton::ClearPendingMenu() { | 
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 253   if (state() != STATE_DISABLED) | 255   if (state() != STATE_DISABLED) | 
| 254     SetState(STATE_NORMAL); | 256     SetState(STATE_NORMAL); | 
| 255 | 257 | 
| 256   menu_runner_.reset(); | 258   menu_runner_.reset(); | 
| 257   menu_model_adapter_.reset(); | 259   menu_model_adapter_.reset(); | 
| 258 } | 260 } | 
| 259 | 261 | 
| 260 const char* ToolbarButton::GetClassName() const { | 262 const char* ToolbarButton::GetClassName() const { | 
| 261   return "ToolbarButton"; | 263   return "ToolbarButton"; | 
| 262 } | 264 } | 
| OLD | NEW | 
|---|