1a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 2a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// found in the LICENSE file. 4a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 5a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#ifndef CONTENT_BROWSER_WEB_CONTENTS_AURA_GESTURE_NAV_SIMPLE_H_ 6a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#define CONTENT_BROWSER_WEB_CONTENTS_AURA_GESTURE_NAV_SIMPLE_H_ 7a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "base/memory/scoped_ptr.h" 9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "content/browser/renderer_host/overscroll_controller_delegate.h" 10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 11a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace gfx { 12a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class Transform; 13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace ui { 16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class Layer; 17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace content { 20a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class ArrowLayerDelegate; 22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class WebContentsImpl; 23a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 24a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// A simple delegate for the overscroll controller that paints an arrow on top 25a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// of the web-contents as a hint for pending navigations from overscroll. 26a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class GestureNavSimple : public OverscrollControllerDelegate { 27a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) public: 28a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) explicit GestureNavSimple(WebContentsImpl* web_contents); 29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual ~GestureNavSimple(); 30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) private: 32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void ApplyEffectsAndDestroy(const gfx::Transform& transform, float opacity); 33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void AbortGestureAnimation(); 34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void CompleteGestureAnimation(); 35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void ApplyEffectsForDelta(float delta_x); 36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // OverscrollControllerDelegate: 38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual gfx::Rect GetVisibleBounds() const OVERRIDE; 39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual void OnOverscrollUpdate(float delta_x, float delta_y) OVERRIDE; 40a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual void OnOverscrollComplete(OverscrollMode overscroll_mode) OVERRIDE; 41a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual void OnOverscrollModeChange(OverscrollMode old_mode, 42a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) OverscrollMode new_mode) OVERRIDE; 43a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 44a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) WebContentsImpl* web_contents_; 45a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) scoped_ptr<ui::Layer> clip_layer_; 46a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) scoped_ptr<ui::Layer> arrow_; 47a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) scoped_ptr<ArrowLayerDelegate> arrow_delegate_; 48a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) float completion_threshold_; 49a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 50a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(GestureNavSimple); 51a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}; 52a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 53a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} // namespace content 54a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 55a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_GESTURE_NAV_SIMPLE_H_ 56