| 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/root_window.h" | 10 #include "ui/aura/root_window.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 host_->SetDesktop(this); | 27 host_->SetDesktop(this); |
| 28 DCHECK(compositor_.get()); | 28 DCHECK(compositor_.get()); |
| 29 window_.reset(new internal::RootWindow); | 29 window_.reset(new internal::RootWindow); |
| 30 } | 30 } |
| 31 | 31 |
| 32 Desktop::~Desktop() { | 32 Desktop::~Desktop() { |
| 33 if (instance_ == this) | 33 if (instance_ == this) |
| 34 instance_ = NULL; | 34 instance_ = NULL; |
| 35 } | 35 } |
| 36 | 36 |
| 37 void Desktop::Init() { |
| 38 window_->Init(); |
| 39 compositor()->set_root_layer(window_->layer()); |
| 40 #if defined(USE_X11) |
| 41 // TODO(oshima): Implement configure notify and remove this. |
| 42 OnHostResized(host_->GetSize()); |
| 43 #endif |
| 44 } |
| 45 |
| 37 void Desktop::Show() { | 46 void Desktop::Show() { |
| 38 host_->Show(); | 47 host_->Show(); |
| 39 } | 48 } |
| 40 | 49 |
| 41 void Desktop::SetSize(const gfx::Size& size) { | 50 void Desktop::SetSize(const gfx::Size& size) { |
| 42 host_->SetSize(size); | 51 host_->SetSize(size); |
| 43 } | 52 } |
| 44 | 53 |
| 45 void Desktop::Run() { | 54 void Desktop::Run() { |
| 46 Show(); | 55 Show(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 69 if (schedule_paint_.empty()) { | 78 if (schedule_paint_.empty()) { |
| 70 MessageLoop::current()->PostTask(FROM_HERE, | 79 MessageLoop::current()->PostTask(FROM_HERE, |
| 71 schedule_paint_.NewRunnableMethod(&Desktop::Draw)); | 80 schedule_paint_.NewRunnableMethod(&Desktop::Draw)); |
| 72 } | 81 } |
| 73 } | 82 } |
| 74 | 83 |
| 75 // static | 84 // static |
| 76 Desktop* Desktop::GetInstance() { | 85 Desktop* Desktop::GetInstance() { |
| 77 if (!instance_) { | 86 if (!instance_) { |
| 78 instance_ = new Desktop; | 87 instance_ = new Desktop; |
| 79 instance_->window_->Init(); | 88 instance_->Init(); |
| 80 instance_->compositor()->set_root_layer(instance_->window_->layer()); | |
| 81 } | 89 } |
| 82 return instance_; | 90 return instance_; |
| 83 } | 91 } |
| 84 | 92 |
| 85 } // namespace aura | 93 } // namespace aura |
| OLD | NEW |