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

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

Issue 7980023: Fixes aura unit tests. There were a couple of problems: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 | « no previous file | ui/aura/event_filter.h » ('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) 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"
11 #include "ui/aura/toplevel_window_container.h"
11 #include "ui/aura/window.h" 12 #include "ui/aura/window.h"
12 #include "ui/gfx/compositor/compositor.h" 13 #include "ui/gfx/compositor/compositor.h"
13 #include "ui/gfx/compositor/layer.h" 14 #include "ui/gfx/compositor/layer.h"
14 15
15 namespace aura { 16 namespace aura {
16 17
17 // static 18 // static
18 Desktop* Desktop::instance_ = NULL; 19 Desktop* Desktop::instance_ = NULL;
19 20
20 Desktop::Desktop() 21 Desktop::Desktop()
21 : toplevel_window_container_(NULL), 22 : toplevel_window_container_(new aura::internal::ToplevelWindowContainer),
22 host_(aura::DesktopHost::Create(gfx::Rect(200, 200, 1280, 1024))), 23 host_(aura::DesktopHost::Create(gfx::Rect(200, 200, 1280, 1024))),
23 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_(this)) { 24 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_(this)) {
24 DCHECK(MessageLoopForUI::current()) 25 DCHECK(MessageLoopForUI::current())
25 << "The UI message loop must be initialized first."; 26 << "The UI message loop must be initialized first.";
26 compositor_ = ui::Compositor::Create(this, host_->GetAcceleratedWidget(), 27 compositor_ = ui::Compositor::Create(this, host_->GetAcceleratedWidget(),
27 host_->GetSize()); 28 host_->GetSize());
28 host_->SetDesktop(this); 29 host_->SetDesktop(this);
29 DCHECK(compositor_.get()); 30 DCHECK(compositor_.get());
30 window_.reset(new internal::RootWindow); 31 window_.reset(new internal::RootWindow);
31 } 32 }
32 33
33 Desktop::~Desktop() { 34 Desktop::~Desktop() {
34 if (instance_ == this) 35 if (instance_ == this)
35 instance_ = NULL; 36 instance_ = NULL;
36 } 37 }
37 38
38 void Desktop::Init() { 39 void Desktop::Init() {
39 window_->Init(); 40 window_->Init();
40 compositor()->set_root_layer(window_->layer()); 41 compositor()->set_root_layer(window_->layer());
42 toplevel_window_container_->Init();
43 toplevel_window_container_->SetBounds(gfx::Rect(0, 0, 1280, 1024), 0);
44 toplevel_window_container_->SetVisibility(aura::Window::VISIBILITY_SHOWN);
45 toplevel_window_container_->SetParent(window_.get());
41 #if defined(USE_X11) 46 #if defined(USE_X11)
42 // TODO(oshima): Implement configure notify and remove this. 47 // TODO(oshima): Implement configure notify and remove this.
43 OnHostResized(host_->GetSize()); 48 OnHostResized(host_->GetSize());
44 #endif 49 #endif
45 } 50 }
46 51
47 void Desktop::Show() { 52 void Desktop::Show() {
48 host_->Show(); 53 host_->Show();
49 } 54 }
50 55
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // static 90 // static
86 Desktop* Desktop::GetInstance() { 91 Desktop* Desktop::GetInstance() {
87 if (!instance_) { 92 if (!instance_) {
88 instance_ = new Desktop; 93 instance_ = new Desktop;
89 instance_->Init(); 94 instance_->Init();
90 } 95 }
91 return instance_; 96 return instance_;
92 } 97 }
93 98
94 } // namespace aura 99 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | ui/aura/event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698