Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/renderer/browser_plugin/browser_plugin.h" | 5 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 #include "third_party/WebKit/public/web/WebBindings.h" | 30 #include "third_party/WebKit/public/web/WebBindings.h" |
| 31 #include "third_party/WebKit/public/web/WebDOMCustomEvent.h" | 31 #include "third_party/WebKit/public/web/WebDOMCustomEvent.h" |
| 32 #include "third_party/WebKit/public/web/WebDocument.h" | 32 #include "third_party/WebKit/public/web/WebDocument.h" |
| 33 #include "third_party/WebKit/public/web/WebElement.h" | 33 #include "third_party/WebKit/public/web/WebElement.h" |
| 34 #include "third_party/WebKit/public/web/WebFrame.h" | 34 #include "third_party/WebKit/public/web/WebFrame.h" |
| 35 #include "third_party/WebKit/public/web/WebInputEvent.h" | 35 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 36 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 36 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 37 #include "third_party/WebKit/public/web/WebPluginParams.h" | 37 #include "third_party/WebKit/public/web/WebPluginParams.h" |
| 38 #include "third_party/WebKit/public/web/WebScriptSource.h" | 38 #include "third_party/WebKit/public/web/WebScriptSource.h" |
| 39 #include "third_party/WebKit/public/web/WebView.h" | 39 #include "third_party/WebKit/public/web/WebView.h" |
| 40 #include "third_party/WebKit/public/web/WebWidget.h" | |
| 40 #include "ui/events/keycodes/keyboard_codes.h" | 41 #include "ui/events/keycodes/keyboard_codes.h" |
| 41 | 42 |
| 42 #if defined (OS_WIN) | 43 #if defined (OS_WIN) |
| 43 #include "base/sys_info.h" | 44 #include "base/sys_info.h" |
| 44 #endif | 45 #endif |
| 45 | 46 |
| 46 using blink::WebCanvas; | 47 using blink::WebCanvas; |
| 47 using blink::WebPluginContainer; | 48 using blink::WebPluginContainer; |
| 48 using blink::WebPluginParams; | 49 using blink::WebPluginParams; |
| 49 using blink::WebPoint; | 50 using blink::WebPoint; |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 958 } | 959 } |
| 959 | 960 |
| 960 bool BrowserPlugin::supportsKeyboardFocus() const { | 961 bool BrowserPlugin::supportsKeyboardFocus() const { |
| 961 return true; | 962 return true; |
| 962 } | 963 } |
| 963 | 964 |
| 964 bool BrowserPlugin::supportsEditCommands() const { | 965 bool BrowserPlugin::supportsEditCommands() const { |
| 965 return true; | 966 return true; |
| 966 } | 967 } |
| 967 | 968 |
| 969 bool BrowserPlugin::supportsInputMethod() const { | |
| 970 return true; | |
| 971 } | |
| 972 | |
| 968 bool BrowserPlugin::canProcessDrag() const { | 973 bool BrowserPlugin::canProcessDrag() const { |
| 969 return true; | 974 return true; |
| 970 } | 975 } |
| 971 | 976 |
| 972 void BrowserPlugin::paint(WebCanvas* canvas, const WebRect& rect) { | 977 void BrowserPlugin::paint(WebCanvas* canvas, const WebRect& rect) { |
| 973 if (guest_crashed_) { | 978 if (guest_crashed_) { |
| 974 if (!sad_guest_) // Lazily initialize bitmap. | 979 if (!sad_guest_) // Lazily initialize bitmap. |
| 975 sad_guest_ = content::GetContentClient()->renderer()-> | 980 sad_guest_ = content::GetContentClient()->renderer()-> |
| 976 GetSadWebViewBitmap(); | 981 GetSadWebViewBitmap(); |
| 977 // content_shell does not have the sad plugin bitmap, so we'll paint black | 982 // content_shell does not have the sad plugin bitmap, so we'll paint black |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1310 return true; | 1315 return true; |
| 1311 } | 1316 } |
| 1312 | 1317 |
| 1313 bool BrowserPlugin::executeEditCommand(const blink::WebString& name, | 1318 bool BrowserPlugin::executeEditCommand(const blink::WebString& name, |
| 1314 const blink::WebString& value) { | 1319 const blink::WebString& value) { |
| 1315 edit_commands_.push_back(EditCommand(name.utf8(), value.utf8())); | 1320 edit_commands_.push_back(EditCommand(name.utf8(), value.utf8())); |
| 1316 // BrowserPlugin swallows edit commands. | 1321 // BrowserPlugin swallows edit commands. |
| 1317 return true; | 1322 return true; |
| 1318 } | 1323 } |
| 1319 | 1324 |
| 1325 bool BrowserPlugin::setComposition( | |
| 1326 const blink::WebString& text, | |
| 1327 const blink::WebVector<blink::WebCompositionUnderline>& underlines, | |
| 1328 int selectionStart, | |
| 1329 int selectionEnd) { | |
|
Fady Samuel
2013/12/10 17:55:32
if (!HasGuestInstanceID())
return false;
kochi
2013/12/11 01:35:21
Done.
Thanks for pointing out.
| |
| 1330 std::vector<blink::WebCompositionUnderline> std_underlines; | |
| 1331 for (size_t i = 0; i < underlines.size(); ++i) { | |
| 1332 std_underlines.push_back(underlines[i]); | |
| 1333 } | |
| 1334 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ImeSetComposition( | |
| 1335 render_view_routing_id_, | |
| 1336 guest_instance_id_, | |
| 1337 text.utf8(), | |
| 1338 std_underlines, | |
| 1339 selectionStart, | |
| 1340 selectionEnd)); | |
| 1341 // TODO(kochi): This assumes the IPC handling always succeeds. | |
| 1342 return true; | |
| 1343 } | |
| 1344 | |
| 1345 bool BrowserPlugin::confirmComposition( | |
| 1346 const blink::WebString& text, | |
| 1347 blink::WebWidget::ConfirmCompositionBehavior selectionBehavior) { | |
|
Fady Samuel
2013/12/10 17:55:32
if (!HasGuestInstanceID())
return false;
kochi
2013/12/11 01:35:21
Done.
| |
| 1348 bool keep_selection = (selectionBehavior == blink::WebWidget::KeepSelection); | |
| 1349 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ImeConfirmComposition( | |
| 1350 render_view_routing_id_, | |
| 1351 guest_instance_id_, | |
| 1352 text.utf8(), | |
| 1353 keep_selection)); | |
| 1354 // TODO(kochi): This assumes the IPC handling always succeeds. | |
| 1355 return true; | |
| 1356 } | |
| 1357 | |
| 1320 void BrowserPlugin::OnLockMouseACK(bool succeeded) { | 1358 void BrowserPlugin::OnLockMouseACK(bool succeeded) { |
| 1321 mouse_locked_ = succeeded; | 1359 mouse_locked_ = succeeded; |
| 1322 browser_plugin_manager()->Send(new BrowserPluginHostMsg_LockMouse_ACK( | 1360 browser_plugin_manager()->Send(new BrowserPluginHostMsg_LockMouse_ACK( |
| 1323 render_view_routing_id_, | 1361 render_view_routing_id_, |
| 1324 guest_instance_id_, | 1362 guest_instance_id_, |
| 1325 succeeded)); | 1363 succeeded)); |
| 1326 } | 1364 } |
| 1327 | 1365 |
| 1328 void BrowserPlugin::OnMouseLockLost() { | 1366 void BrowserPlugin::OnMouseLockLost() { |
| 1329 mouse_locked_ = false; | 1367 mouse_locked_ = false; |
| 1330 browser_plugin_manager()->Send(new BrowserPluginHostMsg_UnlockMouse_ACK( | 1368 browser_plugin_manager()->Send(new BrowserPluginHostMsg_UnlockMouse_ACK( |
| 1331 render_view_routing_id_, | 1369 render_view_routing_id_, |
| 1332 guest_instance_id_)); | 1370 guest_instance_id_)); |
| 1333 } | 1371 } |
| 1334 | 1372 |
| 1335 bool BrowserPlugin::HandleMouseLockedInputEvent( | 1373 bool BrowserPlugin::HandleMouseLockedInputEvent( |
| 1336 const blink::WebMouseEvent& event) { | 1374 const blink::WebMouseEvent& event) { |
| 1337 browser_plugin_manager()->Send( | 1375 browser_plugin_manager()->Send( |
| 1338 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, | 1376 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, |
| 1339 guest_instance_id_, | 1377 guest_instance_id_, |
| 1340 plugin_rect_, | 1378 plugin_rect_, |
| 1341 &event)); | 1379 &event)); |
| 1342 return true; | 1380 return true; |
| 1343 } | 1381 } |
| 1344 | 1382 |
| 1345 } // namespace content | 1383 } // namespace content |
| OLD | NEW |