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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 return; | 118 return; |
119 } | 119 } |
120 | 120 |
121 LabelButton::OnGestureEvent(event); | 121 LabelButton::OnGestureEvent(event); |
122 } | 122 } |
123 | 123 |
124 void ToolbarButton::GetAccessibleState(ui::AXViewState* state) { | 124 void ToolbarButton::GetAccessibleState(ui::AXViewState* state) { |
125 CustomButton::GetAccessibleState(state); | 125 CustomButton::GetAccessibleState(state); |
126 state->role = ui::AX_ROLE_BUTTON_DROP_DOWN; | 126 state->role = ui::AX_ROLE_BUTTON_DROP_DOWN; |
127 state->default_action = l10n_util::GetStringUTF16(IDS_APP_ACCACTION_PRESS); | 127 state->default_action = l10n_util::GetStringUTF16(IDS_APP_ACCACTION_PRESS); |
128 state->state = ui::AX_STATE_HASPOPUP; | 128 state->SetStateFlag(ui::AX_STATE_HASPOPUP); |
129 } | 129 } |
130 | 130 |
131 void ToolbarButton::ShowContextMenuForView(View* source, | 131 void ToolbarButton::ShowContextMenuForView(View* source, |
132 const gfx::Point& point, | 132 const gfx::Point& point, |
133 ui::MenuSourceType source_type) { | 133 ui::MenuSourceType source_type) { |
134 if (!enabled()) | 134 if (!enabled()) |
135 return; | 135 return; |
136 | 136 |
137 show_menu_factory_.InvalidateWeakPtrs(); | 137 show_menu_factory_.InvalidateWeakPtrs(); |
138 ShowDropDownMenu(source_type); | 138 ShowDropDownMenu(source_type); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 224 |
225 // Need to explicitly clear mouse handler so that events get sent | 225 // Need to explicitly clear mouse handler so that events get sent |
226 // properly after the menu finishes running. If we don't do this, then | 226 // properly after the menu finishes running. If we don't do this, then |
227 // the first click to other parts of the UI is eaten. | 227 // the first click to other parts of the UI is eaten. |
228 SetMouseHandler(NULL); | 228 SetMouseHandler(NULL); |
229 | 229 |
230 // Set the state back to normal after the drop down menu is closed. | 230 // Set the state back to normal after the drop down menu is closed. |
231 if (state_ != STATE_DISABLED) | 231 if (state_ != STATE_DISABLED) |
232 SetState(STATE_NORMAL); | 232 SetState(STATE_NORMAL); |
233 } | 233 } |
OLD | NEW |