Popular sites on the NTP: Try to keep the ordering constant
[chromium-blink-merge.git] / content / public / browser / android / synchronous_compositor_client.h
blobc77799c7a5cb8f84845773688f0b7d791e5bcf57
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_CLIENT_H_
6 #define CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_CLIENT_H_
8 #include "base/basictypes.h"
9 #include "base/callback_forward.h"
10 #include "base/time/time.h"
11 #include "ui/gfx/geometry/size_f.h"
12 #include "ui/gfx/geometry/vector2d_f.h"
14 namespace content {
16 class SynchronousCompositor;
18 class SynchronousCompositorClient {
19 public:
20 // Indication to the client that |compositor| is now initialized on the
21 // compositor thread, and open for business.
22 virtual void DidInitializeCompositor(SynchronousCompositor* compositor) = 0;
24 // Indication to the client that |compositor| is going out of scope, and
25 // must not be accessed within or after this call.
26 // NOTE if the client goes away before the compositor it must call
27 // SynchronousCompositor::SetClient(nullptr) to release the back pointer.
28 virtual void DidDestroyCompositor(SynchronousCompositor* compositor) = 0;
30 // See LayerScrollOffsetDelegate for details.
31 virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() = 0;
32 virtual void UpdateRootLayerState(const gfx::Vector2dF& total_scroll_offset,
33 const gfx::Vector2dF& max_scroll_offset,
34 const gfx::SizeF& scrollable_size,
35 float page_scale_factor,
36 float min_page_scale_factor,
37 float max_page_scale_factor) = 0;
38 virtual bool IsExternalScrollActive() const = 0;
40 typedef base::Callback<void(base::TimeTicks)> AnimationCallback;
41 virtual void SetNeedsAnimateScroll(const AnimationCallback& animation) = 0;
43 virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll,
44 gfx::Vector2dF latest_overscroll_delta,
45 gfx::Vector2dF current_fling_velocity) = 0;
47 virtual void PostInvalidate() = 0;
49 virtual void DidUpdateContent() = 0;
51 protected:
52 SynchronousCompositorClient() {}
53 virtual ~SynchronousCompositorClient() {}
55 private:
56 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorClient);
59 } // namespace content
61 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_CLIENT_H_