| 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 14 matching lines...) Expand all Loading... |
| 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_animator.h" | 29 #include "ui/gfx/compositor/layer_animator.h" |
| 30 | 30 |
| 31 #ifdef USE_WEBKIT_COMPOSITOR | 31 #ifdef USE_WEBKIT_COMPOSITOR |
| 32 #include "ui/gfx/compositor/compositor_cc.h" | 32 #include "ui/gfx/compositor/compositor_cc.h" |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 #if defined(USE_X11) | |
| 36 #include "base/message_pump_x.h" | |
| 37 #endif | |
| 38 | |
| 39 using std::string; | 35 using std::string; |
| 40 using std::vector; | 36 using std::vector; |
| 41 | 37 |
| 42 namespace aura { | 38 namespace aura { |
| 43 | 39 |
| 44 namespace { | 40 namespace { |
| 45 | 41 |
| 46 // Default bounds for the host window. | 42 // Default bounds for the host window. |
| 47 static const int kDefaultHostWindowX = 200; | 43 static const int kDefaultHostWindowX = 200; |
| 48 static const int kDefaultHostWindowY = 200; | 44 static const int kDefaultHostWindowY = 200; |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 if (ui::Compositor::compositor_factory()) { | 413 if (ui::Compositor::compositor_factory()) { |
| 418 compositor_ = (*ui::Compositor::compositor_factory())(this); | 414 compositor_ = (*ui::Compositor::compositor_factory())(this); |
| 419 } else { | 415 } else { |
| 420 #ifdef USE_WEBKIT_COMPOSITOR | 416 #ifdef USE_WEBKIT_COMPOSITOR |
| 421 ui::CompositorCC::Initialize(false); | 417 ui::CompositorCC::Initialize(false); |
| 422 #endif | 418 #endif |
| 423 compositor_ = ui::Compositor::Create(this, host_->GetAcceleratedWidget(), | 419 compositor_ = ui::Compositor::Create(this, host_->GetAcceleratedWidget(), |
| 424 host_->GetSize()); | 420 host_->GetSize()); |
| 425 } | 421 } |
| 426 DCHECK(compositor_.get()); | 422 DCHECK(compositor_.get()); |
| 427 #if defined(USE_X11) | |
| 428 base::MessagePumpX::SetDefaultDispatcher(host_.get()); | |
| 429 #endif | |
| 430 } | 423 } |
| 431 | 424 |
| 432 Desktop::~Desktop() { | 425 Desktop::~Desktop() { |
| 433 #if defined(USE_X11) | |
| 434 base::MessagePumpX::SetDefaultDispatcher(NULL); | |
| 435 #endif | |
| 436 | |
| 437 in_destructor_ = true; | 426 in_destructor_ = true; |
| 438 #ifdef USE_WEBKIT_COMPOSITOR | 427 #ifdef USE_WEBKIT_COMPOSITOR |
| 439 if (!ui::Compositor::compositor_factory()) | 428 if (!ui::Compositor::compositor_factory()) |
| 440 ui::CompositorCC::Terminate(); | 429 ui::CompositorCC::Terminate(); |
| 441 #endif | 430 #endif |
| 442 if (instance_ == this) | 431 if (instance_ == this) |
| 443 instance_ = NULL; | 432 instance_ = NULL; |
| 444 } | 433 } |
| 445 | 434 |
| 446 void Desktop::HandleMouseMoved(const MouseEvent& event, Window* target) { | 435 void Desktop::HandleMouseMoved(const MouseEvent& event, Window* target) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { | 591 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { |
| 603 bounds.set_size(gfx::Size(parsed_width, parsed_height)); | 592 bounds.set_size(gfx::Size(parsed_width, parsed_height)); |
| 604 } else if (use_fullscreen_host_window_) { | 593 } else if (use_fullscreen_host_window_) { |
| 605 bounds = gfx::Rect(DesktopHost::GetNativeDisplaySize()); | 594 bounds = gfx::Rect(DesktopHost::GetNativeDisplaySize()); |
| 606 } | 595 } |
| 607 | 596 |
| 608 return bounds; | 597 return bounds; |
| 609 } | 598 } |
| 610 | 599 |
| 611 } // namespace aura | 600 } // namespace aura |
| OLD | NEW |