| 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/desktop.h" | 5 #include "ui/aura/desktop.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "ui/aura/desktop_host.h" | 9 #include "ui/aura/desktop_host.h" |
| 10 #include "ui/aura/focus_manager.h" | 10 #include "ui/aura/focus_manager.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 Desktop::~Desktop() { | 45 Desktop::~Desktop() { |
| 46 in_destructor_ = true; | 46 in_destructor_ = true; |
| 47 if (instance_ == this) | 47 if (instance_ == this) |
| 48 instance_ = NULL; | 48 instance_ = NULL; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void Desktop::Init() { | 51 void Desktop::Init() { |
| 52 window_->Init(); | 52 window_->Init(); |
| 53 compositor()->SetRootLayer(window_->layer()); | 53 compositor()->SetRootLayer(window_->layer()); |
| 54 toplevel_window_container_->Init(); | 54 toplevel_window_container_->Init(); |
| 55 toplevel_window_container_->SetBounds(gfx::Rect(0, 0, 1280, 1024), 0); | 55 toplevel_window_container_->SetBounds(gfx::Rect(0, 0, 1280, 1024)); |
| 56 toplevel_window_container_->SetVisibility(aura::Window::VISIBILITY_SHOWN); | 56 toplevel_window_container_->SetVisibility(aura::Window::VISIBILITY_SHOWN); |
| 57 toplevel_window_container_->SetParent(window_.get()); | 57 toplevel_window_container_->SetParent(window_.get()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void Desktop::Show() { | 60 void Desktop::Show() { |
| 61 host_->Show(); | 61 host_->Show(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void Desktop::SetSize(const gfx::Size& size) { | 64 void Desktop::SetSize(const gfx::Size& size) { |
| 65 host_->SetSize(size); | 65 host_->SetSize(size); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 81 bool Desktop::OnMouseEvent(const MouseEvent& event) { | 81 bool Desktop::OnMouseEvent(const MouseEvent& event) { |
| 82 return window_->HandleMouseEvent(event); | 82 return window_->HandleMouseEvent(event); |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool Desktop::OnKeyEvent(const KeyEvent& event) { | 85 bool Desktop::OnKeyEvent(const KeyEvent& event) { |
| 86 return window_->HandleKeyEvent(event); | 86 return window_->HandleKeyEvent(event); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void Desktop::OnHostResized(const gfx::Size& size) { | 89 void Desktop::OnHostResized(const gfx::Size& size) { |
| 90 gfx::Rect bounds(window_->bounds().origin(), size); | 90 gfx::Rect bounds(window_->bounds().origin(), size); |
| 91 window_->SetBounds(bounds, 0); | 91 window_->SetBounds(bounds); |
| 92 compositor_->WidgetSizeChanged(size); | 92 compositor_->WidgetSizeChanged(size); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void Desktop::ScheduleCompositorPaint() { | 95 void Desktop::ScheduleCompositorPaint() { |
| 96 if (schedule_paint_.empty()) { | 96 if (schedule_paint_.empty()) { |
| 97 MessageLoop::current()->PostTask(FROM_HERE, | 97 MessageLoop::current()->PostTask(FROM_HERE, |
| 98 schedule_paint_.NewRunnableMethod(&Desktop::Draw)); | 98 schedule_paint_.NewRunnableMethod(&Desktop::Draw)); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // static | 141 // static |
| 142 Desktop* Desktop::GetInstance() { | 142 Desktop* Desktop::GetInstance() { |
| 143 if (!instance_) { | 143 if (!instance_) { |
| 144 instance_ = new Desktop; | 144 instance_ = new Desktop; |
| 145 instance_->Init(); | 145 instance_->Init(); |
| 146 } | 146 } |
| 147 return instance_; | 147 return instance_; |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace aura | 150 } // namespace aura |
| OLD | NEW |