| Index: ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
|
| diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
|
| index 3a571a76c8deb5b6a4607c3fdc4540703c0265b4..d0c7ee240304f7ad39c9766a45eb15b97e762315 100644
|
| --- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
|
| +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
|
| @@ -25,19 +25,14 @@
|
| #include "ui/native_theme/native_theme_win.h"
|
| #include "ui/views/corewm/compound_event_filter.h"
|
| #include "ui/views/corewm/corewm_switches.h"
|
| -#include "ui/views/corewm/cursor_manager.h"
|
| -#include "ui/views/corewm/focus_controller.h"
|
| #include "ui/views/corewm/input_method_event_filter.h"
|
| #include "ui/views/corewm/tooltip_win.h"
|
| #include "ui/views/corewm/window_animations.h"
|
| #include "ui/views/ime/input_method_bridge.h"
|
| #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater.h"
|
| -#include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h"
|
| #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h"
|
| -#include "ui/views/widget/desktop_aura/desktop_focus_rules.h"
|
| #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h"
|
| #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
|
| -#include "ui/views/widget/desktop_aura/desktop_screen_position_client.h"
|
| #include "ui/views/widget/root_view.h"
|
| #include "ui/views/widget/widget_delegate.h"
|
| #include "ui/views/widget/widget_hwnd_utils.h"
|
| @@ -54,14 +49,14 @@ DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL);
|
|
|
| DesktopRootWindowHostWin::DesktopRootWindowHostWin(
|
| internal::NativeWidgetDelegate* native_widget_delegate,
|
| - DesktopNativeWidgetAura* desktop_native_widget_aura,
|
| - const gfx::Rect& initial_bounds)
|
| + DesktopNativeWidgetAura* desktop_native_widget_aura)
|
| : root_window_(NULL),
|
| message_handler_(new HWNDMessageHandler(this)),
|
| native_widget_delegate_(native_widget_delegate),
|
| desktop_native_widget_aura_(desktop_native_widget_aura),
|
| root_window_host_delegate_(NULL),
|
| content_window_(NULL),
|
| + drag_drop_client_(NULL),
|
| should_animate_window_close_(false),
|
| pending_close_(false),
|
| has_non_client_view_(false),
|
| @@ -70,12 +65,8 @@ DesktopRootWindowHostWin::DesktopRootWindowHostWin(
|
|
|
| DesktopRootWindowHostWin::~DesktopRootWindowHostWin() {
|
| // WARNING: |content_window_| has been destroyed by the time we get here.
|
| - aura::client::SetFocusClient(root_window_, NULL);
|
| - aura::client::SetActivationClient(root_window_, NULL);
|
| - aura::client::SetScreenPositionClient(root_window_, NULL);
|
| - aura::client::SetDispatcherClient(root_window_, NULL);
|
| - aura::client::SetCursorClient(root_window_, NULL);
|
| - aura::client::SetDragDropClient(root_window_, NULL);
|
| + desktop_native_widget_aura_->OnDesktopRootWindowHostDestroyed(
|
| + root_window_);
|
| }
|
|
|
| // static
|
| @@ -102,12 +93,15 @@ ui::NativeTheme* DesktopRootWindowHost::GetNativeTheme(aura::Window* window) {
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // DesktopRootWindowHostWin, DesktopRootWindowHost implementation:
|
|
|
| -aura::RootWindow* DesktopRootWindowHostWin::Init(
|
| +void DesktopRootWindowHostWin::Init(
|
| aura::Window* content_window,
|
| - const Widget::InitParams& params) {
|
| + const Widget::InitParams& params,
|
| + aura::RootWindow::CreateParams* rw_create_params) {
|
| // TODO(beng): SetInitParams().
|
| content_window_ = content_window;
|
|
|
| + aura::client::SetAnimationHost(content_window_, this);
|
| +
|
| ConfigureWindowStyles(message_handler_.get(), params,
|
| GetWidget()->widget_delegate(),
|
| native_widget_delegate_);
|
| @@ -123,56 +117,22 @@ aura::RootWindow* DesktopRootWindowHostWin::Init(
|
| gfx::Rect pixel_bounds = gfx::win::DIPToScreenRect(params.bounds);
|
| message_handler_->Init(parent_hwnd, pixel_bounds);
|
|
|
| - aura::RootWindow::CreateParams rw_params(params.bounds);
|
| - rw_params.host = this;
|
| - root_window_ = new aura::RootWindow(rw_params);
|
| + rw_create_params->host = this;
|
| +}
|
|
|
| - SetWindowTransparency();
|
| - root_window_->Init();
|
| - root_window_->AddChild(content_window_);
|
| -
|
| - desktop_native_widget_aura_->InstallWindowModalityController(root_window_);
|
| - desktop_native_widget_aura_->CreateCaptureClient(root_window_);
|
| -
|
| - corewm::FocusController* focus_controller =
|
| - new corewm::FocusController(new DesktopFocusRules(content_window));
|
| - focus_client_.reset(focus_controller);
|
| - aura::client::SetFocusClient(root_window_, focus_controller);
|
| - aura::client::SetActivationClient(root_window_, focus_controller);
|
| - root_window_->AddPreTargetHandler(focus_controller);
|
| -
|
| - dispatcher_client_.reset(new DesktopDispatcherClient);
|
| - aura::client::SetDispatcherClient(root_window_,
|
| - dispatcher_client_.get());
|
| -
|
| - cursor_client_.reset(
|
| - new views::corewm::CursorManager(
|
| - scoped_ptr<corewm::NativeCursorManager>(
|
| - new views::DesktopNativeCursorManager(
|
| - root_window_,
|
| - scoped_ptr<DesktopCursorLoaderUpdater>()))));
|
| - aura::client::SetCursorClient(root_window_,
|
| - cursor_client_.get());
|
| -
|
| - position_client_.reset(new DesktopScreenPositionClient());
|
| - aura::client::SetScreenPositionClient(root_window_,
|
| - position_client_.get());
|
| -
|
| - desktop_native_widget_aura_->InstallInputMethodEventFilter(root_window_);
|
| -
|
| - drag_drop_client_.reset(new DesktopDragDropClientWin(root_window_,
|
| - GetHWND()));
|
| - aura::client::SetDragDropClient(root_window_, drag_drop_client_.get());
|
| +void DesktopRootWindowHostWin::OnRootWindowCreated(
|
| + aura::RootWindow* root,
|
| + const Widget::InitParams& params) {
|
| + root_window_ = root;
|
|
|
| root_window_->SetProperty(kContentWindowForRootWindow, content_window_);
|
|
|
| - aura::client::SetAnimationHost(content_window_, this);
|
| -
|
| should_animate_window_close_ =
|
| content_window_->type() != aura::client::WINDOW_TYPE_NORMAL &&
|
| !views::corewm::WindowAnimationsDisabled(content_window_);
|
|
|
| - return root_window_;
|
| +// TODO this is not invoked *after* Init(), but should be ok.
|
| + SetWindowTransparency();
|
| }
|
|
|
| scoped_ptr<corewm::Tooltip> DesktopRootWindowHostWin::CreateTooltip() {
|
| @@ -181,6 +141,13 @@ scoped_ptr<corewm::Tooltip> DesktopRootWindowHostWin::CreateTooltip() {
|
| return scoped_ptr<corewm::Tooltip>(tooltip_);
|
| }
|
|
|
| +scoped_ptr<aura::client::DragDropClient>
|
| +DesktopRootWindowHostWin::CreateDragDropClient(
|
| + DesktopNativeCursorManager* cursor_manager) {
|
| + drag_drop_client_ = new DesktopDragDropClientWin(root_window_, GetHWND());
|
| + return scoped_ptr<aura::client::DragDropClient>(drag_drop_client_).Pass();
|
| +}
|
| +
|
| void DesktopRootWindowHostWin::Close() {
|
| if (should_animate_window_close_) {
|
| pending_close_ = true;
|
| @@ -487,7 +454,7 @@ void DesktopRootWindowHostWin::SetCursor(gfx::NativeCursor cursor) {
|
|
|
| bool DesktopRootWindowHostWin::QueryMouseLocation(gfx::Point* location_return) {
|
| aura::client::CursorClient* cursor_client =
|
| - aura::client::GetCursorClient(GetRootWindow());
|
| + aura::client::GetCursorClient(root_window_);
|
| if (cursor_client && !cursor_client->IsMouseEventsEnabled()) {
|
| *location_return = gfx::Point(0, 0);
|
| return false;
|
| @@ -710,8 +677,6 @@ void DesktopRootWindowHostWin::HandleCreate() {
|
| // TODO(beng): moar
|
| NOTIMPLEMENTED();
|
|
|
| - native_widget_delegate_->OnNativeWidgetCreated(true);
|
| -
|
| // 1. Window property association
|
| // 2. MouseWheel.
|
| }
|
| @@ -911,11 +876,9 @@ bool DesktopRootWindowHostWin::IsModalWindowActive() const {
|
| // static
|
| DesktopRootWindowHost* DesktopRootWindowHost::Create(
|
| internal::NativeWidgetDelegate* native_widget_delegate,
|
| - DesktopNativeWidgetAura* desktop_native_widget_aura,
|
| - const gfx::Rect& initial_bounds) {
|
| + DesktopNativeWidgetAura* desktop_native_widget_aura) {
|
| return new DesktopRootWindowHostWin(native_widget_delegate,
|
| - desktop_native_widget_aura,
|
| - initial_bounds);
|
| + desktop_native_widget_aura);
|
| }
|
|
|
| } // namespace views
|
|
|