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

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

Issue 8240006: Use a mocked compositor for unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missed views_test_base.cc Created 9 years, 2 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
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/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "ui/aura/desktop_delegate.h" 10 #include "ui/aura/desktop_delegate.h"
11 #include "ui/aura/desktop_host.h" 11 #include "ui/aura/desktop_host.h"
12 #include "ui/aura/desktop_observer.h" 12 #include "ui/aura/desktop_observer.h"
13 #include "ui/aura/event.h" 13 #include "ui/aura/event.h"
14 #include "ui/aura/focus_manager.h" 14 #include "ui/aura/focus_manager.h"
15 #include "ui/aura/root_window.h" 15 #include "ui/aura/root_window.h"
16 #include "ui/aura/screen_aura.h" 16 #include "ui/aura/screen_aura.h"
17 #include "ui/aura/toplevel_window_container.h" 17 #include "ui/aura/toplevel_window_container.h"
18 #include "ui/aura/window.h" 18 #include "ui/aura/window.h"
19 #include "ui/aura/window_delegate.h" 19 #include "ui/aura/window_delegate.h"
20 #include "ui/gfx/compositor/compositor.h" 20 #include "ui/gfx/compositor/compositor.h"
21 #include "ui/gfx/compositor/layer.h" 21 #include "ui/gfx/compositor/layer.h"
22 22
23 namespace aura { 23 namespace aura {
24 24
25 // static 25 // static
26 Desktop* Desktop::instance_ = NULL; 26 Desktop* Desktop::instance_ = NULL;
27 27
28 // static
29 ui::Compositor*(*Desktop::compositor_factory_)() = NULL;
30
31 Desktop::Desktop() 28 Desktop::Desktop()
32 : delegate_(NULL), 29 : delegate_(NULL),
33 host_(aura::DesktopHost::Create(gfx::Rect(200, 200, 1280, 1024))), 30 host_(aura::DesktopHost::Create(gfx::Rect(200, 200, 1280, 1024))),
34 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)), 31 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)),
35 active_window_(NULL), 32 active_window_(NULL),
36 in_destructor_(false) { 33 in_destructor_(false) {
37 if (compositor_factory_) { 34 if (ui::Compositor::compositor_factory_()) {
38 compositor_ = (*Desktop::compositor_factory())(); 35 compositor_ = (*ui::Compositor::compositor_factory())(this);
39 } else { 36 } else {
40 compositor_ = ui::Compositor::Create(this, host_->GetAcceleratedWidget(), 37 compositor_ = ui::Compositor::Create(this, host_->GetAcceleratedWidget(),
41 host_->GetSize()); 38 host_->GetSize());
42 } 39 }
43 gfx::Screen::SetInstance(new internal::ScreenAura); 40 gfx::Screen::SetInstance(new internal::ScreenAura);
44 host_->SetDesktop(this); 41 host_->SetDesktop(this);
45 DCHECK(compositor_.get()); 42 DCHECK(compositor_.get());
46 window_.reset(new internal::RootWindow); 43 window_.reset(new internal::RootWindow);
47 last_mouse_location_ = host_->QueryMouseLocation(); 44 last_mouse_location_ = host_->QueryMouseLocation();
48 } 45 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // static 179 // static
183 Desktop* Desktop::GetInstance() { 180 Desktop* Desktop::GetInstance() {
184 if (!instance_) { 181 if (!instance_) {
185 instance_ = new Desktop; 182 instance_ = new Desktop;
186 instance_->Init(); 183 instance_->Init();
187 } 184 }
188 return instance_; 185 return instance_;
189 } 186 }
190 187
191 } // namespace aura 188 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698