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 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(p, gfx::Size()), | 298 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(p, gfx::Size()), |
299 views::MenuItemView::TOPLEFT, source_type, MenuRunner::HAS_MNEMONICS | | 299 views::MenuItemView::TOPLEFT, source_type, MenuRunner::HAS_MNEMONICS | |
300 views::MenuRunner::CONTEXT_MENU) == | 300 views::MenuRunner::CONTEXT_MENU) == |
301 MenuRunner::MENU_DELETED) | 301 MenuRunner::MENU_DELETED) |
302 return; | 302 return; |
303 } | 303 } |
304 | 304 |
305 /////////////////////////////////////////////////////////////////////////////// | 305 /////////////////////////////////////////////////////////////////////////////// |
306 // BaseScrollBar, Menu::Delegate implementation: | 306 // BaseScrollBar, Menu::Delegate implementation: |
307 | 307 |
308 string16 BaseScrollBar::GetLabel(int id) const { | 308 base::string16 BaseScrollBar::GetLabel(int id) const { |
309 int ids_value = 0; | 309 int ids_value = 0; |
310 switch (id) { | 310 switch (id) { |
311 case ScrollBarContextMenuCommand_ScrollHere: | 311 case ScrollBarContextMenuCommand_ScrollHere: |
312 ids_value = IDS_APP_SCROLLBAR_CXMENU_SCROLLHERE; | 312 ids_value = IDS_APP_SCROLLBAR_CXMENU_SCROLLHERE; |
313 break; | 313 break; |
314 case ScrollBarContextMenuCommand_ScrollStart: | 314 case ScrollBarContextMenuCommand_ScrollStart: |
315 ids_value = IsHorizontal() ? IDS_APP_SCROLLBAR_CXMENU_SCROLLLEFTEDGE | 315 ids_value = IsHorizontal() ? IDS_APP_SCROLLBAR_CXMENU_SCROLLLEFTEDGE |
316 : IDS_APP_SCROLLBAR_CXMENU_SCROLLHOME; | 316 : IDS_APP_SCROLLBAR_CXMENU_SCROLLHOME; |
317 break; | 317 break; |
318 case ScrollBarContextMenuCommand_ScrollEnd: | 318 case ScrollBarContextMenuCommand_ScrollEnd: |
(...skipping 11 matching lines...) Expand all Loading... |
330 : IDS_APP_SCROLLBAR_CXMENU_SCROLLUP; | 330 : IDS_APP_SCROLLBAR_CXMENU_SCROLLUP; |
331 break; | 331 break; |
332 case ScrollBarContextMenuCommand_ScrollNext: | 332 case ScrollBarContextMenuCommand_ScrollNext: |
333 ids_value = IsHorizontal() ? IDS_APP_SCROLLBAR_CXMENU_SCROLLRIGHT | 333 ids_value = IsHorizontal() ? IDS_APP_SCROLLBAR_CXMENU_SCROLLRIGHT |
334 : IDS_APP_SCROLLBAR_CXMENU_SCROLLDOWN; | 334 : IDS_APP_SCROLLBAR_CXMENU_SCROLLDOWN; |
335 break; | 335 break; |
336 default: | 336 default: |
337 NOTREACHED() << "Invalid BaseScrollBar Context Menu command!"; | 337 NOTREACHED() << "Invalid BaseScrollBar Context Menu command!"; |
338 } | 338 } |
339 | 339 |
340 return ids_value ? l10n_util::GetStringUTF16(ids_value) : string16(); | 340 return ids_value ? l10n_util::GetStringUTF16(ids_value) : base::string16(); |
341 } | 341 } |
342 | 342 |
343 bool BaseScrollBar::IsCommandEnabled(int id) const { | 343 bool BaseScrollBar::IsCommandEnabled(int id) const { |
344 switch (id) { | 344 switch (id) { |
345 case ScrollBarContextMenuCommand_ScrollPageUp: | 345 case ScrollBarContextMenuCommand_ScrollPageUp: |
346 case ScrollBarContextMenuCommand_ScrollPageDown: | 346 case ScrollBarContextMenuCommand_ScrollPageDown: |
347 return !IsHorizontal(); | 347 return !IsHorizontal(); |
348 } | 348 } |
349 return true; | 349 return true; |
350 } | 350 } |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 thumb_position = thumb_position - (thumb_->GetSize() / 2); | 493 thumb_position = thumb_position - (thumb_->GetSize() / 2); |
494 return (thumb_position * contents_size_) / GetTrackSize(); | 494 return (thumb_position * contents_size_) / GetTrackSize(); |
495 } | 495 } |
496 | 496 |
497 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { | 497 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { |
498 thumb_track_state_ = state; | 498 thumb_track_state_ = state; |
499 SchedulePaint(); | 499 SchedulePaint(); |
500 } | 500 } |
501 | 501 |
502 } // namespace views | 502 } // namespace views |
OLD | NEW |