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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 1332753002: BrowserPluginGuest should carry the correct text input states when notifying the text input type cha (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/browser_plugin/browser_plugin_guest.h" 5 #include "content/browser/browser_plugin/browser_plugin_guest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 browser_plugin_instance_id_(browser_plugin::kInstanceIDNone), 85 browser_plugin_instance_id_(browser_plugin::kInstanceIDNone),
86 focused_(false), 86 focused_(false),
87 mouse_locked_(false), 87 mouse_locked_(false),
88 pending_lock_request_(false), 88 pending_lock_request_(false),
89 guest_visible_(false), 89 guest_visible_(false),
90 embedder_visible_(true), 90 embedder_visible_(true),
91 is_full_page_plugin_(false), 91 is_full_page_plugin_(false),
92 has_render_view_(has_render_view), 92 has_render_view_(has_render_view),
93 is_in_destruction_(false), 93 is_in_destruction_(false),
94 initialized_(false), 94 initialized_(false),
95 last_text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
96 last_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT),
97 last_input_flags_(0),
98 last_can_compose_inline_(true),
99 guest_proxy_routing_id_(MSG_ROUTING_NONE), 95 guest_proxy_routing_id_(MSG_ROUTING_NONE),
100 last_drag_status_(blink::WebDragStatusUnknown), 96 last_drag_status_(blink::WebDragStatusUnknown),
101 seen_embedder_system_drag_ended_(false), 97 seen_embedder_system_drag_ended_(false),
102 seen_embedder_drag_source_ended_at_(false), 98 seen_embedder_drag_source_ended_at_(false),
103 delegate_(delegate), 99 delegate_(delegate),
104 weak_ptr_factory_(this) { 100 weak_ptr_factory_(this) {
105 DCHECK(web_contents); 101 DCHECK(web_contents);
106 DCHECK(delegate); 102 DCHECK(delegate);
107 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Create")); 103 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Create"));
108 web_contents->SetBrowserPluginGuest(this); 104 web_contents->SetBrowserPluginGuest(this);
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 // embedder shutdown or when the embedder navigates to a different page. 563 // embedder shutdown or when the embedder navigates to a different page.
568 // The call stack is roughly: 564 // The call stack is roughly:
569 // BrowserPluginGuest::SetFocus() 565 // BrowserPluginGuest::SetFocus()
570 // content::InterstitialPageImpl::Hide() 566 // content::InterstitialPageImpl::Hide()
571 // content::InterstitialPageImpl::DontProceed(). 567 // content::InterstitialPageImpl::DontProceed().
572 // 568 //
573 // TODO(lazyboy): Write a WebUI test once http://crbug.com/463674 is fixed. 569 // TODO(lazyboy): Write a WebUI test once http://crbug.com/463674 is fixed.
574 return; 570 return;
575 } 571 }
576 572
577 ViewHostMsg_TextInputState_Params params; 573 if (last_text_input_state_.get())
578 params.type = last_text_input_type_; 574 guest_rwhv->TextInputStateChanged(*last_text_input_state_);
579 params.mode = last_input_mode_;
580 params.flags = last_input_flags_;
581 params.can_compose_inline = last_can_compose_inline_;
582 guest_rwhv->TextInputStateChanged(params);
583 } 575 }
584 576
585 void BrowserPluginGuest::DidCommitProvisionalLoadForFrame( 577 void BrowserPluginGuest::DidCommitProvisionalLoadForFrame(
586 RenderFrameHost* render_frame_host, 578 RenderFrameHost* render_frame_host,
587 const GURL& url, 579 const GURL& url,
588 ui::PageTransition transition_type) { 580 ui::PageTransition transition_type) {
589 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.DidNavigate")); 581 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.DidNavigate"));
590 } 582 }
591 583
592 void BrowserPluginGuest::RenderViewReady() { 584 void BrowserPluginGuest::RenderViewReady() {
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 } 961 }
970 962
971 void BrowserPluginGuest::OnTakeFocus(bool reverse) { 963 void BrowserPluginGuest::OnTakeFocus(bool reverse) {
972 SendMessageToEmbedder( 964 SendMessageToEmbedder(
973 new BrowserPluginMsg_AdvanceFocus(browser_plugin_instance_id(), reverse)); 965 new BrowserPluginMsg_AdvanceFocus(browser_plugin_instance_id(), reverse));
974 } 966 }
975 967
976 void BrowserPluginGuest::OnTextInputStateChanged( 968 void BrowserPluginGuest::OnTextInputStateChanged(
977 const ViewHostMsg_TextInputState_Params& params) { 969 const ViewHostMsg_TextInputState_Params& params) {
978 // Save the state of text input so we can restore it on focus. 970 // Save the state of text input so we can restore it on focus.
979 last_text_input_type_ = params.type; 971 last_text_input_state_.reset(new ViewHostMsg_TextInputState_Params(params));
980 last_input_mode_ = params.mode;
981 last_input_flags_ = params.flags;
982 last_can_compose_inline_ = params.can_compose_inline;
983 972
984 SendTextInputTypeChangedToView( 973 SendTextInputTypeChangedToView(
985 static_cast<RenderWidgetHostViewBase*>( 974 static_cast<RenderWidgetHostViewBase*>(
986 web_contents()->GetRenderWidgetHostView())); 975 web_contents()->GetRenderWidgetHostView()));
987 } 976 }
988 977
989 void BrowserPluginGuest::OnImeCancelComposition() { 978 void BrowserPluginGuest::OnImeCancelComposition() {
990 static_cast<RenderWidgetHostViewBase*>( 979 static_cast<RenderWidgetHostViewBase*>(
991 web_contents()->GetRenderWidgetHostView())->ImeCancelComposition(); 980 web_contents()->GetRenderWidgetHostView())->ImeCancelComposition();
992 } 981 }
993 982
994 #if defined(OS_MACOSX) || defined(USE_AURA) 983 #if defined(OS_MACOSX) || defined(USE_AURA)
995 void BrowserPluginGuest::OnImeCompositionRangeChanged( 984 void BrowserPluginGuest::OnImeCompositionRangeChanged(
996 const gfx::Range& range, 985 const gfx::Range& range,
997 const std::vector<gfx::Rect>& character_bounds) { 986 const std::vector<gfx::Rect>& character_bounds) {
998 static_cast<RenderWidgetHostViewBase*>( 987 static_cast<RenderWidgetHostViewBase*>(
999 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( 988 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged(
1000 range, character_bounds); 989 range, character_bounds);
1001 } 990 }
1002 #endif 991 #endif
1003 992
1004 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { 993 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) {
1005 if (delegate_) 994 if (delegate_)
1006 delegate_->SetContextMenuPosition(position); 995 delegate_->SetContextMenuPosition(position);
1007 } 996 }
1008 997
1009 } // namespace content 998 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698