Connect PPAPI IPC channels for non-SFI mode.
[chromium-blink-merge.git] / cc / layers / solid_color_scrollbar_layer.cc
blob22c39a6c145bfb54cfbb66117333bd01f6f5d967
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 #include "cc/layers/solid_color_scrollbar_layer.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "cc/layers/layer_impl.h"
9 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
11 namespace cc {
13 scoped_ptr<LayerImpl> SolidColorScrollbarLayer::CreateLayerImpl(
14 LayerTreeImpl* tree_impl) {
15 const bool kIsOverlayScrollbar = true;
16 return SolidColorScrollbarLayerImpl::Create(tree_impl,
17 id(),
18 orientation(),
19 thumb_thickness_,
20 is_left_side_vertical_scrollbar_,
21 kIsOverlayScrollbar)
22 .PassAs<LayerImpl>();
25 scoped_refptr<SolidColorScrollbarLayer> SolidColorScrollbarLayer::Create(
26 ScrollbarOrientation orientation,
27 int thumb_thickness,
28 bool is_left_side_vertical_scrollbar,
29 int scroll_layer_id) {
30 return make_scoped_refptr(new SolidColorScrollbarLayer(
31 orientation,
32 thumb_thickness,
33 is_left_side_vertical_scrollbar,
34 scroll_layer_id));
37 SolidColorScrollbarLayer::SolidColorScrollbarLayer(
38 ScrollbarOrientation orientation,
39 int thumb_thickness,
40 bool is_left_side_vertical_scrollbar,
41 int scroll_layer_id)
42 : scroll_layer_id_(Layer::INVALID_ID),
43 clip_layer_id_(scroll_layer_id),
44 orientation_(orientation),
45 thumb_thickness_(thumb_thickness),
46 is_left_side_vertical_scrollbar_(is_left_side_vertical_scrollbar) {}
48 SolidColorScrollbarLayer::~SolidColorScrollbarLayer() {}
50 ScrollbarLayerInterface* SolidColorScrollbarLayer::ToScrollbarLayer() {
51 return this;
54 void SolidColorScrollbarLayer::PushPropertiesTo(LayerImpl* layer) {
55 Layer::PushPropertiesTo(layer);
56 PushScrollClipPropertiesTo(layer);
59 void SolidColorScrollbarLayer::PushScrollClipPropertiesTo(LayerImpl* layer) {
60 SolidColorScrollbarLayerImpl* scrollbar_layer =
61 static_cast<SolidColorScrollbarLayerImpl*>(layer);
63 scrollbar_layer->SetScrollLayerById(scroll_layer_id_);
64 scrollbar_layer->SetClipLayerById(clip_layer_id_);
67 bool SolidColorScrollbarLayer::OpacityCanAnimateOnImplThread() const {
68 return true;
71 int SolidColorScrollbarLayer::ScrollLayerId() const {
72 return scroll_layer_id_;
75 void SolidColorScrollbarLayer::SetScrollLayer(int layer_id) {
76 if (layer_id == scroll_layer_id_)
77 return;
79 scroll_layer_id_ = layer_id;
80 SetNeedsFullTreeSync();
83 void SolidColorScrollbarLayer::SetClipLayer(int layer_id) {
84 if (layer_id == clip_layer_id_)
85 return;
87 clip_layer_id_ = layer_id;
88 SetNeedsFullTreeSync();
91 ScrollbarOrientation SolidColorScrollbarLayer::orientation() const {
92 return orientation_;
95 } // namespace cc