| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/browser_plugin/browser_plugin_compositing_helper.h" | 5 #include "content/renderer/browser_plugin/browser_plugin_compositing_helper.h" |
| 6 | 6 |
| 7 #include "cc/context_provider.h" | 7 #include "cc/context_provider.h" |
| 8 #include "cc/solid_color_layer.h" | 8 #include "cc/solid_color_layer.h" |
| 9 #include "cc/texture_layer.h" | 9 #include "cc/texture_layer.h" |
| 10 #include "content/common/browser_plugin/browser_plugin_messages.h" | 10 #include "content/common/browser_plugin/browser_plugin_messages.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 ack_pending_for_crashed_guest_(false), | 33 ack_pending_for_crashed_guest_(false), |
| 34 container_(container), | 34 container_(container), |
| 35 browser_plugin_manager_(manager) { | 35 browser_plugin_manager_(manager) { |
| 36 } | 36 } |
| 37 | 37 |
| 38 BrowserPluginCompositingHelper::~BrowserPluginCompositingHelper() { | 38 BrowserPluginCompositingHelper::~BrowserPluginCompositingHelper() { |
| 39 } | 39 } |
| 40 | 40 |
| 41 void BrowserPluginCompositingHelper::EnableCompositing(bool enable) { | 41 void BrowserPluginCompositingHelper::EnableCompositing(bool enable) { |
| 42 if (enable && !texture_layer_) { | 42 if (enable && !texture_layer_) { |
| 43 texture_layer_ = cc::TextureLayer::CreateForMailbox(); | 43 texture_layer_ = cc::TextureLayer::Create(NULL, true); |
| 44 texture_layer_->SetIsDrawable(true); | 44 texture_layer_->SetIsDrawable(true); |
| 45 texture_layer_->SetContentsOpaque(true); | 45 texture_layer_->SetContentsOpaque(true); |
| 46 | 46 |
| 47 background_layer_ = cc::SolidColorLayer::Create(); | 47 background_layer_ = cc::SolidColorLayer::Create(); |
| 48 background_layer_->SetMasksToBounds(true); | 48 background_layer_->SetMasksToBounds(true); |
| 49 background_layer_->SetBackgroundColor( | 49 background_layer_->SetBackgroundColor( |
| 50 SkColorSetARGBInline(255, 255, 255, 255)); | 50 SkColorSetARGBInline(255, 255, 255, 255)); |
| 51 background_layer_->AddChild(texture_layer_); | 51 background_layer_->AddChild(texture_layer_); |
| 52 web_layer_.reset(new WebKit::WebLayerImpl(background_layer_)); | 52 web_layer_.reset(new WebKit::WebLayerImpl(background_layer_)); |
| 53 } | 53 } |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 texture_layer_->SetNeedsDisplay(); | 223 texture_layer_->SetNeedsDisplay(); |
| 224 last_mailbox_valid_ = current_mailbox_valid; | 224 last_mailbox_valid_ = current_mailbox_valid; |
| 225 } | 225 } |
| 226 | 226 |
| 227 void BrowserPluginCompositingHelper::UpdateVisibility(bool visible) { | 227 void BrowserPluginCompositingHelper::UpdateVisibility(bool visible) { |
| 228 if (texture_layer_) | 228 if (texture_layer_) |
| 229 texture_layer_->SetIsDrawable(visible); | 229 texture_layer_->SetIsDrawable(visible); |
| 230 } | 230 } |
| 231 | 231 |
| 232 } // namespace content | 232 } // namespace content |
| OLD | NEW |