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

Side by Side Diff: content/renderer/render_view.cc

Issue 6990072: The first step for enabling off-the-spot IME on Pepper on ChromeOS/Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed a silly mistake lacking an initialization. Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view.h ('k') | content/renderer/render_widget.h » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer/render_view.h" 5 #include "content/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams. h" 82 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams. h"
83 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback s.h" 83 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback s.h"
84 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" 84 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h"
85 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement .h" 85 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement .h"
86 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" 86 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h"
87 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 87 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
88 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D. h" 88 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D. h"
89 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" 89 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h"
90 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" 90 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h"
91 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" 91 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
92 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
92 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction. h" 93 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction. h"
93 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNetworkStateNotifi er.h" 94 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNetworkStateNotifi er.h"
94 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h" 95 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h"
95 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" 96 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h"
96 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" 97 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
97 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginDocument.h" 98 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginDocument.h"
98 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" 99 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h"
99 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" 100 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h"
100 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" 101 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h"
101 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" 102 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h"
(...skipping 3827 matching lines...) Expand 10 before | Expand all | Expand 10 after
3929 (*plugin_it)->SetWindowFocus(true); 3930 (*plugin_it)->SetWindowFocus(true);
3930 #endif 3931 #endif
3931 (*plugin_it)->SetContentAreaFocus(enable); 3932 (*plugin_it)->SetContentAreaFocus(enable);
3932 } 3933 }
3933 3934
3934 // Notify all Pepper plugins. 3935 // Notify all Pepper plugins.
3935 pepper_delegate_.OnSetFocus(enable); 3936 pepper_delegate_.OnSetFocus(enable);
3936 } 3937 }
3937 } 3938 }
3938 3939
3940 void RenderView::PpapiPluginFocusChanged() {
3941 UpdateInputMethod();
3942 }
3943
3944 void RenderView::OnImeSetComposition(
3945 const string16& text,
3946 const std::vector<WebKit::WebCompositionUnderline>& underlines,
3947 int selection_start,
3948 int selection_end) {
3949 // Until PPAPI has an interface for handling IME events, we skip sending
3950 // OnImeSetComposition. Otherwise the composition is canceled when a
3951 // non-editable DOM element is focused.
3952 //
3953 // TODO(kinaba) This temporal remedy can be removed after PPAPI is extended
3954 // with an IME handling interface.
3955 if (!pepper_delegate_.IsPluginFocused()) {
3956 RenderWidget::OnImeSetComposition(text,
3957 underlines,
3958 selection_start,
3959 selection_end);
3960 }
3961 }
3962
3963 void RenderView::OnImeConfirmComposition(const string16& text) {
3964 if (pepper_delegate_.IsPluginFocused()) {
3965 // TODO(kinaba) Until PPAPI has an interface for handling IME events, we
3966 // send character events.
3967 for (size_t i = 0; i < text.size(); ++i) {
3968 WebKit::WebKeyboardEvent char_event;
3969 char_event.type = WebKit::WebInputEvent::Char;
3970 char_event.timeStampSeconds = base::Time::Now().ToDoubleT();
3971 char_event.modifiers = 0;
3972 char_event.windowsKeyCode = text[i];
3973 char_event.nativeKeyCode = text[i];
3974 char_event.text[0] = text[i];
3975 char_event.unmodifiedText[0] = text[i];
3976 if (webwidget_)
3977 webwidget_->handleInputEvent(char_event);
3978 }
3979 } else {
3980 RenderWidget::OnImeConfirmComposition(text);
3981 }
3982 }
3983
3984 WebKit::WebTextInputType RenderView::GetTextInputType() {
3985 if (pepper_delegate_.IsPluginFocused()) {
3986 // TODO(kinaba) Until PPAPI has an interface for handling IME events, we
3987 // consider all the parts of PPAPI plugins are accepting text inputs.
3988 return WebKit::WebTextInputTypeText;
3989 } else {
3990 return RenderWidget::GetTextInputType();
3991 }
3992 }
3993
3939 #if defined(OS_MACOSX) 3994 #if defined(OS_MACOSX)
3940 void RenderView::PluginFocusChanged(bool focused, int plugin_id) { 3995 void RenderView::PluginFocusChanged(bool focused, int plugin_id) {
3941 IPC::Message* msg = new ViewHostMsg_PluginFocusChanged(routing_id(), 3996 IPC::Message* msg = new ViewHostMsg_PluginFocusChanged(routing_id(),
3942 focused, plugin_id); 3997 focused, plugin_id);
3943 Send(msg); 3998 Send(msg);
3944 } 3999 }
3945 4000
3946 void RenderView::StartPluginIme() { 4001 void RenderView::StartPluginIme() {
3947 IPC::Message* msg = new ViewHostMsg_StartPluginIme(routing_id()); 4002 IPC::Message* msg = new ViewHostMsg_StartPluginIme(routing_id());
3948 // This message can be sent during event-handling, and needs to be delivered 4003 // This message can be sent during event-handling, and needs to be delivered
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
4179 const webkit_glue::CustomContextMenuContext& custom_context) { 4234 const webkit_glue::CustomContextMenuContext& custom_context) {
4180 if (custom_context.is_pepper_menu) 4235 if (custom_context.is_pepper_menu)
4181 pepper_delegate_.OnContextMenuClosed(custom_context); 4236 pepper_delegate_.OnContextMenuClosed(custom_context);
4182 else 4237 else
4183 context_menu_node_.reset(); 4238 context_menu_node_.reset();
4184 } 4239 }
4185 4240
4186 void RenderView::OnNetworkStateChanged(bool online) { 4241 void RenderView::OnNetworkStateChanged(bool online) {
4187 WebNetworkStateNotifier::setOnLine(online); 4242 WebNetworkStateNotifier::setOnLine(online);
4188 } 4243 }
OLDNEW
« no previous file with comments | « content/renderer/render_view.h ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698