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

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

Issue 23874013: Remove old activation code and disable-focus-controller flags (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
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 "ui/aura/client/activation_client.h" 8 #include "ui/aura/client/activation_client.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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 aura::Window* lost_active) { 859 aura::Window* lost_active) {
860 DCHECK(window_ == gained_active || window_ == lost_active); 860 DCHECK(window_ == gained_active || window_ == lost_active);
861 if ((window_ == gained_active || window_ == lost_active) && 861 if ((window_ == gained_active || window_ == lost_active) &&
862 IsVisible() && GetWidget()->non_client_view()) { 862 IsVisible() && GetWidget()->non_client_view()) {
863 GetWidget()->non_client_view()->SchedulePaint(); 863 GetWidget()->non_client_view()->SchedulePaint();
864 } 864 }
865 if (gained_active == window_ && restore_focus_on_activate_) { 865 if (gained_active == window_ && restore_focus_on_activate_) {
866 restore_focus_on_activate_ = false; 866 restore_focus_on_activate_ = false;
867 GetWidget()->GetFocusManager()->RestoreFocusedView(); 867 GetWidget()->GetFocusManager()->RestoreFocusedView();
868 } else if (lost_active == window_ && GetWidget()->HasFocusManager()) { 868 } else if (lost_active == window_ && GetWidget()->HasFocusManager()) {
869 bool store_focused_view = corewm::UseFocusControllerOnDesktop(); 869 DCHECK(!restore_focus_on_activate_);
870 if (!store_focused_view) { 870 restore_focus_on_activate_ = true;
871 // If we're losing focus to a window that is a top level (such as a 871 // Pass in false so that ClearNativeFocus() isn't invoked.
872 // bubble) store the focus. Such a window shares the same 872 GetWidget()->GetFocusManager()->StoreFocusedView(false);
873 // RootWindowHost, so that such a change won't trigger an activation
874 // change (which calls StoreFocusedView()). Without this the focused
875 // view is never told it lost focus.
876 aura::Window* focused_window =
877 aura::client::GetFocusClient(window_)->GetFocusedWindow();
878 if (focused_window && focused_window != window_) {
879 Widget* focused_widget =
880 Widget::GetWidgetForNativeWindow(focused_window);
881 store_focused_view = focused_widget && focused_widget != GetWidget() &&
882 focused_widget->is_top_level();
883 }
884 }
885 if (store_focused_view) {
886 DCHECK(!restore_focus_on_activate_);
887 restore_focus_on_activate_ = true;
888 // Pass in false so that ClearNativeFocus() isn't invoked.
889 GetWidget()->GetFocusManager()->StoreFocusedView(false);
890 }
891 } 873 }
892 } 874 }
893 875
894 //////////////////////////////////////////////////////////////////////////////// 876 ////////////////////////////////////////////////////////////////////////////////
895 // DesktopNativeWidgetAura, aura::client::FocusChangeObserver implementation: 877 // DesktopNativeWidgetAura, aura::client::FocusChangeObserver implementation:
896 878
897 void DesktopNativeWidgetAura::OnWindowFocused(aura::Window* gained_focus, 879 void DesktopNativeWidgetAura::OnWindowFocused(aura::Window* gained_focus,
898 aura::Window* lost_focus) { 880 aura::Window* lost_focus) {
899 if (window_ == gained_focus) { 881 if (window_ == gained_focus) {
900 desktop_root_window_host_->OnNativeWidgetFocus(); 882 desktop_root_window_host_->OnNativeWidgetFocus();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 } 943 }
962 944
963 //////////////////////////////////////////////////////////////////////////////// 945 ////////////////////////////////////////////////////////////////////////////////
964 // DesktopNativeWidgetAura, NativeWidget implementation: 946 // DesktopNativeWidgetAura, NativeWidget implementation:
965 947
966 ui::EventHandler* DesktopNativeWidgetAura::GetEventHandler() { 948 ui::EventHandler* DesktopNativeWidgetAura::GetEventHandler() {
967 return this; 949 return this;
968 } 950 }
969 951
970 } // namespace views 952 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698