OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/views/touchui/touch_selection_controller_impl.h" | 5 #include "ui/views/touchui/touch_selection_controller_impl.h" |
6 | 6 |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
9 #include "grit/ui_strings.h" | 9 #include "grit/ui_strings.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 415 } |
416 | 416 |
417 void TouchSelectionControllerImpl::ExecuteCommand(int command_id, | 417 void TouchSelectionControllerImpl::ExecuteCommand(int command_id, |
418 int event_flags) { | 418 int event_flags) { |
419 HideContextMenu(); | 419 HideContextMenu(); |
420 client_view_->ExecuteCommand(command_id, event_flags); | 420 client_view_->ExecuteCommand(command_id, event_flags); |
421 } | 421 } |
422 | 422 |
423 void TouchSelectionControllerImpl::OpenContextMenu() { | 423 void TouchSelectionControllerImpl::OpenContextMenu() { |
424 // Context menu should appear centered on top of the selected region. | 424 // Context menu should appear centered on top of the selected region. |
425 gfx::Point anchor(context_menu_->anchor_rect().CenterPoint().x(), | 425 const gfx::Rect rect = context_menu_->GetAnchorRect(); |
426 context_menu_->anchor_rect().y()); | 426 const gfx::Point anchor(rect.CenterPoint().x(), rect.y()); |
427 HideContextMenu(); | 427 HideContextMenu(); |
428 client_view_->OpenContextMenu(anchor); | 428 client_view_->OpenContextMenu(anchor); |
429 } | 429 } |
430 | 430 |
431 void TouchSelectionControllerImpl::OnMenuClosed(TouchEditingMenuView* menu) { | 431 void TouchSelectionControllerImpl::OnMenuClosed(TouchEditingMenuView* menu) { |
432 if (menu == context_menu_) | 432 if (menu == context_menu_) |
433 context_menu_ = NULL; | 433 context_menu_ = NULL; |
434 } | 434 } |
435 | 435 |
436 void TouchSelectionControllerImpl::OnWidgetClosing(Widget* widget) { | 436 void TouchSelectionControllerImpl::OnWidgetClosing(Widget* widget) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 } | 534 } |
535 | 535 |
536 ui::TouchSelectionController* ViewsTouchSelectionControllerFactory::create( | 536 ui::TouchSelectionController* ViewsTouchSelectionControllerFactory::create( |
537 ui::TouchEditable* client_view) { | 537 ui::TouchEditable* client_view) { |
538 if (switches::IsTouchEditingEnabled()) | 538 if (switches::IsTouchEditingEnabled()) |
539 return new views::TouchSelectionControllerImpl(client_view); | 539 return new views::TouchSelectionControllerImpl(client_view); |
540 return NULL; | 540 return NULL; |
541 } | 541 } |
542 | 542 |
543 } // namespace views | 543 } // namespace views |
OLD | NEW |