| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/root_window.h" | 5 #include "ui/aura/root_window.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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 15 #include "base/string_split.h" | 15 #include "base/string_split.h" |
| 16 #include "ui/aura/aura_switches.h" | 16 #include "ui/aura/aura_switches.h" |
| 17 #include "ui/aura/client/activation_client.h" | 17 #include "ui/aura/client/activation_client.h" |
| 18 #include "ui/aura/root_window_host.h" | 18 #include "ui/aura/root_window_host.h" |
| 19 #include "ui/aura/root_window_observer.h" | 19 #include "ui/aura/root_window_observer.h" |
| 20 #include "ui/aura/event.h" | 20 #include "ui/aura/event.h" |
| 21 #include "ui/aura/event_filter.h" | 21 #include "ui/aura/event_filter.h" |
| 22 #include "ui/aura/focus_manager.h" | 22 #include "ui/aura/focus_manager.h" |
| 23 #include "ui/aura/gestures/gesture_recognizer.h" | 23 #include "ui/aura/gestures/gesture_recognizer.h" |
| 24 #include "ui/aura/screen_aura.h" | 24 #include "ui/aura/screen_aura.h" |
| 25 #include "ui/aura/window.h" | 25 #include "ui/aura/window.h" |
| 26 #include "ui/aura/window_delegate.h" | 26 #include "ui/aura/window_delegate.h" |
| 27 #include "ui/base/hit_test.h" | 27 #include "ui/base/hit_test.h" |
| 28 #include "ui/gfx/compositor/compositor.h" | 28 #include "ui/gfx/compositor/compositor.h" |
| 29 #include "ui/gfx/compositor/compositor_cc.h" | |
| 30 #include "ui/gfx/compositor/layer.h" | 29 #include "ui/gfx/compositor/layer.h" |
| 31 #include "ui/gfx/compositor/layer_animator.h" | 30 #include "ui/gfx/compositor/layer_animator.h" |
| 32 | 31 |
| 33 using std::string; | 32 using std::string; |
| 34 using std::vector; | 33 using std::vector; |
| 35 | 34 |
| 36 namespace aura { | 35 namespace aura { |
| 37 | 36 |
| 38 namespace { | 37 namespace { |
| 39 | 38 |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 mouse_moved_handler_(NULL), | 429 mouse_moved_handler_(NULL), |
| 431 focused_window_(NULL), | 430 focused_window_(NULL), |
| 432 touch_event_handler_(NULL), | 431 touch_event_handler_(NULL), |
| 433 gesture_handler_(NULL), | 432 gesture_handler_(NULL), |
| 434 gesture_recognizer_(GestureRecognizer::Create()), | 433 gesture_recognizer_(GestureRecognizer::Create()), |
| 435 synthesize_mouse_move_(false) { | 434 synthesize_mouse_move_(false) { |
| 436 SetName("RootWindow"); | 435 SetName("RootWindow"); |
| 437 gfx::Screen::SetInstance(screen_); | 436 gfx::Screen::SetInstance(screen_); |
| 438 last_mouse_location_ = host_->QueryMouseLocation(); | 437 last_mouse_location_ = host_->QueryMouseLocation(); |
| 439 | 438 |
| 440 ui::CompositorCC::Initialize(false); | 439 ui::Compositor::Initialize(false); |
| 441 compositor_ = ui::Compositor::Create(this, host_->GetAcceleratedWidget(), | 440 compositor_ = new ui::Compositor(this, host_->GetAcceleratedWidget(), |
| 442 host_->GetSize()); | 441 host_->GetSize()); |
| 443 DCHECK(compositor_.get()); | 442 DCHECK(compositor_.get()); |
| 444 } | 443 } |
| 445 | 444 |
| 446 RootWindow::~RootWindow() { | 445 RootWindow::~RootWindow() { |
| 447 // Make sure to destroy the compositor before terminating so that state is | 446 // Make sure to destroy the compositor before terminating so that state is |
| 448 // cleared and we don't hit asserts. | 447 // cleared and we don't hit asserts. |
| 449 compositor_ = NULL; | 448 compositor_ = NULL; |
| 450 // An observer may have been added by an animation on the RootWindow. | 449 // An observer may have been added by an animation on the RootWindow. |
| 451 layer()->GetAnimator()->RemoveObserver(this); | 450 layer()->GetAnimator()->RemoveObserver(this); |
| 452 ui::CompositorCC::Terminate(); | 451 ui::Compositor::Terminate(); |
| 453 if (instance_ == this) | 452 if (instance_ == this) |
| 454 instance_ = NULL; | 453 instance_ = NULL; |
| 455 } | 454 } |
| 456 | 455 |
| 457 void RootWindow::HandleMouseMoved(const MouseEvent& event, Window* target) { | 456 void RootWindow::HandleMouseMoved(const MouseEvent& event, Window* target) { |
| 458 if (target == mouse_moved_handler_) | 457 if (target == mouse_moved_handler_) |
| 459 return; | 458 return; |
| 460 | 459 |
| 461 // Send an exited event. | 460 // Send an exited event. |
| 462 if (mouse_moved_handler_ && mouse_moved_handler_->delegate()) { | 461 if (mouse_moved_handler_ && mouse_moved_handler_->delegate()) { |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 // TODO(derat|oshima): Don't use mouse_button_flags_ as it's | 745 // TODO(derat|oshima): Don't use mouse_button_flags_ as it's |
| 747 // is currently broken. See/ crbug.com/107931. | 746 // is currently broken. See/ crbug.com/107931. |
| 748 MouseEvent event(ui::ET_MOUSE_MOVED, | 747 MouseEvent event(ui::ET_MOUSE_MOVED, |
| 749 orig_mouse_location, | 748 orig_mouse_location, |
| 750 orig_mouse_location, | 749 orig_mouse_location, |
| 751 0); | 750 0); |
| 752 DispatchMouseEvent(&event); | 751 DispatchMouseEvent(&event); |
| 753 } | 752 } |
| 754 | 753 |
| 755 } // namespace aura | 754 } // namespace aura |
| OLD | NEW |