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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 void Window::SetTransparent(bool transparent) { | 137 void Window::SetTransparent(bool transparent) { |
138 // Cannot change transparent flag after the window is initialized. | 138 // Cannot change transparent flag after the window is initialized. |
139 DCHECK(!layer()); | 139 DCHECK(!layer()); |
140 transparent_ = transparent; | 140 transparent_ = transparent; |
141 } | 141 } |
142 | 142 |
143 ui::Layer* Window::AcquireLayer() { | 143 ui::Layer* Window::AcquireLayer() { |
144 return layer_owner_.release(); | 144 return layer_owner_.release(); |
145 } | 145 } |
146 | 146 |
| 147 RootWindow* Window::GetRootWindow() { |
| 148 return const_cast<RootWindow*>( |
| 149 static_cast<const Window*>(this)->GetRootWindow()); |
| 150 } |
| 151 |
| 152 const RootWindow* Window::GetRootWindow() const { |
| 153 return parent_ ? parent_->GetRootWindow() : NULL; |
| 154 } |
| 155 |
147 void Window::Show() { | 156 void Window::Show() { |
148 SetVisible(true); | 157 SetVisible(true); |
149 } | 158 } |
150 | 159 |
151 void Window::Hide() { | 160 void Window::Hide() { |
152 SetVisible(false); | 161 SetVisible(false); |
153 ReleaseCapture(); | 162 ReleaseCapture(); |
154 } | 163 } |
155 | 164 |
156 bool Window::IsVisible() const { | 165 bool Window::IsVisible() const { |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 | 512 |
504 bool Window::StopsEventPropagation() const { | 513 bool Window::StopsEventPropagation() const { |
505 if (!stops_event_propagation_ || children_.empty()) | 514 if (!stops_event_propagation_ || children_.empty()) |
506 return false; | 515 return false; |
507 aura::Window::Windows::const_iterator it = | 516 aura::Window::Windows::const_iterator it = |
508 std::find_if(children_.begin(), children_.end(), | 517 std::find_if(children_.begin(), children_.end(), |
509 std::mem_fun(&aura::Window::IsVisible)); | 518 std::mem_fun(&aura::Window::IsVisible)); |
510 return it != children_.end(); | 519 return it != children_.end(); |
511 } | 520 } |
512 | 521 |
513 RootWindow* Window::GetRootWindow() { | |
514 return parent_ ? parent_->GetRootWindow() : NULL; | |
515 } | |
516 | |
517 void Window::OnWindowDetachingFromRootWindow(aura::Window* window) { | 522 void Window::OnWindowDetachingFromRootWindow(aura::Window* window) { |
518 } | 523 } |
519 | 524 |
520 void Window::OnWindowAttachedToRootWindow(aura::Window* window) { | 525 void Window::OnWindowAttachedToRootWindow(aura::Window* window) { |
521 } | 526 } |
522 | 527 |
523 void Window::SetBoundsInternal(const gfx::Rect& new_bounds) { | 528 void Window::SetBoundsInternal(const gfx::Rect& new_bounds) { |
524 gfx::Rect actual_new_bounds(new_bounds); | 529 gfx::Rect actual_new_bounds(new_bounds); |
525 | 530 |
526 // Ensure we don't go smaller than our minimum bounds. | 531 // Ensure we don't go smaller than our minimum bounds. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 parent_->children().end(), | 669 parent_->children().end(), |
665 this); | 670 this); |
666 for (++i; i != parent_->children().end(); ++i) { | 671 for (++i; i != parent_->children().end(); ++i) { |
667 if ((*i)->StopsEventPropagation()) | 672 if ((*i)->StopsEventPropagation()) |
668 return true; | 673 return true; |
669 } | 674 } |
670 return false; | 675 return false; |
671 } | 676 } |
672 | 677 |
673 } // namespace aura | 678 } // namespace aura |
OLD | NEW |