summaryrefslogtreecommitdiffstats
path: root/cc/layers/ui_resource_layer.h
diff options
context:
space:
mode:
authorclholgat@chromium.org <clholgat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-04 00:35:13 +0000
committerclholgat@chromium.org <clholgat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-04 00:35:13 +0000
commitefbdb3ac428aa1829161729189604865e606691b (patch)
treee2b465b299b54934d06c020c0ea514292841aa15 /cc/layers/ui_resource_layer.h
parent18ae4320efce8e3342c3a5048569a25c4f2498ab (diff)
downloadchromium_src-efbdb3ac428aa1829161729189604865e606691b.zip
chromium_src-efbdb3ac428aa1829161729189604865e606691b.tar.gz
chromium_src-efbdb3ac428aa1829161729189604865e606691b.tar.bz2
Generic UIResourceLayer for shared resources.
Separated the UIResource management from the NinePatchLayer because we need it for other things as well. BUG=235290 Review URL: https://codereview.chromium.org/24716003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226908 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layers/ui_resource_layer.h')
-rw-r--r--cc/layers/ui_resource_layer.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/cc/layers/ui_resource_layer.h b/cc/layers/ui_resource_layer.h
new file mode 100644
index 0000000..173ca44
--- /dev/null
+++ b/cc/layers/ui_resource_layer.h
@@ -0,0 +1,59 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_LAYERS_UI_RESOURCE_LAYER_H_
+#define CC_LAYERS_UI_RESOURCE_LAYER_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "cc/base/cc_export.h"
+#include "cc/layers/layer.h"
+#include "cc/resources/ui_resource_client.h"
+#include "ui/gfx/rect.h"
+
+namespace cc {
+
+class LayerTreeHost;
+class ScopedUIResource;
+
+class CC_EXPORT UIResourceLayer : public Layer {
+ public:
+ static scoped_refptr<UIResourceLayer> Create();
+
+ virtual bool DrawsContent() const OVERRIDE;
+
+ virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
+
+ virtual void SetLayerTreeHost(LayerTreeHost* host) OVERRIDE;
+
+ void SetBitmap(const SkBitmap& skbitmap);
+
+ // An alternative way of setting the resource to allow for sharing.
+ void SetUIResourceId(UIResourceId resource_id);
+
+ class UIResourceHolder {
+ public:
+ virtual UIResourceId id() = 0;
+ virtual ~UIResourceHolder();
+ };
+
+ protected:
+ UIResourceLayer();
+ virtual ~UIResourceLayer();
+
+ scoped_ptr<UIResourceHolder> ui_resource_holder_;
+ SkBitmap bitmap_;
+
+ private:
+ virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
+ OVERRIDE;
+ void RecreateUIResourceHolder();
+
+
+
+ DISALLOW_COPY_AND_ASSIGN(UIResourceLayer);
+};
+
+} // namespace cc
+
+#endif // CC_LAYERS_UI_RESOURCE_LAYER_H_