OLD | NEW |
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/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" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollHere); | 298 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollHere); |
299 menu->AppendSeparator(); | 299 menu->AppendSeparator(); |
300 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollStart); | 300 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollStart); |
301 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollEnd); | 301 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollEnd); |
302 menu->AppendSeparator(); | 302 menu->AppendSeparator(); |
303 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollPageUp); | 303 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollPageUp); |
304 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollPageDown); | 304 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollPageDown); |
305 menu->AppendSeparator(); | 305 menu->AppendSeparator(); |
306 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollPrev); | 306 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollPrev); |
307 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollNext); | 307 menu->AppendDelegateMenuItem(ScrollBarContextMenuCommand_ScrollNext); |
308 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(p, gfx::Size()), | 308 if (menu_runner_->RunMenuAt( |
309 views::MenuItemView::TOPLEFT, source_type, MenuRunner::HAS_MNEMONICS | | 309 GetWidget(), |
310 views::MenuRunner::CONTEXT_MENU) == | 310 NULL, |
311 MenuRunner::MENU_DELETED) | 311 gfx::Rect(p, gfx::Size()), |
| 312 MENU_ANCHOR_TOPLEFT, |
| 313 source_type, |
| 314 MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU) == |
| 315 MenuRunner::MENU_DELETED) { |
312 return; | 316 return; |
| 317 } |
313 } | 318 } |
314 | 319 |
315 /////////////////////////////////////////////////////////////////////////////// | 320 /////////////////////////////////////////////////////////////////////////////// |
316 // BaseScrollBar, Menu::Delegate implementation: | 321 // BaseScrollBar, Menu::Delegate implementation: |
317 | 322 |
318 base::string16 BaseScrollBar::GetLabel(int id) const { | 323 base::string16 BaseScrollBar::GetLabel(int id) const { |
319 int ids_value = 0; | 324 int ids_value = 0; |
320 switch (id) { | 325 switch (id) { |
321 case ScrollBarContextMenuCommand_ScrollHere: | 326 case ScrollBarContextMenuCommand_ScrollHere: |
322 ids_value = IDS_APP_SCROLLBAR_CXMENU_SCROLLHERE; | 327 ids_value = IDS_APP_SCROLLBAR_CXMENU_SCROLLHERE; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 thumb_position = thumb_position - (thumb_->GetSize() / 2); | 510 thumb_position = thumb_position - (thumb_->GetSize() / 2); |
506 return (thumb_position * contents_size_) / GetTrackSize(); | 511 return (thumb_position * contents_size_) / GetTrackSize(); |
507 } | 512 } |
508 | 513 |
509 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { | 514 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { |
510 thumb_track_state_ = state; | 515 thumb_track_state_ = state; |
511 SchedulePaint(); | 516 SchedulePaint(); |
512 } | 517 } |
513 | 518 |
514 } // namespace views | 519 } // namespace views |
OLD | NEW |