Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / android_webview / browser / browser_view_renderer_client.h
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
3 // found in the LICENSE file.
4
5 #ifndef ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_CLIENT_H_
6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_CLIENT_H_
7
8 #include "base/android/scoped_java_ref.h"
9 #include "ui/gfx/geometry/point.h"
10 #include "ui/gfx/geometry/size_f.h"
11 #include "ui/gfx/geometry/vector2d_f.h"
12
13 namespace android_webview {
14
15 class BrowserViewRendererClient {
16  public:
17   // Request DrawGL to be in called AwDrawGLInfo::kModeProcess type.
18   // |wait_for_completion| will cause the call to block until DrawGL has
19   // happened. The callback may never be made, and the mode may be promoted to
20   // kModeDraw.
21   virtual bool RequestDrawGL(bool wait_for_completion) = 0;
22
23   // Called when a new Picture is available. Needs to be enabled
24   // via the EnableOnNewPicture method.
25   virtual void OnNewPicture() = 0;
26
27   // Called to trigger view invalidations.
28   virtual void PostInvalidate() = 0;
29
30   // Call postInvalidateOnAnimation for invalidations. This is only used to
31   // synchronize draw functor destruction.
32   virtual void InvalidateOnFunctorDestroy() = 0;
33
34   // Called to update the parent draw constraints in browser view renderer.
35   virtual void UpdateParentDrawConstraints() = 0;
36
37   // Called if commit is skipped due to pipeline stall.
38   virtual void DidSkipCommitFrame() = 0;
39
40   // Called to get view's absolute location on the screen.
41   virtual gfx::Point GetLocationOnScreen() = 0;
42
43   // Try to set the view's scroll offset to |new_value|.
44   virtual void ScrollContainerViewTo(gfx::Vector2d new_value) = 0;
45
46   // Is a Android view system managed fling in progress?
47   virtual bool IsFlingActive() const = 0;
48
49   // Sets the following:
50   // view's scroll offset cap to |max_scroll_offset|,
51   // current contents_size to |contents_size_dip|,
52   // the current page scale to |page_scale_factor| and page scale limits
53   // to |min_page_scale_factor|..|max_page_scale_factor|.
54   virtual void UpdateScrollState(gfx::Vector2d max_scroll_offset,
55                                  gfx::SizeF contents_size_dip,
56                                  float page_scale_factor,
57                                  float min_page_scale_factor,
58                                  float max_page_scale_factor) = 0;
59
60   // Handle overscroll.
61   virtual void DidOverscroll(gfx::Vector2d overscroll_delta) = 0;
62
63  protected:
64   virtual ~BrowserViewRendererClient() {}
65 };
66
67 }  // namespace android_webview
68
69 #endif  // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_CLIENT_H_