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/native_widget_win.h" | 5 #include "ui/views/widget/native_widget_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 | 495 |
496 bool NativeWidgetWin::CanSaveFocus() const { | 496 bool NativeWidgetWin::CanSaveFocus() const { |
497 return GetWidget()->is_top_level(); | 497 return GetWidget()->is_top_level(); |
498 } | 498 } |
499 | 499 |
500 void NativeWidgetWin::SaveFocusOnDeactivate() { | 500 void NativeWidgetWin::SaveFocusOnDeactivate() { |
501 GetWidget()->GetFocusManager()->StoreFocusedView(true); | 501 GetWidget()->GetFocusManager()->StoreFocusedView(true); |
502 } | 502 } |
503 | 503 |
504 void NativeWidgetWin::RestoreFocusOnActivate() { | 504 void NativeWidgetWin::RestoreFocusOnActivate() { |
505 // Mysteriously, this only appears to be needed support restoration of focus | |
506 // to a child hwnd when restoring its top level window from the minimized | |
507 // state. If we don't do this, then ::SetFocus() to that child HWND returns | |
508 // ERROR_INVALID_PARAMETER, despite both HWNDs being of the same thread. | |
509 // See http://crbug.com/125976 | |
510 { | |
511 // Since this is a synthetic reset, we don't need to tell anyone about it. | |
512 AutoNativeNotificationDisabler disabler; | |
513 GetWidget()->GetFocusManager()->ClearFocus(); | |
514 } | |
515 RestoreFocusOnEnable(); | 505 RestoreFocusOnEnable(); |
516 } | 506 } |
517 | 507 |
518 void NativeWidgetWin::RestoreFocusOnEnable() { | 508 void NativeWidgetWin::RestoreFocusOnEnable() { |
519 GetWidget()->GetFocusManager()->RestoreFocusedView(); | 509 GetWidget()->GetFocusManager()->RestoreFocusedView(); |
520 } | 510 } |
521 | 511 |
522 bool NativeWidgetWin::IsModal() const { | 512 bool NativeWidgetWin::IsModal() const { |
523 return delegate_->IsModal(); | 513 return delegate_->IsModal(); |
524 } | 514 } |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 // static | 964 // static |
975 bool NativeWidgetPrivate::IsTouchDown() { | 965 bool NativeWidgetPrivate::IsTouchDown() { |
976 // This currently isn't necessary because we're not generating touch events on | 966 // This currently isn't necessary because we're not generating touch events on |
977 // windows. When we do, this will need to be updated. | 967 // windows. When we do, this will need to be updated. |
978 return false; | 968 return false; |
979 } | 969 } |
980 | 970 |
981 } // namespace internal | 971 } // namespace internal |
982 | 972 |
983 } // namespace views | 973 } // namespace views |
OLD | NEW |