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

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: Removed fprintf Created 7 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/browser_plugin/browser_plugin.h ('k') | content/renderer/render_view_impl.cc » ('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) 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 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 } 1235 }
1236 1236
1237 NPP BrowserPlugin::pluginNPP() { 1237 NPP BrowserPlugin::pluginNPP() {
1238 return npp_.get(); 1238 return npp_.get();
1239 } 1239 }
1240 1240
1241 bool BrowserPlugin::supportsKeyboardFocus() const { 1241 bool BrowserPlugin::supportsKeyboardFocus() const {
1242 return true; 1242 return true;
1243 } 1243 }
1244 1244
1245 bool BrowserPlugin::supportsEditCommands() const {
1246 return true;
1247 }
1248
1245 bool BrowserPlugin::canProcessDrag() const { 1249 bool BrowserPlugin::canProcessDrag() const {
1246 return true; 1250 return true;
1247 } 1251 }
1248 1252
1249 void BrowserPlugin::paint(WebCanvas* canvas, const WebRect& rect) { 1253 void BrowserPlugin::paint(WebCanvas* canvas, const WebRect& rect) {
1250 if (guest_crashed_) { 1254 if (guest_crashed_) {
1251 if (!sad_guest_) // Lazily initialize bitmap. 1255 if (!sad_guest_) // Lazily initialize bitmap.
1252 sad_guest_ = content::GetContentClient()->renderer()-> 1256 sad_guest_ = content::GetContentClient()->renderer()->
1253 GetSadWebViewBitmap(); 1257 GetSadWebViewBitmap();
1254 // content_shell does not have the sad plugin bitmap, so we'll paint black 1258 // 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
1511 touch_event.reset(new WebKit::WebTouchEvent()); 1515 touch_event.reset(new WebKit::WebTouchEvent());
1512 memcpy(touch_event.get(), orig_touch_event, sizeof(WebKit::WebTouchEvent)); 1516 memcpy(touch_event.get(), orig_touch_event, sizeof(WebKit::WebTouchEvent));
1513 if (touch_event->changedTouchesLength > 0) { 1517 if (touch_event->changedTouchesLength > 0) {
1514 memcpy(&touch_event->touches[touch_event->touchesLength], 1518 memcpy(&touch_event->touches[touch_event->touchesLength],
1515 &touch_event->changedTouches, 1519 &touch_event->changedTouches,
1516 touch_event->changedTouchesLength * sizeof(WebKit::WebTouchPoint)); 1520 touch_event->changedTouchesLength * sizeof(WebKit::WebTouchPoint));
1517 } 1521 }
1518 touch_event->touchesLength += touch_event->changedTouchesLength; 1522 touch_event->touchesLength += touch_event->changedTouchesLength;
1519 modified_event = touch_event.get(); 1523 modified_event = touch_event.get();
1520 } 1524 }
1525
1526 if (WebKit::WebInputEvent::isKeyboardEventType(event.type) &&
1527 !edit_commands_.empty()) {
1528 browser_plugin_manager()->Send(
1529 new BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent(
1530 render_view_routing_id_,
1531 instance_id_,
1532 edit_commands_));
1533 edit_commands_.clear();
1534 }
1535
1521 browser_plugin_manager()->Send( 1536 browser_plugin_manager()->Send(
1522 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, 1537 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
1523 guest_instance_id_, 1538 guest_instance_id_,
1524 plugin_rect_, 1539 plugin_rect_,
1525 modified_event)); 1540 modified_event));
1526 webkit_glue::GetWebKitCursorInfo(cursor_, &cursor_info); 1541 webkit_glue::GetWebKitCursorInfo(cursor_, &cursor_info);
1527 return true; 1542 return true;
1528 } 1543 }
1529 1544
1530 bool BrowserPlugin::handleDragStatusUpdate(WebKit::WebDragStatus drag_status, 1545 bool BrowserPlugin::handleDragStatusUpdate(WebKit::WebDragStatus drag_status,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 bool BrowserPlugin::executeEditCommand(const WebKit::WebString& name) { 1586 bool BrowserPlugin::executeEditCommand(const WebKit::WebString& name) {
1572 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ExecuteEditCommand( 1587 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ExecuteEditCommand(
1573 render_view_routing_id_, 1588 render_view_routing_id_,
1574 guest_instance_id_, 1589 guest_instance_id_,
1575 name.utf8())); 1590 name.utf8()));
1576 1591
1577 // BrowserPlugin swallows edit commands. 1592 // BrowserPlugin swallows edit commands.
1578 return true; 1593 return true;
1579 } 1594 }
1580 1595
1596 bool BrowserPlugin::executeEditCommand(const WebKit::WebString& name,
1597 const WebKit::WebString& value) {
1598 edit_commands_.push_back(EditCommand(name.utf8(), value.utf8()));
1599 // BrowserPlugin swallows edit commands.
1600 return true;
1601 }
1602
1581 void BrowserPlugin::OnLockMouseACK(bool succeeded) { 1603 void BrowserPlugin::OnLockMouseACK(bool succeeded) {
1582 browser_plugin_manager()->Send(new BrowserPluginHostMsg_LockMouse_ACK( 1604 browser_plugin_manager()->Send(new BrowserPluginHostMsg_LockMouse_ACK(
1583 render_view_routing_id_, 1605 render_view_routing_id_,
1584 guest_instance_id_, 1606 guest_instance_id_,
1585 succeeded)); 1607 succeeded));
1586 } 1608 }
1587 1609
1588 void BrowserPlugin::OnMouseLockLost() { 1610 void BrowserPlugin::OnMouseLockLost() {
1589 browser_plugin_manager()->Send(new BrowserPluginHostMsg_UnlockMouse_ACK( 1611 browser_plugin_manager()->Send(new BrowserPluginHostMsg_UnlockMouse_ACK(
1590 render_view_routing_id_, 1612 render_view_routing_id_,
1591 guest_instance_id_)); 1613 guest_instance_id_));
1592 } 1614 }
1593 1615
1594 bool BrowserPlugin::HandleMouseLockedInputEvent( 1616 bool BrowserPlugin::HandleMouseLockedInputEvent(
1595 const WebKit::WebMouseEvent& event) { 1617 const WebKit::WebMouseEvent& event) {
1596 browser_plugin_manager()->Send( 1618 browser_plugin_manager()->Send(
1597 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, 1619 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
1598 guest_instance_id_, 1620 guest_instance_id_,
1599 plugin_rect_, 1621 plugin_rect_,
1600 &event)); 1622 &event));
1601 return true; 1623 return true;
1602 } 1624 }
1603 1625
1604 } // namespace content 1626 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin.h ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698