| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 public: | 213 public: |
| 214 explicit FocusManagerEventHandler( | 214 explicit FocusManagerEventHandler( |
| 215 DesktopNativeWidgetAura* desktop_native_widget_aura) | 215 DesktopNativeWidgetAura* desktop_native_widget_aura) |
| 216 : desktop_native_widget_aura_(desktop_native_widget_aura) {} | 216 : desktop_native_widget_aura_(desktop_native_widget_aura) {} |
| 217 | 217 |
| 218 // Implementation of ui::EventHandler: | 218 // Implementation of ui::EventHandler: |
| 219 void OnKeyEvent(ui::KeyEvent* event) override { | 219 void OnKeyEvent(ui::KeyEvent* event) override { |
| 220 Widget* widget = desktop_native_widget_aura_->GetWidget(); | 220 Widget* widget = desktop_native_widget_aura_->GetWidget(); |
| 221 if (widget && widget->GetFocusManager()->GetFocusedView() && | 221 if (widget && widget->GetFocusManager()->GetFocusedView() && |
| 222 !widget->GetFocusManager()->OnKeyEvent(*event)) { | 222 !widget->GetFocusManager()->OnKeyEvent(*event)) { |
| 223 event->SetHandled(); | 223 event->StopPropagation(); |
| 224 } | 224 } |
| 225 } | 225 } |
| 226 | 226 |
| 227 private: | 227 private: |
| 228 DesktopNativeWidgetAura* desktop_native_widget_aura_; | 228 DesktopNativeWidgetAura* desktop_native_widget_aura_; |
| 229 | 229 |
| 230 DISALLOW_COPY_AND_ASSIGN(FocusManagerEventHandler); | 230 DISALLOW_COPY_AND_ASSIGN(FocusManagerEventHandler); |
| 231 }; | 231 }; |
| 232 | 232 |
| 233 class RootWindowDestructionObserver : public aura::WindowObserver { | 233 class RootWindowDestructionObserver : public aura::WindowObserver { |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 // Renderer may send a key event back to us if the key event wasn't handled, | 1028 // Renderer may send a key event back to us if the key event wasn't handled, |
| 1029 // and the window may be invisible by that time. | 1029 // and the window may be invisible by that time. |
| 1030 if (!content_window_->IsVisible()) | 1030 if (!content_window_->IsVisible()) |
| 1031 return; | 1031 return; |
| 1032 | 1032 |
| 1033 native_widget_delegate_->OnKeyEvent(event); | 1033 native_widget_delegate_->OnKeyEvent(event); |
| 1034 if (event->handled()) | 1034 if (event->handled()) |
| 1035 return; | 1035 return; |
| 1036 | 1036 |
| 1037 if (GetWidget()->HasFocusManager() && | 1037 if (GetWidget()->HasFocusManager() && |
| 1038 !GetWidget()->GetFocusManager()->OnKeyEvent(*event)) | 1038 !GetWidget()->GetFocusManager()->OnKeyEvent(*event)) { |
| 1039 event->SetHandled(); | 1039 event->StopPropagation(); |
| 1040 } |
| 1040 } | 1041 } |
| 1041 | 1042 |
| 1042 void DesktopNativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) { | 1043 void DesktopNativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) { |
| 1043 DCHECK(content_window_->IsVisible()); | 1044 DCHECK(content_window_->IsVisible()); |
| 1044 if (tooltip_manager_.get()) | 1045 if (tooltip_manager_.get()) |
| 1045 tooltip_manager_->UpdateTooltip(); | 1046 tooltip_manager_->UpdateTooltip(); |
| 1046 TooltipManagerAura::UpdateTooltipManagerForCapture(GetWidget()); | 1047 TooltipManagerAura::UpdateTooltipManagerForCapture(GetWidget()); |
| 1047 native_widget_delegate_->OnMouseEvent(event); | 1048 native_widget_delegate_->OnMouseEvent(event); |
| 1048 // WARNING: we may have been deleted. | 1049 // WARNING: we may have been deleted. |
| 1049 } | 1050 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 if (cursor_reference_count_ == 0) { | 1187 if (cursor_reference_count_ == 0) { |
| 1187 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1188 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
| 1188 // for cleaning up |cursor_manager_|. | 1189 // for cleaning up |cursor_manager_|. |
| 1189 delete cursor_manager_; | 1190 delete cursor_manager_; |
| 1190 native_cursor_manager_ = NULL; | 1191 native_cursor_manager_ = NULL; |
| 1191 cursor_manager_ = NULL; | 1192 cursor_manager_ = NULL; |
| 1192 } | 1193 } |
| 1193 } | 1194 } |
| 1194 | 1195 |
| 1195 } // namespace views | 1196 } // namespace views |
| OLD | NEW |