| 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 "chrome/browser/ui/views/frame/contents_web_view.h" | 5 #include "chrome/browser/ui/views/frame/contents_web_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/themes/theme_properties.h" | 7 #include "chrome/browser/themes/theme_properties.h" |
| 8 #include "chrome/browser/ui/views/status_bubble_views.h" | 8 #include "chrome/browser/ui/views/status_bubble_views.h" |
| 9 #include "content/public/browser/render_widget_host_view.h" | 9 #include "content/public/browser/render_widget_host_view.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // in effect. The animation cloned our layer, but it won't create another | 85 // in effect. The animation cloned our layer, but it won't create another |
| 86 // clone of the WebContents layer (|cloned_layer_tree_|). Another clone | 86 // clone of the WebContents layer (|cloned_layer_tree_|). Another clone |
| 87 // is not created as the clone has no owner (see CloneChildren()). Because we | 87 // is not created as the clone has no owner (see CloneChildren()). Because we |
| 88 // want the WebContents layer clone to be animated we move it to the | 88 // want the WebContents layer clone to be animated we move it to the |
| 89 // old_layer, which is the layer the animation happens on. This animation ends | 89 // old_layer, which is the layer the animation happens on. This animation ends |
| 90 // up owning the layer (and all its descendants). | 90 // up owning the layer (and all its descendants). |
| 91 old_layer->Add(cloned_layer_tree_->release()); | 91 old_layer->Add(cloned_layer_tree_->release()); |
| 92 cloned_layer_tree_.reset(); | 92 cloned_layer_tree_.reset(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void ContentsWebView::OnLayerMirrored(ui::Layer* mirror) { |
| 96 NOTREACHED(); |
| 97 } |
| 98 |
| 95 void ContentsWebView::CloneWebContentsLayer() { | 99 void ContentsWebView::CloneWebContentsLayer() { |
| 96 if (!web_contents()) | 100 if (!web_contents()) |
| 97 return; | 101 return; |
| 98 #if defined(USE_AURA) | 102 #if defined(USE_AURA) |
| 99 // We don't need to clone the layers on non-Aura (Mac), because closing an | 103 // We don't need to clone the layers on non-Aura (Mac), because closing an |
| 100 // NSWindow does not animate. | 104 // NSWindow does not animate. |
| 101 cloned_layer_tree_ = | 105 cloned_layer_tree_ = |
| 102 wm::RecreateLayers(web_contents()->GetNativeView(), nullptr); | 106 wm::RecreateLayers(web_contents()->GetNativeView(), nullptr); |
| 103 #endif | 107 #endif |
| 104 if (!cloned_layer_tree_ || !cloned_layer_tree_->root()) { | 108 if (!cloned_layer_tree_ || !cloned_layer_tree_->root()) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 123 cloned_layer_tree_.reset(); | 127 cloned_layer_tree_.reset(); |
| 124 SetPaintToLayer(false); | 128 SetPaintToLayer(false); |
| 125 set_layer_owner_delegate(nullptr); | 129 set_layer_owner_delegate(nullptr); |
| 126 } | 130 } |
| 127 | 131 |
| 128 void ContentsWebView::RenderViewReady() { | 132 void ContentsWebView::RenderViewReady() { |
| 129 // Apply the theme color to be the default background on startup. | 133 // Apply the theme color to be the default background on startup. |
| 130 OnThemeChanged(); | 134 OnThemeChanged(); |
| 131 WebView::RenderViewReady(); | 135 WebView::RenderViewReady(); |
| 132 } | 136 } |
| OLD | NEW |