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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 873513002: [Views] Make MenuButton track its desired state while pressed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months 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
« no previous file with comments | « ui/views/controls/button/menu_button_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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
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
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
OLDNEW
« no previous file with comments | « ui/views/controls/button/menu_button_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698