Index: content/shell/shell_stacking_client_ash.cc |
diff --git a/content/shell/shell_stacking_client_ash.cc b/content/shell/shell_stacking_client_ash.cc |
index f9e7c0a644f2fa8a7ce9fd96f1db654d9e700e27..c558572439c593fe576c3b016ae6caba3b55b5c7 100644 |
--- a/content/shell/shell_stacking_client_ash.cc |
+++ b/content/shell/shell_stacking_client_ash.cc |
@@ -13,7 +13,10 @@ |
namespace content { |
-ShellStackingClientAsh::ShellStackingClientAsh() { |
+ShellStackingClientAsh::ShellStackingClientAsh( |
+ scoped_ptr<aura::RootWindow> root_window) |
+ : root_window_(root_window.Pass()){ |
+ Init(); |
} |
ShellStackingClientAsh::~ShellStackingClientAsh() { |
@@ -23,33 +26,30 @@ ShellStackingClientAsh::~ShellStackingClientAsh() { |
aura::client::SetStackingClient(NULL); |
} |
+void ShellStackingClientAsh::Init() { |
+ focus_client_.reset(new aura::FocusManager); |
+ aura::client::SetFocusClient(root_window_.get(), focus_client_.get()); |
+ |
+ root_window_event_filter_ = new views::corewm::CompoundEventFilter; |
+ // Pass ownership of the filter to the root_window. |
+ root_window_->SetEventFilter(root_window_event_filter_); |
+ |
+ input_method_filter_.reset(new views::corewm::InputMethodEventFilter( |
+ root_window_->GetAcceleratedWidget())); |
+ input_method_filter_->SetInputMethodPropertyInRootWindow( |
+ root_window_.get()); |
+ root_window_event_filter_->AddHandler(input_method_filter_.get()); |
+ |
+ test_activation_client_.reset( |
+ new aura::test::TestActivationClient(root_window_.get())); |
+ capture_client_.reset( |
+ new aura::client::DefaultCaptureClient(root_window_.get())); |
+} |
+ |
aura::Window* ShellStackingClientAsh::GetDefaultParent( |
aura::Window* context, |
aura::Window* window, |
const gfx::Rect& bounds) { |
- if (!root_window_.get()) { |
- root_window_.reset(new aura::RootWindow( |
- aura::RootWindow::CreateParams(gfx::Rect(100, 100)))); |
- root_window_->Init(); |
- focus_client_.reset(new aura::FocusManager); |
- aura::client::SetFocusClient(root_window_.get(), focus_client_.get()); |
- |
- root_window_event_filter_ = new views::corewm::CompoundEventFilter; |
- // Pass ownership of the filter to the root_window. |
- root_window_->SetEventFilter(root_window_event_filter_); |
- |
- input_method_filter_.reset(new views::corewm::InputMethodEventFilter( |
- root_window_->GetAcceleratedWidget())); |
- input_method_filter_->SetInputMethodPropertyInRootWindow( |
- root_window_.get()); |
- root_window_event_filter_->AddHandler(input_method_filter_.get()); |
- |
- test_activation_client_.reset( |
- new aura::test::TestActivationClient(root_window_.get())); |
- |
- capture_client_.reset( |
- new aura::client::DefaultCaptureClient(root_window_.get())); |
- } |
return root_window_.get(); |
} |