Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: ui/aura/window.cc

Issue 10412044: layers: Consolidate the ownership of layers in views::View and aura::Window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/window.h ('k') | ui/compositor/compositor.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 Window::TestApi::TestApi(Window* window) : window_(window) {} 43 Window::TestApi::TestApi(Window* window) : window_(window) {}
44 44
45 bool Window::TestApi::OwnsLayer() const { 45 bool Window::TestApi::OwnsLayer() const {
46 return !!window_->layer_owner_.get(); 46 return !!window_->layer_owner_.get();
47 } 47 }
48 48
49 Window::Window(WindowDelegate* delegate) 49 Window::Window(WindowDelegate* delegate)
50 : type_(client::WINDOW_TYPE_UNKNOWN), 50 : type_(client::WINDOW_TYPE_UNKNOWN),
51 owned_by_parent_(true), 51 owned_by_parent_(true),
52 delegate_(delegate), 52 delegate_(delegate),
53 layer_(NULL),
54 parent_(NULL), 53 parent_(NULL),
55 transient_parent_(NULL), 54 transient_parent_(NULL),
56 visible_(false), 55 visible_(false),
57 id_(-1), 56 id_(-1),
58 transparent_(false), 57 transparent_(false),
59 user_data_(NULL), 58 user_data_(NULL),
60 ignore_events_(false) { 59 ignore_events_(false) {
61 } 60 }
62 61
63 Window::~Window() { 62 Window::~Window() {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 if (layer()) 158 if (layer())
160 UpdateLayerName(name_); 159 UpdateLayerName(name_);
161 } 160 }
162 161
163 void Window::SetTransparent(bool transparent) { 162 void Window::SetTransparent(bool transparent) {
164 // Cannot change transparent flag after the window is initialized. 163 // Cannot change transparent flag after the window is initialized.
165 DCHECK(!layer()); 164 DCHECK(!layer());
166 transparent_ = transparent; 165 transparent_ = transparent;
167 } 166 }
168 167
169 ui::Layer* Window::AcquireLayer() {
170 return layer_owner_.release();
171 }
172
173 RootWindow* Window::GetRootWindow() { 168 RootWindow* Window::GetRootWindow() {
174 return const_cast<RootWindow*>( 169 return const_cast<RootWindow*>(
175 static_cast<const Window*>(this)->GetRootWindow()); 170 static_cast<const Window*>(this)->GetRootWindow());
176 } 171 }
177 172
178 const RootWindow* Window::GetRootWindow() const { 173 const RootWindow* Window::GetRootWindow() const {
179 return parent_ ? parent_->GetRootWindow() : NULL; 174 return parent_ ? parent_->GetRootWindow() : NULL;
180 } 175 }
181 176
182 void Window::Show() { 177 void Window::Show() {
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 for (Windows::const_reverse_iterator it = children_.rbegin(), 822 for (Windows::const_reverse_iterator it = children_.rbegin(),
828 rend = children_.rend(); 823 rend = children_.rend();
829 it != rend; ++it) { 824 it != rend; ++it) {
830 Window* child = *it; 825 Window* child = *it;
831 child->PrintWindowHierarchy(depth + 1); 826 child->PrintWindowHierarchy(depth + 1);
832 } 827 }
833 } 828 }
834 #endif 829 #endif
835 830
836 } // namespace aura 831 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window.h ('k') | ui/compositor/compositor.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698