chromium/content/browser/web_contents/aura/gesture_nav_simple.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/web_contents/aura/gesture_nav_simple.h"

#include <utility>

#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "cc/paint/paint_flags.h"
#include "components/vector_icons/vector_icons.h"
#include "content/browser/renderer_host/navigation_controller_impl.h"
#include "content/browser/renderer_host/overscroll_controller.h"
#include "content/browser/web_contents/aura/types.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/overscroll_configuration.h"
#include "content/public/browser/preloading.h"
#include "ui/aura/window.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_delegate.h"
#include "ui/compositor/paint_recorder.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/animation/linear_animation.h"
#include "ui/gfx/animation/tween.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/shadow_value.h"
#include "ui/gfx/skia_paint_util.h"

namespace content {

namespace {

// Parameters defining the arrow icon inside the affordance.
constexpr int kArrowSize =;
constexpr SkColor kArrowColorBeforeActivation =;
constexpr SkColor kArrowColorAfterActivation =;

// Parameters defining the background circle of the affordance.
constexpr int kBackgroundRadius =;
constexpr SkColor kBackgroundColorBeforeActivation =;
constexpr SkColor kBackgroundColorAfterActivation =;
constexpr int kBgShadowOffsetY =;
constexpr int kBgShadowBlurRadius =;
constexpr SkColor kBgShadowColor =;

// Parameters defining the affordance ripple. The ripple fades in and grows as
// the user drags the affordance until it reaches |kMaxRippleRadius|. If the
// overscroll is successful, the ripple will burst by fading out and growing to
// |kMaxRippleBurstRadius|.
constexpr int kMaxRippleRadius =;
constexpr SkColor kRippleColor =;  // 30%

constexpr int kMaxRippleBurstRadius =;
constexpr gfx::Tween::Type kBurstAnimationTweenType =;
constexpr auto kRippleBurstAnimationDuration =;

// Offset of the affordance when it is at the activation threshold. Since the
// affordance is initially out of content bounds, this is the offset of the
// farther side of the affordance (which equals 128 + 18).
constexpr int kAffordanceActivationOffset =;

// Extra offset of the affordance when it is dragged past the activation
// threshold.
constexpr int kAffordanceExtraOffset =;
constexpr gfx::Tween::Type kExtraDragTweenType =;

constexpr float kExtraAffordanceRatio =;

// Parameters defining animation when the affordance is aborted.
constexpr gfx::Tween::Type kAbortAnimationTweenType =;
constexpr auto kAbortAnimationDuration =;

bool ShouldNavigateForward(NavigationController* controller,
                           OverscrollMode mode) {}

bool ShouldNavigateBack(NavigationController* controller, OverscrollMode mode) {}

bool ShouldReload(const NavigationController& controller, OverscrollMode mode) {}

NavigationDirection GetDirectionFromMode(OverscrollMode mode) {}

// Records UMA histogram and also user action for the cancelled overscroll.
void RecordGestureOverscrollCancelled(NavigationDirection direction,
                                      OverscrollSource source) {}

}  // namespace

// This class is responsible for creating, painting, and positioning the layer
// for the gesture nav affordance.
class Affordance : public ui::LayerDelegate, public gfx::AnimationDelegate {};

Affordance::Affordance(GestureNavSimple* owner,
                       OverscrollMode mode,
                       const gfx::Rect& content_bounds,
                       float max_drag_progress)
    :{}

Affordance::~Affordance() {}

void Affordance::SetDragProgress(float progress) {}

void Affordance::Abort() {}

void Affordance::Complete() {}

gfx::Point Affordance::GetPaintedLayerOrigin(
    const gfx::Rect& content_bounds) const {}

void Affordance::UpdatePaintedLayer() {}

void Affordance::SchedulePaint() {}

void Affordance::SetAbortProgress(float progress) {}

void Affordance::SetCompleteProgress(float progress) {}

float Affordance::GetAffordanceProgress() const {}

void Affordance::OnPaintLayer(const ui::PaintContext& context) {}

void Affordance::OnDeviceScaleFactorChanged(float old_device_scale_factor,
                                            float new_device_scale_factor) {}

void Affordance::AnimationEnded(const gfx::Animation* animation) {}

void Affordance::AnimationProgressed(const gfx::Animation* animation) {}

void Affordance::AnimationCanceled(const gfx::Animation* animation) {}

GestureNavSimple::GestureNavSimple(WebContentsImpl* web_contents)
    :{}

GestureNavSimple::~GestureNavSimple() {}

void GestureNavSimple::OnAffordanceAnimationEnded() {}

gfx::Size GestureNavSimple::GetDisplaySize() const {}

bool GestureNavSimple::OnOverscrollUpdate(float delta_x, float delta_y) {}

void GestureNavSimple::OnOverscrollComplete(OverscrollMode overscroll_mode) {}

void GestureNavSimple::OnOverscrollModeChange(OverscrollMode old_mode,
                                              OverscrollMode new_mode,
                                              OverscrollSource source,
                                              cc::OverscrollBehavior behavior) {}

std::optional<float> GestureNavSimple::GetMaxOverscrollDelta() const {}

}  // namespace content