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