Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 Env::GetInstance()->NotifyWindowInitialized(this); | 160 Env::GetInstance()->NotifyWindowInitialized(this); |
| 161 } | 161 } |
| 162 | 162 |
| 163 ui::Layer* Window::RecreateLayer() { | 163 ui::Layer* Window::RecreateLayer() { |
| 164 // Disconnect the old layer, but don't delete it. | 164 // Disconnect the old layer, but don't delete it. |
| 165 ui::Layer* old_layer = AcquireLayer(); | 165 ui::Layer* old_layer = AcquireLayer(); |
| 166 if (!old_layer) | 166 if (!old_layer) |
| 167 return NULL; | 167 return NULL; |
| 168 | 168 |
| 169 old_layer->set_delegate(NULL); | 169 old_layer->set_delegate(NULL); |
| 170 if (delegate_ && old_layer->external_texture()) | |
| 171 old_layer->SetExternalTexture(delegate_->CopyTexture()); | |
|
piman
2012/09/14 02:27:17
I just realized, the ui::Texture doesn't take owne
| |
| 170 layer_ = new ui::Layer(old_layer->type()); | 172 layer_ = new ui::Layer(old_layer->type()); |
| 171 layer_owner_.reset(layer_); | 173 layer_owner_.reset(layer_); |
| 172 layer_->SetVisible(old_layer->visible()); | 174 layer_->SetVisible(old_layer->visible()); |
| 173 layer_->set_scale_content(old_layer->scale_content()); | 175 layer_->set_scale_content(old_layer->scale_content()); |
| 174 layer_->set_delegate(this); | 176 layer_->set_delegate(this); |
| 175 UpdateLayerName(name_); | 177 UpdateLayerName(name_); |
| 176 layer_->SetFillsBoundsOpaquely(!transparent_); | 178 layer_->SetFillsBoundsOpaquely(!transparent_); |
| 177 // Install new layer as a sibling of the old layer, stacked on top of it. | 179 // Install new layer as a sibling of the old layer, stacked on top of it. |
| 178 if (old_layer->parent()) { | 180 if (old_layer->parent()) { |
| 179 old_layer->parent()->Add(layer_); | 181 old_layer->parent()->Add(layer_); |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 967 bool contains_mouse = false; | 969 bool contains_mouse = false; |
| 968 if (IsVisible()) { | 970 if (IsVisible()) { |
| 969 RootWindow* root_window = GetRootWindow(); | 971 RootWindow* root_window = GetRootWindow(); |
| 970 contains_mouse = root_window && | 972 contains_mouse = root_window && |
| 971 ContainsPointInRoot(root_window->GetLastMouseLocationInRoot()); | 973 ContainsPointInRoot(root_window->GetLastMouseLocationInRoot()); |
| 972 } | 974 } |
| 973 return contains_mouse; | 975 return contains_mouse; |
| 974 } | 976 } |
| 975 | 977 |
| 976 } // namespace aura | 978 } // namespace aura |
| OLD | NEW |