Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / cc / blink / web_content_layer_impl.cc
blob9e31bb6b3be622d81dffbaccee8256424d6bc6fb
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 #include "cc/blink/web_content_layer_impl.h"
7 #include "cc/blink/web_display_item_list_impl.h"
8 #include "cc/layers/content_layer.h"
9 #include "cc/layers/picture_layer.h"
10 #include "third_party/WebKit/public/platform/WebContentLayerClient.h"
11 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
12 #include "third_party/WebKit/public/platform/WebFloatRect.h"
13 #include "third_party/WebKit/public/platform/WebRect.h"
14 #include "third_party/WebKit/public/platform/WebSize.h"
15 #include "third_party/skia/include/utils/SkMatrix44.h"
17 using cc::ContentLayer;
18 using cc::PictureLayer;
20 namespace cc_blink {
22 static blink::WebContentLayerClient::PaintingControlSetting
23 PaintingControlToWeb(
24 cc::ContentLayerClient::PaintingControlSetting painting_control) {
25 switch (painting_control) {
26 case cc::ContentLayerClient::PAINTING_BEHAVIOR_NORMAL:
27 return blink::WebContentLayerClient::PaintDefaultBehavior;
28 case cc::ContentLayerClient::DISPLAY_LIST_CONSTRUCTION_DISABLED:
29 return blink::WebContentLayerClient::DisplayListConstructionDisabled;
30 case cc::ContentLayerClient::DISPLAY_LIST_CACHING_DISABLED:
31 return blink::WebContentLayerClient::DisplayListCachingDisabled;
32 case cc::ContentLayerClient::DISPLAY_LIST_PAINTING_DISABLED:
33 return blink::WebContentLayerClient::DisplayListPaintingDisabled;
35 NOTREACHED();
36 return blink::WebContentLayerClient::PaintDefaultBehavior;
39 WebContentLayerImpl::WebContentLayerImpl(blink::WebContentLayerClient* client)
40 : client_(client) {
41 if (WebLayerImpl::UsingPictureLayer())
42 layer_ = make_scoped_ptr(new WebLayerImpl(
43 PictureLayer::Create(WebLayerImpl::LayerSettings(), this)));
44 else
45 layer_ = make_scoped_ptr(new WebLayerImpl(
46 ContentLayer::Create(WebLayerImpl::LayerSettings(), this)));
47 layer_->layer()->SetIsDrawable(true);
50 WebContentLayerImpl::~WebContentLayerImpl() {
51 if (WebLayerImpl::UsingPictureLayer())
52 static_cast<PictureLayer*>(layer_->layer())->ClearClient();
53 else
54 static_cast<ContentLayer*>(layer_->layer())->ClearClient();
57 blink::WebLayer* WebContentLayerImpl::layer() {
58 return layer_.get();
61 void WebContentLayerImpl::setDoubleSided(bool double_sided) {
62 layer_->layer()->SetDoubleSided(double_sided);
65 void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) {
66 layer_->layer()->SetDrawCheckerboardForMissingTiles(enable);
69 void WebContentLayerImpl::PaintContents(
70 SkCanvas* canvas,
71 const gfx::Rect& clip,
72 cc::ContentLayerClient::PaintingControlSetting painting_control) {
73 if (!client_)
74 return;
76 client_->paintContents(canvas, clip, PaintingControlToWeb(painting_control));
79 void WebContentLayerImpl::PaintContentsToDisplayList(
80 cc::DisplayItemList* display_list,
81 const gfx::Rect& clip,
82 cc::ContentLayerClient::PaintingControlSetting painting_control) {
83 if (!client_)
84 return;
86 WebDisplayItemListImpl list(display_list);
87 client_->paintContents(&list, clip, PaintingControlToWeb(painting_control));
90 bool WebContentLayerImpl::FillsBoundsCompletely() const {
91 return false;
94 } // namespace cc_blink