Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1189)

Side by Side Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 1566083002: Makes sure the keyboard typing isn't blocked when InputMethod::OnFocus() is not correctly called. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remote_input_method_win.cc is gone again. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 drag_drop_client_.reset(); 362 drag_drop_client_.reset();
363 363
364 aura::client::SetEventClient(host->window(), NULL); 364 aura::client::SetEventClient(host->window(), NULL);
365 event_client_.reset(); 365 event_client_.reset();
366 } 366 }
367 367
368 void DesktopNativeWidgetAura::HandleActivationChanged(bool active) { 368 void DesktopNativeWidgetAura::HandleActivationChanged(bool active) {
369 native_widget_delegate_->OnNativeWidgetActivationChanged(active); 369 native_widget_delegate_->OnNativeWidgetActivationChanged(active);
370 aura::client::ActivationClient* activation_client = 370 aura::client::ActivationClient* activation_client =
371 aura::client::GetActivationClient(host_->window()); 371 aura::client::GetActivationClient(host_->window());
372 if (!activation_client) 372 if (!activation_client) {
373 GetInputMethod()->GetLogCollector()->AddString(
374 "Missing OnFocus call when activating due to no activation client.");
373 return; 375 return;
376 }
374 if (active) { 377 if (active) {
375 if (GetWidget()->HasFocusManager()) { 378 if (GetWidget()->HasFocusManager()) {
376 // This function can be called before the focus manager has had a 379 // 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 380 // chance to set the focused view. In which case we should get the
378 // last focused view. 381 // last focused view.
379 View* view_for_activation = 382 View* view_for_activation =
380 GetWidget()->GetFocusManager()->GetFocusedView() ? 383 GetWidget()->GetFocusManager()->GetFocusedView() ?
381 GetWidget()->GetFocusManager()->GetFocusedView() : 384 GetWidget()->GetFocusManager()->GetFocusedView() :
382 GetWidget()->GetFocusManager()->GetStoredFocusView(); 385 GetWidget()->GetFocusManager()->GetStoredFocusView();
383 if (!view_for_activation) 386 if (!view_for_activation)
384 view_for_activation = GetWidget()->GetRootView(); 387 view_for_activation = GetWidget()->GetRootView();
385 activation_client->ActivateWindow( 388 activation_client->ActivateWindow(
386 view_for_activation->GetWidget()->GetNativeView()); 389 view_for_activation->GetWidget()->GetNativeView());
387 // Refreshes the focus info to IMF in case that IMF cached the old info 390 // Refreshes the focus info to IMF in case that IMF cached the old info
388 // about focused text input client when it was "inactive". 391 // about focused text input client when it was "inactive".
389 GetInputMethod()->OnFocus(); 392 GetInputMethod()->OnFocus();
393 } else {
394 GetInputMethod()->GetLogCollector()->AddString(
395 "Missing OnFocus call when activating due to no focus manager.");
390 } 396 }
391 } else { 397 } else {
392 // If we're not active we need to deactivate the corresponding 398 // 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 399 // aura::Window. This way if a child widget is active it gets correctly
394 // deactivated (child widgets don't get native desktop activation changes, 400 // deactivated (child widgets don't get native desktop activation changes,
395 // only aura activation changes). 401 // only aura activation changes).
396 aura::Window* active_window = activation_client->GetActiveWindow(); 402 aura::Window* active_window = activation_client->GetActiveWindow();
397 if (active_window) { 403 if (active_window) {
398 activation_client->DeactivateWindow(active_window); 404 activation_client->DeactivateWindow(active_window);
399 GetInputMethod()->OnBlur(); 405 GetInputMethod()->OnBlur();
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 if (cursor_reference_count_ == 0) { 1212 if (cursor_reference_count_ == 0) {
1207 // We are the last DesktopNativeWidgetAura instance, and we are responsible 1213 // We are the last DesktopNativeWidgetAura instance, and we are responsible
1208 // for cleaning up |cursor_manager_|. 1214 // for cleaning up |cursor_manager_|.
1209 delete cursor_manager_; 1215 delete cursor_manager_;
1210 native_cursor_manager_ = NULL; 1216 native_cursor_manager_ = NULL;
1211 cursor_manager_ = NULL; 1217 cursor_manager_ = NULL;
1212 } 1218 }
1213 } 1219 }
1214 1220
1215 } // namespace views 1221 } // namespace views
OLDNEW
« no previous file with comments | « ui/base/ime/ui_base_ime.gyp ('k') | ui/views/widget/desktop_aura/desktop_window_tree_host_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698