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

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

Issue 1249013005: Merge ViewHostMsg_TextInputTypeChanged and ViewHostMsg_TextInputStateChanged into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits. Created 5 years, 4 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/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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 // embedder shutdown or when the embedder navigates to a different page. 559 // embedder shutdown or when the embedder navigates to a different page.
560 // The call stack is roughly: 560 // The call stack is roughly:
561 // BrowserPluginGuest::SetFocus() 561 // BrowserPluginGuest::SetFocus()
562 // content::InterstitialPageImpl::Hide() 562 // content::InterstitialPageImpl::Hide()
563 // content::InterstitialPageImpl::DontProceed(). 563 // content::InterstitialPageImpl::DontProceed().
564 // 564 //
565 // TODO(lazyboy): Write a WebUI test once http://crbug.com/463674 is fixed. 565 // TODO(lazyboy): Write a WebUI test once http://crbug.com/463674 is fixed.
566 return; 566 return;
567 } 567 }
568 568
569 guest_rwhv->TextInputTypeChanged(last_text_input_type_, last_input_mode_, 569 ViewHostMsg_TextInputState_Params params;
570 last_can_compose_inline_, last_input_flags_); 570 params.type = last_text_input_type_;
571 params.mode = last_input_mode_;
572 params.flags = last_input_flags_;
573 params.can_compose_inline = last_can_compose_inline_;
574 guest_rwhv->TextInputStateChanged(params);
571 } 575 }
572 576
573 void BrowserPluginGuest::DidCommitProvisionalLoadForFrame( 577 void BrowserPluginGuest::DidCommitProvisionalLoadForFrame(
574 RenderFrameHost* render_frame_host, 578 RenderFrameHost* render_frame_host,
575 const GURL& url, 579 const GURL& url,
576 ui::PageTransition transition_type) { 580 ui::PageTransition transition_type) {
577 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.DidNavigate")); 581 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.DidNavigate"));
578 } 582 }
579 583
580 void BrowserPluginGuest::RenderViewReady() { 584 void BrowserPluginGuest::RenderViewReady() {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 OnImeCancelComposition) 640 OnImeCancelComposition)
637 #if defined(OS_MACOSX) || defined(USE_AURA) 641 #if defined(OS_MACOSX) || defined(USE_AURA)
638 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged, 642 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged,
639 OnImeCompositionRangeChanged) 643 OnImeCompositionRangeChanged)
640 #endif 644 #endif
641 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, 645 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers,
642 OnHasTouchEventHandlers) 646 OnHasTouchEventHandlers)
643 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse) 647 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse)
644 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) 648 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget)
645 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) 649 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus)
646 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputTypeChanged, 650 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
647 OnTextInputTypeChanged) 651 OnTextInputStateChanged)
648 IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse) 652 IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse)
649 IPC_MESSAGE_UNHANDLED(handled = false) 653 IPC_MESSAGE_UNHANDLED(handled = false)
650 IPC_END_MESSAGE_MAP() 654 IPC_END_MESSAGE_MAP()
651 return handled; 655 return handled;
652 } 656 }
653 657
654 bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message, 658 bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message,
655 RenderFrameHost* render_frame_host) { 659 RenderFrameHost* render_frame_host) {
656 // This will eventually be the home for more IPC handlers that depend on 660 // This will eventually be the home for more IPC handlers that depend on
657 // RenderFrameHost. Until more are moved here, though, the IPC_* macros won't 661 // RenderFrameHost. Until more are moved here, though, the IPC_* macros won't
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 void BrowserPluginGuest::OnShowWidget(int route_id, 956 void BrowserPluginGuest::OnShowWidget(int route_id,
953 const gfx::Rect& initial_rect) { 957 const gfx::Rect& initial_rect) {
954 GetWebContents()->ShowCreatedWidget(route_id, initial_rect); 958 GetWebContents()->ShowCreatedWidget(route_id, initial_rect);
955 } 959 }
956 960
957 void BrowserPluginGuest::OnTakeFocus(bool reverse) { 961 void BrowserPluginGuest::OnTakeFocus(bool reverse) {
958 SendMessageToEmbedder( 962 SendMessageToEmbedder(
959 new BrowserPluginMsg_AdvanceFocus(browser_plugin_instance_id(), reverse)); 963 new BrowserPluginMsg_AdvanceFocus(browser_plugin_instance_id(), reverse));
960 } 964 }
961 965
962 void BrowserPluginGuest::OnTextInputTypeChanged(ui::TextInputType type, 966 void BrowserPluginGuest::OnTextInputStateChanged(
963 ui::TextInputMode input_mode, 967 const ViewHostMsg_TextInputState_Params& params) {
964 bool can_compose_inline,
965 int flags) {
966 // Save the state of text input so we can restore it on focus. 968 // Save the state of text input so we can restore it on focus.
967 last_text_input_type_ = type; 969 last_text_input_type_ = params.type;
968 last_input_mode_ = input_mode; 970 last_input_mode_ = params.mode;
969 last_input_flags_ = flags; 971 last_input_flags_ = params.flags;
970 last_can_compose_inline_ = can_compose_inline; 972 last_can_compose_inline_ = params.can_compose_inline;
971 973
972 SendTextInputTypeChangedToView( 974 SendTextInputTypeChangedToView(
973 static_cast<RenderWidgetHostViewBase*>( 975 static_cast<RenderWidgetHostViewBase*>(
974 web_contents()->GetRenderWidgetHostView())); 976 web_contents()->GetRenderWidgetHostView()));
975 } 977 }
976 978
977 void BrowserPluginGuest::OnImeCancelComposition() { 979 void BrowserPluginGuest::OnImeCancelComposition() {
978 static_cast<RenderWidgetHostViewBase*>( 980 static_cast<RenderWidgetHostViewBase*>(
979 web_contents()->GetRenderWidgetHostView())->ImeCancelComposition(); 981 web_contents()->GetRenderWidgetHostView())->ImeCancelComposition();
980 } 982 }
981 983
982 #if defined(OS_MACOSX) || defined(USE_AURA) 984 #if defined(OS_MACOSX) || defined(USE_AURA)
983 void BrowserPluginGuest::OnImeCompositionRangeChanged( 985 void BrowserPluginGuest::OnImeCompositionRangeChanged(
984 const gfx::Range& range, 986 const gfx::Range& range,
985 const std::vector<gfx::Rect>& character_bounds) { 987 const std::vector<gfx::Rect>& character_bounds) {
986 static_cast<RenderWidgetHostViewBase*>( 988 static_cast<RenderWidgetHostViewBase*>(
987 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( 989 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged(
988 range, character_bounds); 990 range, character_bounds);
989 } 991 }
990 #endif 992 #endif
991 993
992 } // namespace content 994 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698