Commit a34ff62d authored by lazyboy's avatar lazyboy Committed by Commit bot

Update guest's InputMethodActive each time we see a TextInputTypeChanged.

BUG=450641
Test=<TO_BE_FILLED_IN>

Review URL: https://codereview.chromium.org/1052343003

Cr-Commit-Position: refs/heads/master@{#324002}
parent c73b6a46
...@@ -179,10 +179,7 @@ void BrowserPluginGuest::SetFocus(RenderWidgetHost* rwh, ...@@ -179,10 +179,7 @@ void BrowserPluginGuest::SetFocus(RenderWidgetHost* rwh,
// Restore the last seen state of text input to the view. // Restore the last seen state of text input to the view.
RenderWidgetHostViewBase* rwhv = static_cast<RenderWidgetHostViewBase*>( RenderWidgetHostViewBase* rwhv = static_cast<RenderWidgetHostViewBase*>(
rwh->GetView()); rwh->GetView());
if (rwhv) { SendTextInputTypeChangedToView(rwhv);
rwhv->TextInputTypeChanged(last_text_input_type_, last_input_mode_,
last_can_compose_inline_, last_input_flags_);
}
} }
void BrowserPluginGuest::SetTooltipText(const base::string16& tooltip_text) { void BrowserPluginGuest::SetTooltipText(const base::string16& tooltip_text) {
...@@ -494,6 +491,23 @@ void BrowserPluginGuest::SendQueuedMessages() { ...@@ -494,6 +491,23 @@ void BrowserPluginGuest::SendQueuedMessages() {
} }
} }
void BrowserPluginGuest::SendTextInputTypeChangedToView(
RenderWidgetHostViewBase* guest_rwhv) {
if (!guest_rwhv)
return;
guest_rwhv->TextInputTypeChanged(last_text_input_type_, last_input_mode_,
last_can_compose_inline_, last_input_flags_);
// Enable input method for guest if it's enabled for the embedder.
if (!static_cast<RenderViewHostImpl*>(
owner_web_contents_->GetRenderViewHost())->input_method_active()) {
return;
}
RenderViewHostImpl* guest_rvh =
static_cast<RenderViewHostImpl*>(GetWebContents()->GetRenderViewHost());
guest_rvh->SetInputMethodActive(true);
}
void BrowserPluginGuest::DidCommitProvisionalLoadForFrame( void BrowserPluginGuest::DidCommitProvisionalLoadForFrame(
RenderFrameHost* render_frame_host, RenderFrameHost* render_frame_host,
const GURL& url, const GURL& url,
...@@ -888,9 +902,9 @@ void BrowserPluginGuest::OnTextInputTypeChanged(ui::TextInputType type, ...@@ -888,9 +902,9 @@ void BrowserPluginGuest::OnTextInputTypeChanged(ui::TextInputType type,
last_input_flags_ = flags; last_input_flags_ = flags;
last_can_compose_inline_ = can_compose_inline; last_can_compose_inline_ = can_compose_inline;
static_cast<RenderWidgetHostViewBase*>( SendTextInputTypeChangedToView(
web_contents()->GetRenderWidgetHostView())->TextInputTypeChanged( static_cast<RenderWidgetHostViewBase*>(
type, input_mode, can_compose_inline, flags); web_contents()->GetRenderWidgetHostView()));
} }
void BrowserPluginGuest::OnImeCancelComposition() { void BrowserPluginGuest::OnImeCancelComposition() {
......
...@@ -63,6 +63,7 @@ class BrowserPluginGuestManager; ...@@ -63,6 +63,7 @@ class BrowserPluginGuestManager;
class RenderViewHostImpl; class RenderViewHostImpl;
class RenderWidgetHost; class RenderWidgetHost;
class RenderWidgetHostView; class RenderWidgetHostView;
class RenderWidgetHostViewBase;
class SiteInstance; class SiteInstance;
struct DropData; struct DropData;
...@@ -341,6 +342,8 @@ class CONTENT_EXPORT BrowserPluginGuest : public GuestHost, ...@@ -341,6 +342,8 @@ class CONTENT_EXPORT BrowserPluginGuest : public GuestHost,
// Forwards all messages from the |pending_messages_| queue to the embedder. // Forwards all messages from the |pending_messages_| queue to the embedder.
void SendQueuedMessages(); void SendQueuedMessages();
void SendTextInputTypeChangedToView(RenderWidgetHostViewBase* guest_rwhv);
// The last tooltip that was set with SetTooltipText(). // The last tooltip that was set with SetTooltipText().
base::string16 current_tooltip_text_; base::string16 current_tooltip_text_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment