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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 #if defined(USE_AURA) | 98 #if defined(USE_AURA) |
99 // We don't need to clone the layers on non-Aura (Mac), because closing an | 99 // We don't need to clone the layers on non-Aura (Mac), because closing an |
100 // NSWindow does not animate. | 100 // NSWindow does not animate. |
101 cloned_layer_tree_ = wm::RecreateLayers(web_contents()->GetNativeView()); | 101 cloned_layer_tree_ = wm::RecreateLayers(web_contents()->GetNativeView()); |
102 #endif | 102 #endif |
103 if (!cloned_layer_tree_ || !cloned_layer_tree_->root()) { | 103 if (!cloned_layer_tree_ || !cloned_layer_tree_->root()) { |
104 cloned_layer_tree_.reset(); | 104 cloned_layer_tree_.reset(); |
105 return; | 105 return; |
106 } | 106 } |
107 | 107 |
108 SetPaintToLayer(true); | 108 SetPaintToLayer(); |
109 set_layer_owner_delegate(this); | 109 set_layer_owner_delegate(this); |
110 | 110 |
111 // The cloned layer is in a different coordinate system them our layer (which | 111 // The cloned layer is in a different coordinate system them our layer (which |
112 // is now the new parent of the cloned layer). Convert coordinates so that the | 112 // is now the new parent of the cloned layer). Convert coordinates so that the |
113 // cloned layer appears at the right location. | 113 // cloned layer appears at the right location. |
114 gfx::Point origin; | 114 gfx::Point origin; |
115 ui::Layer::ConvertPointToLayer(cloned_layer_tree_->root(), layer(), &origin); | 115 ui::Layer::ConvertPointToLayer(cloned_layer_tree_->root(), layer(), &origin); |
116 cloned_layer_tree_->root()->SetBounds( | 116 cloned_layer_tree_->root()->SetBounds( |
117 gfx::Rect(origin, cloned_layer_tree_->root()->bounds().size())); | 117 gfx::Rect(origin, cloned_layer_tree_->root()->bounds().size())); |
118 layer()->Add(cloned_layer_tree_->root()); | 118 layer()->Add(cloned_layer_tree_->root()); |
119 } | 119 } |
120 | 120 |
121 void ContentsWebView::DestroyClonedLayer() { | 121 void ContentsWebView::DestroyClonedLayer() { |
122 cloned_layer_tree_.reset(); | 122 cloned_layer_tree_.reset(); |
123 SetPaintToLayer(false); | 123 DestroyLayer(); |
124 set_layer_owner_delegate(nullptr); | 124 set_layer_owner_delegate(nullptr); |
125 } | 125 } |
126 | 126 |
127 void ContentsWebView::RenderViewReady() { | 127 void ContentsWebView::RenderViewReady() { |
128 // Apply the theme color to be the default background on startup. | 128 // Apply the theme color to be the default background on startup. |
129 OnThemeChanged(); | 129 OnThemeChanged(); |
130 WebView::RenderViewReady(); | 130 WebView::RenderViewReady(); |
131 } | 131 } |
OLD | NEW |