| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| 11 #include "ui/aura/desktop.h" | 11 #include "ui/aura/desktop.h" |
| 12 #include "ui/aura/desktop_delegate.h" | 12 #include "ui/aura/desktop_delegate.h" |
| 13 #include "ui/aura/event.h" | 13 #include "ui/aura/event.h" |
| 14 #include "ui/aura/event_filter.h" | 14 #include "ui/aura/event_filter.h" |
| 15 #include "ui/aura/layout_manager.h" | 15 #include "ui/aura/layout_manager.h" |
| 16 #include "ui/aura/window_delegate.h" | 16 #include "ui/aura/window_delegate.h" |
| 17 #include "ui/aura/window_observer.h" | 17 #include "ui/aura/window_observer.h" |
| 18 #include "ui/aura/window_types.h" | 18 #include "ui/aura/window_types.h" |
| 19 #include "ui/base/animation/multi_animation.h" | 19 #include "ui/base/animation/multi_animation.h" |
| 20 #include "ui/base/view_prop.h" | 20 #include "ui/base/view_prop.h" |
| 21 #include "ui/gfx/canvas_skia.h" | 21 #include "ui/gfx/canvas_skia.h" |
| 22 #include "ui/gfx/compositor/compositor.h" | 22 #include "ui/gfx/compositor/compositor.h" |
| 23 #include "ui/gfx/screen.h" | 23 #include "ui/gfx/screen.h" |
| 24 | 24 |
| 25 namespace aura { | 25 namespace aura { |
| 26 | 26 |
| 27 Window::Window(WindowDelegate* delegate) | 27 Window::Window(WindowDelegate* delegate) |
| 28 : type_(kWindowType_None), | 28 : type_(WINDOW_TYPE_UNKNOWN), |
| 29 delegate_(delegate), | 29 delegate_(delegate), |
| 30 show_state_(ui::SHOW_STATE_NORMAL), | 30 show_state_(ui::SHOW_STATE_NORMAL), |
| 31 parent_(NULL), | 31 parent_(NULL), |
| 32 transient_parent_(NULL), | 32 transient_parent_(NULL), |
| 33 id_(-1), | 33 id_(-1), |
| 34 user_data_(NULL), | 34 user_data_(NULL), |
| 35 stops_event_propagation_(false) { | 35 stops_event_propagation_(false) { |
| 36 } | 36 } |
| 37 | 37 |
| 38 Window::~Window() { | 38 Window::~Window() { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 69 if (parent_) | 69 if (parent_) |
| 70 parent_->RemoveChild(this); | 70 parent_->RemoveChild(this); |
| 71 | 71 |
| 72 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroyed(this)); | 72 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroyed(this)); |
| 73 | 73 |
| 74 STLDeleteValues(&prop_map_); | 74 STLDeleteValues(&prop_map_); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void Window::Init(ui::Layer::LayerType layer_type) { | 77 void Window::Init(ui::Layer::LayerType layer_type) { |
| 78 layer_.reset(new ui::Layer(Desktop::GetInstance()->compositor(), layer_type)); | 78 layer_.reset(new ui::Layer(Desktop::GetInstance()->compositor(), layer_type)); |
| 79 // Windows (and therefore their layers) should initially be hidden, except for | 79 layer_->SetVisible(false); |
| 80 // controls. | |
| 81 layer_->SetVisible(type_ == kWindowType_Control); | |
| 82 layer_->set_delegate(this); | 80 layer_->set_delegate(this); |
| 83 } | 81 } |
| 84 | 82 |
| 85 void Window::SetType(int type) { | 83 void Window::SetType(WindowType type) { |
| 86 // Cannot change type after the window is initialized. | 84 // Cannot change type after the window is initialized. |
| 87 DCHECK(!layer()); | 85 DCHECK(!layer()); |
| 88 type_ = type; | 86 type_ = type; |
| 89 } | 87 } |
| 90 | 88 |
| 91 void Window::Show() { | 89 void Window::Show() { |
| 92 SetVisible(true); | 90 SetVisible(true); |
| 93 } | 91 } |
| 94 | 92 |
| 95 void Window::Hide() { | 93 void Window::Hide() { |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 | 530 |
| 533 void Window::OnPaintLayer(gfx::Canvas* canvas) { | 531 void Window::OnPaintLayer(gfx::Canvas* canvas) { |
| 534 delegate_->OnPaint(canvas); | 532 delegate_->OnPaint(canvas); |
| 535 } | 533 } |
| 536 | 534 |
| 537 void Window::OnLayerAnimationEnded( | 535 void Window::OnLayerAnimationEnded( |
| 538 const ui::LayerAnimationSequence* animation) { | 536 const ui::LayerAnimationSequence* animation) { |
| 539 } | 537 } |
| 540 | 538 |
| 541 } // namespace aura | 539 } // namespace aura |
| OLD | NEW |