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

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

Issue 15149006: <webview>: Plumb edit commands (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 7 years, 7 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) 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/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.h" 9 #include "base/message_loop.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 NPObject* browser_plugin_np_object(bindings_->np_object()); 1199 NPObject* browser_plugin_np_object(bindings_->np_object());
1200 // The object is expected to be retained before it is returned. 1200 // The object is expected to be retained before it is returned.
1201 WebKit::WebBindings::retainObject(browser_plugin_np_object); 1201 WebKit::WebBindings::retainObject(browser_plugin_np_object);
1202 return browser_plugin_np_object; 1202 return browser_plugin_np_object;
1203 } 1203 }
1204 1204
1205 bool BrowserPlugin::supportsKeyboardFocus() const { 1205 bool BrowserPlugin::supportsKeyboardFocus() const {
1206 return true; 1206 return true;
1207 } 1207 }
1208 1208
1209 bool BrowserPlugin::supportsEditCommands() const {
1210 return true;
1211 }
1212
1209 bool BrowserPlugin::canProcessDrag() const { 1213 bool BrowserPlugin::canProcessDrag() const {
1210 return true; 1214 return true;
1211 } 1215 }
1212 1216
1213 void BrowserPlugin::paint(WebCanvas* canvas, const WebRect& rect) { 1217 void BrowserPlugin::paint(WebCanvas* canvas, const WebRect& rect) {
1214 if (guest_crashed_) { 1218 if (guest_crashed_) {
1215 if (!sad_guest_) // Lazily initialize bitmap. 1219 if (!sad_guest_) // Lazily initialize bitmap.
1216 sad_guest_ = content::GetContentClient()->renderer()-> 1220 sad_guest_ = content::GetContentClient()->renderer()->
1217 GetSadWebViewBitmap(); 1221 GetSadWebViewBitmap();
1218 // content_shell does not have the sad plugin bitmap, so we'll paint black 1222 // content_shell does not have the sad plugin bitmap, so we'll paint black
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 touch_event.reset(new WebKit::WebTouchEvent()); 1479 touch_event.reset(new WebKit::WebTouchEvent());
1476 memcpy(touch_event.get(), orig_touch_event, sizeof(WebKit::WebTouchEvent)); 1480 memcpy(touch_event.get(), orig_touch_event, sizeof(WebKit::WebTouchEvent));
1477 if (touch_event->changedTouchesLength > 0) { 1481 if (touch_event->changedTouchesLength > 0) {
1478 memcpy(&touch_event->touches[touch_event->touchesLength], 1482 memcpy(&touch_event->touches[touch_event->touchesLength],
1479 &touch_event->changedTouches, 1483 &touch_event->changedTouches,
1480 touch_event->changedTouchesLength * sizeof(WebKit::WebTouchPoint)); 1484 touch_event->changedTouchesLength * sizeof(WebKit::WebTouchPoint));
1481 } 1485 }
1482 touch_event->touchesLength += touch_event->changedTouchesLength; 1486 touch_event->touchesLength += touch_event->changedTouchesLength;
1483 modified_event = touch_event.get(); 1487 modified_event = touch_event.get();
1484 } 1488 }
1489
1490 if (WebKit::WebInputEvent::isKeyboardEventType(event.type) &&
1491 !edit_commands_.empty()) {
1492 browser_plugin_manager()->Send(
1493 new BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent(
1494 render_view_routing_id_,
1495 instance_id_,
1496 edit_commands_));
1497 edit_commands_.clear();
1498 }
1499
1485 browser_plugin_manager()->Send( 1500 browser_plugin_manager()->Send(
1486 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, 1501 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
1487 instance_id_, 1502 instance_id_,
1488 plugin_rect_, 1503 plugin_rect_,
1489 modified_event)); 1504 modified_event));
1490 cursor_.GetCursorInfo(&cursor_info); 1505 cursor_.GetCursorInfo(&cursor_info);
1491 return true; 1506 return true;
1492 } 1507 }
1493 1508
1494 bool BrowserPlugin::handleDragStatusUpdate(WebKit::WebDragStatus drag_status, 1509 bool BrowserPlugin::handleDragStatusUpdate(WebKit::WebDragStatus drag_status,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 bool BrowserPlugin::executeEditCommand(const WebKit::WebString& name) { 1550 bool BrowserPlugin::executeEditCommand(const WebKit::WebString& name) {
1536 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ExecuteEditCommand( 1551 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ExecuteEditCommand(
1537 render_view_routing_id_, 1552 render_view_routing_id_,
1538 instance_id_, 1553 instance_id_,
1539 name.utf8())); 1554 name.utf8()));
1540 1555
1541 // BrowserPlugin swallows edit commands. 1556 // BrowserPlugin swallows edit commands.
1542 return true; 1557 return true;
1543 } 1558 }
1544 1559
1560 bool BrowserPlugin::executeEditCommand(const WebKit::WebString& name,
1561 const WebKit::WebString& value) {
1562 edit_commands_.push_back(EditCommand(name.utf8(), value.utf8()));
1563 // BrowserPlugin swallows edit commands.
1564 return true;
1565 }
1566
1545 void BrowserPlugin::OnLockMouseACK(bool succeeded) { 1567 void BrowserPlugin::OnLockMouseACK(bool succeeded) {
1546 browser_plugin_manager()->Send(new BrowserPluginHostMsg_LockMouse_ACK( 1568 browser_plugin_manager()->Send(new BrowserPluginHostMsg_LockMouse_ACK(
1547 render_view_routing_id_, 1569 render_view_routing_id_,
1548 instance_id_, 1570 instance_id_,
1549 succeeded)); 1571 succeeded));
1550 } 1572 }
1551 1573
1552 void BrowserPlugin::OnMouseLockLost() { 1574 void BrowserPlugin::OnMouseLockLost() {
1553 browser_plugin_manager()->Send(new BrowserPluginHostMsg_UnlockMouse_ACK( 1575 browser_plugin_manager()->Send(new BrowserPluginHostMsg_UnlockMouse_ACK(
1554 render_view_routing_id_, 1576 render_view_routing_id_,
1555 instance_id_)); 1577 instance_id_));
1556 } 1578 }
1557 1579
1558 bool BrowserPlugin::HandleMouseLockedInputEvent( 1580 bool BrowserPlugin::HandleMouseLockedInputEvent(
1559 const WebKit::WebMouseEvent& event) { 1581 const WebKit::WebMouseEvent& event) {
1560 browser_plugin_manager()->Send( 1582 browser_plugin_manager()->Send(
1561 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, 1583 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
1562 instance_id_, 1584 instance_id_,
1563 plugin_rect_, 1585 plugin_rect_,
1564 &event)); 1586 &event));
1565 return true; 1587 return true;
1566 } 1588 }
1567 1589
1568 } // namespace content 1590 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698