OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/child_frame_compositing_helper.h" | 5 #include "content/renderer/child_frame_compositing_helper.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "cc/blink/web_layer_impl.h" | 9 #include "cc/blink/web_layer_impl.h" |
10 #include "cc/layers/picture_image_layer.h" | 10 #include "cc/layers/picture_image_layer.h" |
11 #include "cc/layers/solid_color_layer.h" | 11 #include "cc/layers/solid_color_layer.h" |
12 #include "cc/layers/surface_layer.h" | 12 #include "cc/layers/surface_layer.h" |
13 #include "cc/output/context_provider.h" | 13 #include "cc/output/context_provider.h" |
14 #include "cc/output/copy_output_request.h" | 14 #include "cc/output/copy_output_request.h" |
15 #include "cc/output/copy_output_result.h" | 15 #include "cc/output/copy_output_result.h" |
| 16 #include "cc/paint/paint_image.h" |
16 #include "cc/resources/single_release_callback.h" | 17 #include "cc/resources/single_release_callback.h" |
17 #include "cc/surfaces/sequence_surface_reference_factory.h" | 18 #include "cc/surfaces/sequence_surface_reference_factory.h" |
18 #include "content/child/thread_safe_sender.h" | 19 #include "content/child/thread_safe_sender.h" |
19 #include "content/common/browser_plugin/browser_plugin_messages.h" | 20 #include "content/common/browser_plugin/browser_plugin_messages.h" |
20 #include "content/common/content_switches_internal.h" | 21 #include "content/common/content_switches_internal.h" |
21 #include "content/common/frame_messages.h" | 22 #include "content/common/frame_messages.h" |
22 #include "content/public/common/content_client.h" | 23 #include "content/public/common/content_client.h" |
23 #include "content/public/renderer/content_renderer_client.h" | 24 #include "content/public/renderer/content_renderer_client.h" |
24 #include "content/renderer/browser_plugin/browser_plugin.h" | 25 #include "content/renderer/browser_plugin/browser_plugin.h" |
25 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 26 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 crashed_layer->SetMasksToBounds(true); | 185 crashed_layer->SetMasksToBounds(true); |
185 crashed_layer->SetBackgroundColor(SK_ColorBLACK); | 186 crashed_layer->SetBackgroundColor(SK_ColorBLACK); |
186 | 187 |
187 if (web_layer_) { | 188 if (web_layer_) { |
188 SkBitmap* sad_bitmap = | 189 SkBitmap* sad_bitmap = |
189 GetContentClient()->renderer()->GetSadWebViewBitmap(); | 190 GetContentClient()->renderer()->GetSadWebViewBitmap(); |
190 if (sad_bitmap && web_layer_->Bounds().width > sad_bitmap->width() && | 191 if (sad_bitmap && web_layer_->Bounds().width > sad_bitmap->width() && |
191 web_layer_->Bounds().height > sad_bitmap->height()) { | 192 web_layer_->Bounds().height > sad_bitmap->height()) { |
192 scoped_refptr<cc::PictureImageLayer> sad_layer = | 193 scoped_refptr<cc::PictureImageLayer> sad_layer = |
193 cc::PictureImageLayer::Create(); | 194 cc::PictureImageLayer::Create(); |
194 sad_layer->SetImage(SkImage::MakeFromBitmap(*sad_bitmap)); | 195 sad_layer->SetImage(cc::PaintImage(SkImage::MakeFromBitmap(*sad_bitmap))); |
195 sad_layer->SetBounds( | 196 sad_layer->SetBounds( |
196 gfx::Size(sad_bitmap->width(), sad_bitmap->height())); | 197 gfx::Size(sad_bitmap->width(), sad_bitmap->height())); |
197 sad_layer->SetPosition(gfx::PointF( | 198 sad_layer->SetPosition(gfx::PointF( |
198 (web_layer_->Bounds().width - sad_bitmap->width()) / 2, | 199 (web_layer_->Bounds().width - sad_bitmap->width()) / 2, |
199 (web_layer_->Bounds().height - sad_bitmap->height()) / 2)); | 200 (web_layer_->Bounds().height - sad_bitmap->height()) / 2)); |
200 sad_layer->SetIsDrawable(true); | 201 sad_layer->SetIsDrawable(true); |
201 | 202 |
202 crashed_layer->AddChild(sad_layer); | 203 crashed_layer->AddChild(sad_layer); |
203 } | 204 } |
204 } | 205 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 surface_info.size_in_pixels(), surface_info.device_scale_factor(), | 250 surface_info.size_in_pixels(), surface_info.device_scale_factor(), |
250 static_cast<cc_blink::WebLayerImpl*>(web_layer_.get())->layer()); | 251 static_cast<cc_blink::WebLayerImpl*>(web_layer_.get())->layer()); |
251 } | 252 } |
252 | 253 |
253 void ChildFrameCompositingHelper::UpdateVisibility(bool visible) { | 254 void ChildFrameCompositingHelper::UpdateVisibility(bool visible) { |
254 if (web_layer_) | 255 if (web_layer_) |
255 web_layer_->SetDrawsContent(visible); | 256 web_layer_->SetDrawsContent(visible); |
256 } | 257 } |
257 | 258 |
258 } // namespace content | 259 } // namespace content |
OLD | NEW |