| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/views/widget/desktop_aura/desktop_stacking_client.h" | |
| 6 | |
| 7 #include "ui/aura/client/activation_client.h" | |
| 8 #include "ui/aura/client/default_capture_client.h" | |
| 9 #include "ui/aura/focus_manager.h" | |
| 10 #include "ui/aura/root_window.h" | |
| 11 #include "ui/aura/window.h" | |
| 12 #include "ui/views/corewm/compound_event_filter.h" | |
| 13 #include "ui/views/corewm/input_method_event_filter.h" | |
| 14 #include "ui/views/widget/desktop_aura/desktop_activation_client.h" | |
| 15 | |
| 16 namespace views { | |
| 17 | |
| 18 DesktopStackingClient::DesktopStackingClient() | |
| 19 : window_event_filter_(NULL) { | |
| 20 aura::client::SetStackingClient(this); | |
| 21 } | |
| 22 | |
| 23 DesktopStackingClient::~DesktopStackingClient() { | |
| 24 if (window_event_filter_) | |
| 25 window_event_filter_->RemoveHandler(input_method_filter_.get()); | |
| 26 | |
| 27 aura::client::SetStackingClient(NULL); | |
| 28 } | |
| 29 | |
| 30 aura::Window* DesktopStackingClient::GetDefaultParent(aura::Window* context, | |
| 31 aura::Window* window, | |
| 32 const gfx::Rect& bounds) { | |
| 33 if (!null_parent_.get()) | |
| 34 CreateNULLParent(); | |
| 35 | |
| 36 return null_parent_.get(); | |
| 37 } | |
| 38 | |
| 39 void DesktopStackingClient::CreateNULLParent() { | |
| 40 focus_client_.reset(new aura::FocusManager); | |
| 41 | |
| 42 null_parent_.reset(new aura::RootWindow( | |
| 43 aura::RootWindow::CreateParams(gfx::Rect(100, 100)))); | |
| 44 null_parent_->Init(); | |
| 45 aura::client::SetFocusClient(null_parent_.get(), focus_client_.get()); | |
| 46 | |
| 47 activation_client_.reset(new DesktopActivationClient(null_parent_.get())); | |
| 48 | |
| 49 window_event_filter_ = new corewm::CompoundEventFilter; | |
| 50 null_parent_->SetEventFilter(window_event_filter_); | |
| 51 | |
| 52 input_method_filter_.reset(new corewm::InputMethodEventFilter( | |
| 53 null_parent_->GetAcceleratedWidget())); | |
| 54 input_method_filter_->SetInputMethodPropertyInRootWindow(null_parent_.get()); | |
| 55 window_event_filter_->AddHandler(input_method_filter_.get()); | |
| 56 | |
| 57 capture_client_.reset( | |
| 58 new aura::client::DefaultCaptureClient(null_parent_.get())); | |
| 59 | |
| 60 // Hide the window so we don't attempt to draw to it and what not. | |
| 61 null_parent_->Hide(); | |
| 62 } | |
| 63 | |
| 64 } // namespace views | |
| OLD | NEW |