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

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

Issue 7977017: Never submit: tentative Pepper IME. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
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 4251 matching lines...) Expand 10 before | Expand all | Expand 10 after
4262 4262
4263 void RenderView::RequestRemoteAccessClientFirewallTraversal() { 4263 void RenderView::RequestRemoteAccessClientFirewallTraversal() {
4264 Send(new ViewHostMsg_RequestRemoteAccessClientFirewallTraversal(routing_id_)); 4264 Send(new ViewHostMsg_RequestRemoteAccessClientFirewallTraversal(routing_id_));
4265 } 4265 }
4266 4266
4267 void RenderView::OnImeSetComposition( 4267 void RenderView::OnImeSetComposition(
4268 const string16& text, 4268 const string16& text,
4269 const std::vector<WebKit::WebCompositionUnderline>& underlines, 4269 const std::vector<WebKit::WebCompositionUnderline>& underlines,
4270 int selection_start, 4270 int selection_start,
4271 int selection_end) { 4271 int selection_end) {
4272 // Until PPAPI has an interface for handling IME events, we skip sending 4272 if (pepper_delegate_.IsPluginFocused()) {
4273 // OnImeSetComposition. Otherwise the composition is canceled when a 4273 pepper_delegate_.OnImeSetComposition(text,
4274 // non-editable DOM element is focused. 4274 underlines,
4275 // 4275 selection_start,
4276 // TODO(kinaba) This temporal remedy can be removed after PPAPI is extended 4276 selection_end);
4277 // with an IME handling interface. 4277 } else {
4278 if (!pepper_delegate_.IsPluginFocused()) {
4279 RenderWidget::OnImeSetComposition(text, 4278 RenderWidget::OnImeSetComposition(text,
4280 underlines, 4279 underlines,
4281 selection_start, 4280 selection_start,
4282 selection_end); 4281 selection_end);
4283 } 4282 }
4284 } 4283 }
4285 4284
4286 void RenderView::OnImeConfirmComposition(const string16& text) { 4285 void RenderView::OnImeConfirmComposition(const string16& text) {
4287 if (pepper_delegate_.IsPluginFocused()) { 4286 if (pepper_delegate_.IsPluginFocused()) {
4288 // TODO(kinaba) Until PPAPI has an interface for handling IME events, we 4287 pepper_delegate_.OnImeConfirmComposition(text);
4289 // send character events.
4290 for (size_t i = 0; i < text.size(); ++i) {
4291 WebKit::WebKeyboardEvent char_event;
4292 char_event.type = WebKit::WebInputEvent::Char;
4293 char_event.timeStampSeconds = base::Time::Now().ToDoubleT();
4294 char_event.modifiers = 0;
4295 char_event.windowsKeyCode = text[i];
4296 char_event.nativeKeyCode = text[i];
4297 char_event.text[0] = text[i];
4298 char_event.unmodifiedText[0] = text[i];
4299 if (webwidget_)
4300 webwidget_->handleInputEvent(char_event);
4301 }
4302 } else { 4288 } else {
4303 RenderWidget::OnImeConfirmComposition(text); 4289 RenderWidget::OnImeConfirmComposition(text);
4304 } 4290 }
James Su 2011/09/23 01:46:48 nit: no {}
4305 } 4291 }
4306 4292
4307 ui::TextInputType RenderView::GetTextInputType() { 4293 WebKit::WebTextInputType RenderView::GetTextInputType() {
4308 if (pepper_delegate_.IsPluginFocused()) { 4294 if (pepper_delegate_.IsPluginFocused()) {
4309 #if !defined(TOUCH_UI) 4295 #if !defined(TOUCH_UI)
4310 // TODO(kinaba) Until PPAPI has an interface for handling IME events, we 4296 return pepper_delegate_.GetTextInputType();
4311 // consider all the parts of PPAPI plugins are accepting text inputs.
4312 return ui::TEXT_INPUT_TYPE_TEXT;
4313 #else 4297 #else
4314 // Disable keyboard input in flash for touch ui until PPAPI can support IME 4298 // Disable keyboard input in flash for touch ui until PPAPI can support IME
4315 // events. 4299 // events.
4316 return ui::TEXT_INPUT_TYPE_NONE; 4300 // TODO(kinaba): remove after IME-aware PPAPI flash is ready.
4301 return WebKit::WebTextInputTypeNone;
4317 #endif 4302 #endif
4318 } 4303 }
4319 return RenderWidget::GetTextInputType(); 4304 return RenderWidget::GetTextInputType();
4320 } 4305 }
4321 4306
4307 WebKit::WebRect RenderView::GetCaretBounds() {
4308 if (pepper_delegate_.IsPluginFocused())
4309 return pepper_delegate_.GetCaretBounds();
4310 return RenderWidget::GetCaretBounds();
James Su 2011/09/23 01:46:48 nit: return ... ? ... : ... ;
4311 }
4312
4322 bool RenderView::CanComposeInline() { 4313 bool RenderView::CanComposeInline() {
4323 if (pepper_delegate_.IsPluginFocused()) { 4314 if (pepper_delegate_.IsPluginFocused())
4324 // TODO(kinaba) Until PPAPI has an interface for handling IME events, there 4315 return pepper_delegate_.CanComposeInline();
James Su 2011/09/23 01:46:48 ditto.
4325 // is no way for the browser to know whether the plugin is capable of
4326 // drawing composition text. We assume plugins are incapable and let the
4327 // browser handle composition display for now.
4328 return false;
4329 }
4330 return true; 4316 return true;
4331 } 4317 }
4332 4318
4333 #if defined(OS_MACOSX) 4319 #if defined(OS_MACOSX)
4334 void RenderView::PluginFocusChanged(bool focused, int plugin_id) { 4320 void RenderView::PluginFocusChanged(bool focused, int plugin_id) {
4335 IPC::Message* msg = new ViewHostMsg_PluginFocusChanged(routing_id(), 4321 IPC::Message* msg = new ViewHostMsg_PluginFocusChanged(routing_id(),
4336 focused, plugin_id); 4322 focused, plugin_id);
4337 Send(msg); 4323 Send(msg);
4338 } 4324 }
4339 4325
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
4627 } 4613 }
4628 4614
4629 void RenderView::OnEnableViewSourceMode() { 4615 void RenderView::OnEnableViewSourceMode() {
4630 if (!webview()) 4616 if (!webview())
4631 return; 4617 return;
4632 WebFrame* main_frame = webview()->mainFrame(); 4618 WebFrame* main_frame = webview()->mainFrame();
4633 if (!main_frame) 4619 if (!main_frame)
4634 return; 4620 return;
4635 main_frame->enableViewSourceMode(true); 4621 main_frame->enableViewSourceMode(true);
4636 } 4622 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698