#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 {
constexpr int kArrowSize = …;
constexpr SkColor kArrowColorBeforeActivation = …;
constexpr SkColor kArrowColorAfterActivation = …;
constexpr int kBackgroundRadius = …;
constexpr SkColor kBackgroundColorBeforeActivation = …;
constexpr SkColor kBackgroundColorAfterActivation = …;
constexpr int kBgShadowOffsetY = …;
constexpr int kBgShadowBlurRadius = …;
constexpr SkColor kBgShadowColor = …;
constexpr int kMaxRippleRadius = …;
constexpr SkColor kRippleColor = …;
constexpr int kMaxRippleBurstRadius = …;
constexpr gfx::Tween::Type kBurstAnimationTweenType = …;
constexpr auto kRippleBurstAnimationDuration = …;
constexpr int kAffordanceActivationOffset = …;
constexpr int kAffordanceExtraOffset = …;
constexpr gfx::Tween::Type kExtraDragTweenType = …;
constexpr float kExtraAffordanceRatio = …;
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) { … }
void RecordGestureOverscrollCancelled(NavigationDirection direction,
OverscrollSource source) { … }
}
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 { … }
}