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

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

Issue 285403003: Re-land: Store and restore view focus in OnWindowFocused. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable ConstrainedWindowViewTest.ClosesOnEscape on Win XP. Created 6 years, 7 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/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/widget.h" 5 #include "ui/views/widget/widget.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 SaveWindowPlacement(); 1027 SaveWindowPlacement();
1028 1028
1029 FOR_EACH_OBSERVER(WidgetObserver, observers_, 1029 FOR_EACH_OBSERVER(WidgetObserver, observers_,
1030 OnWidgetActivationChanged(this, active)); 1030 OnWidgetActivationChanged(this, active));
1031 1031
1032 if (IsVisible() && non_client_view()) 1032 if (IsVisible() && non_client_view())
1033 non_client_view()->frame_view()->SchedulePaint(); 1033 non_client_view()->frame_view()->SchedulePaint();
1034 } 1034 }
1035 1035
1036 void Widget::OnNativeFocus(gfx::NativeView old_focused_view) { 1036 void Widget::OnNativeFocus(gfx::NativeView old_focused_view) {
1037 // Ensure the focused view's TextInputClient is used for text input.
1038 views::FocusManager* focus_manager = GetFocusManager();
1039 focus_manager->FocusTextInputClient(focus_manager->GetFocusedView());
1040
1041 WidgetFocusManager::GetInstance()->OnWidgetFocusEvent(old_focused_view, 1037 WidgetFocusManager::GetInstance()->OnWidgetFocusEvent(old_focused_view,
1042 GetNativeView()); 1038 GetNativeView());
1043 } 1039 }
1044 1040
1045 void Widget::OnNativeBlur(gfx::NativeView new_focused_view) { 1041 void Widget::OnNativeBlur(gfx::NativeView new_focused_view) {
1046 // Ensure the focused view's TextInputClient is not used for text input.
1047 views::FocusManager* focus_manager = GetFocusManager();
1048 focus_manager->BlurTextInputClient(focus_manager->GetFocusedView());
1049
1050 WidgetFocusManager::GetInstance()->OnWidgetFocusEvent(GetNativeView(), 1042 WidgetFocusManager::GetInstance()->OnWidgetFocusEvent(GetNativeView(),
1051 new_focused_view); 1043 new_focused_view);
1052 } 1044 }
1053 1045
1054 void Widget::OnNativeWidgetVisibilityChanging(bool visible) { 1046 void Widget::OnNativeWidgetVisibilityChanging(bool visible) {
1055 FOR_EACH_OBSERVER(WidgetObserver, observers_, 1047 FOR_EACH_OBSERVER(WidgetObserver, observers_,
1056 OnWidgetVisibilityChanging(this, visible)); 1048 OnWidgetVisibilityChanging(this, visible));
1057 } 1049 }
1058 1050
1059 void Widget::OnNativeWidgetVisibilityChanged(bool visible) { 1051 void Widget::OnNativeWidgetVisibilityChanged(bool visible) {
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 1503
1512 //////////////////////////////////////////////////////////////////////////////// 1504 ////////////////////////////////////////////////////////////////////////////////
1513 // internal::NativeWidgetPrivate, NativeWidget implementation: 1505 // internal::NativeWidgetPrivate, NativeWidget implementation:
1514 1506
1515 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { 1507 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() {
1516 return this; 1508 return this;
1517 } 1509 }
1518 1510
1519 } // namespace internal 1511 } // namespace internal
1520 } // namespace views 1512 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698