| 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 13 matching lines...) Expand all Loading... |
| 24 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
| 25 #include "ui/aura/window_delegate.h" | 25 #include "ui/aura/window_delegate.h" |
| 26 #include "ui/base/hit_test.h" | 26 #include "ui/base/hit_test.h" |
| 27 #include "ui/gfx/compositor/compositor.h" | 27 #include "ui/gfx/compositor/compositor.h" |
| 28 #include "ui/gfx/compositor/layer.h" | 28 #include "ui/gfx/compositor/layer.h" |
| 29 #include "ui/gfx/compositor/layer_animation_sequence.h" | 29 #include "ui/gfx/compositor/layer_animation_sequence.h" |
| 30 #include "ui/gfx/compositor/layer_animator.h" | 30 #include "ui/gfx/compositor/layer_animator.h" |
| 31 #include "ui/gfx/compositor/screen_rotation.h" | 31 #include "ui/gfx/compositor/screen_rotation.h" |
| 32 #include "ui/gfx/interpolated_transform.h" | 32 #include "ui/gfx/interpolated_transform.h" |
| 33 | 33 |
| 34 #ifdef USE_WEBKIT_COMPOSITOR |
| 35 #include "ui/gfx/compositor/compositor_cc.h" |
| 36 #endif |
| 37 |
| 34 using std::string; | 38 using std::string; |
| 35 using std::vector; | 39 using std::vector; |
| 36 | 40 |
| 37 namespace aura { | 41 namespace aura { |
| 38 | 42 |
| 39 namespace { | 43 namespace { |
| 40 | 44 |
| 41 // Default bounds for the host window. | 45 // Default bounds for the host window. |
| 42 static const int kDefaultHostWindowX = 200; | 46 static const int kDefaultHostWindowX = 200; |
| 43 static const int kDefaultHostWindowY = 200; | 47 static const int kDefaultHostWindowY = 200; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 focused_window_(NULL), | 165 focused_window_(NULL), |
| 162 touch_event_handler_(NULL) { | 166 touch_event_handler_(NULL) { |
| 163 set_name("RootWindow"); | 167 set_name("RootWindow"); |
| 164 gfx::Screen::SetInstance(screen_); | 168 gfx::Screen::SetInstance(screen_); |
| 165 host_->SetDesktop(this); | 169 host_->SetDesktop(this); |
| 166 last_mouse_location_ = host_->QueryMouseLocation(); | 170 last_mouse_location_ = host_->QueryMouseLocation(); |
| 167 | 171 |
| 168 if (ui::Compositor::compositor_factory()) { | 172 if (ui::Compositor::compositor_factory()) { |
| 169 compositor_ = (*ui::Compositor::compositor_factory())(this); | 173 compositor_ = (*ui::Compositor::compositor_factory())(this); |
| 170 } else { | 174 } else { |
| 175 #ifdef USE_WEBKIT_COMPOSITOR |
| 176 ui::CompositorCC::Initialize(false); |
| 177 #endif |
| 171 compositor_ = ui::Compositor::Create(this, host_->GetAcceleratedWidget(), | 178 compositor_ = ui::Compositor::Create(this, host_->GetAcceleratedWidget(), |
| 172 host_->GetSize()); | 179 host_->GetSize()); |
| 173 } | 180 } |
| 174 DCHECK(compositor_.get()); | 181 DCHECK(compositor_.get()); |
| 175 } | 182 } |
| 176 | 183 |
| 177 Desktop::~Desktop() { | 184 Desktop::~Desktop() { |
| 178 in_destructor_ = true; | 185 in_destructor_ = true; |
| 186 #ifdef USE_WEBKIT_COMPOSITOR |
| 187 if (!compositor_factory_) |
| 188 ui::CompositorCC::Terminate(); |
| 189 #endif |
| 179 if (instance_ == this) | 190 if (instance_ == this) |
| 180 instance_ = NULL; | 191 instance_ = NULL; |
| 181 } | 192 } |
| 182 | 193 |
| 183 // static | 194 // static |
| 184 Desktop* Desktop::GetInstance() { | 195 Desktop* Desktop::GetInstance() { |
| 185 if (!instance_) { | 196 if (!instance_) { |
| 186 instance_ = new Desktop; | 197 instance_ = new Desktop; |
| 187 instance_->Init(); | 198 instance_->Init(); |
| 188 } | 199 } |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { | 621 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { |
| 611 bounds.set_size(gfx::Size(parsed_width, parsed_height)); | 622 bounds.set_size(gfx::Size(parsed_width, parsed_height)); |
| 612 } else if (use_fullscreen_host_window_) { | 623 } else if (use_fullscreen_host_window_) { |
| 613 bounds = gfx::Rect(DesktopHost::GetNativeDisplaySize()); | 624 bounds = gfx::Rect(DesktopHost::GetNativeDisplaySize()); |
| 614 } | 625 } |
| 615 | 626 |
| 616 return bounds; | 627 return bounds; |
| 617 } | 628 } |
| 618 | 629 |
| 619 } // namespace aura | 630 } // namespace aura |
| OLD | NEW |