Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / public / browser / android / compositor.h
blob6ce49e98b8794d7f71471b484dc00f0823ae0d54
1 // Copyright (c) 2012 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_COMPOSITOR_H_
6 #define CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_
8 #include "base/callback.h"
9 #include "cc/resources/ui_resource_bitmap.h"
10 #include "content/common/content_export.h"
11 #include "ui/android/resources/ui_resource_provider.h"
12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/gfx/geometry/size.h"
14 #include "ui/gfx/native_widget_types.h"
16 class SkBitmap;
18 namespace cc {
19 class Layer;
20 class LayerSettings;
23 namespace gfx {
24 class JavaBitmap;
27 namespace ui {
28 class ResourceManager;
29 class UIResourceProvider;
32 namespace content {
33 class CompositorClient;
35 // An interface to the browser-side compositor.
36 class CONTENT_EXPORT Compositor {
37 public:
38 virtual ~Compositor() {}
40 // Performs the global initialization needed before any compositor
41 // instance can be used. This should be called only once.
42 static void Initialize();
44 // Creates and returns a compositor instance. |root_window| needs to outlive
45 // the compositor as it manages callbacks on the compositor.
46 static Compositor* Create(CompositorClient* client,
47 gfx::NativeWindow root_window);
49 static const cc::LayerSettings& LayerSettings();
50 static void SetLayerSettings(const cc::LayerSettings& settings);
52 // Attaches the layer tree.
53 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) = 0;
55 // Set the scale factor from DIP to pixel.
56 virtual void setDeviceScaleFactor(float factor) = 0;
58 // Set the output surface bounds.
59 virtual void SetWindowBounds(const gfx::Size& size) = 0;
61 // Set the output surface which the compositor renders into.
62 virtual void SetSurface(jobject surface) = 0;
64 // Tells the view tree to assume a transparent background when rendering.
65 virtual void SetHasTransparentBackground(bool flag) = 0;
67 // Request layout and draw. You only need to call this if you need to trigger
68 // Composite *without* having modified the layer tree.
69 virtual void SetNeedsComposite() = 0;
71 // Returns the UI resource provider associated with the compositor.
72 virtual ui::UIResourceProvider& GetUIResourceProvider() = 0;
74 // Returns the resource manager associated with the compositor.
75 virtual ui::ResourceManager& GetResourceManager() = 0;
77 protected:
78 Compositor() {}
81 } // namespace content
83 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_