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/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 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1024 void Widget::OnNativeWidgetActivationChanged(bool active) { | 1024 void Widget::OnNativeWidgetActivationChanged(bool active) { |
1025 // On windows we may end up here before we've completed initialization (from | 1025 // On windows we may end up here before we've completed initialization (from |
1026 // an WM_NCACTIVATE). If that happens the WidgetDelegate likely doesn't know | 1026 // an WM_NCACTIVATE). If that happens the WidgetDelegate likely doesn't know |
1027 // the Widget and will crash attempting to access it. | 1027 // the Widget and will crash attempting to access it. |
1028 if (!active && native_widget_initialized_) | 1028 if (!active && native_widget_initialized_) |
1029 SaveWindowPlacement(); | 1029 SaveWindowPlacement(); |
1030 | 1030 |
1031 FOR_EACH_OBSERVER(WidgetObserver, observers_, | 1031 FOR_EACH_OBSERVER(WidgetObserver, observers_, |
1032 OnWidgetActivationChanged(this, active)); | 1032 OnWidgetActivationChanged(this, active)); |
1033 | 1033 |
1034 // We have to update the focused text input client when the active widget | |
sky
2014/05/30 16:30:15
This just describes the code, document why this is
Yuki
2014/06/02 07:38:55
Done.
| |
1035 // changes. See crbug.com/377479 | |
1036 views::FocusManager* focus_manager = GetFocusManager(); | |
1037 if (focus_manager) { | |
1038 if (active) | |
1039 focus_manager->FocusTextInputClient(focus_manager->GetFocusedView()); | |
1040 else | |
1041 focus_manager->BlurTextInputClient(focus_manager->GetFocusedView()); | |
1042 } | |
1043 | |
1034 if (IsVisible() && non_client_view()) | 1044 if (IsVisible() && non_client_view()) |
1035 non_client_view()->frame_view()->SchedulePaint(); | 1045 non_client_view()->frame_view()->SchedulePaint(); |
1036 } | 1046 } |
1037 | 1047 |
1038 void Widget::OnNativeFocus(gfx::NativeView old_focused_view) { | 1048 void Widget::OnNativeFocus(gfx::NativeView old_focused_view) { |
1039 WidgetFocusManager::GetInstance()->OnWidgetFocusEvent(old_focused_view, | 1049 WidgetFocusManager::GetInstance()->OnWidgetFocusEvent(old_focused_view, |
1040 GetNativeView()); | 1050 GetNativeView()); |
1041 } | 1051 } |
1042 | 1052 |
1043 void Widget::OnNativeBlur(gfx::NativeView new_focused_view) { | 1053 void Widget::OnNativeBlur(gfx::NativeView new_focused_view) { |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1505 | 1515 |
1506 //////////////////////////////////////////////////////////////////////////////// | 1516 //////////////////////////////////////////////////////////////////////////////// |
1507 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1517 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1508 | 1518 |
1509 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1519 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1510 return this; | 1520 return this; |
1511 } | 1521 } |
1512 | 1522 |
1513 } // namespace internal | 1523 } // namespace internal |
1514 } // namespace views | 1524 } // namespace views |
OLD | NEW |