OLD | NEW |
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_native_widget_aura.h" | 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 can_activate_(true), | 252 can_activate_(true), |
253 content_window_container_(NULL), | 253 content_window_container_(NULL), |
254 content_window_(new aura::Window(this)), | 254 content_window_(new aura::Window(this)), |
255 native_widget_delegate_(delegate), | 255 native_widget_delegate_(delegate), |
256 last_drop_operation_(ui::DragDropTypes::DRAG_NONE), | 256 last_drop_operation_(ui::DragDropTypes::DRAG_NONE), |
257 restore_focus_on_activate_(false), | 257 restore_focus_on_activate_(false), |
258 cursor_(gfx::kNullCursor), | 258 cursor_(gfx::kNullCursor), |
259 widget_type_(Widget::InitParams::TYPE_WINDOW) { | 259 widget_type_(Widget::InitParams::TYPE_WINDOW) { |
260 aura::client::SetFocusChangeObserver(content_window_, this); | 260 aura::client::SetFocusChangeObserver(content_window_, this); |
261 aura::client::SetActivationChangeObserver(content_window_, this); | 261 aura::client::SetActivationChangeObserver(content_window_, this); |
262 wm::SetCursorDelegate(content_window_, this); | |
263 } | 262 } |
264 | 263 |
265 DesktopNativeWidgetAura::~DesktopNativeWidgetAura() { | 264 DesktopNativeWidgetAura::~DesktopNativeWidgetAura() { |
266 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) | 265 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) |
267 delete native_widget_delegate_; | 266 delete native_widget_delegate_; |
268 else | 267 else |
269 CloseNow(); | 268 CloseNow(); |
270 } | 269 } |
271 | 270 |
272 // static | 271 // static |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 // DesktopNativeWidgetAura, aura::WindowDelegate implementation: | 922 // DesktopNativeWidgetAura, aura::WindowDelegate implementation: |
924 | 923 |
925 gfx::Size DesktopNativeWidgetAura::GetMinimumSize() const { | 924 gfx::Size DesktopNativeWidgetAura::GetMinimumSize() const { |
926 return native_widget_delegate_->GetMinimumSize(); | 925 return native_widget_delegate_->GetMinimumSize(); |
927 } | 926 } |
928 | 927 |
929 gfx::Size DesktopNativeWidgetAura::GetMaximumSize() const { | 928 gfx::Size DesktopNativeWidgetAura::GetMaximumSize() const { |
930 return native_widget_delegate_->GetMaximumSize(); | 929 return native_widget_delegate_->GetMaximumSize(); |
931 } | 930 } |
932 | 931 |
| 932 gfx::NativeCursor DesktopNativeWidgetAura::GetCursor(const gfx::Point& point) { |
| 933 return cursor_; |
| 934 } |
| 935 |
933 int DesktopNativeWidgetAura::GetNonClientComponent( | 936 int DesktopNativeWidgetAura::GetNonClientComponent( |
934 const gfx::Point& point) const { | 937 const gfx::Point& point) const { |
935 return native_widget_delegate_->GetNonClientComponent(point); | 938 return native_widget_delegate_->GetNonClientComponent(point); |
936 } | 939 } |
937 | 940 |
938 bool DesktopNativeWidgetAura::ShouldDescendIntoChildForEventHandling( | 941 bool DesktopNativeWidgetAura::ShouldDescendIntoChildForEventHandling( |
939 aura::Window* child, | 942 aura::Window* child, |
940 const gfx::Point& location) { | 943 const gfx::Point& location) { |
941 views::WidgetDelegate* widget_delegate = GetWidget()->widget_delegate(); | 944 views::WidgetDelegate* widget_delegate = GetWidget()->widget_delegate(); |
942 return !widget_delegate || | 945 return !widget_delegate || |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 | 1156 |
1154 void DesktopNativeWidgetAura::OnHostMoved(const aura::WindowTreeHost* host, | 1157 void DesktopNativeWidgetAura::OnHostMoved(const aura::WindowTreeHost* host, |
1155 const gfx::Point& new_origin) { | 1158 const gfx::Point& new_origin) { |
1156 TRACE_EVENT1("views", "DesktopNativeWidgetAura::OnHostMoved", | 1159 TRACE_EVENT1("views", "DesktopNativeWidgetAura::OnHostMoved", |
1157 "new_origin", new_origin.ToString()); | 1160 "new_origin", new_origin.ToString()); |
1158 | 1161 |
1159 native_widget_delegate_->OnNativeWidgetMove(); | 1162 native_widget_delegate_->OnNativeWidgetMove(); |
1160 } | 1163 } |
1161 | 1164 |
1162 //////////////////////////////////////////////////////////////////////////////// | 1165 //////////////////////////////////////////////////////////////////////////////// |
1163 // DesktopNativeWidgetAura, wm::CursorDelegate implementation: | |
1164 | |
1165 gfx::NativeCursor DesktopNativeWidgetAura::GetCursorForPoint( | |
1166 const gfx::Point& point) { | |
1167 return cursor_; | |
1168 } | |
1169 | |
1170 //////////////////////////////////////////////////////////////////////////////// | |
1171 // DesktopNativeWidgetAura, NativeWidget implementation: | 1166 // DesktopNativeWidgetAura, NativeWidget implementation: |
1172 | 1167 |
1173 ui::EventHandler* DesktopNativeWidgetAura::GetEventHandler() { | 1168 ui::EventHandler* DesktopNativeWidgetAura::GetEventHandler() { |
1174 return this; | 1169 return this; |
1175 } | 1170 } |
1176 | 1171 |
1177 void DesktopNativeWidgetAura::InstallInputMethodEventFilter() { | 1172 void DesktopNativeWidgetAura::InstallInputMethodEventFilter() { |
1178 DCHECK(!input_method_event_filter_.get()); | 1173 DCHECK(!input_method_event_filter_.get()); |
1179 | 1174 |
1180 input_method_event_filter_.reset(new wm::InputMethodEventFilter( | 1175 input_method_event_filter_.reset(new wm::InputMethodEventFilter( |
(...skipping 17 matching lines...) Expand all Loading... |
1198 if (cursor_reference_count_ == 0) { | 1193 if (cursor_reference_count_ == 0) { |
1199 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1194 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
1200 // for cleaning up |cursor_manager_|. | 1195 // for cleaning up |cursor_manager_|. |
1201 delete cursor_manager_; | 1196 delete cursor_manager_; |
1202 native_cursor_manager_ = NULL; | 1197 native_cursor_manager_ = NULL; |
1203 cursor_manager_ = NULL; | 1198 cursor_manager_ = NULL; |
1204 } | 1199 } |
1205 } | 1200 } |
1206 | 1201 |
1207 } // namespace views | 1202 } // namespace views |
OLD | NEW |