Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: ui/views/controls/button/button_dropdown.cc

Issue 16979002: Add ContextMenuSourceType to views::ContextMenuController::ShowContextMenuForView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/controls/button/button_dropdown.h" 5 #include "ui/views/controls/button/button_dropdown.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 ImageButton::OnGestureEvent(event); 124 ImageButton::OnGestureEvent(event);
125 } 125 }
126 126
127 void ButtonDropDown::GetAccessibleState(ui::AccessibleViewState* state) { 127 void ButtonDropDown::GetAccessibleState(ui::AccessibleViewState* state) {
128 CustomButton::GetAccessibleState(state); 128 CustomButton::GetAccessibleState(state);
129 state->role = ui::AccessibilityTypes::ROLE_BUTTONDROPDOWN; 129 state->role = ui::AccessibilityTypes::ROLE_BUTTONDROPDOWN;
130 state->default_action = l10n_util::GetStringUTF16(IDS_APP_ACCACTION_PRESS); 130 state->default_action = l10n_util::GetStringUTF16(IDS_APP_ACCACTION_PRESS);
131 state->state = ui::AccessibilityTypes::STATE_HASPOPUP; 131 state->state = ui::AccessibilityTypes::STATE_HASPOPUP;
132 } 132 }
133 133
134 void ButtonDropDown::ShowContextMenuForView(View* source, 134 void ButtonDropDown::ShowContextMenuForView(
135 const gfx::Point& point) { 135 View* source,
136 const gfx::Point& point,
137 ui::ContextMenuSourceType source_type) {
136 if (!enabled()) 138 if (!enabled())
137 return; 139 return;
138 140
139 show_menu_factory_.InvalidateWeakPtrs(); 141 show_menu_factory_.InvalidateWeakPtrs();
140 ShowDropDownMenu(); 142 ShowDropDownMenu();
141 } 143 }
142 144
143 bool ButtonDropDown::ShouldEnterPushedState(const ui::Event& event) { 145 bool ButtonDropDown::ShouldEnterPushedState(const ui::Event& event) {
144 // Enter PUSHED state on press with Left or Right mouse button or on taps. 146 // Enter PUSHED state on press with Left or Right mouse button or on taps.
145 // Remain in this state while the context menu is open. 147 // Remain in this state while the context menu is open.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 SetState(STATE_NORMAL); 221 SetState(STATE_NORMAL);
220 } 222 }
221 223
222 //////////////////////////////////////////////////////////////////////////////// 224 ////////////////////////////////////////////////////////////////////////////////
223 // 225 //
224 // ButtonDropDown - Accessibility 226 // ButtonDropDown - Accessibility
225 // 227 //
226 //////////////////////////////////////////////////////////////////////////////// 228 ////////////////////////////////////////////////////////////////////////////////
227 229
228 } // namespace views 230 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698