Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: ui/views/widget/desktop_aura/desktop_root_window_host_win.cc

Issue 11444013: Get drag and drop working for win aura. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: move DropTargetWin to DesktopDragDropClientWin Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_win.h" 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_win.h"
6 6
7 #include "third_party/skia/include/core/SkPath.h" 7 #include "third_party/skia/include/core/SkPath.h"
8 #include "third_party/skia/include/core/SkRegion.h" 8 #include "third_party/skia/include/core/SkRegion.h"
9 #include "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/client/default_capture_client.h" 10 #include "ui/aura/client/default_capture_client.h"
11 #include "ui/aura/focus_manager.h" 11 #include "ui/aura/focus_manager.h"
12 #include "ui/aura/root_window.h" 12 #include "ui/aura/root_window.h"
13 #include "ui/aura/ui_controls_aura.h" 13 #include "ui/aura/ui_controls_aura.h"
14 #include "ui/aura/window_property.h" 14 #include "ui/aura/window_property.h"
15 #include "ui/base/cursor/cursor_loader_win.h" 15 #include "ui/base/cursor/cursor_loader_win.h"
16 #include "ui/base/win/shell.h" 16 #include "ui/base/win/shell.h"
17 #include "ui/gfx/native_widget_types.h" 17 #include "ui/gfx/native_widget_types.h"
18 #include "ui/gfx/path_win.h" 18 #include "ui/gfx/path_win.h"
19 #include "ui/native_theme/native_theme_aura.h" 19 #include "ui/native_theme/native_theme_aura.h"
20 #include "ui/native_theme/native_theme_win.h" 20 #include "ui/native_theme/native_theme_win.h"
21 #include "ui/ui_controls/ui_controls.h" 21 #include "ui/ui_controls/ui_controls.h"
22 #include "ui/views/corewm/compound_event_filter.h" 22 #include "ui/views/corewm/compound_event_filter.h"
23 #include "ui/views/corewm/input_method_event_filter.h" 23 #include "ui/views/corewm/input_method_event_filter.h"
24 #include "ui/views/ime/input_method_win.h" 24 #include "ui/views/ime/input_method_win.h"
25 #include "ui/views/widget/desktop_aura/desktop_activation_client.h" 25 #include "ui/views/widget/desktop_aura/desktop_activation_client.h"
26 #include "ui/views/widget/desktop_aura/desktop_cursor_client.h" 26 #include "ui/views/widget/desktop_aura/desktop_cursor_client.h"
27 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" 27 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h"
28 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h"
28 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 29 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
29 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" 30 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h"
31 #include "ui/views/widget/root_view.h"
30 #include "ui/views/widget/widget_delegate.h" 32 #include "ui/views/widget/widget_delegate.h"
31 #include "ui/views/widget/widget_hwnd_utils.h" 33 #include "ui/views/widget/widget_hwnd_utils.h"
32 #include "ui/views/win/fullscreen_handler.h" 34 #include "ui/views/win/fullscreen_handler.h"
33 #include "ui/views/win/hwnd_message_handler.h" 35 #include "ui/views/win/hwnd_message_handler.h"
34 #include "ui/views/window/native_frame_view.h" 36 #include "ui/views/window/native_frame_view.h"
35 37
36 namespace views { 38 namespace views {
37 39
38 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL); 40 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL);
39 41
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 124
123 activation_client_.reset(new DesktopActivationClient(root_window_)); 125 activation_client_.reset(new DesktopActivationClient(root_window_));
124 126
125 dispatcher_client_.reset(new DesktopDispatcherClient); 127 dispatcher_client_.reset(new DesktopDispatcherClient);
126 aura::client::SetDispatcherClient(root_window_, 128 aura::client::SetDispatcherClient(root_window_,
127 dispatcher_client_.get()); 129 dispatcher_client_.get());
128 130
129 cursor_client_.reset(new DesktopCursorClient(root_window_)); 131 cursor_client_.reset(new DesktopCursorClient(root_window_));
130 aura::client::SetCursorClient(root_window_, cursor_client_.get()); 132 aura::client::SetCursorClient(root_window_, cursor_client_.get());
131 133
132
133 position_client_.reset(new DesktopScreenPositionClient()); 134 position_client_.reset(new DesktopScreenPositionClient());
134 aura::client::SetScreenPositionClient(root_window_, 135 aura::client::SetScreenPositionClient(root_window_,
135 position_client_.get()); 136 position_client_.get());
136 137
138 drag_drop_client_.reset(new DesktopDragDropClientWin);
139 aura::client::SetDragDropClient(root_window_, drag_drop_client_.get());
140
137 // CEF sets focus to the window the user clicks down on. 141 // CEF sets focus to the window the user clicks down on.
138 // TODO(beng): see if we can't do this some other way. CEF seems a heavy- 142 // TODO(beng): see if we can't do this some other way. CEF seems a heavy-
139 // handed way of accomplishing focus. 143 // handed way of accomplishing focus.
140 root_window_event_filter_ = new views::corewm::CompoundEventFilter; 144 root_window_event_filter_ = new views::corewm::CompoundEventFilter;
141 root_window_->SetEventFilter(root_window_event_filter_); 145 root_window_->SetEventFilter(root_window_event_filter_);
142 146
143 input_method_filter_.reset(new views::corewm::InputMethodEventFilter); 147 input_method_filter_.reset(new views::corewm::InputMethodEventFilter);
144 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window_); 148 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window_);
145 root_window_event_filter_->AddHandler(input_method_filter_.get()); 149 root_window_event_filter_->AddHandler(input_method_filter_.get());
146 150
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 607
604 void DesktopRootWindowHostWin::HandleAccelerator( 608 void DesktopRootWindowHostWin::HandleAccelerator(
605 const ui::Accelerator& accelerator) { 609 const ui::Accelerator& accelerator) {
606 GetWidget()->GetFocusManager()->ProcessAccelerator(accelerator); 610 GetWidget()->GetFocusManager()->ProcessAccelerator(accelerator);
607 } 611 }
608 612
609 void DesktopRootWindowHostWin::HandleCreate() { 613 void DesktopRootWindowHostWin::HandleCreate() {
610 // TODO(beng): moar 614 // TODO(beng): moar
611 NOTIMPLEMENTED(); 615 NOTIMPLEMENTED();
612 616
617 drag_drop_client_->OnNativeWidgetCreated(
Ben Goodger (Google) 2012/12/06 18:52:55 this won't work. HandleCreate is sent in response
jam 2012/12/06 18:56:50 i had uploaded before testing, ptal
618 GetHWND(),
619 static_cast<internal::RootView*>(GetWidget()->GetRootView()));
620
613 native_widget_delegate_->OnNativeWidgetCreated(); 621 native_widget_delegate_->OnNativeWidgetCreated();
614 622
615 // 1. Window property association 623 // 1. Window property association
616 // 2. MouseWheel. 624 // 2. MouseWheel.
617 // 3. Drop target. 625 // 3. Tooltip Manager.
618 // 4. Tooltip Manager.
619 } 626 }
620 627
621 void DesktopRootWindowHostWin::HandleDestroying() { 628 void DesktopRootWindowHostWin::HandleDestroying() {
629 drag_drop_client_->OnNativeWidgetDestroying(GetHWND());
622 native_widget_delegate_->OnNativeWidgetDestroying(); 630 native_widget_delegate_->OnNativeWidgetDestroying();
623 } 631 }
624 632
625 void DesktopRootWindowHostWin::HandleDestroyed() { 633 void DesktopRootWindowHostWin::HandleDestroyed() {
626 root_window_event_filter_->RemoveHandler(input_method_filter_.get()); 634 root_window_event_filter_->RemoveHandler(input_method_filter_.get());
627 desktop_native_widget_aura_->OnHostClosed(); 635 desktop_native_widget_aura_->OnHostClosed();
628 } 636 }
629 637
630 bool DesktopRootWindowHostWin::HandleInitialFocus() { 638 bool DesktopRootWindowHostWin::HandleInitialFocus() {
631 return GetWidget()->SetInitialFocus(); 639 return GetWidget()->SetInitialFocus();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 DesktopRootWindowHost* DesktopRootWindowHost::Create( 795 DesktopRootWindowHost* DesktopRootWindowHost::Create(
788 internal::NativeWidgetDelegate* native_widget_delegate, 796 internal::NativeWidgetDelegate* native_widget_delegate,
789 DesktopNativeWidgetAura* desktop_native_widget_aura, 797 DesktopNativeWidgetAura* desktop_native_widget_aura,
790 const gfx::Rect& initial_bounds) { 798 const gfx::Rect& initial_bounds) {
791 return new DesktopRootWindowHostWin(native_widget_delegate, 799 return new DesktopRootWindowHostWin(native_widget_delegate,
792 desktop_native_widget_aura, 800 desktop_native_widget_aura,
793 initial_bounds); 801 initial_bounds);
794 } 802 }
795 803
796 } // namespace views 804 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_root_window_host_win.h ('k') | ui/views/widget/drop_target_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698