| Index: content/shell/browser/shell_views.cc
|
| diff --git a/content/shell/browser/shell_views.cc b/content/shell/browser/shell_views.cc
|
| index 5789cd642766a766464958e59c20c606c0ad673e..cc6c3bd61da0f6da5fa7cbf7c13de7a6676692c1 100644
|
| --- a/content/shell/browser/shell_views.cc
|
| +++ b/content/shell/browser/shell_views.cc
|
| @@ -39,8 +39,13 @@
|
|
|
| #if defined(OS_CHROMEOS)
|
| #include "chromeos/dbus/dbus_thread_manager.h"
|
| +#include "ui/aura/client/window_tree_client.h"
|
| +#include "ui/aura/test/test_focus_client.h"
|
| #include "ui/aura/test/test_screen.h"
|
| -#include "ui/wm/test/wm_test_helper.h"
|
| +#include "ui/aura/window_observer.h"
|
| +#include "ui/aura/window_tree_host.h"
|
| +#include "ui/wm/core/compound_event_filter.h"
|
| +#include "ui/wm/core/input_method_event_filter.h"
|
| #endif
|
|
|
| #if defined(OS_WIN)
|
| @@ -70,6 +75,47 @@ class ShellViewsDelegateAura : public views::DesktopTestViewsDelegate {
|
| DISALLOW_COPY_AND_ASSIGN(ShellViewsDelegateAura);
|
| };
|
|
|
| +#if defined(OS_CHROMEOS)
|
| +class ShellWindowTreeClient : public aura::client::WindowTreeClient,
|
| + public aura::WindowObserver {
|
| + public:
|
| + ShellWindowTreeClient(aura::WindowTreeHost* host) : host_(host) {
|
| + host_->window()->AddObserver(this);
|
| + aura::client::SetWindowTreeClient(host_->window(), this);
|
| + input_method_filter_.reset(
|
| + new wm::InputMethodEventFilter(host_->GetAcceleratedWidget()));
|
| + input_method_filter_->SetInputMethodPropertyInRootWindow(host_->window());
|
| + }
|
| + virtual ~ShellWindowTreeClient() {
|
| + host_->window()->RemoveObserver(this);
|
| + }
|
| +
|
| + private:
|
| + // Overridden from aura::client::WindowTreeClient:
|
| + virtual aura::Window* GetDefaultParent(
|
| + aura::Window* context,
|
| + aura::Window* window,
|
| + const gfx::Rect& bounds) OVERRIDE {
|
| + return host_->window();
|
| + }
|
| +
|
| + // Overridden from aura::WindowObserver:
|
| + virtual void OnWindowDestroyed(aura::Window* window) {
|
| + DCHECK_EQ(window, host_->window());
|
| + delete this;
|
| + }
|
| +
|
| + aura::WindowTreeHost* host_;
|
| + wm::CompoundEventFilter* root_window_event_filter_;
|
| + scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
|
| + scoped_ptr<wm::InputMethodEventFilter> input_method_filter_;
|
| + scoped_ptr<wm::DefaultActivationClient> activation_client_;
|
| + scoped_ptr<aura::client::FocusClient> focus_client_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ShellWindowTreeClient);
|
| +};
|
| +#endif // OS_CHROMEOS
|
| +
|
| // Model for the "Debug" menu
|
| class ContextMenuModel : public ui::SimpleMenuModel,
|
| public ui::SimpleMenuModel::Delegate {
|
| @@ -408,7 +454,7 @@ class ShellWindowDelegateView : public views::WidgetDelegateView,
|
| } // namespace
|
|
|
| #if defined(OS_CHROMEOS)
|
| -wm::WMTestHelper* Shell::wm_test_helper_ = NULL;
|
| +aura::WindowTreeHost* Shell::shell_host_ = NULL;
|
| #endif
|
| views::ViewsDelegate* Shell::views_delegate_ = NULL;
|
|
|
| @@ -422,7 +468,9 @@ void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
|
| chromeos::DBusThreadManager::Initialize();
|
| gfx::Screen::SetScreenInstance(
|
| gfx::SCREEN_TYPE_NATIVE, aura::TestScreen::Create());
|
| - wm_test_helper_ = new wm::WMTestHelper(default_window_size);
|
| + aura::Env::CreateInstance();
|
| + shell_host_ = aura::WindowTreeHost::Create(gfx::Rect(0, 0, 800, 600));
|
| + new ShellWindowTreeClient(shell_host_); // Deletes itself when host dies.
|
| #else
|
| gfx::Screen::SetScreenInstance(
|
| gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen());
|
| @@ -432,7 +480,8 @@ void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
|
|
|
| void Shell::PlatformExit() {
|
| #if defined(OS_CHROMEOS)
|
| - delete wm_test_helper_;
|
| + delete shell_host_;
|
| + aura::Env::DeleteInstance();
|
| #endif
|
| delete views_delegate_;
|
| views_delegate_ = NULL;
|
| @@ -487,7 +536,7 @@ void Shell::PlatformCreateWindow(int width, int height) {
|
| #if defined(OS_CHROMEOS)
|
| window_widget_ = views::Widget::CreateWindowWithContextAndBounds(
|
| new ShellWindowDelegateView(this),
|
| - wm_test_helper_->GetDefaultParent(NULL, NULL, gfx::Rect()),
|
| + shell_host_->window(),
|
| gfx::Rect(0, 0, width, height));
|
| #else
|
| window_widget_ = new views::Widget;
|
|
|