Chromium Code Reviews| 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/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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 377 // chance to set the focused view. In which case we should get the | 377 // chance to set the focused view. In which case we should get the |
| 378 // last focused view. | 378 // last focused view. |
| 379 View* view_for_activation = | 379 View* view_for_activation = |
| 380 GetWidget()->GetFocusManager()->GetFocusedView() ? | 380 GetWidget()->GetFocusManager()->GetFocusedView() ? |
| 381 GetWidget()->GetFocusManager()->GetFocusedView() : | 381 GetWidget()->GetFocusManager()->GetFocusedView() : |
| 382 GetWidget()->GetFocusManager()->GetStoredFocusView(); | 382 GetWidget()->GetFocusManager()->GetStoredFocusView(); |
| 383 if (!view_for_activation) | 383 if (!view_for_activation) |
| 384 view_for_activation = GetWidget()->GetRootView(); | 384 view_for_activation = GetWidget()->GetRootView(); |
| 385 activation_client->ActivateWindow( | 385 activation_client->ActivateWindow( |
| 386 view_for_activation->GetWidget()->GetNativeView()); | 386 view_for_activation->GetWidget()->GetNativeView()); |
| 387 // Refreshes the focus info to IMF in case that IMF cached the old info | |
| 388 // about focused text input client when it was "inactive". | |
| 389 GetInputMethod()->OnFocus(); | |
| 390 } | 387 } |
| 388 // Refreshes the focus info to IMF in case that IMF cached the old info | |
|
yukawa
2016/01/07 09:23:56
(optional) I'm fine with moving those logic, but c
Shu Chen
2016/01/08 02:04:11
Done.
| |
| 389 // about focused text input client when it was "inactive". | |
| 390 GetInputMethod()->OnFocus(); | |
| 391 } else { | 391 } else { |
| 392 // If we're not active we need to deactivate the corresponding | 392 // If we're not active we need to deactivate the corresponding |
| 393 // aura::Window. This way if a child widget is active it gets correctly | 393 // aura::Window. This way if a child widget is active it gets correctly |
| 394 // deactivated (child widgets don't get native desktop activation changes, | 394 // deactivated (child widgets don't get native desktop activation changes, |
| 395 // only aura activation changes). | 395 // only aura activation changes). |
| 396 aura::Window* active_window = activation_client->GetActiveWindow(); | 396 aura::Window* active_window = activation_client->GetActiveWindow(); |
| 397 if (active_window) { | 397 if (active_window) |
| 398 activation_client->DeactivateWindow(active_window); | 398 activation_client->DeactivateWindow(active_window); |
| 399 GetInputMethod()->OnBlur(); | 399 GetInputMethod()->OnBlur(); |
| 400 } | |
| 401 } | 400 } |
| 402 } | 401 } |
| 403 | 402 |
| 404 //////////////////////////////////////////////////////////////////////////////// | 403 //////////////////////////////////////////////////////////////////////////////// |
| 405 // DesktopNativeWidgetAura, internal::NativeWidgetPrivate implementation: | 404 // DesktopNativeWidgetAura, internal::NativeWidgetPrivate implementation: |
| 406 | 405 |
| 407 void DesktopNativeWidgetAura::InitNativeWidget( | 406 void DesktopNativeWidgetAura::InitNativeWidget( |
| 408 const Widget::InitParams& params) { | 407 const Widget::InitParams& params) { |
| 409 ownership_ = params.ownership; | 408 ownership_ = params.ownership; |
| 410 widget_type_ = params.type; | 409 widget_type_ = params.type; |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1204 if (cursor_reference_count_ == 0) { | 1203 if (cursor_reference_count_ == 0) { |
| 1205 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1204 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
| 1206 // for cleaning up |cursor_manager_|. | 1205 // for cleaning up |cursor_manager_|. |
| 1207 delete cursor_manager_; | 1206 delete cursor_manager_; |
| 1208 native_cursor_manager_ = NULL; | 1207 native_cursor_manager_ = NULL; |
| 1209 cursor_manager_ = NULL; | 1208 cursor_manager_ = NULL; |
| 1210 } | 1209 } |
| 1211 } | 1210 } |
| 1212 | 1211 |
| 1213 } // namespace views | 1212 } // namespace views |
| OLD | NEW |