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

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

Issue 16057004: <webview>: Fix navigation/attachment race (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comment 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') | no next file » | 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 current_nav_entry_index_(0), 130 current_nav_entry_index_(0),
131 nav_entry_count_(0), 131 nav_entry_count_(0),
132 compositing_enabled_(false), 132 compositing_enabled_(false),
133 weak_ptr_factory_(this) { 133 weak_ptr_factory_(this) {
134 } 134 }
135 135
136 BrowserPlugin::~BrowserPlugin() { 136 BrowserPlugin::~BrowserPlugin() {
137 // If the BrowserPlugin has never navigated then the browser process and 137 // If the BrowserPlugin has never navigated then the browser process and
138 // BrowserPluginManager don't know about it and so there is nothing to do 138 // BrowserPluginManager don't know about it and so there is nothing to do
139 // here. 139 // here.
140 if (!HasGuest()) 140 if (!HasInstanceID())
141 return; 141 return;
142 browser_plugin_manager()->RemoveBrowserPlugin(instance_id_); 142 browser_plugin_manager()->RemoveBrowserPlugin(instance_id_);
143 browser_plugin_manager()->Send( 143 browser_plugin_manager()->Send(
144 new BrowserPluginHostMsg_PluginDestroyed(render_view_routing_id_, 144 new BrowserPluginHostMsg_PluginDestroyed(render_view_routing_id_,
145 instance_id_)); 145 instance_id_));
146 } 146 }
147 147
148 /*static*/ 148 /*static*/
149 BrowserPlugin* BrowserPlugin::FromContainer( 149 BrowserPlugin* BrowserPlugin::FromContainer(
150 WebKit::WebPluginContainer* container) { 150 WebKit::WebPluginContainer* container) {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 min_width = min_width ? min_width : width(); 294 min_width = min_width ? min_width : width();
295 // For autosize, minWidth should not be bigger than maxWidth. 295 // For autosize, minWidth should not be bigger than maxWidth.
296 return std::min(min_width, GetAdjustedMaxWidth()); 296 return std::min(min_width, GetAdjustedMaxWidth());
297 } 297 }
298 298
299 std::string BrowserPlugin::GetPartitionAttribute() const { 299 std::string BrowserPlugin::GetPartitionAttribute() const {
300 return GetDOMAttributeValue(browser_plugin::kAttributePartition); 300 return GetDOMAttributeValue(browser_plugin::kAttributePartition);
301 } 301 }
302 302
303 void BrowserPlugin::ParseNameAttribute() { 303 void BrowserPlugin::ParseNameAttribute() {
304 if (!HasGuest()) 304 if (!HasInstanceID())
305 return; 305 return;
306 browser_plugin_manager()->Send( 306 browser_plugin_manager()->Send(
307 new BrowserPluginHostMsg_SetName(render_view_routing_id_, 307 new BrowserPluginHostMsg_SetName(render_view_routing_id_,
308 instance_id_, 308 instance_id_,
309 GetNameAttribute())); 309 GetNameAttribute()));
310 } 310 }
311 311
312 bool BrowserPlugin::ParseSrcAttribute(std::string* error_message) { 312 bool BrowserPlugin::ParseSrcAttribute(std::string* error_message) {
313 if (!valid_partition_id_) { 313 if (!valid_partition_id_) {
314 *error_message = browser_plugin::kErrorInvalidPartition; 314 *error_message = browser_plugin::kErrorInvalidPartition;
315 return false; 315 return false;
316 } 316 }
317 std::string src = GetSrcAttribute(); 317 std::string src = GetSrcAttribute();
318 if (src.empty()) 318 if (src.empty())
319 return true; 319 return true;
320 320
321 // If we haven't created the guest yet, do so now. We will navigate it right 321 // If we haven't created the guest yet, do so now. We will navigate it right
322 // after creation. If |src| is empty, we can delay the creation until we 322 // after creation. If |src| is empty, we can delay the creation until we
323 // actually need it. 323 // actually need it.
324 if (!HasGuest()) { 324 if (!HasInstanceID()) {
325 // On initial navigation, we request an instance ID from the browser 325 // On initial navigation, we request an instance ID from the browser
326 // process. We essentially ignore all subsequent calls to SetSrcAttribute 326 // process. We essentially ignore all subsequent calls to SetSrcAttribute
327 // until we receive an instance ID. |before_first_navigation_| 327 // until we receive an instance ID. |before_first_navigation_|
328 // prevents BrowserPlugin from allocating more than one instance ID. 328 // prevents BrowserPlugin from allocating more than one instance ID.
329 // Upon receiving an instance ID from the browser process, we continue 329 // Upon receiving an instance ID from the browser process, we continue
330 // the process of navigation by populating the 330 // the process of navigation by populating the
331 // BrowserPluginHostMsg_Attach_Params with the current state of 331 // BrowserPluginHostMsg_Attach_Params with the current state of
332 // BrowserPlugin and sending a BrowserPluginHostMsg_CreateGuest to the 332 // BrowserPlugin and sending a BrowserPluginHostMsg_CreateGuest to the
333 // browser process in order to create a new guest. 333 // browser process in order to create a new guest.
334 if (before_first_navigation_) { 334 if (before_first_navigation_) {
(...skipping 23 matching lines...) Expand all
358 if (current_auto_size) { 358 if (current_auto_size) {
359 params->max_size = gfx::Size(GetAdjustedMaxWidth(), GetAdjustedMaxHeight()); 359 params->max_size = gfx::Size(GetAdjustedMaxWidth(), GetAdjustedMaxHeight());
360 params->min_size = gfx::Size(GetAdjustedMinWidth(), GetAdjustedMinHeight()); 360 params->min_size = gfx::Size(GetAdjustedMinWidth(), GetAdjustedMinHeight());
361 } 361 }
362 } 362 }
363 363
364 void BrowserPlugin::UpdateGuestAutoSizeState(bool current_auto_size) { 364 void BrowserPlugin::UpdateGuestAutoSizeState(bool current_auto_size) {
365 // If we haven't yet heard back from the guest about the last resize request, 365 // If we haven't yet heard back from the guest about the last resize request,
366 // then we don't issue another request until we do in 366 // then we don't issue another request until we do in
367 // BrowserPlugin::UpdateRect. 367 // BrowserPlugin::UpdateRect.
368 if (!HasGuest() || !resize_ack_received_) 368 if (!HasInstanceID() || !resize_ack_received_)
369 return; 369 return;
370 BrowserPluginHostMsg_AutoSize_Params auto_size_params; 370 BrowserPluginHostMsg_AutoSize_Params auto_size_params;
371 BrowserPluginHostMsg_ResizeGuest_Params resize_guest_params; 371 BrowserPluginHostMsg_ResizeGuest_Params resize_guest_params;
372 if (current_auto_size) { 372 if (current_auto_size) {
373 GetDamageBufferWithSizeParams(&auto_size_params, &resize_guest_params); 373 GetDamageBufferWithSizeParams(&auto_size_params, &resize_guest_params);
374 } else { 374 } else {
375 GetDamageBufferWithSizeParams(NULL, &resize_guest_params); 375 GetDamageBufferWithSizeParams(NULL, &resize_guest_params);
376 } 376 }
377 resize_ack_received_ = false; 377 resize_ack_received_ = false;
378 browser_plugin_manager()->Send( 378 browser_plugin_manager()->Send(
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 WebKit::WebPluginContainer* plugin_container = 833 WebKit::WebPluginContainer* plugin_container =
834 plugin_element.pluginContainer(); 834 plugin_element.pluginContainer();
835 if (!plugin_container) 835 if (!plugin_container)
836 return false; 836 return false;
837 837
838 BrowserPlugin* browser_plugin = 838 BrowserPlugin* browser_plugin =
839 BrowserPlugin::FromContainer(plugin_container); 839 BrowserPlugin::FromContainer(plugin_container);
840 if (!browser_plugin) 840 if (!browser_plugin)
841 return false; 841 return false;
842 842
843 // If the BrowserPlugin already has a guest attached to it then we probably 843 // If the BrowserPlugin has already begun to navigate then we shouldn't allow
844 // shouldn't allow attaching a different guest. 844 // attaching a different guest.
845 //
846 // Navigation happens in two stages.
847 // 1. BrowserPlugin requests an instance ID from the browser process.
848 // 2. The browser process returns an instance ID and BrowserPlugin is
849 // "Attach"ed to that instance ID.
850 // If the instance ID is new then a new guest will be created.
851 // If the instance ID corresponds to an unattached guest then BrowserPlugin
852 // is attached to that guest.
853 //
854 // Between step 1, and step 2, BrowserPlugin::AttachWindowTo may be called.
855 // The check below ensures that BrowserPlugin:Attach does not get called with
856 // a different instance ID after step 1 has happened.
845 // TODO(fsamuel): We may wish to support reattaching guests in the future: 857 // TODO(fsamuel): We may wish to support reattaching guests in the future:
846 // http://crbug.com/156219. 858 // http://crbug.com/156219.
847 if (browser_plugin->HasGuest()) 859 if (browser_plugin->HasNavigated())
848 return false; 860 return false;
849 861
850 browser_plugin->Attach(window_id); 862 browser_plugin->Attach(window_id);
851 return true; 863 return true;
852 } 864 }
853 865
854 bool BrowserPlugin::HasGuest() const { 866 bool BrowserPlugin::HasNavigated() const {
867 return !before_first_navigation_;
868 }
869
870 bool BrowserPlugin::HasInstanceID() const {
855 return instance_id_ != browser_plugin::kInstanceIDNone; 871 return instance_id_ != browser_plugin::kInstanceIDNone;
856 } 872 }
857 873
858 bool BrowserPlugin::CanGoBack() const { 874 bool BrowserPlugin::CanGoBack() const {
859 return nav_entry_count_ > 1 && current_nav_entry_index_ > 0; 875 return nav_entry_count_ > 1 && current_nav_entry_index_ > 0;
860 } 876 }
861 877
862 bool BrowserPlugin::CanGoForward() const { 878 bool BrowserPlugin::CanGoForward() const {
863 return current_nav_entry_index_ >= 0 && 879 return current_nav_entry_index_ >= 0 &&
864 current_nav_entry_index_ < (nav_entry_count_ - 1); 880 current_nav_entry_index_ < (nav_entry_count_ - 1);
(...skipping 25 matching lines...) Expand all
890 } else { 906 } else {
891 persist_storage_ = false; 907 persist_storage_ = false;
892 } 908 }
893 909
894 valid_partition_id_ = true; 910 valid_partition_id_ = true;
895 storage_partition_id_ = input; 911 storage_partition_id_ = input;
896 return true; 912 return true;
897 } 913 }
898 914
899 bool BrowserPlugin::CanRemovePartitionAttribute(std::string* error_message) { 915 bool BrowserPlugin::CanRemovePartitionAttribute(std::string* error_message) {
900 if (HasGuest()) 916 if (HasInstanceID())
901 *error_message = browser_plugin::kErrorCannotRemovePartition; 917 *error_message = browser_plugin::kErrorCannotRemovePartition;
902 return !HasGuest(); 918 return !HasInstanceID();
903 } 919 }
904 920
905 void BrowserPlugin::ParseAttributes() { 921 void BrowserPlugin::ParseAttributes() {
906 // TODO(mthiesse): Handle errors here? 922 // TODO(mthiesse): Handle errors here?
907 std::string error; 923 std::string error;
908 ParsePartitionAttribute(&error); 924 ParsePartitionAttribute(&error);
909 925
910 // Parse the 'src' attribute last, as it will set the has_navigated_ flag to 926 // Parse the 'src' attribute last, as it will set the has_navigated_ flag to
911 // true, which prevents changing the 'partition' attribute. 927 // true, which prevents changing the 'partition' attribute.
912 ParseSrcAttribute(&error); 928 ParseSrcAttribute(&error);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 // don't need to worry about BrowserPlugin going away. 1037 // don't need to worry about BrowserPlugin going away.
1022 base::MessageLoop::current()->PostTask( 1038 base::MessageLoop::current()->PostTask(
1023 FROM_HERE, 1039 FROM_HERE,
1024 base::Bind(&BrowserPlugin::OnRequestObjectGarbageCollected, 1040 base::Bind(&BrowserPlugin::OnRequestObjectGarbageCollected,
1025 plugin, 1041 plugin,
1026 request_id)); 1042 request_id));
1027 } 1043 }
1028 } 1044 }
1029 1045
1030 void BrowserPlugin::Back() { 1046 void BrowserPlugin::Back() {
1031 if (!HasGuest()) 1047 if (!HasInstanceID())
1032 return; 1048 return;
1033 browser_plugin_manager()->Send( 1049 browser_plugin_manager()->Send(
1034 new BrowserPluginHostMsg_Go(render_view_routing_id_, 1050 new BrowserPluginHostMsg_Go(render_view_routing_id_,
1035 instance_id_, -1)); 1051 instance_id_, -1));
1036 } 1052 }
1037 1053
1038 void BrowserPlugin::Forward() { 1054 void BrowserPlugin::Forward() {
1039 if (!HasGuest()) 1055 if (!HasInstanceID())
1040 return; 1056 return;
1041 browser_plugin_manager()->Send( 1057 browser_plugin_manager()->Send(
1042 new BrowserPluginHostMsg_Go(render_view_routing_id_, 1058 new BrowserPluginHostMsg_Go(render_view_routing_id_,
1043 instance_id_, 1)); 1059 instance_id_, 1));
1044 } 1060 }
1045 1061
1046 void BrowserPlugin::Go(int relative_index) { 1062 void BrowserPlugin::Go(int relative_index) {
1047 if (!HasGuest()) 1063 if (!HasInstanceID())
1048 return; 1064 return;
1049 browser_plugin_manager()->Send( 1065 browser_plugin_manager()->Send(
1050 new BrowserPluginHostMsg_Go(render_view_routing_id_, 1066 new BrowserPluginHostMsg_Go(render_view_routing_id_,
1051 instance_id_, 1067 instance_id_,
1052 relative_index)); 1068 relative_index));
1053 } 1069 }
1054 1070
1055 void BrowserPlugin::TerminateGuest() { 1071 void BrowserPlugin::TerminateGuest() {
1056 if (!HasGuest() || guest_crashed_) 1072 if (!HasInstanceID() || guest_crashed_)
1057 return; 1073 return;
1058 browser_plugin_manager()->Send( 1074 browser_plugin_manager()->Send(
1059 new BrowserPluginHostMsg_TerminateGuest(render_view_routing_id_, 1075 new BrowserPluginHostMsg_TerminateGuest(render_view_routing_id_,
1060 instance_id_)); 1076 instance_id_));
1061 } 1077 }
1062 1078
1063 void BrowserPlugin::Stop() { 1079 void BrowserPlugin::Stop() {
1064 if (!HasGuest()) 1080 if (!HasInstanceID())
1065 return; 1081 return;
1066 browser_plugin_manager()->Send( 1082 browser_plugin_manager()->Send(
1067 new BrowserPluginHostMsg_Stop(render_view_routing_id_, 1083 new BrowserPluginHostMsg_Stop(render_view_routing_id_,
1068 instance_id_)); 1084 instance_id_));
1069 } 1085 }
1070 1086
1071 void BrowserPlugin::Reload() { 1087 void BrowserPlugin::Reload() {
1072 if (!HasGuest()) 1088 if (!HasInstanceID())
1073 return; 1089 return;
1074 browser_plugin_manager()->Send( 1090 browser_plugin_manager()->Send(
1075 new BrowserPluginHostMsg_Reload(render_view_routing_id_, 1091 new BrowserPluginHostMsg_Reload(render_view_routing_id_,
1076 instance_id_)); 1092 instance_id_));
1077 } 1093 }
1078 1094
1079 void BrowserPlugin::UpdateGuestFocusState() { 1095 void BrowserPlugin::UpdateGuestFocusState() {
1080 if (!HasGuest()) 1096 if (!HasInstanceID())
1081 return; 1097 return;
1082 bool should_be_focused = ShouldGuestBeFocused(); 1098 bool should_be_focused = ShouldGuestBeFocused();
1083 browser_plugin_manager()->Send(new BrowserPluginHostMsg_SetFocus( 1099 browser_plugin_manager()->Send(new BrowserPluginHostMsg_SetFocus(
1084 render_view_routing_id_, 1100 render_view_routing_id_,
1085 instance_id_, 1101 instance_id_,
1086 should_be_focused)); 1102 should_be_focused));
1087 } 1103 }
1088 1104
1089 bool BrowserPlugin::ShouldGuestBeFocused() const { 1105 bool BrowserPlugin::ShouldGuestBeFocused() const {
1090 bool embedder_focused = false; 1106 bool embedder_focused = false;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 SkIntToScalar(plugin_rect_.height())); 1262 SkIntToScalar(plugin_rect_.height()));
1247 canvas->clipRect(image_data_rect); 1263 canvas->clipRect(image_data_rect);
1248 // Paint black or white in case we have nothing in our backing store or we 1264 // Paint black or white in case we have nothing in our backing store or we
1249 // need to show a gutter. 1265 // need to show a gutter.
1250 SkPaint paint; 1266 SkPaint paint;
1251 paint.setStyle(SkPaint::kFill_Style); 1267 paint.setStyle(SkPaint::kFill_Style);
1252 paint.setColor(guest_crashed_ ? SK_ColorBLACK : SK_ColorWHITE); 1268 paint.setColor(guest_crashed_ ? SK_ColorBLACK : SK_ColorWHITE);
1253 canvas->drawRect(image_data_rect, paint); 1269 canvas->drawRect(image_data_rect, paint);
1254 // Stay a solid color if we have never set a non-empty src, or we don't have a 1270 // Stay a solid color if we have never set a non-empty src, or we don't have a
1255 // backing store. 1271 // backing store.
1256 if (!backing_store_.get() || !HasGuest()) 1272 if (!backing_store_.get() || !HasInstanceID())
1257 return; 1273 return;
1258 float inverse_scale_factor = 1.0f / backing_store_->GetScaleFactor(); 1274 float inverse_scale_factor = 1.0f / backing_store_->GetScaleFactor();
1259 canvas->scale(inverse_scale_factor, inverse_scale_factor); 1275 canvas->scale(inverse_scale_factor, inverse_scale_factor);
1260 canvas->drawBitmap(backing_store_->GetBitmap(), 0, 0); 1276 canvas->drawBitmap(backing_store_->GetBitmap(), 0, 0);
1261 } 1277 }
1262 1278
1263 bool BrowserPlugin::InBounds(const gfx::Point& position) const { 1279 bool BrowserPlugin::InBounds(const gfx::Point& position) const {
1264 // Note that even for plugins that are rotated using rotate transformations, 1280 // Note that even for plugins that are rotated using rotate transformations,
1265 // we use the the |plugin_rect_| provided by updateGeometry, which means we 1281 // we use the the |plugin_rect_| provided by updateGeometry, which means we
1266 // will be off if |position| is within the plugin rect but does not fall 1282 // will be off if |position| is within the plugin rect but does not fall
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 } 1331 }
1316 1332
1317 void BrowserPlugin::updateGeometry( 1333 void BrowserPlugin::updateGeometry(
1318 const WebRect& window_rect, 1334 const WebRect& window_rect,
1319 const WebRect& clip_rect, 1335 const WebRect& clip_rect,
1320 const WebVector<WebRect>& cut_outs_rects, 1336 const WebVector<WebRect>& cut_outs_rects,
1321 bool is_visible) { 1337 bool is_visible) {
1322 int old_width = width(); 1338 int old_width = width();
1323 int old_height = height(); 1339 int old_height = height();
1324 plugin_rect_ = window_rect; 1340 plugin_rect_ = window_rect;
1325 if (!HasGuest()) 1341 if (!HasInstanceID())
1326 return; 1342 return;
1327 1343
1328 // In AutoSize mode, guests don't care when the BrowserPlugin container is 1344 // In AutoSize mode, guests don't care when the BrowserPlugin container is
1329 // resized. If |!resize_ack_received_|, then we are still waiting on a 1345 // resized. If |!resize_ack_received_|, then we are still waiting on a
1330 // previous resize to be ACK'ed and so we don't issue additional resizes 1346 // previous resize to be ACK'ed and so we don't issue additional resizes
1331 // until the previous one is ACK'ed. 1347 // until the previous one is ACK'ed.
1332 // TODO(mthiesse): Assess the performance of calling GetAutoSizeAttribute() on 1348 // TODO(mthiesse): Assess the performance of calling GetAutoSizeAttribute() on
1333 // resize. 1349 // resize.
1334 if (!resize_ack_received_ || 1350 if (!resize_ack_received_ ||
1335 (old_width == window_rect.width && old_height == window_rect.height) || 1351 (old_width == window_rect.width && old_height == window_rect.height) ||
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 1466
1451 if (ShouldGuestBeFocused() != old_guest_focus_state) 1467 if (ShouldGuestBeFocused() != old_guest_focus_state)
1452 UpdateGuestFocusState(); 1468 UpdateGuestFocusState();
1453 } 1469 }
1454 1470
1455 void BrowserPlugin::updateVisibility(bool visible) { 1471 void BrowserPlugin::updateVisibility(bool visible) {
1456 if (visible_ == visible) 1472 if (visible_ == visible)
1457 return; 1473 return;
1458 1474
1459 visible_ = visible; 1475 visible_ = visible;
1460 if (!HasGuest()) 1476 if (!HasInstanceID())
1461 return; 1477 return;
1462 1478
1463 if (compositing_helper_) 1479 if (compositing_helper_)
1464 compositing_helper_->UpdateVisibility(visible); 1480 compositing_helper_->UpdateVisibility(visible);
1465 1481
1466 browser_plugin_manager()->Send(new BrowserPluginHostMsg_SetVisibility( 1482 browser_plugin_manager()->Send(new BrowserPluginHostMsg_SetVisibility(
1467 render_view_routing_id_, 1483 render_view_routing_id_,
1468 instance_id_, 1484 instance_id_,
1469 visible)); 1485 visible));
1470 } 1486 }
1471 1487
1472 bool BrowserPlugin::acceptsInputEvents() { 1488 bool BrowserPlugin::acceptsInputEvents() {
1473 return true; 1489 return true;
1474 } 1490 }
1475 1491
1476 bool BrowserPlugin::handleInputEvent(const WebKit::WebInputEvent& event, 1492 bool BrowserPlugin::handleInputEvent(const WebKit::WebInputEvent& event,
1477 WebKit::WebCursorInfo& cursor_info) { 1493 WebKit::WebCursorInfo& cursor_info) {
1478 if (guest_crashed_ || !HasGuest() || 1494 if (guest_crashed_ || !HasInstanceID() ||
1479 event.type == WebKit::WebInputEvent::ContextMenu) 1495 event.type == WebKit::WebInputEvent::ContextMenu)
1480 return false; 1496 return false;
1481 1497
1482 const WebKit::WebInputEvent* modified_event = &event; 1498 const WebKit::WebInputEvent* modified_event = &event;
1483 scoped_ptr<WebKit::WebTouchEvent> touch_event; 1499 scoped_ptr<WebKit::WebTouchEvent> touch_event;
1484 // WebKit gives BrowserPlugin a list of touches that are down, but the browser 1500 // WebKit gives BrowserPlugin a list of touches that are down, but the browser
1485 // process expects a list of all touches. We modify the TouchEnd event here to 1501 // process expects a list of all touches. We modify the TouchEnd event here to
1486 // match these expectations. 1502 // match these expectations.
1487 if (event.type == WebKit::WebInputEvent::TouchEnd) { 1503 if (event.type == WebKit::WebInputEvent::TouchEnd) {
1488 const WebKit::WebTouchEvent* orig_touch_event = 1504 const WebKit::WebTouchEvent* orig_touch_event =
(...skipping 15 matching lines...) Expand all
1504 modified_event)); 1520 modified_event));
1505 webkit_glue::GetWebKitCursorInfo(cursor_, &cursor_info); 1521 webkit_glue::GetWebKitCursorInfo(cursor_, &cursor_info);
1506 return true; 1522 return true;
1507 } 1523 }
1508 1524
1509 bool BrowserPlugin::handleDragStatusUpdate(WebKit::WebDragStatus drag_status, 1525 bool BrowserPlugin::handleDragStatusUpdate(WebKit::WebDragStatus drag_status,
1510 const WebKit::WebDragData& drag_data, 1526 const WebKit::WebDragData& drag_data,
1511 WebKit::WebDragOperationsMask mask, 1527 WebKit::WebDragOperationsMask mask,
1512 const WebKit::WebPoint& position, 1528 const WebKit::WebPoint& position,
1513 const WebKit::WebPoint& screen) { 1529 const WebKit::WebPoint& screen) {
1514 if (guest_crashed_ || !HasGuest()) 1530 if (guest_crashed_ || !HasInstanceID())
1515 return false; 1531 return false;
1516 browser_plugin_manager()->Send( 1532 browser_plugin_manager()->Send(
1517 new BrowserPluginHostMsg_DragStatusUpdate( 1533 new BrowserPluginHostMsg_DragStatusUpdate(
1518 render_view_routing_id_, 1534 render_view_routing_id_,
1519 instance_id_, 1535 instance_id_,
1520 drag_status, 1536 drag_status,
1521 WebDropData(drag_data), 1537 WebDropData(drag_data),
1522 mask, 1538 mask,
1523 position)); 1539 position));
1524 return true; 1540 return true;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 const WebKit::WebMouseEvent& event) { 1590 const WebKit::WebMouseEvent& event) {
1575 browser_plugin_manager()->Send( 1591 browser_plugin_manager()->Send(
1576 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, 1592 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
1577 instance_id_, 1593 instance_id_,
1578 plugin_rect_, 1594 plugin_rect_,
1579 &event)); 1595 &event));
1580 return true; 1596 return true;
1581 } 1597 }
1582 1598
1583 } // namespace content 1599 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698