OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 Loading... | |
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 Loading... | |
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. |
lazyboy
2013/05/29 00:38:25
Can you add a comment: in which case HasNavigated(
| |
845 // TODO(fsamuel): We may wish to support reattaching guests in the future: | 845 // TODO(fsamuel): We may wish to support reattaching guests in the future: |
846 // http://crbug.com/156219. | 846 // http://crbug.com/156219. |
847 if (browser_plugin->HasGuest()) | 847 if (browser_plugin->HasNavigated()) |
848 return false; | 848 return false; |
849 | 849 |
850 browser_plugin->Attach(window_id); | 850 browser_plugin->Attach(window_id); |
851 return true; | 851 return true; |
852 } | 852 } |
853 | 853 |
854 bool BrowserPlugin::HasGuest() const { | 854 bool BrowserPlugin::HasNavigated() const { |
855 return !before_first_navigation_; | |
856 } | |
857 | |
858 bool BrowserPlugin::HasInstanceID() const { | |
855 return instance_id_ != browser_plugin::kInstanceIDNone; | 859 return instance_id_ != browser_plugin::kInstanceIDNone; |
856 } | 860 } |
857 | 861 |
858 bool BrowserPlugin::CanGoBack() const { | 862 bool BrowserPlugin::CanGoBack() const { |
859 return nav_entry_count_ > 1 && current_nav_entry_index_ > 0; | 863 return nav_entry_count_ > 1 && current_nav_entry_index_ > 0; |
860 } | 864 } |
861 | 865 |
862 bool BrowserPlugin::CanGoForward() const { | 866 bool BrowserPlugin::CanGoForward() const { |
863 return current_nav_entry_index_ >= 0 && | 867 return current_nav_entry_index_ >= 0 && |
864 current_nav_entry_index_ < (nav_entry_count_ - 1); | 868 current_nav_entry_index_ < (nav_entry_count_ - 1); |
(...skipping 25 matching lines...) Expand all Loading... | |
890 } else { | 894 } else { |
891 persist_storage_ = false; | 895 persist_storage_ = false; |
892 } | 896 } |
893 | 897 |
894 valid_partition_id_ = true; | 898 valid_partition_id_ = true; |
895 storage_partition_id_ = input; | 899 storage_partition_id_ = input; |
896 return true; | 900 return true; |
897 } | 901 } |
898 | 902 |
899 bool BrowserPlugin::CanRemovePartitionAttribute(std::string* error_message) { | 903 bool BrowserPlugin::CanRemovePartitionAttribute(std::string* error_message) { |
900 if (HasGuest()) | 904 if (HasInstanceID()) |
901 *error_message = browser_plugin::kErrorCannotRemovePartition; | 905 *error_message = browser_plugin::kErrorCannotRemovePartition; |
902 return !HasGuest(); | 906 return !HasInstanceID(); |
903 } | 907 } |
904 | 908 |
905 void BrowserPlugin::ParseAttributes() { | 909 void BrowserPlugin::ParseAttributes() { |
906 // TODO(mthiesse): Handle errors here? | 910 // TODO(mthiesse): Handle errors here? |
907 std::string error; | 911 std::string error; |
908 ParsePartitionAttribute(&error); | 912 ParsePartitionAttribute(&error); |
909 | 913 |
910 // Parse the 'src' attribute last, as it will set the has_navigated_ flag to | 914 // Parse the 'src' attribute last, as it will set the has_navigated_ flag to |
911 // true, which prevents changing the 'partition' attribute. | 915 // true, which prevents changing the 'partition' attribute. |
912 ParseSrcAttribute(&error); | 916 ParseSrcAttribute(&error); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1021 // don't need to worry about BrowserPlugin going away. | 1025 // don't need to worry about BrowserPlugin going away. |
1022 base::MessageLoop::current()->PostTask( | 1026 base::MessageLoop::current()->PostTask( |
1023 FROM_HERE, | 1027 FROM_HERE, |
1024 base::Bind(&BrowserPlugin::OnRequestObjectGarbageCollected, | 1028 base::Bind(&BrowserPlugin::OnRequestObjectGarbageCollected, |
1025 plugin, | 1029 plugin, |
1026 request_id)); | 1030 request_id)); |
1027 } | 1031 } |
1028 } | 1032 } |
1029 | 1033 |
1030 void BrowserPlugin::Back() { | 1034 void BrowserPlugin::Back() { |
1031 if (!HasGuest()) | 1035 if (!HasInstanceID()) |
1032 return; | 1036 return; |
1033 browser_plugin_manager()->Send( | 1037 browser_plugin_manager()->Send( |
1034 new BrowserPluginHostMsg_Go(render_view_routing_id_, | 1038 new BrowserPluginHostMsg_Go(render_view_routing_id_, |
1035 instance_id_, -1)); | 1039 instance_id_, -1)); |
1036 } | 1040 } |
1037 | 1041 |
1038 void BrowserPlugin::Forward() { | 1042 void BrowserPlugin::Forward() { |
1039 if (!HasGuest()) | 1043 if (!HasInstanceID()) |
1040 return; | 1044 return; |
1041 browser_plugin_manager()->Send( | 1045 browser_plugin_manager()->Send( |
1042 new BrowserPluginHostMsg_Go(render_view_routing_id_, | 1046 new BrowserPluginHostMsg_Go(render_view_routing_id_, |
1043 instance_id_, 1)); | 1047 instance_id_, 1)); |
1044 } | 1048 } |
1045 | 1049 |
1046 void BrowserPlugin::Go(int relative_index) { | 1050 void BrowserPlugin::Go(int relative_index) { |
1047 if (!HasGuest()) | 1051 if (!HasInstanceID()) |
1048 return; | 1052 return; |
1049 browser_plugin_manager()->Send( | 1053 browser_plugin_manager()->Send( |
1050 new BrowserPluginHostMsg_Go(render_view_routing_id_, | 1054 new BrowserPluginHostMsg_Go(render_view_routing_id_, |
1051 instance_id_, | 1055 instance_id_, |
1052 relative_index)); | 1056 relative_index)); |
1053 } | 1057 } |
1054 | 1058 |
1055 void BrowserPlugin::TerminateGuest() { | 1059 void BrowserPlugin::TerminateGuest() { |
1056 if (!HasGuest() || guest_crashed_) | 1060 if (!HasInstanceID() || guest_crashed_) |
1057 return; | 1061 return; |
1058 browser_plugin_manager()->Send( | 1062 browser_plugin_manager()->Send( |
1059 new BrowserPluginHostMsg_TerminateGuest(render_view_routing_id_, | 1063 new BrowserPluginHostMsg_TerminateGuest(render_view_routing_id_, |
1060 instance_id_)); | 1064 instance_id_)); |
1061 } | 1065 } |
1062 | 1066 |
1063 void BrowserPlugin::Stop() { | 1067 void BrowserPlugin::Stop() { |
1064 if (!HasGuest()) | 1068 if (!HasInstanceID()) |
1065 return; | 1069 return; |
1066 browser_plugin_manager()->Send( | 1070 browser_plugin_manager()->Send( |
1067 new BrowserPluginHostMsg_Stop(render_view_routing_id_, | 1071 new BrowserPluginHostMsg_Stop(render_view_routing_id_, |
1068 instance_id_)); | 1072 instance_id_)); |
1069 } | 1073 } |
1070 | 1074 |
1071 void BrowserPlugin::Reload() { | 1075 void BrowserPlugin::Reload() { |
1072 if (!HasGuest()) | 1076 if (!HasInstanceID()) |
1073 return; | 1077 return; |
1074 browser_plugin_manager()->Send( | 1078 browser_plugin_manager()->Send( |
1075 new BrowserPluginHostMsg_Reload(render_view_routing_id_, | 1079 new BrowserPluginHostMsg_Reload(render_view_routing_id_, |
1076 instance_id_)); | 1080 instance_id_)); |
1077 } | 1081 } |
1078 | 1082 |
1079 void BrowserPlugin::UpdateGuestFocusState() { | 1083 void BrowserPlugin::UpdateGuestFocusState() { |
1080 if (!HasGuest()) | 1084 if (!HasInstanceID()) |
1081 return; | 1085 return; |
1082 bool should_be_focused = ShouldGuestBeFocused(); | 1086 bool should_be_focused = ShouldGuestBeFocused(); |
1083 browser_plugin_manager()->Send(new BrowserPluginHostMsg_SetFocus( | 1087 browser_plugin_manager()->Send(new BrowserPluginHostMsg_SetFocus( |
1084 render_view_routing_id_, | 1088 render_view_routing_id_, |
1085 instance_id_, | 1089 instance_id_, |
1086 should_be_focused)); | 1090 should_be_focused)); |
1087 } | 1091 } |
1088 | 1092 |
1089 bool BrowserPlugin::ShouldGuestBeFocused() const { | 1093 bool BrowserPlugin::ShouldGuestBeFocused() const { |
1090 bool embedder_focused = false; | 1094 bool embedder_focused = false; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1246 SkIntToScalar(plugin_rect_.height())); | 1250 SkIntToScalar(plugin_rect_.height())); |
1247 canvas->clipRect(image_data_rect); | 1251 canvas->clipRect(image_data_rect); |
1248 // Paint black or white in case we have nothing in our backing store or we | 1252 // Paint black or white in case we have nothing in our backing store or we |
1249 // need to show a gutter. | 1253 // need to show a gutter. |
1250 SkPaint paint; | 1254 SkPaint paint; |
1251 paint.setStyle(SkPaint::kFill_Style); | 1255 paint.setStyle(SkPaint::kFill_Style); |
1252 paint.setColor(guest_crashed_ ? SK_ColorBLACK : SK_ColorWHITE); | 1256 paint.setColor(guest_crashed_ ? SK_ColorBLACK : SK_ColorWHITE); |
1253 canvas->drawRect(image_data_rect, paint); | 1257 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 | 1258 // Stay a solid color if we have never set a non-empty src, or we don't have a |
1255 // backing store. | 1259 // backing store. |
1256 if (!backing_store_.get() || !HasGuest()) | 1260 if (!backing_store_.get() || !HasInstanceID()) |
1257 return; | 1261 return; |
1258 float inverse_scale_factor = 1.0f / backing_store_->GetScaleFactor(); | 1262 float inverse_scale_factor = 1.0f / backing_store_->GetScaleFactor(); |
1259 canvas->scale(inverse_scale_factor, inverse_scale_factor); | 1263 canvas->scale(inverse_scale_factor, inverse_scale_factor); |
1260 canvas->drawBitmap(backing_store_->GetBitmap(), 0, 0); | 1264 canvas->drawBitmap(backing_store_->GetBitmap(), 0, 0); |
1261 } | 1265 } |
1262 | 1266 |
1263 bool BrowserPlugin::InBounds(const gfx::Point& position) const { | 1267 bool BrowserPlugin::InBounds(const gfx::Point& position) const { |
1264 // Note that even for plugins that are rotated using rotate transformations, | 1268 // Note that even for plugins that are rotated using rotate transformations, |
1265 // we use the the |plugin_rect_| provided by updateGeometry, which means we | 1269 // 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 | 1270 // 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 Loading... | |
1315 } | 1319 } |
1316 | 1320 |
1317 void BrowserPlugin::updateGeometry( | 1321 void BrowserPlugin::updateGeometry( |
1318 const WebRect& window_rect, | 1322 const WebRect& window_rect, |
1319 const WebRect& clip_rect, | 1323 const WebRect& clip_rect, |
1320 const WebVector<WebRect>& cut_outs_rects, | 1324 const WebVector<WebRect>& cut_outs_rects, |
1321 bool is_visible) { | 1325 bool is_visible) { |
1322 int old_width = width(); | 1326 int old_width = width(); |
1323 int old_height = height(); | 1327 int old_height = height(); |
1324 plugin_rect_ = window_rect; | 1328 plugin_rect_ = window_rect; |
1325 if (!HasGuest()) | 1329 if (!HasInstanceID()) |
1326 return; | 1330 return; |
1327 | 1331 |
1328 // In AutoSize mode, guests don't care when the BrowserPlugin container is | 1332 // 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 | 1333 // 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 | 1334 // previous resize to be ACK'ed and so we don't issue additional resizes |
1331 // until the previous one is ACK'ed. | 1335 // until the previous one is ACK'ed. |
1332 // TODO(mthiesse): Assess the performance of calling GetAutoSizeAttribute() on | 1336 // TODO(mthiesse): Assess the performance of calling GetAutoSizeAttribute() on |
1333 // resize. | 1337 // resize. |
1334 if (!resize_ack_received_ || | 1338 if (!resize_ack_received_ || |
1335 (old_width == window_rect.width && old_height == window_rect.height) || | 1339 (old_width == window_rect.width && old_height == window_rect.height) || |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1450 | 1454 |
1451 if (ShouldGuestBeFocused() != old_guest_focus_state) | 1455 if (ShouldGuestBeFocused() != old_guest_focus_state) |
1452 UpdateGuestFocusState(); | 1456 UpdateGuestFocusState(); |
1453 } | 1457 } |
1454 | 1458 |
1455 void BrowserPlugin::updateVisibility(bool visible) { | 1459 void BrowserPlugin::updateVisibility(bool visible) { |
1456 if (visible_ == visible) | 1460 if (visible_ == visible) |
1457 return; | 1461 return; |
1458 | 1462 |
1459 visible_ = visible; | 1463 visible_ = visible; |
1460 if (!HasGuest()) | 1464 if (!HasInstanceID()) |
1461 return; | 1465 return; |
1462 | 1466 |
1463 if (compositing_helper_) | 1467 if (compositing_helper_) |
1464 compositing_helper_->UpdateVisibility(visible); | 1468 compositing_helper_->UpdateVisibility(visible); |
1465 | 1469 |
1466 browser_plugin_manager()->Send(new BrowserPluginHostMsg_SetVisibility( | 1470 browser_plugin_manager()->Send(new BrowserPluginHostMsg_SetVisibility( |
1467 render_view_routing_id_, | 1471 render_view_routing_id_, |
1468 instance_id_, | 1472 instance_id_, |
1469 visible)); | 1473 visible)); |
1470 } | 1474 } |
1471 | 1475 |
1472 bool BrowserPlugin::acceptsInputEvents() { | 1476 bool BrowserPlugin::acceptsInputEvents() { |
1473 return true; | 1477 return true; |
1474 } | 1478 } |
1475 | 1479 |
1476 bool BrowserPlugin::handleInputEvent(const WebKit::WebInputEvent& event, | 1480 bool BrowserPlugin::handleInputEvent(const WebKit::WebInputEvent& event, |
1477 WebKit::WebCursorInfo& cursor_info) { | 1481 WebKit::WebCursorInfo& cursor_info) { |
1478 if (guest_crashed_ || !HasGuest() || | 1482 if (guest_crashed_ || !HasInstanceID() || |
1479 event.type == WebKit::WebInputEvent::ContextMenu) | 1483 event.type == WebKit::WebInputEvent::ContextMenu) |
1480 return false; | 1484 return false; |
1481 | 1485 |
1482 const WebKit::WebInputEvent* modified_event = &event; | 1486 const WebKit::WebInputEvent* modified_event = &event; |
1483 scoped_ptr<WebKit::WebTouchEvent> touch_event; | 1487 scoped_ptr<WebKit::WebTouchEvent> touch_event; |
1484 // WebKit gives BrowserPlugin a list of touches that are down, but the browser | 1488 // 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 | 1489 // process expects a list of all touches. We modify the TouchEnd event here to |
1486 // match these expectations. | 1490 // match these expectations. |
1487 if (event.type == WebKit::WebInputEvent::TouchEnd) { | 1491 if (event.type == WebKit::WebInputEvent::TouchEnd) { |
1488 const WebKit::WebTouchEvent* orig_touch_event = | 1492 const WebKit::WebTouchEvent* orig_touch_event = |
(...skipping 15 matching lines...) Expand all Loading... | |
1504 modified_event)); | 1508 modified_event)); |
1505 webkit_glue::GetWebKitCursorInfo(cursor_, &cursor_info); | 1509 webkit_glue::GetWebKitCursorInfo(cursor_, &cursor_info); |
1506 return true; | 1510 return true; |
1507 } | 1511 } |
1508 | 1512 |
1509 bool BrowserPlugin::handleDragStatusUpdate(WebKit::WebDragStatus drag_status, | 1513 bool BrowserPlugin::handleDragStatusUpdate(WebKit::WebDragStatus drag_status, |
1510 const WebKit::WebDragData& drag_data, | 1514 const WebKit::WebDragData& drag_data, |
1511 WebKit::WebDragOperationsMask mask, | 1515 WebKit::WebDragOperationsMask mask, |
1512 const WebKit::WebPoint& position, | 1516 const WebKit::WebPoint& position, |
1513 const WebKit::WebPoint& screen) { | 1517 const WebKit::WebPoint& screen) { |
1514 if (guest_crashed_ || !HasGuest()) | 1518 if (guest_crashed_ || !HasInstanceID()) |
1515 return false; | 1519 return false; |
1516 browser_plugin_manager()->Send( | 1520 browser_plugin_manager()->Send( |
1517 new BrowserPluginHostMsg_DragStatusUpdate( | 1521 new BrowserPluginHostMsg_DragStatusUpdate( |
1518 render_view_routing_id_, | 1522 render_view_routing_id_, |
1519 instance_id_, | 1523 instance_id_, |
1520 drag_status, | 1524 drag_status, |
1521 WebDropData(drag_data), | 1525 WebDropData(drag_data), |
1522 mask, | 1526 mask, |
1523 position)); | 1527 position)); |
1524 return true; | 1528 return true; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1574 const WebKit::WebMouseEvent& event) { | 1578 const WebKit::WebMouseEvent& event) { |
1575 browser_plugin_manager()->Send( | 1579 browser_plugin_manager()->Send( |
1576 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, | 1580 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, |
1577 instance_id_, | 1581 instance_id_, |
1578 plugin_rect_, | 1582 plugin_rect_, |
1579 &event)); | 1583 &event)); |
1580 return true; | 1584 return true; |
1581 } | 1585 } |
1582 | 1586 |
1583 } // namespace content | 1587 } // namespace content |
OLD | NEW |