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" |
11 #include "ui/aura/client/aura_constants.h" | 11 #include "ui/aura/client/aura_constants.h" |
12 #include "ui/aura/client/cursor_client.h" | 12 #include "ui/aura/client/cursor_client.h" |
13 #include "ui/aura/client/focus_client.h" | 13 #include "ui/aura/client/focus_client.h" |
14 #include "ui/aura/client/window_tree_client.h" | 14 #include "ui/aura/client/window_tree_client.h" |
15 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
16 #include "ui/aura/window_observer.h" | 16 #include "ui/aura/window_observer.h" |
17 #include "ui/aura/window_property.h" | 17 #include "ui/aura/window_property.h" |
18 #include "ui/aura/window_tree_host.h" | 18 #include "ui/aura/window_tree_host.h" |
19 #include "ui/base/hit_test.h" | 19 #include "ui/base/hit_test.h" |
20 #include "ui/base/ime/input_method.h" | 20 #include "ui/base/ime/input_method.h" |
21 #include "ui/base/ime/input_method_log_collector.h" | |
21 #include "ui/compositor/layer.h" | 22 #include "ui/compositor/layer.h" |
22 #include "ui/gfx/canvas.h" | 23 #include "ui/gfx/canvas.h" |
23 #include "ui/gfx/display.h" | 24 #include "ui/gfx/display.h" |
24 #include "ui/gfx/geometry/point_conversions.h" | 25 #include "ui/gfx/geometry/point_conversions.h" |
25 #include "ui/gfx/geometry/rect.h" | 26 #include "ui/gfx/geometry/rect.h" |
26 #include "ui/gfx/geometry/size_conversions.h" | 27 #include "ui/gfx/geometry/size_conversions.h" |
27 #include "ui/gfx/screen.h" | 28 #include "ui/gfx/screen.h" |
28 #include "ui/native_theme/native_theme.h" | 29 #include "ui/native_theme/native_theme.h" |
29 #include "ui/views/corewm/tooltip.h" | 30 #include "ui/views/corewm/tooltip.h" |
30 #include "ui/views/corewm/tooltip_controller.h" | 31 #include "ui/views/corewm/tooltip_controller.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 GetWidget()->GetFocusManager()->GetFocusedView() ? | 381 GetWidget()->GetFocusManager()->GetFocusedView() ? |
381 GetWidget()->GetFocusManager()->GetFocusedView() : | 382 GetWidget()->GetFocusManager()->GetFocusedView() : |
382 GetWidget()->GetFocusManager()->GetStoredFocusView(); | 383 GetWidget()->GetFocusManager()->GetStoredFocusView(); |
383 if (!view_for_activation) | 384 if (!view_for_activation) |
384 view_for_activation = GetWidget()->GetRootView(); | 385 view_for_activation = GetWidget()->GetRootView(); |
385 activation_client->ActivateWindow( | 386 activation_client->ActivateWindow( |
386 view_for_activation->GetWidget()->GetNativeView()); | 387 view_for_activation->GetWidget()->GetNativeView()); |
387 // Refreshes the focus info to IMF in case that IMF cached the old info | 388 // 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 // about focused text input client when it was "inactive". |
389 GetInputMethod()->OnFocus(); | 390 GetInputMethod()->OnFocus(); |
391 } else { | |
392 GetInputMethod()->GetLogCollector()->AddLog( | |
393 "Missing OnFocus call when activating."); | |
sky
2016/01/08 16:51:58
What about the early return on 374 too?
Shu Chen
2016/01/09 01:46:02
Thanks for catching it. Log is added.
| |
390 } | 394 } |
391 } else { | 395 } else { |
392 // If we're not active we need to deactivate the corresponding | 396 // 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 | 397 // aura::Window. This way if a child widget is active it gets correctly |
394 // deactivated (child widgets don't get native desktop activation changes, | 398 // deactivated (child widgets don't get native desktop activation changes, |
395 // only aura activation changes). | 399 // only aura activation changes). |
396 aura::Window* active_window = activation_client->GetActiveWindow(); | 400 aura::Window* active_window = activation_client->GetActiveWindow(); |
397 if (active_window) { | 401 if (active_window) { |
398 activation_client->DeactivateWindow(active_window); | 402 activation_client->DeactivateWindow(active_window); |
399 GetInputMethod()->OnBlur(); | 403 GetInputMethod()->OnBlur(); |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1204 if (cursor_reference_count_ == 0) { | 1208 if (cursor_reference_count_ == 0) { |
1205 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1209 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
1206 // for cleaning up |cursor_manager_|. | 1210 // for cleaning up |cursor_manager_|. |
1207 delete cursor_manager_; | 1211 delete cursor_manager_; |
1208 native_cursor_manager_ = NULL; | 1212 native_cursor_manager_ = NULL; |
1209 cursor_manager_ = NULL; | 1213 cursor_manager_ = NULL; |
1210 } | 1214 } |
1211 } | 1215 } |
1212 | 1216 |
1213 } // namespace views | 1217 } // namespace views |
OLD | NEW |