Vectorize website settings icons in omnibox
[chromium-blink-merge.git] / components / html_viewer / web_layer_tree_view_impl.h
blobfc4d173160527b5a46413c4a3ee51ec9e308bd67
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.
5 #ifndef COMPONENTS_HTML_VIEWER_WEB_LAYER_TREE_VIEW_IMPL_H_
6 #define COMPONENTS_HTML_VIEWER_WEB_LAYER_TREE_VIEW_IMPL_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/single_thread_task_runner.h"
13 #include "cc/trees/layer_tree_host_client.h"
14 #include "components/view_manager/public/interfaces/gpu.mojom.h"
15 #include "mojo/cc/output_surface_mojo.h"
16 #include "third_party/WebKit/public/platform/WebLayerTreeView.h"
18 namespace base {
19 class SingleThreadTaskRunner;
22 namespace blink {
23 class WebWidget;
26 namespace cc {
27 class LayerTreeHost;
28 class TaskGraphRunner;
31 namespace gpu {
32 class GpuMemoryBufferManager;
35 namespace mojo {
36 class View;
39 namespace html_viewer {
41 class WebLayerTreeViewImpl : public blink::WebLayerTreeView,
42 public cc::LayerTreeHostClient {
43 public:
44 WebLayerTreeViewImpl(
45 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner,
46 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
47 cc::TaskGraphRunner* task_graph_runner);
48 ~WebLayerTreeViewImpl() override;
50 void Initialize(mojo::GpuPtr gpu_service,
51 mojo::View* view,
52 blink::WebWidget* widget);
54 // cc::LayerTreeHostClient implementation.
55 void WillBeginMainFrame() override;
56 void DidBeginMainFrame() override;
57 void BeginMainFrame(const cc::BeginFrameArgs& args) override;
58 void BeginMainFrameNotExpectedSoon() override;
59 void Layout() override;
60 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
61 const gfx::Vector2dF& outer_delta,
62 const gfx::Vector2dF& elastic_overscroll_delta,
63 float page_scale,
64 float top_controls_delta) override;
65 void RequestNewOutputSurface() override;
66 void DidFailToInitializeOutputSurface() override;
67 void DidInitializeOutputSurface() override;
68 void WillCommit() override;
69 void DidCommit() override;
70 void DidCommitAndDrawFrame() override;
71 void DidCompleteSwapBuffers() override;
72 void DidCompletePageScaleAnimation() override {}
73 void RateLimitSharedMainThreadContext() override {}
74 void RecordFrameTimingEvents(
75 scoped_ptr<cc::FrameTimingTracker::CompositeTimingSet> composite_events,
76 scoped_ptr<cc::FrameTimingTracker::MainFrameTimingSet> main_frame_events)
77 override {}
79 // blink::WebLayerTreeView implementation.
80 virtual void setRootLayer(const blink::WebLayer& layer);
81 virtual void clearRootLayer();
82 virtual void setViewportSize(const blink::WebSize& device_viewport_size);
83 virtual blink::WebSize deviceViewportSize() const;
84 virtual void setDeviceScaleFactor(float);
85 virtual float deviceScaleFactor() const;
86 virtual void setBackgroundColor(blink::WebColor color);
87 virtual void setHasTransparentBackground(bool has_transparent_background);
88 virtual void setVisible(bool visible);
89 virtual void setPageScaleFactorAndLimits(float page_scale_factor,
90 float minimum,
91 float maximum);
92 virtual void startPageScaleAnimation(const blink::WebPoint& destination,
93 bool use_anchor,
94 float new_page_scale,
95 double duration_sec);
96 virtual void heuristicsForGpuRasterizationUpdated(bool matches_heuristic) {}
97 virtual void setNeedsAnimate();
98 virtual void didStopFlinging() {}
99 virtual void compositeAndReadbackAsync(
100 blink::WebCompositeAndReadbackAsyncCallback* callback) {}
101 virtual void finishAllRendering();
102 virtual void setDeferCommits(bool defer_commits) {}
103 virtual void registerForAnimations(blink::WebLayer* layer);
104 virtual void registerViewportLayers(
105 const blink::WebLayer* overscrollElasticityLayer,
106 const blink::WebLayer* pageScaleLayerLayer,
107 const blink::WebLayer* innerViewportScrollLayer,
108 const blink::WebLayer* outerViewportScrollLayer);
109 virtual void clearViewportLayers();
110 virtual void registerSelection(const blink::WebSelection& selection) {}
111 virtual void clearSelection() {}
112 virtual void setShowFPSCounter(bool) {}
113 virtual void setShowPaintRects(bool) {}
114 virtual void setShowDebugBorders(bool) {}
115 virtual void setContinuousPaintingEnabled(bool) {}
116 virtual void setShowScrollBottleneckRects(bool) {}
118 private:
119 // widget_ and view_ will outlive us.
120 blink::WebWidget* widget_;
121 mojo::View* view_;
122 scoped_ptr<cc::LayerTreeHost> layer_tree_host_;
123 scoped_ptr<cc::OutputSurface> output_surface_;
124 scoped_refptr<base::SingleThreadTaskRunner>
125 main_thread_compositor_task_runner_;
126 base::WeakPtr<WebLayerTreeViewImpl> main_thread_bound_weak_ptr_;
128 base::WeakPtrFactory<WebLayerTreeViewImpl> weak_factory_;
129 DISALLOW_COPY_AND_ASSIGN(WebLayerTreeViewImpl);
132 } // namespace html_viewer
134 #endif // COMPONENTS_HTML_VIEWER_WEB_LAYER_TREE_VIEW_IMPL_H_