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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 drag_drop_client_.reset(); | 363 drag_drop_client_.reset(); |
363 | 364 |
364 aura::client::SetEventClient(host->window(), NULL); | 365 aura::client::SetEventClient(host->window(), NULL); |
365 event_client_.reset(); | 366 event_client_.reset(); |
366 } | 367 } |
367 | 368 |
368 void DesktopNativeWidgetAura::HandleActivationChanged(bool active) { | 369 void DesktopNativeWidgetAura::HandleActivationChanged(bool active) { |
369 native_widget_delegate_->OnNativeWidgetActivationChanged(active); | 370 native_widget_delegate_->OnNativeWidgetActivationChanged(active); |
370 aura::client::ActivationClient* activation_client = | 371 aura::client::ActivationClient* activation_client = |
371 aura::client::GetActivationClient(host_->window()); | 372 aura::client::GetActivationClient(host_->window()); |
372 if (!activation_client) | 373 if (!activation_client) { |
| 374 GetInputMethod()->GetLogCollector()->AddLog( |
| 375 "Missing OnFocus call when activating due to no activation client."); |
373 return; | 376 return; |
| 377 } |
374 if (active) { | 378 if (active) { |
375 if (GetWidget()->HasFocusManager()) { | 379 if (GetWidget()->HasFocusManager()) { |
376 // This function can be called before the focus manager has had a | 380 // This function can be called before the focus manager has had a |
377 // chance to set the focused view. In which case we should get the | 381 // chance to set the focused view. In which case we should get the |
378 // last focused view. | 382 // last focused view. |
379 View* view_for_activation = | 383 View* view_for_activation = |
380 GetWidget()->GetFocusManager()->GetFocusedView() ? | 384 GetWidget()->GetFocusManager()->GetFocusedView() ? |
381 GetWidget()->GetFocusManager()->GetFocusedView() : | 385 GetWidget()->GetFocusManager()->GetFocusedView() : |
382 GetWidget()->GetFocusManager()->GetStoredFocusView(); | 386 GetWidget()->GetFocusManager()->GetStoredFocusView(); |
383 if (!view_for_activation) | 387 if (!view_for_activation) |
384 view_for_activation = GetWidget()->GetRootView(); | 388 view_for_activation = GetWidget()->GetRootView(); |
385 activation_client->ActivateWindow( | 389 activation_client->ActivateWindow( |
386 view_for_activation->GetWidget()->GetNativeView()); | 390 view_for_activation->GetWidget()->GetNativeView()); |
387 // Refreshes the focus info to IMF in case that IMF cached the old info | 391 // Refreshes the focus info to IMF in case that IMF cached the old info |
388 // about focused text input client when it was "inactive". | 392 // about focused text input client when it was "inactive". |
389 GetInputMethod()->OnFocus(); | 393 GetInputMethod()->OnFocus(); |
| 394 } else { |
| 395 GetInputMethod()->GetLogCollector()->AddLog( |
| 396 "Missing OnFocus call when activating due to no focus manager."); |
390 } | 397 } |
391 } else { | 398 } else { |
392 // If we're not active we need to deactivate the corresponding | 399 // 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 | 400 // aura::Window. This way if a child widget is active it gets correctly |
394 // deactivated (child widgets don't get native desktop activation changes, | 401 // deactivated (child widgets don't get native desktop activation changes, |
395 // only aura activation changes). | 402 // only aura activation changes). |
396 aura::Window* active_window = activation_client->GetActiveWindow(); | 403 aura::Window* active_window = activation_client->GetActiveWindow(); |
397 if (active_window) { | 404 if (active_window) { |
398 activation_client->DeactivateWindow(active_window); | 405 activation_client->DeactivateWindow(active_window); |
399 GetInputMethod()->OnBlur(); | 406 GetInputMethod()->OnBlur(); |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 if (cursor_reference_count_ == 0) { | 1213 if (cursor_reference_count_ == 0) { |
1207 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1214 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
1208 // for cleaning up |cursor_manager_|. | 1215 // for cleaning up |cursor_manager_|. |
1209 delete cursor_manager_; | 1216 delete cursor_manager_; |
1210 native_cursor_manager_ = NULL; | 1217 native_cursor_manager_ = NULL; |
1211 cursor_manager_ = NULL; | 1218 cursor_manager_ = NULL; |
1212 } | 1219 } |
1213 } | 1220 } |
1214 | 1221 |
1215 } // namespace views | 1222 } // namespace views |
OLD | NEW |