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

Side by Side Diff: content/browser/web_contents/aura/gesture_nav_simple.cc

Issue 2698673006: Add User Actions and adding more details to UMA metrics for overscroll navigation (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/web_contents/aura/gesture_nav_simple.h" 5 #include "content/browser/web_contents/aura/gesture_nav_simple.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "cc/paint/paint_flags.h" 10 #include "cc/paint/paint_flags.h"
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 CompleteGestureAnimation(); 367 CompleteGestureAnimation();
368 368
369 NavigationControllerImpl& controller = web_contents_->GetController(); 369 NavigationControllerImpl& controller = web_contents_->GetController();
370 if (ShouldNavigateForward(controller, overscroll_mode)) 370 if (ShouldNavigateForward(controller, overscroll_mode))
371 controller.GoForward(); 371 controller.GoForward();
372 else if (ShouldNavigateBack(controller, overscroll_mode)) 372 else if (ShouldNavigateBack(controller, overscroll_mode))
373 controller.GoBack(); 373 controller.GoBack();
374 } 374 }
375 375
376 void GestureNavSimple::OnOverscrollModeChange(OverscrollMode old_mode, 376 void GestureNavSimple::OnOverscrollModeChange(OverscrollMode old_mode,
377 OverscrollMode new_mode) { 377 OverscrollMode new_mode,
378 OverscrollSource source) {
378 NavigationControllerImpl& controller = web_contents_->GetController(); 379 NavigationControllerImpl& controller = web_contents_->GetController();
379 if (!ShouldNavigateForward(controller, new_mode) && 380 if (!ShouldNavigateForward(controller, new_mode) &&
380 !ShouldNavigateBack(controller, new_mode)) { 381 !ShouldNavigateBack(controller, new_mode)) {
381 AbortGestureAnimation(); 382 AbortGestureAnimation();
382 return; 383 return;
383 } 384 }
384 385
385 aura::Window* window = web_contents_->GetNativeView(); 386 aura::Window* window = web_contents_->GetNativeView();
386 const gfx::Rect& window_bounds = window->bounds(); 387 const gfx::Rect& window_bounds = window->bounds();
387 completion_threshold_ = 388 completion_threshold_ =
388 window_bounds.width() * 389 window_bounds.width() *
389 GetOverscrollConfig(OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE) - 390 GetOverscrollConfig(OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE) -
390 GetOverscrollConfig(OVERSCROLL_CONFIG_HORIZ_THRESHOLD_START_TOUCHSCREEN); 391 GetOverscrollConfig(OVERSCROLL_CONFIG_HORIZ_THRESHOLD_START_TOUCHSCREEN);
mohsen 2017/02/21 20:47:58 Can you use the new source value to get the correc
mfomitchev 2017/02/23 02:59:42 Done.
391 392
392 affordance_.reset(new Affordance(new_mode, window_bounds)); 393 affordance_.reset(new Affordance(new_mode, window_bounds));
393 394
394 // Adding the affordance as a child of the content window is not sufficient, 395 // Adding the affordance as a child of the content window is not sufficient,
395 // because it is possible for a new layer to be parented on top of the 396 // because it is possible for a new layer to be parented on top of the
396 // affordance layer (e.g. when the navigated-to page is displayed while the 397 // affordance layer (e.g. when the navigated-to page is displayed while the
397 // completion animation is in progress). So instead, it is installed on top of 398 // completion animation is in progress). So instead, it is installed on top of
398 // the content window as its sibling. Note that the affordance itself makes 399 // the content window as its sibling. Note that the affordance itself makes
399 // sure that its contents are clipped to the bounds given to it. 400 // sure that its contents are clipped to the bounds given to it.
400 ui::Layer* parent = window->layer()->parent(); 401 ui::Layer* parent = window->layer()->parent();
401 parent->Add(affordance_->root_layer()); 402 parent->Add(affordance_->root_layer());
402 parent->StackAtTop(affordance_->root_layer()); 403 parent->StackAtTop(affordance_->root_layer());
403 } 404 }
404 405
405 } // namespace content 406 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698