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

Side by Side Diff: ui/views/controls/scrollbar/base_scroll_bar.cc

Issue 9665008: views: Nuke is_mouse_gesture parameter from ContextMenuController::ShowContextMenuForView(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nuke is_mouse_gesture parameter Created 8 years, 9 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) 2011 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/scrollbar/base_scroll_bar.h" 5 #include "ui/views/controls/scrollbar/base_scroll_bar.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 enum ScrollBarContextMenuCommands { 195 enum ScrollBarContextMenuCommands {
196 ScrollBarContextMenuCommand_ScrollHere = 1, 196 ScrollBarContextMenuCommand_ScrollHere = 1,
197 ScrollBarContextMenuCommand_ScrollStart, 197 ScrollBarContextMenuCommand_ScrollStart,
198 ScrollBarContextMenuCommand_ScrollEnd, 198 ScrollBarContextMenuCommand_ScrollEnd,
199 ScrollBarContextMenuCommand_ScrollPageUp, 199 ScrollBarContextMenuCommand_ScrollPageUp,
200 ScrollBarContextMenuCommand_ScrollPageDown, 200 ScrollBarContextMenuCommand_ScrollPageDown,
201 ScrollBarContextMenuCommand_ScrollPrev, 201 ScrollBarContextMenuCommand_ScrollPrev,
202 ScrollBarContextMenuCommand_ScrollNext 202 ScrollBarContextMenuCommand_ScrollNext
203 }; 203 };
204 204
205 void BaseScrollBar::ShowContextMenuForView(View* source, 205 void BaseScrollBar::ShowContextMenuForView(View* source, const gfx::Point& p) {
206 const gfx::Point& p,
207 bool is_mouse_gesture) {
208 Widget* widget = GetWidget(); 206 Widget* widget = GetWidget();
209 gfx::Rect widget_bounds = widget->GetWindowScreenBounds(); 207 gfx::Rect widget_bounds = widget->GetWindowScreenBounds();
210 gfx::Point temp_pt(p.x() - widget_bounds.x(), p.y() - widget_bounds.y()); 208 gfx::Point temp_pt(p.x() - widget_bounds.x(), p.y() - widget_bounds.y());
211 View::ConvertPointFromWidget(this, &temp_pt); 209 View::ConvertPointFromWidget(this, &temp_pt);
212 context_menu_mouse_position_ = IsHorizontal() ? temp_pt.x() : temp_pt.y(); 210 context_menu_mouse_position_ = IsHorizontal() ? temp_pt.x() : temp_pt.y();
213 211
214 views::MenuItemView* menu = new views::MenuItemView(this); 212 views::MenuItemView* menu = new views::MenuItemView(this);
215 // MenuRunner takes ownership of |menu|. 213 // MenuRunner takes ownership of |menu|.
216 menu_runner_.reset(new MenuRunner(menu)); 214 menu_runner_.reset(new MenuRunner(menu));
217 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollHere); 215 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollHere);
218 menu->AppendSeparator(); 216 menu->AppendSeparator();
219 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollStart); 217 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollStart);
220 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollEnd); 218 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollEnd);
221 menu->AppendSeparator(); 219 menu->AppendSeparator();
222 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollPageUp); 220 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollPageUp);
223 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollPageDown); 221 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollPageDown);
224 menu->AppendSeparator(); 222 menu->AppendSeparator();
225 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollPrev); 223 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollPrev);
226 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollNext); 224 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollNext);
227 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(p, gfx::Size(0, 0)), 225 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(p, gfx::Size()),
228 MenuItemView::TOPLEFT, MenuRunner::HAS_MNEMONICS) == 226 MenuItemView::TOPLEFT, MenuRunner::HAS_MNEMONICS) ==
229 MenuRunner::MENU_DELETED) 227 MenuRunner::MENU_DELETED)
230 return; 228 return;
231 } 229 }
232 230
233 /////////////////////////////////////////////////////////////////////////////// 231 ///////////////////////////////////////////////////////////////////////////////
234 // BaseScrollBar, Menu::Delegate implementation: 232 // BaseScrollBar, Menu::Delegate implementation:
235 233
236 string16 BaseScrollBar::GetLabel(int id) const { 234 string16 BaseScrollBar::GetLabel(int id) const {
237 int ids_value = 0; 235 int ids_value = 0;
238 switch (id) { 236 switch (id) {
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 thumb_position = thumb_position - (thumb_->GetSize() / 2); 382 thumb_position = thumb_position - (thumb_->GetSize() / 2);
385 return (thumb_position * contents_size_) / GetTrackSize(); 383 return (thumb_position * contents_size_) / GetTrackSize();
386 } 384 }
387 385
388 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { 386 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) {
389 thumb_track_state_ = state; 387 thumb_track_state_ = state;
390 SchedulePaint(); 388 SchedulePaint();
391 } 389 }
392 390
393 } // namespace views 391 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/scrollbar/base_scroll_bar.h ('k') | ui/views/controls/textfield/native_textfield_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698