1 // Copyright 2013 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.
5 #include "content/shell/browser/minimal_shell.h"
7 #include "ui/aura/client/default_capture_client.h"
8 #include "ui/aura/focus_manager.h"
9 #include "ui/aura/root_window.h"
10 #include "ui/aura/test/test_activation_client.h"
11 #include "ui/views/corewm/compound_event_filter.h"
12 #include "ui/views/corewm/input_method_event_filter.h"
16 MinimalShell::MinimalShell(const gfx::Size
& default_window_size
) {
17 root_window_
.reset(new aura::RootWindow(
18 aura::RootWindow::CreateParams(
19 gfx::Rect(default_window_size
))));
21 aura::client::SetStackingClient(root_window_
.get(), this);
23 focus_client_
.reset(new aura::FocusManager
);
24 aura::client::SetFocusClient(root_window_
.get(), focus_client_
.get());
26 root_window_event_filter_
= new views::corewm::CompoundEventFilter
;
27 // Pass ownership of the filter to the root_window.
28 root_window_
->SetEventFilter(root_window_event_filter_
);
30 input_method_filter_
.reset(new views::corewm::InputMethodEventFilter(
31 root_window_
->GetAcceleratedWidget()));
32 input_method_filter_
->SetInputMethodPropertyInRootWindow(
34 root_window_event_filter_
->AddHandler(input_method_filter_
.get());
36 test_activation_client_
.reset(
37 new aura::test::TestActivationClient(root_window_
.get()));
39 capture_client_
.reset(
40 new aura::client::DefaultCaptureClient(root_window_
.get()));
43 MinimalShell::~MinimalShell() {
44 root_window_event_filter_
->RemoveHandler(input_method_filter_
.get());
47 aura::Window
* MinimalShell::GetDefaultParent(
48 aura::Window
* context
,
50 const gfx::Rect
& bounds
) {
51 return root_window_
.get();
54 } // namespace content