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

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: Trailing period Created 3 years, 9 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();
388 DCHECK_NE(source, OverscrollSource::NONE);
389 float start_threshold = GetOverscrollConfig(
390 source == OverscrollSource::TOUCHPAD
391 ? OVERSCROLL_CONFIG_HORIZ_THRESHOLD_START_TOUCHPAD
392 : OVERSCROLL_CONFIG_HORIZ_THRESHOLD_START_TOUCHSCREEN);
387 completion_threshold_ = 393 completion_threshold_ =
388 window_bounds.width() * 394 window_bounds.width() *
389 GetOverscrollConfig(OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE) - 395 GetOverscrollConfig(OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE) -
390 GetOverscrollConfig(OVERSCROLL_CONFIG_HORIZ_THRESHOLD_START_TOUCHSCREEN); 396 start_threshold;
391 397
392 affordance_.reset(new Affordance(new_mode, window_bounds)); 398 affordance_.reset(new Affordance(new_mode, window_bounds));
393 399
394 // Adding the affordance as a child of the content window is not sufficient, 400 // 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 401 // 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 402 // 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 403 // 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 404 // 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. 405 // sure that its contents are clipped to the bounds given to it.
400 ui::Layer* parent = window->layer()->parent(); 406 ui::Layer* parent = window->layer()->parent();
401 parent->Add(affordance_->root_layer()); 407 parent->Add(affordance_->root_layer());
402 parent->StackAtTop(affordance_->root_layer()); 408 parent->StackAtTop(affordance_->root_layer());
403 } 409 }
404 410
405 } // namespace content 411 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698