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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "grit/ui_strings.h" | 9 #include "grit/ui_strings.h" |
10 #include "ui/base/ui_base_switches.h" | 10 #include "ui/base/ui_base_switches.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 return client_view_->IsCommandIdEnabled(command_id); | 296 return client_view_->IsCommandIdEnabled(command_id); |
297 } | 297 } |
298 | 298 |
299 void TouchSelectionControllerImpl::ExecuteCommand(int command_id, | 299 void TouchSelectionControllerImpl::ExecuteCommand(int command_id, |
300 int event_flags) { | 300 int event_flags) { |
301 HideContextMenu(); | 301 HideContextMenu(); |
302 client_view_->ExecuteCommand(command_id, event_flags); | 302 client_view_->ExecuteCommand(command_id, event_flags); |
303 } | 303 } |
304 | 304 |
305 void TouchSelectionControllerImpl::OpenContextMenu() { | 305 void TouchSelectionControllerImpl::OpenContextMenu() { |
306 gfx::Point anchor = context_menu_->anchor_point(); | 306 gfx::Point anchor = context_menu_->anchor_rect().origin(); |
307 anchor.Offset(0, -kSelectionHandleRadius); | 307 anchor.Offset(0, -kSelectionHandleRadius); |
308 HideContextMenu(); | 308 HideContextMenu(); |
309 client_view_->OpenContextMenu(anchor); | 309 client_view_->OpenContextMenu(anchor); |
310 } | 310 } |
311 | 311 |
312 void TouchSelectionControllerImpl::OnMenuClosed(TouchEditingMenuView* menu) { | 312 void TouchSelectionControllerImpl::OnMenuClosed(TouchEditingMenuView* menu) { |
313 if (menu == context_menu_) | 313 if (menu == context_menu_) |
314 context_menu_ = NULL; | 314 context_menu_ = NULL; |
315 } | 315 } |
316 | 316 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 ui::TouchEditable* client_view) { | 415 ui::TouchEditable* client_view) { |
416 #if defined(OS_CHROMEOS) | 416 #if defined(OS_CHROMEOS) |
417 if (CommandLine::ForCurrentProcess()->HasSwitch( | 417 if (CommandLine::ForCurrentProcess()->HasSwitch( |
418 switches::kEnableTouchEditing)) | 418 switches::kEnableTouchEditing)) |
419 return new views::TouchSelectionControllerImpl(client_view); | 419 return new views::TouchSelectionControllerImpl(client_view); |
420 #endif | 420 #endif |
421 return NULL; | 421 return NULL; |
422 } | 422 } |
423 | 423 |
424 } // namespace views | 424 } // namespace views |
OLD | NEW |