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/native_widget_aura.cc

Issue 438113002: Merge 286589 "Do not save and restore View focus on aura::Window..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/2062/src/
Patch Set: Created 6 years, 4 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
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.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/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "third_party/skia/include/core/SkRegion.h" 9 #include "third_party/skia/include/core/SkRegion.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 // NativeWidgetAura, aura::client::FocusChangeObserver: 901 // NativeWidgetAura, aura::client::FocusChangeObserver:
902 902
903 void NativeWidgetAura::OnWindowFocused(aura::Window* gained_focus, 903 void NativeWidgetAura::OnWindowFocused(aura::Window* gained_focus,
904 aura::Window* lost_focus) { 904 aura::Window* lost_focus) {
905 if (window_ == gained_focus) { 905 if (window_ == gained_focus) {
906 // In aura, it is possible for child native widgets to take input and focus, 906 // In aura, it is possible for child native widgets to take input and focus,
907 // this differs from the behavior on windows. 907 // this differs from the behavior on windows.
908 if (GetWidget()->GetInputMethod()) // Null in tests. 908 if (GetWidget()->GetInputMethod()) // Null in tests.
909 GetWidget()->GetInputMethod()->OnFocus(); 909 GetWidget()->GetInputMethod()->OnFocus();
910 delegate_->OnNativeFocus(lost_focus); 910 delegate_->OnNativeFocus(lost_focus);
911 GetWidget()->GetFocusManager()->RestoreFocusedView();
912 } else if (window_ == lost_focus) { 911 } else if (window_ == lost_focus) {
913 // GetInputMethod() recreates the input method if it's previously been 912 // GetInputMethod() recreates the input method if it's previously been
914 // destroyed. If we get called during destruction, the input method will be 913 // destroyed. If we get called during destruction, the input method will be
915 // gone, and creating a new one and telling it that we lost the focus will 914 // gone, and creating a new one and telling it that we lost the focus will
916 // trigger a DCHECK (the new input method doesn't think that we have the 915 // trigger a DCHECK (the new input method doesn't think that we have the
917 // focus and doesn't expect a blur). OnBlur() shouldn't be called during 916 // focus and doesn't expect a blur). OnBlur() shouldn't be called during
918 // destruction unless WIDGET_OWNS_NATIVE_WIDGET is set (which is just the 917 // destruction unless WIDGET_OWNS_NATIVE_WIDGET is set (which is just the
919 // case in tests). 918 // case in tests).
920 if (!destroying_) { 919 if (!destroying_) {
921 if (GetWidget()->GetInputMethod()) 920 if (GetWidget()->GetInputMethod())
922 GetWidget()->GetInputMethod()->OnBlur(); 921 GetWidget()->GetInputMethod()->OnBlur();
923 } else { 922 } else {
924 DCHECK_EQ(ownership_, Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET); 923 DCHECK_EQ(ownership_, Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET);
925 } 924 }
926 925
927 delegate_->OnNativeBlur(gained_focus); 926 delegate_->OnNativeBlur(gained_focus);
928 GetWidget()->GetFocusManager()->StoreFocusedView(true);
929 } 927 }
930 } 928 }
931 929
932 //////////////////////////////////////////////////////////////////////////////// 930 ////////////////////////////////////////////////////////////////////////////////
933 // NativeWidgetAura, aura::WindowDragDropDelegate implementation: 931 // NativeWidgetAura, aura::WindowDragDropDelegate implementation:
934 932
935 void NativeWidgetAura::OnDragEntered(const ui::DropTargetEvent& event) { 933 void NativeWidgetAura::OnDragEntered(const ui::DropTargetEvent& event) {
936 DCHECK(drop_helper_.get() != NULL); 934 DCHECK(drop_helper_.get() != NULL);
937 last_drop_operation_ = drop_helper_->OnDragOver(event.data(), 935 last_drop_operation_ = drop_helper_->OnDragOver(event.data(),
938 event.location(), event.source_operations()); 936 event.location(), event.source_operations());
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); 1157 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont));
1160 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); 1158 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont)));
1161 return gfx::FontList(gfx::Font(caption_font)); 1159 return gfx::FontList(gfx::Font(caption_font));
1162 #else 1160 #else
1163 return gfx::FontList(); 1161 return gfx::FontList();
1164 #endif 1162 #endif
1165 } 1163 }
1166 1164
1167 } // namespace internal 1165 } // namespace internal
1168 } // namespace views 1166 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698