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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 826713002: [ChromeOS] Show autofill popup after keyboard (if any) is shown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "ui/aura/client/window_tree_client.h" 54 #include "ui/aura/client/window_tree_client.h"
55 #include "ui/aura/env.h" 55 #include "ui/aura/env.h"
56 #include "ui/aura/window.h" 56 #include "ui/aura/window.h"
57 #include "ui/aura/window_event_dispatcher.h" 57 #include "ui/aura/window_event_dispatcher.h"
58 #include "ui/aura/window_observer.h" 58 #include "ui/aura/window_observer.h"
59 #include "ui/aura/window_tracker.h" 59 #include "ui/aura/window_tracker.h"
60 #include "ui/aura/window_tree_host.h" 60 #include "ui/aura/window_tree_host.h"
61 #include "ui/base/clipboard/scoped_clipboard_writer.h" 61 #include "ui/base/clipboard/scoped_clipboard_writer.h"
62 #include "ui/base/hit_test.h" 62 #include "ui/base/hit_test.h"
63 #include "ui/base/ime/input_method.h" 63 #include "ui/base/ime/input_method.h"
64 #include "ui/base/ime/input_method_observer.h"
64 #include "ui/base/ui_base_types.h" 65 #include "ui/base/ui_base_types.h"
65 #include "ui/compositor/compositor_vsync_manager.h" 66 #include "ui/compositor/compositor_vsync_manager.h"
66 #include "ui/compositor/dip_util.h" 67 #include "ui/compositor/dip_util.h"
67 #include "ui/events/event.h" 68 #include "ui/events/event.h"
68 #include "ui/events/event_utils.h" 69 #include "ui/events/event_utils.h"
69 #include "ui/events/gestures/gesture_recognizer.h" 70 #include "ui/events/gestures/gesture_recognizer.h"
70 #include "ui/gfx/canvas.h" 71 #include "ui/gfx/canvas.h"
71 #include "ui/gfx/display.h" 72 #include "ui/gfx/display.h"
72 #include "ui/gfx/geometry/rect_conversions.h" 73 #include "ui/gfx/geometry/rect_conversions.h"
73 #include "ui/gfx/geometry/size_conversions.h" 74 #include "ui/gfx/geometry/size_conversions.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 333
333 if (event.type() == ui::ET_GESTURE_BEGIN) { 334 if (event.type() == ui::ET_GESTURE_BEGIN) {
334 const ui::GestureEvent& gesture = 335 const ui::GestureEvent& gesture =
335 static_cast<const ui::GestureEvent&>(event); 336 static_cast<const ui::GestureEvent&>(event);
336 return gesture.details().touch_points() == 1; 337 return gesture.details().touch_points() == 1;
337 } 338 }
338 339
339 return false; 340 return false;
340 } 341 }
341 342
343 class KeyboardBoundsUnchangedListener : public ui::InputMethodObserver {
344 public:
345 KeyboardBoundsUnchangedListener(ui::InputMethod* input_method,
346 RenderWidgetHostImpl* host)
347 : host_(host) {
348 input_method->AddObserver(this);
349 }
350
351 private:
352 ~KeyboardBoundsUnchangedListener() override {}
353
354 // Overridden from ui::InputMethodObserver:
355 void OnTextInputTypeChanged(const ui::TextInputClient* client) override {}
356 void OnFocus() override {}
357 void OnBlur() override {}
358 void OnCaretBoundsChanged(const ui::TextInputClient* client) override {}
359 void OnTextInputStateChanged(const ui::TextInputClient* client) override {}
360 void OnInputMethodDestroyed(const ui::InputMethod* input_method) override {
361 delete this;
362 }
363 void OnShowImeIfNeeded() override {}
364 void OnKeyboardBoundsUnchanged() override {
365 host_->Send(new ViewMsg_FocusChangeComplete(host_->GetRoutingID()));
366 }
367
368 RenderWidgetHostImpl* const host_;
369
370 DISALLOW_COPY_AND_ASSIGN(KeyboardBoundsUnchangedListener);
371 };
372
342 } // namespace 373 } // namespace
343 374
344 // We need to watch for mouse events outside a Web Popup or its parent 375 // We need to watch for mouse events outside a Web Popup or its parent
345 // and dismiss the popup for certain events. 376 // and dismiss the popup for certain events.
346 class RenderWidgetHostViewAura::EventFilterForPopupExit 377 class RenderWidgetHostViewAura::EventFilterForPopupExit
347 : public ui::EventHandler { 378 : public ui::EventHandler {
348 public: 379 public:
349 explicit EventFilterForPopupExit(RenderWidgetHostViewAura* rwhva) 380 explicit EventFilterForPopupExit(RenderWidgetHostViewAura* rwhva)
350 : rwhva_(rwhva) { 381 : rwhva_(rwhva) {
351 DCHECK(rwhva_); 382 DCHECK(rwhva_);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 aura::client::SetTooltipText(window_, &tooltip_); 492 aura::client::SetTooltipText(window_, &tooltip_);
462 aura::client::SetActivationDelegate(window_, this); 493 aura::client::SetActivationDelegate(window_, this);
463 aura::client::SetActivationChangeObserver(window_, this); 494 aura::client::SetActivationChangeObserver(window_, this);
464 aura::client::SetFocusChangeObserver(window_, this); 495 aura::client::SetFocusChangeObserver(window_, this);
465 window_->set_layer_owner_delegate(delegated_frame_host_.get()); 496 window_->set_layer_owner_delegate(delegated_frame_host_.get());
466 gfx::Screen::GetScreenFor(window_)->AddObserver(this); 497 gfx::Screen::GetScreenFor(window_)->AddObserver(this);
467 498
468 bool overscroll_enabled = base::CommandLine::ForCurrentProcess()-> 499 bool overscroll_enabled = base::CommandLine::ForCurrentProcess()->
469 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; 500 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0";
470 SetOverscrollControllerEnabled(overscroll_enabled); 501 SetOverscrollControllerEnabled(overscroll_enabled);
502
503 if (GetInputMethod())
504 new KeyboardBoundsUnchangedListener(GetInputMethod(), host_);
471 } 505 }
472 506
473 //////////////////////////////////////////////////////////////////////////////// 507 ////////////////////////////////////////////////////////////////////////////////
474 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: 508 // RenderWidgetHostViewAura, RenderWidgetHostView implementation:
475 509
476 bool RenderWidgetHostViewAura::OnMessageReceived( 510 bool RenderWidgetHostViewAura::OnMessageReceived(
477 const IPC::Message& message) { 511 const IPC::Message& message) {
478 bool handled = true; 512 bool handled = true;
479 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message) 513 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message)
480 // TODO(kevers): Move to RenderWidgetHostViewImpl and consolidate IPC 514 // TODO(kevers): Move to RenderWidgetHostViewImpl and consolidate IPC
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 } 908 }
875 } 909 }
876 910
877 void RenderWidgetHostViewAura::OnTextInputStateChanged( 911 void RenderWidgetHostViewAura::OnTextInputStateChanged(
878 const ViewHostMsg_TextInputState_Params& params) { 912 const ViewHostMsg_TextInputState_Params& params) {
879 text_input_flags_ = params.flags; 913 text_input_flags_ = params.flags;
880 if (params.show_ime_if_needed && params.type != ui::TEXT_INPUT_TYPE_NONE) { 914 if (params.show_ime_if_needed && params.type != ui::TEXT_INPUT_TYPE_NONE) {
881 if (GetInputMethod()) 915 if (GetInputMethod())
882 GetInputMethod()->ShowImeIfNeeded(); 916 GetInputMethod()->ShowImeIfNeeded();
883 } 917 }
918
919 if (!GetInputMethod() || !GetInputMethod()->SupportsOnScreenKeyboard())
920 host_->Send(new ViewMsg_FocusChangeComplete(host_->GetRoutingID()));
884 } 921 }
885 922
886 void RenderWidgetHostViewAura::ImeCancelComposition() { 923 void RenderWidgetHostViewAura::ImeCancelComposition() {
887 if (GetInputMethod()) 924 if (GetInputMethod())
888 GetInputMethod()->CancelComposition(this); 925 GetInputMethod()->CancelComposition(this);
889 has_composition_text_ = false; 926 has_composition_text_ = false;
890 } 927 }
891 928
892 void RenderWidgetHostViewAura::ImeCompositionRangeChanged( 929 void RenderWidgetHostViewAura::ImeCompositionRangeChanged(
893 const gfx::Range& range, 930 const gfx::Range& range,
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 2687
2651 //////////////////////////////////////////////////////////////////////////////// 2688 ////////////////////////////////////////////////////////////////////////////////
2652 // RenderWidgetHostViewBase, public: 2689 // RenderWidgetHostViewBase, public:
2653 2690
2654 // static 2691 // static
2655 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2692 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2656 GetScreenInfoForWindow(results, NULL); 2693 GetScreenInfoForWindow(results, NULL);
2657 } 2694 }
2658 2695
2659 } // namespace content 2696 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698