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/aura/desktop/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/desktop/desktop_activation_client.h" | |
10 #include "ui/aura/focus_manager.h" | |
11 #include "ui/aura/root_window.h" | |
12 #include "ui/aura/window.h" | |
13 #include "ui/views/corewm/compound_event_filter.h" | |
14 #include "ui/views/corewm/input_method_event_filter.h" | |
15 | |
16 namespace aura { | |
17 | |
18 DesktopStackingClient::DesktopStackingClient() | |
19 : window_event_filter_(NULL) { | |
20 client::SetStackingClient(this); | |
21 } | |
22 | |
23 DesktopStackingClient::~DesktopStackingClient() { | |
24 if (window_event_filter_) | |
25 window_event_filter_->RemoveFilter(input_method_filter_.get()); | |
26 | |
27 client::SetStackingClient(NULL); | |
28 } | |
29 | |
30 Window* DesktopStackingClient::GetDefaultParent(Window* window, | |
31 const gfx::Rect& bounds) { | |
32 if (!null_parent_.get()) | |
33 CreateNULLParent(); | |
34 | |
35 return null_parent_.get(); | |
36 } | |
37 | |
38 void DesktopStackingClient::CreateNULLParent() { | |
39 focus_manager_.reset(new FocusManager); | |
40 | |
41 activation_client_.reset(new DesktopActivationClient(focus_manager_.get())); | |
42 | |
43 null_parent_.reset(new RootWindow( | |
44 RootWindow::CreateParams(gfx::Rect(100, 100)))); | |
45 null_parent_->Init(); | |
46 null_parent_->set_focus_manager(focus_manager_.get()); | |
47 | |
48 client::SetActivationClient(null_parent_.get(), activation_client_.get()); | |
49 | |
50 window_event_filter_ = new views::corewm::CompoundEventFilter; | |
51 null_parent_->SetEventFilter(window_event_filter_); | |
52 | |
53 input_method_filter_.reset(new views::corewm::InputMethodEventFilter); | |
54 input_method_filter_->SetInputMethodPropertyInRootWindow(null_parent_.get()); | |
55 window_event_filter_->AddFilter(input_method_filter_.get()); | |
56 | |
57 capture_client_.reset(new client::DefaultCaptureClient(null_parent_.get())); | |
58 } | |
59 | |
60 } // namespace aura | |
OLD | NEW |