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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 static const int kDefaultHostWindowX = 200; | 37 static const int kDefaultHostWindowX = 200; |
38 static const int kDefaultHostWindowY = 200; | 38 static const int kDefaultHostWindowY = 200; |
39 static const int kDefaultHostWindowWidth = 1280; | 39 static const int kDefaultHostWindowWidth = 1280; |
40 static const int kDefaultHostWindowHeight = 1024; | 40 static const int kDefaultHostWindowHeight = 1024; |
41 | 41 |
42 } // namespace | 42 } // namespace |
43 | 43 |
44 // static | 44 // static |
45 Desktop* Desktop::instance_ = NULL; | 45 Desktop* Desktop::instance_ = NULL; |
46 | 46 |
47 // static | |
48 ui::Compositor*(*Desktop::compositor_factory_)() = NULL; | |
49 | |
50 Desktop::Desktop() | 47 Desktop::Desktop() |
51 : Window(NULL), | 48 : Window(NULL), |
52 host_(aura::DesktopHost::Create(GetInitialHostWindowBounds())), | 49 host_(aura::DesktopHost::Create(GetInitialHostWindowBounds())), |
53 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)), | 50 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)), |
54 active_window_(NULL), | 51 active_window_(NULL), |
55 in_destructor_(false), | 52 in_destructor_(false), |
56 screen_(new ScreenAura), | 53 screen_(new ScreenAura), |
57 capture_window_(NULL), | 54 capture_window_(NULL), |
58 mouse_pressed_handler_(NULL), | 55 mouse_pressed_handler_(NULL), |
59 mouse_moved_handler_(NULL), | 56 mouse_moved_handler_(NULL), |
60 focused_window_(NULL), | 57 focused_window_(NULL), |
61 touch_event_handler_(NULL) { | 58 touch_event_handler_(NULL) { |
62 set_name("RootWindow"); | 59 set_name("RootWindow"); |
63 gfx::Screen::SetInstance(screen_); | 60 gfx::Screen::SetInstance(screen_); |
64 host_->SetDesktop(this); | 61 host_->SetDesktop(this); |
65 last_mouse_location_ = host_->QueryMouseLocation(); | 62 last_mouse_location_ = host_->QueryMouseLocation(); |
66 | 63 |
67 if (compositor_factory_) { | 64 if (ui::Compositor::compositor_factory()) { |
68 compositor_ = (*Desktop::compositor_factory())(); | 65 compositor_ = (*ui::Compositor::compositor_factory())(this); |
69 } else { | 66 } else { |
70 compositor_ = ui::Compositor::Create(this, host_->GetAcceleratedWidget(), | 67 compositor_ = ui::Compositor::Create(this, host_->GetAcceleratedWidget(), |
71 host_->GetSize()); | 68 host_->GetSize()); |
72 } | 69 } |
73 DCHECK(compositor_.get()); | 70 DCHECK(compositor_.get()); |
74 } | 71 } |
75 | 72 |
76 Desktop::~Desktop() { | 73 Desktop::~Desktop() { |
77 in_destructor_ = true; | 74 in_destructor_ = true; |
78 if (instance_ == this) | 75 if (instance_ == this) |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 !base::StringToInt(parts[0], &width) || | 424 !base::StringToInt(parts[0], &width) || |
428 !base::StringToInt(parts[1], &height) || | 425 !base::StringToInt(parts[1], &height) || |
429 width <= 0 || height <= 0) { | 426 width <= 0 || height <= 0) { |
430 width = kDefaultHostWindowWidth; | 427 width = kDefaultHostWindowWidth; |
431 height = kDefaultHostWindowHeight; | 428 height = kDefaultHostWindowHeight; |
432 } | 429 } |
433 return gfx::Rect(kDefaultHostWindowX, kDefaultHostWindowY, width, height); | 430 return gfx::Rect(kDefaultHostWindowX, kDefaultHostWindowY, width, height); |
434 } | 431 } |
435 | 432 |
436 } // namespace aura | 433 } // namespace aura |
OLD | NEW |