| 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 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 | 863 |
| 864 void DesktopNativeWidgetAura::SetCursor(gfx::NativeCursor cursor) { | 864 void DesktopNativeWidgetAura::SetCursor(gfx::NativeCursor cursor) { |
| 865 cursor_ = cursor; | 865 cursor_ = cursor; |
| 866 aura::client::CursorClient* cursor_client = | 866 aura::client::CursorClient* cursor_client = |
| 867 aura::client::GetCursorClient(host_->window()); | 867 aura::client::GetCursorClient(host_->window()); |
| 868 if (cursor_client) | 868 if (cursor_client) |
| 869 cursor_client->SetCursor(cursor); | 869 cursor_client->SetCursor(cursor); |
| 870 } | 870 } |
| 871 | 871 |
| 872 bool DesktopNativeWidgetAura::IsMouseEventsEnabled() const { | 872 bool DesktopNativeWidgetAura::IsMouseEventsEnabled() const { |
| 873 if (!content_window_) | 873 // We explicitly check |host_| here because it can be null during the process |
| 874 // of widget shutdown (even if |content_window_| is not), and must be valid to |
| 875 // determine if mouse events are enabled. |
| 876 if (!content_window_ || !host_) |
| 874 return false; | 877 return false; |
| 875 aura::client::CursorClient* cursor_client = | 878 aura::client::CursorClient* cursor_client = |
| 876 aura::client::GetCursorClient(host_->window()); | 879 aura::client::GetCursorClient(host_->window()); |
| 877 return cursor_client ? cursor_client->IsMouseEventsEnabled() : true; | 880 return cursor_client ? cursor_client->IsMouseEventsEnabled() : true; |
| 878 } | 881 } |
| 879 | 882 |
| 880 void DesktopNativeWidgetAura::ClearNativeFocus() { | 883 void DesktopNativeWidgetAura::ClearNativeFocus() { |
| 881 desktop_window_tree_host_->ClearNativeFocus(); | 884 desktop_window_tree_host_->ClearNativeFocus(); |
| 882 | 885 |
| 883 if (ShouldActivate()) { | 886 if (ShouldActivate()) { |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 if (cursor_reference_count_ == 0) { | 1232 if (cursor_reference_count_ == 0) { |
| 1230 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1233 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
| 1231 // for cleaning up |cursor_manager_|. | 1234 // for cleaning up |cursor_manager_|. |
| 1232 delete cursor_manager_; | 1235 delete cursor_manager_; |
| 1233 native_cursor_manager_ = NULL; | 1236 native_cursor_manager_ = NULL; |
| 1234 cursor_manager_ = NULL; | 1237 cursor_manager_ = NULL; |
| 1235 } | 1238 } |
| 1236 } | 1239 } |
| 1237 | 1240 |
| 1238 } // namespace views | 1241 } // namespace views |
| OLD | NEW |