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

Side by Side Diff: views/touchui/touch_selection_controller_impl.cc

Issue 7824041: Update base/timer.h code to pass through Location from call sites. (reland) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: touch Created 9 years, 3 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
« no previous file with comments | « views/touchui/touch_factory.cc ('k') | views/widget/tooltip_manager_views.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/touchui/touch_selection_controller_impl.h" 5 #include "views/touchui/touch_selection_controller_impl.h"
6 6
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "grit/ui_strings.h" 8 #include "grit/ui_strings.h"
9 #include "ui/base/l10n/l10n_util.h" 9 #include "ui/base/l10n/l10n_util.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 selection_handle_1_->SetVisible(false); 304 selection_handle_1_->SetVisible(false);
305 selection_handle_2_->SetVisible(false); 305 selection_handle_2_->SetVisible(false);
306 HideContextMenu(); 306 HideContextMenu();
307 } 307 }
308 308
309 void TouchSelectionControllerImpl::SelectionHandleDragged( 309 void TouchSelectionControllerImpl::SelectionHandleDragged(
310 const gfx::Point& drag_pos) { 310 const gfx::Point& drag_pos) {
311 // We do not want to show the context menu while dragging. 311 // We do not want to show the context menu while dragging.
312 HideContextMenu(); 312 HideContextMenu();
313 context_menu_timer_.Start( 313 context_menu_timer_.Start(
314 FROM_HERE,
314 base::TimeDelta::FromMilliseconds(kContextMenuTimoutMs), 315 base::TimeDelta::FromMilliseconds(kContextMenuTimoutMs),
315 this, 316 this,
316 &TouchSelectionControllerImpl::ContextMenuTimerFired); 317 &TouchSelectionControllerImpl::ContextMenuTimerFired);
317 318
318 if (client_view_->GetWidget()) { 319 if (client_view_->GetWidget()) {
319 DCHECK(dragging_handle_); 320 DCHECK(dragging_handle_);
320 // Find the stationary selection handle. 321 // Find the stationary selection handle.
321 SelectionHandleView* fixed_handle = selection_handle_1_.get(); 322 SelectionHandleView* fixed_handle = selection_handle_1_.get();
322 if (fixed_handle == dragging_handle_) 323 if (fixed_handle == dragging_handle_)
323 fixed_handle = selection_handle_2_.get(); 324 fixed_handle = selection_handle_2_.get();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 } 381 }
381 382
382 void TouchSelectionControllerImpl::UpdateContextMenu(const gfx::Point& p1, 383 void TouchSelectionControllerImpl::UpdateContextMenu(const gfx::Point& p1,
383 const gfx::Point& p2) { 384 const gfx::Point& p2) {
384 // Hide context menu to be shown when the timer fires. 385 // Hide context menu to be shown when the timer fires.
385 HideContextMenu(); 386 HideContextMenu();
386 387
387 // If there is selection, we restart the context menu timer. 388 // If there is selection, we restart the context menu timer.
388 if (p1 != p2) { 389 if (p1 != p2) {
389 context_menu_timer_.Start( 390 context_menu_timer_.Start(
391 FROM_HERE,
390 base::TimeDelta::FromMilliseconds(kContextMenuTimoutMs), 392 base::TimeDelta::FromMilliseconds(kContextMenuTimoutMs),
391 this, 393 this,
392 &TouchSelectionControllerImpl::ContextMenuTimerFired); 394 &TouchSelectionControllerImpl::ContextMenuTimerFired);
393 } 395 }
394 } 396 }
395 397
396 void TouchSelectionControllerImpl::HideContextMenu() { 398 void TouchSelectionControllerImpl::HideContextMenu() {
397 context_menu_->SetVisible(false); 399 context_menu_->SetVisible(false);
398 context_menu_timer_.Stop(); 400 context_menu_timer_.Stop();
399 } 401 }
(...skipping 13 matching lines...) Expand all
413 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { 415 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() {
414 return selection_handle_2_->IsVisible(); 416 return selection_handle_2_->IsVisible();
415 } 417 }
416 418
417 TouchSelectionController* TouchSelectionController::create( 419 TouchSelectionController* TouchSelectionController::create(
418 TouchSelectionClientView* client_view) { 420 TouchSelectionClientView* client_view) {
419 return new TouchSelectionControllerImpl(client_view); 421 return new TouchSelectionControllerImpl(client_view);
420 } 422 }
421 423
422 } // namespace views 424 } // namespace views
OLDNEW
« no previous file with comments | « views/touchui/touch_factory.cc ('k') | views/widget/tooltip_manager_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698