| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 void ToolbarButton::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 130 void ToolbarButton::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 131 CustomButton::GetAccessibleNodeData(node_data); | 131 CustomButton::GetAccessibleNodeData(node_data); |
| 132 node_data->role = ui::AX_ROLE_BUTTON_DROP_DOWN; | 132 node_data->role = ui::AX_ROLE_BUTTON_DROP_DOWN; |
| 133 node_data->AddState(ui::AX_STATE_HASPOPUP); | 133 node_data->AddState(ui::AX_STATE_HASPOPUP); |
| 134 if (enabled()) { | 134 if (enabled()) { |
| 135 node_data->AddIntAttribute(ui::AX_ATTR_DEFAULT_ACTION_VERB, | 135 node_data->AddIntAttribute(ui::AX_ATTR_DEFAULT_ACTION_VERB, |
| 136 ui::AX_DEFAULT_ACTION_VERB_PRESS); | 136 ui::AX_DEFAULT_ACTION_VERB_PRESS); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 | 139 |
| 140 std::unique_ptr<views::InkDropRipple> ToolbarButton::CreateInkDropRipple() | |
| 141 const { | |
| 142 return CreateDefaultInkDropRipple(GetContentsBounds().CenterPoint()); | |
| 143 } | |
| 144 | |
| 145 std::unique_ptr<views::InkDropHighlight> ToolbarButton::CreateInkDropHighlight() | |
| 146 const { | |
| 147 return CreateDefaultInkDropHighlight( | |
| 148 gfx::RectF(GetContentsBounds()).CenterPoint()); | |
| 149 } | |
| 150 | |
| 151 void ToolbarButton::ShowContextMenuForView(View* source, | 140 void ToolbarButton::ShowContextMenuForView(View* source, |
| 152 const gfx::Point& point, | 141 const gfx::Point& point, |
| 153 ui::MenuSourceType source_type) { | 142 ui::MenuSourceType source_type) { |
| 154 if (!enabled()) | 143 if (!enabled()) |
| 155 return; | 144 return; |
| 156 | 145 |
| 157 show_menu_factory_.InvalidateWeakPtrs(); | 146 show_menu_factory_.InvalidateWeakPtrs(); |
| 158 ShowDropDownMenu(source_type); | 147 ShowDropDownMenu(source_type); |
| 159 } | 148 } |
| 160 | 149 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 if (state() != STATE_DISABLED) | 217 if (state() != STATE_DISABLED) |
| 229 SetState(STATE_NORMAL); | 218 SetState(STATE_NORMAL); |
| 230 | 219 |
| 231 menu_runner_.reset(); | 220 menu_runner_.reset(); |
| 232 menu_model_adapter_.reset(); | 221 menu_model_adapter_.reset(); |
| 233 } | 222 } |
| 234 | 223 |
| 235 const char* ToolbarButton::GetClassName() const { | 224 const char* ToolbarButton::GetClassName() const { |
| 236 return "ToolbarButton"; | 225 return "ToolbarButton"; |
| 237 } | 226 } |
| OLD | NEW |