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

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: fix compile 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/drop_target_win.h"
32 #include "ui/views/widget/root_view.h"
30 #include "ui/views/widget/widget_delegate.h" 33 #include "ui/views/widget/widget_delegate.h"
31 #include "ui/views/widget/widget_hwnd_utils.h" 34 #include "ui/views/widget/widget_hwnd_utils.h"
32 #include "ui/views/win/fullscreen_handler.h" 35 #include "ui/views/win/fullscreen_handler.h"
33 #include "ui/views/win/hwnd_message_handler.h" 36 #include "ui/views/win/hwnd_message_handler.h"
34 #include "ui/views/window/native_frame_view.h" 37 #include "ui/views/window/native_frame_view.h"
35 38
36 namespace views { 39 namespace views {
37 40
38 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL); 41 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL);
39 42
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 125
123 activation_client_.reset(new DesktopActivationClient(root_window_)); 126 activation_client_.reset(new DesktopActivationClient(root_window_));
124 127
125 dispatcher_client_.reset(new DesktopDispatcherClient); 128 dispatcher_client_.reset(new DesktopDispatcherClient);
126 aura::client::SetDispatcherClient(root_window_, 129 aura::client::SetDispatcherClient(root_window_,
127 dispatcher_client_.get()); 130 dispatcher_client_.get());
128 131
129 cursor_client_.reset(new DesktopCursorClient(root_window_)); 132 cursor_client_.reset(new DesktopCursorClient(root_window_));
130 aura::client::SetCursorClient(root_window_, cursor_client_.get()); 133 aura::client::SetCursorClient(root_window_, cursor_client_.get());
131 134
132
133 position_client_.reset(new DesktopScreenPositionClient()); 135 position_client_.reset(new DesktopScreenPositionClient());
134 aura::client::SetScreenPositionClient(root_window_, 136 aura::client::SetScreenPositionClient(root_window_,
135 position_client_.get()); 137 position_client_.get());
136 138
139 drag_drop_client_.reset(new DesktopDragDropClientWin);
140 aura::client::SetDragDropClient(root_window_, drag_drop_client_.get());
141
137 // CEF sets focus to the window the user clicks down on. 142 // 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- 143 // TODO(beng): see if we can't do this some other way. CEF seems a heavy-
139 // handed way of accomplishing focus. 144 // handed way of accomplishing focus.
140 root_window_event_filter_ = new views::corewm::CompoundEventFilter; 145 root_window_event_filter_ = new views::corewm::CompoundEventFilter;
141 root_window_->SetEventFilter(root_window_event_filter_); 146 root_window_->SetEventFilter(root_window_event_filter_);
142 147
143 input_method_filter_.reset(new views::corewm::InputMethodEventFilter); 148 input_method_filter_.reset(new views::corewm::InputMethodEventFilter);
144 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window_); 149 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window_);
145 root_window_event_filter_->AddHandler(input_method_filter_.get()); 150 root_window_event_filter_->AddHandler(input_method_filter_.get());
146 151
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 608
604 void DesktopRootWindowHostWin::HandleAccelerator( 609 void DesktopRootWindowHostWin::HandleAccelerator(
605 const ui::Accelerator& accelerator) { 610 const ui::Accelerator& accelerator) {
606 GetWidget()->GetFocusManager()->ProcessAccelerator(accelerator); 611 GetWidget()->GetFocusManager()->ProcessAccelerator(accelerator);
607 } 612 }
608 613
609 void DesktopRootWindowHostWin::HandleCreate() { 614 void DesktopRootWindowHostWin::HandleCreate() {
610 // TODO(beng): moar 615 // TODO(beng): moar
611 NOTIMPLEMENTED(); 616 NOTIMPLEMENTED();
612 617
618 drop_target_ = new DropTargetWin(
619 static_cast<internal::RootView*>(GetWidget()->GetRootView()),
620 GetHWND());
621
613 native_widget_delegate_->OnNativeWidgetCreated(); 622 native_widget_delegate_->OnNativeWidgetCreated();
614 623
615 // 1. Window property association 624 // 1. Window property association
616 // 2. MouseWheel. 625 // 2. MouseWheel.
617 // 3. Drop target. 626 // 3. Tooltip Manager.
618 // 4. Tooltip Manager.
619 } 627 }
620 628
621 void DesktopRootWindowHostWin::HandleDestroying() { 629 void DesktopRootWindowHostWin::HandleDestroying() {
630 if (drop_target_.get()) {
Ben Goodger (Google) 2012/12/06 18:22:28 but can't we just call through to the DDC here the
jam 2012/12/06 18:48:02 ok, done
631 RevokeDragDrop(GetHWND());
632 drop_target_ = NULL;
633 }
622 native_widget_delegate_->OnNativeWidgetDestroying(); 634 native_widget_delegate_->OnNativeWidgetDestroying();
623 } 635 }
624 636
625 void DesktopRootWindowHostWin::HandleDestroyed() { 637 void DesktopRootWindowHostWin::HandleDestroyed() {
626 root_window_event_filter_->RemoveHandler(input_method_filter_.get()); 638 root_window_event_filter_->RemoveHandler(input_method_filter_.get());
627 desktop_native_widget_aura_->OnHostClosed(); 639 desktop_native_widget_aura_->OnHostClosed();
628 } 640 }
629 641
630 bool DesktopRootWindowHostWin::HandleInitialFocus() { 642 bool DesktopRootWindowHostWin::HandleInitialFocus() {
631 return GetWidget()->SetInitialFocus(); 643 return GetWidget()->SetInitialFocus();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 DesktopRootWindowHost* DesktopRootWindowHost::Create( 799 DesktopRootWindowHost* DesktopRootWindowHost::Create(
788 internal::NativeWidgetDelegate* native_widget_delegate, 800 internal::NativeWidgetDelegate* native_widget_delegate,
789 DesktopNativeWidgetAura* desktop_native_widget_aura, 801 DesktopNativeWidgetAura* desktop_native_widget_aura,
790 const gfx::Rect& initial_bounds) { 802 const gfx::Rect& initial_bounds) {
791 return new DesktopRootWindowHostWin(native_widget_delegate, 803 return new DesktopRootWindowHostWin(native_widget_delegate,
792 desktop_native_widget_aura, 804 desktop_native_widget_aura,
793 initial_bounds); 805 initial_bounds);
794 } 806 }
795 807
796 } // namespace views 808 } // 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