| 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/browser/browser_plugin/browser_plugin_guest.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 damage_buffer_sequence_id_(0), | 339 damage_buffer_sequence_id_(0), |
| 340 damage_buffer_size_(0), | 340 damage_buffer_size_(0), |
| 341 damage_buffer_scale_factor_(1.0f), | 341 damage_buffer_scale_factor_(1.0f), |
| 342 guest_device_scale_factor_(1.0f), | 342 guest_device_scale_factor_(1.0f), |
| 343 guest_hang_timeout_( | 343 guest_hang_timeout_( |
| 344 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)), | 344 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)), |
| 345 focused_(false), | 345 focused_(false), |
| 346 mouse_locked_(false), | 346 mouse_locked_(false), |
| 347 pending_lock_request_(false), | 347 pending_lock_request_(false), |
| 348 embedder_visible_(true), | 348 embedder_visible_(true), |
| 349 next_permission_request_id_(0), | 349 next_permission_request_id_(browser_plugin::kInvalidPermissionRequestID), |
| 350 has_render_view_(has_render_view) { | 350 has_render_view_(has_render_view) { |
| 351 DCHECK(web_contents); | 351 DCHECK(web_contents); |
| 352 web_contents->SetDelegate(this); | 352 web_contents->SetDelegate(this); |
| 353 if (opener) | 353 if (opener) |
| 354 opener_ = opener->AsWeakPtr(); | 354 opener_ = opener->AsWeakPtr(); |
| 355 GetWebContents()->GetBrowserPluginGuestManager()->AddGuest(instance_id_, | 355 GetWebContents()->GetBrowserPluginGuestManager()->AddGuest(instance_id_, |
| 356 GetWebContents()); | 356 GetWebContents()); |
| 357 } | 357 } |
| 358 | 358 |
| 359 bool BrowserPluginGuest::AddMessageToConsole(WebContents* source, | 359 bool BrowserPluginGuest::AddMessageToConsole(WebContents* source, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 376 // Clean up unattached new windows opened by this guest. | 376 // Clean up unattached new windows opened by this guest. |
| 377 for (PendingWindowMap::const_iterator it = pending_new_windows.begin(); | 377 for (PendingWindowMap::const_iterator it = pending_new_windows.begin(); |
| 378 it != pending_new_windows.end(); ++it) { | 378 it != pending_new_windows.end(); ++it) { |
| 379 it->first->Destroy(); | 379 it->first->Destroy(); |
| 380 } | 380 } |
| 381 // All pending windows should be removed from the set after Destroy() is | 381 // All pending windows should be removed from the set after Destroy() is |
| 382 // called on all of them. | 382 // called on all of them. |
| 383 DCHECK_EQ(0ul, pending_new_windows_.size()); | 383 DCHECK_EQ(0ul, pending_new_windows_.size()); |
| 384 } | 384 } |
| 385 | 385 |
| 386 void BrowserPluginGuest::RespondToPermissionRequest( |
| 387 int request_id, |
| 388 bool should_allow, |
| 389 const std::string& user_input) { |
| 390 RequestMap::iterator request_itr = permission_request_map_.find(request_id); |
| 391 if (request_itr == permission_request_map_.end()) { |
| 392 LOG(INFO) << "Not a valid request ID."; |
| 393 return; |
| 394 } |
| 395 request_itr->second->Respond(should_allow, user_input); |
| 396 permission_request_map_.erase(request_itr); |
| 397 } |
| 398 |
| 386 int BrowserPluginGuest::RequestPermission( | 399 int BrowserPluginGuest::RequestPermission( |
| 387 BrowserPluginPermissionType permission_type, | 400 BrowserPluginPermissionType permission_type, |
| 388 scoped_refptr<BrowserPluginGuest::PermissionRequest> request, | 401 scoped_refptr<BrowserPluginGuest::PermissionRequest> request, |
| 389 const base::DictionaryValue& request_info) { | 402 const base::DictionaryValue& request_info) { |
| 390 int request_id = next_permission_request_id_++; | 403 if (!delegate_) { |
| 404 request->Respond(false, ""); |
| 405 return browser_plugin::kInvalidPermissionRequestID; |
| 406 } |
| 407 |
| 408 int request_id = ++next_permission_request_id_; |
| 391 permission_request_map_[request_id] = request; | 409 permission_request_map_[request_id] = request; |
| 392 | 410 |
| 393 SendMessageToEmbedder(new BrowserPluginMsg_RequestPermission( | 411 BrowserPluginGuestDelegate::PermissionResponseCallback callback = |
| 394 instance_id(), permission_type, request_id, request_info)); | 412 base::Bind(&BrowserPluginGuest::RespondToPermissionRequest, |
| 413 AsWeakPtr(), |
| 414 request_id); |
| 415 // If BrowserPluginGuestDelegate hasn't handled the permission then we simply |
| 416 // reject it immediately. |
| 417 if (!delegate_->RequestPermission(permission_type, request_info, callback)) |
| 418 callback.Run(false, ""); |
| 395 | 419 |
| 396 return request_id; | 420 return request_id; |
| 397 } | 421 } |
| 398 | 422 |
| 399 void BrowserPluginGuest::Destroy() { | 423 void BrowserPluginGuest::Destroy() { |
| 400 if (!attached() && opener()) | 424 if (!attached() && opener()) |
| 401 opener()->pending_new_windows_.erase(this); | 425 opener()->pending_new_windows_.erase(this); |
| 402 DestroyUnattachedWindows(); | 426 DestroyUnattachedWindows(); |
| 403 GetWebContents()->GetBrowserPluginGuestManager()->RemoveGuest(instance_id_); | 427 GetWebContents()->GetBrowserPluginGuestManager()->RemoveGuest(instance_id_); |
| 404 delete GetWebContents(); | 428 delete GetWebContents(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 415 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_DragStatusUpdate, | 439 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_DragStatusUpdate, |
| 416 OnDragStatusUpdate) | 440 OnDragStatusUpdate) |
| 417 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ExecuteEditCommand, | 441 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ExecuteEditCommand, |
| 418 OnExecuteEditCommand) | 442 OnExecuteEditCommand) |
| 419 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_HandleInputEvent, | 443 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_HandleInputEvent, |
| 420 OnHandleInputEvent) | 444 OnHandleInputEvent) |
| 421 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_LockMouse_ACK, OnLockMouseAck) | 445 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_LockMouse_ACK, OnLockMouseAck) |
| 422 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_NavigateGuest, OnNavigateGuest) | 446 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_NavigateGuest, OnNavigateGuest) |
| 423 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_PluginDestroyed, OnPluginDestroyed) | 447 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_PluginDestroyed, OnPluginDestroyed) |
| 424 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ResizeGuest, OnResizeGuest) | 448 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ResizeGuest, OnResizeGuest) |
| 425 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_RespondPermission, | |
| 426 OnRespondPermission) | |
| 427 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetAutoSize, OnSetSize) | 449 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetAutoSize, OnSetSize) |
| 428 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent, | 450 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent, |
| 429 OnSetEditCommandsForNextKeyEvent) | 451 OnSetEditCommandsForNextKeyEvent) |
| 430 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetFocus, OnSetFocus) | 452 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetFocus, OnSetFocus) |
| 431 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetName, OnSetName) | 453 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetName, OnSetName) |
| 432 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetVisibility, OnSetVisibility) | 454 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetVisibility, OnSetVisibility) |
| 433 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UnlockMouse_ACK, OnUnlockMouseAck) | 455 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UnlockMouse_ACK, OnUnlockMouseAck) |
| 434 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UpdateGeometry, OnUpdateGeometry) | 456 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UpdateGeometry, OnUpdateGeometry) |
| 435 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UpdateRect_ACK, OnUpdateRectACK) | 457 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UpdateRect_ACK, OnUpdateRectACK) |
| 436 IPC_MESSAGE_UNHANDLED(handled = false) | 458 IPC_MESSAGE_UNHANDLED(handled = false) |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 request_info.Set(browser_plugin::kTargetURL, | 824 request_info.Set(browser_plugin::kTargetURL, |
| 803 base::Value::CreateStringValue(new_window_info.url.spec())); | 825 base::Value::CreateStringValue(new_window_info.url.spec())); |
| 804 request_info.Set(browser_plugin::kName, | 826 request_info.Set(browser_plugin::kName, |
| 805 base::Value::CreateStringValue(new_window_info.name)); | 827 base::Value::CreateStringValue(new_window_info.name)); |
| 806 request_info.Set(browser_plugin::kWindowID, | 828 request_info.Set(browser_plugin::kWindowID, |
| 807 base::Value::CreateIntegerValue(guest->instance_id())); | 829 base::Value::CreateIntegerValue(guest->instance_id())); |
| 808 request_info.Set(browser_plugin::kWindowOpenDisposition, | 830 request_info.Set(browser_plugin::kWindowOpenDisposition, |
| 809 base::Value::CreateStringValue( | 831 base::Value::CreateStringValue( |
| 810 WindowOpenDispositionToString(disposition))); | 832 WindowOpenDispositionToString(disposition))); |
| 811 | 833 |
| 812 RequestPermission(BrowserPluginPermissionTypeNewWindow, | 834 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_NEW_WINDOW, |
| 813 new NewWindowRequest(guest->instance_id(), this), | 835 new NewWindowRequest(guest->instance_id(), this), |
| 814 request_info); | 836 request_info); |
| 815 } | 837 } |
| 816 | 838 |
| 817 bool BrowserPluginGuest::UnlockMouseIfNecessary( | 839 bool BrowserPluginGuest::UnlockMouseIfNecessary( |
| 818 const NativeWebKeyboardEvent& event) { | 840 const NativeWebKeyboardEvent& event) { |
| 819 if (!mouse_locked_) | 841 if (!mouse_locked_) |
| 820 return false; | 842 return false; |
| 821 | 843 |
| 822 embedder_web_contents()->GotResponseToLockMouseRequest(false); | 844 embedder_web_contents()->GotResponseToLockMouseRequest(false); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 // Deny the geolocation request. | 895 // Deny the geolocation request. |
| 874 callback.Run(false); | 896 callback.Run(false); |
| 875 return; | 897 return; |
| 876 } | 898 } |
| 877 | 899 |
| 878 base::DictionaryValue request_info; | 900 base::DictionaryValue request_info; |
| 879 request_info.Set(browser_plugin::kURL, | 901 request_info.Set(browser_plugin::kURL, |
| 880 base::Value::CreateStringValue(requesting_frame.spec())); | 902 base::Value::CreateStringValue(requesting_frame.spec())); |
| 881 | 903 |
| 882 int request_id = | 904 int request_id = |
| 883 RequestPermission(BrowserPluginPermissionTypeGeolocation, | 905 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_GEOLOCATION, |
| 884 new GeolocationRequest( | 906 new GeolocationRequest( |
| 885 callback, bridge_id, &weak_ptr_factory_), | 907 callback, bridge_id, &weak_ptr_factory_), |
| 886 request_info); | 908 request_info); |
| 887 | 909 |
| 888 DCHECK(bridge_id_to_request_id_map_.find(bridge_id) == | 910 DCHECK(bridge_id_to_request_id_map_.find(bridge_id) == |
| 889 bridge_id_to_request_id_map_.end()); | 911 bridge_id_to_request_id_map_.end()); |
| 890 bridge_id_to_request_id_map_[bridge_id] = request_id; | 912 bridge_id_to_request_id_map_[bridge_id] = request_id; |
| 891 } | 913 } |
| 892 | 914 |
| 893 int BrowserPluginGuest::RemoveBridgeID(int bridge_id) { | 915 int BrowserPluginGuest::RemoveBridgeID(int bridge_id) { |
| 894 std::map<int, int>::iterator bridge_itr = | 916 std::map<int, int>::iterator bridge_itr = |
| 895 bridge_id_to_request_id_map_.find(bridge_id); | 917 bridge_id_to_request_id_map_.find(bridge_id); |
| 896 if (bridge_itr == bridge_id_to_request_id_map_.end()) | 918 if (bridge_itr == bridge_id_to_request_id_map_.end()) |
| 897 return -1; | 919 return browser_plugin::kInvalidPermissionRequestID; |
| 898 | 920 |
| 899 int request_id = bridge_itr->second; | 921 int request_id = bridge_itr->second; |
| 900 bridge_id_to_request_id_map_.erase(bridge_itr); | 922 bridge_id_to_request_id_map_.erase(bridge_itr); |
| 901 return request_id; | 923 return request_id; |
| 902 } | 924 } |
| 903 | 925 |
| 904 void BrowserPluginGuest::CancelGeolocationRequest(int bridge_id) { | 926 void BrowserPluginGuest::CancelGeolocationRequest(int bridge_id) { |
| 905 int request_id = RemoveBridgeID(bridge_id); | 927 int request_id = RemoveBridgeID(bridge_id); |
| 906 RequestMap::iterator request_itr = permission_request_map_.find(request_id); | 928 RequestMap::iterator request_itr = permission_request_map_.find(request_id); |
| 907 if (request_itr == permission_request_map_.end()) | 929 if (request_itr == permission_request_map_.end()) |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 switch (message.type()) { | 1031 switch (message.type()) { |
| 1010 case BrowserPluginHostMsg_BuffersSwappedACK::ID: | 1032 case BrowserPluginHostMsg_BuffersSwappedACK::ID: |
| 1011 case BrowserPluginHostMsg_CompositorFrameACK::ID: | 1033 case BrowserPluginHostMsg_CompositorFrameACK::ID: |
| 1012 case BrowserPluginHostMsg_DragStatusUpdate::ID: | 1034 case BrowserPluginHostMsg_DragStatusUpdate::ID: |
| 1013 case BrowserPluginHostMsg_ExecuteEditCommand::ID: | 1035 case BrowserPluginHostMsg_ExecuteEditCommand::ID: |
| 1014 case BrowserPluginHostMsg_HandleInputEvent::ID: | 1036 case BrowserPluginHostMsg_HandleInputEvent::ID: |
| 1015 case BrowserPluginHostMsg_LockMouse_ACK::ID: | 1037 case BrowserPluginHostMsg_LockMouse_ACK::ID: |
| 1016 case BrowserPluginHostMsg_NavigateGuest::ID: | 1038 case BrowserPluginHostMsg_NavigateGuest::ID: |
| 1017 case BrowserPluginHostMsg_PluginDestroyed::ID: | 1039 case BrowserPluginHostMsg_PluginDestroyed::ID: |
| 1018 case BrowserPluginHostMsg_ResizeGuest::ID: | 1040 case BrowserPluginHostMsg_ResizeGuest::ID: |
| 1019 case BrowserPluginHostMsg_RespondPermission::ID: | |
| 1020 case BrowserPluginHostMsg_SetAutoSize::ID: | 1041 case BrowserPluginHostMsg_SetAutoSize::ID: |
| 1021 case BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent::ID: | 1042 case BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent::ID: |
| 1022 case BrowserPluginHostMsg_SetFocus::ID: | 1043 case BrowserPluginHostMsg_SetFocus::ID: |
| 1023 case BrowserPluginHostMsg_SetName::ID: | 1044 case BrowserPluginHostMsg_SetName::ID: |
| 1024 case BrowserPluginHostMsg_SetVisibility::ID: | 1045 case BrowserPluginHostMsg_SetVisibility::ID: |
| 1025 case BrowserPluginHostMsg_UnlockMouse_ACK::ID: | 1046 case BrowserPluginHostMsg_UnlockMouse_ACK::ID: |
| 1026 case BrowserPluginHostMsg_UpdateGeometry::ID: | 1047 case BrowserPluginHostMsg_UpdateGeometry::ID: |
| 1027 case BrowserPluginHostMsg_UpdateRect_ACK::ID: | 1048 case BrowserPluginHostMsg_UpdateRect_ACK::ID: |
| 1028 return true; | 1049 return true; |
| 1029 default: | 1050 default: |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 pending_lock_request_ = true; | 1254 pending_lock_request_ = true; |
| 1234 base::DictionaryValue request_info; | 1255 base::DictionaryValue request_info; |
| 1235 request_info.Set(browser_plugin::kUserGesture, | 1256 request_info.Set(browser_plugin::kUserGesture, |
| 1236 base::Value::CreateBooleanValue(user_gesture)); | 1257 base::Value::CreateBooleanValue(user_gesture)); |
| 1237 request_info.Set(browser_plugin::kLastUnlockedBySelf, | 1258 request_info.Set(browser_plugin::kLastUnlockedBySelf, |
| 1238 base::Value::CreateBooleanValue(last_unlocked_by_target)); | 1259 base::Value::CreateBooleanValue(last_unlocked_by_target)); |
| 1239 request_info.Set(browser_plugin::kURL, | 1260 request_info.Set(browser_plugin::kURL, |
| 1240 base::Value::CreateStringValue( | 1261 base::Value::CreateStringValue( |
| 1241 web_contents()->GetURL().spec())); | 1262 web_contents()->GetURL().spec())); |
| 1242 | 1263 |
| 1243 RequestPermission(BrowserPluginPermissionTypePointerLock, | 1264 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_POINTER_LOCK, |
| 1244 new PointerLockRequest(this), | 1265 new PointerLockRequest(this), |
| 1245 request_info); | 1266 request_info); |
| 1246 } | 1267 } |
| 1247 | 1268 |
| 1248 void BrowserPluginGuest::OnLockMouseAck(int instance_id, bool succeeded) { | 1269 void BrowserPluginGuest::OnLockMouseAck(int instance_id, bool succeeded) { |
| 1249 Send(new ViewMsg_LockMouse_ACK(routing_id(), succeeded)); | 1270 Send(new ViewMsg_LockMouse_ACK(routing_id(), succeeded)); |
| 1250 pending_lock_request_ = false; | 1271 pending_lock_request_ = false; |
| 1251 if (succeeded) | 1272 if (succeeded) |
| 1252 mouse_locked_ = true; | 1273 mouse_locked_ = true; |
| 1253 } | 1274 } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 } | 1385 } |
| 1365 | 1386 |
| 1366 void BrowserPluginGuest::OnSetVisibility(int instance_id, bool visible) { | 1387 void BrowserPluginGuest::OnSetVisibility(int instance_id, bool visible) { |
| 1367 guest_visible_ = visible; | 1388 guest_visible_ = visible; |
| 1368 if (embedder_visible_ && guest_visible_) | 1389 if (embedder_visible_ && guest_visible_) |
| 1369 GetWebContents()->WasShown(); | 1390 GetWebContents()->WasShown(); |
| 1370 else | 1391 else |
| 1371 GetWebContents()->WasHidden(); | 1392 GetWebContents()->WasHidden(); |
| 1372 } | 1393 } |
| 1373 | 1394 |
| 1374 void BrowserPluginGuest::OnRespondPermission( | |
| 1375 int instance_id, | |
| 1376 int request_id, | |
| 1377 bool should_allow, | |
| 1378 const std::string& user_input) { | |
| 1379 RequestMap::iterator request_itr = permission_request_map_.find(request_id); | |
| 1380 if (request_itr == permission_request_map_.end()) { | |
| 1381 LOG(INFO) << "Not a valid request ID."; | |
| 1382 return; | |
| 1383 } | |
| 1384 request_itr->second->Respond(should_allow, user_input); | |
| 1385 permission_request_map_.erase(request_itr); | |
| 1386 } | |
| 1387 | |
| 1388 void BrowserPluginGuest::OnSwapBuffersACK(int instance_id, | 1395 void BrowserPluginGuest::OnSwapBuffersACK(int instance_id, |
| 1389 int route_id, | 1396 int route_id, |
| 1390 int gpu_host_id, | 1397 int gpu_host_id, |
| 1391 const std::string& mailbox_name, | 1398 const std::string& mailbox_name, |
| 1392 uint32 sync_point) { | 1399 uint32 sync_point) { |
| 1393 AcknowledgeBufferPresent(route_id, gpu_host_id, mailbox_name, sync_point); | 1400 AcknowledgeBufferPresent(route_id, gpu_host_id, mailbox_name, sync_point); |
| 1394 | 1401 |
| 1395 // This is only relevant on MACOSX and WIN when threaded compositing | 1402 // This is only relevant on MACOSX and WIN when threaded compositing |
| 1396 // is not enabled. In threaded mode, above ACK is sufficient. | 1403 // is not enabled. In threaded mode, above ACK is sufficient. |
| 1397 #if defined(OS_MACOSX) || defined(OS_WIN) | 1404 #if defined(OS_MACOSX) || defined(OS_WIN) |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 // Deny the media request. | 1499 // Deny the media request. |
| 1493 callback.Run(MediaStreamDevices(), scoped_ptr<MediaStreamUI>()); | 1500 callback.Run(MediaStreamDevices(), scoped_ptr<MediaStreamUI>()); |
| 1494 return; | 1501 return; |
| 1495 } | 1502 } |
| 1496 | 1503 |
| 1497 base::DictionaryValue request_info; | 1504 base::DictionaryValue request_info; |
| 1498 request_info.Set( | 1505 request_info.Set( |
| 1499 browser_plugin::kURL, | 1506 browser_plugin::kURL, |
| 1500 base::Value::CreateStringValue(request.security_origin.spec())); | 1507 base::Value::CreateStringValue(request.security_origin.spec())); |
| 1501 | 1508 |
| 1502 RequestPermission(BrowserPluginPermissionTypeMedia, | 1509 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_MEDIA, |
| 1503 new MediaRequest(request, callback, this), | 1510 new MediaRequest(request, callback, this), |
| 1504 request_info); | 1511 request_info); |
| 1505 } | 1512 } |
| 1506 | 1513 |
| 1507 void BrowserPluginGuest::RunJavaScriptDialog( | 1514 void BrowserPluginGuest::RunJavaScriptDialog( |
| 1508 WebContents* web_contents, | 1515 WebContents* web_contents, |
| 1509 const GURL& origin_url, | 1516 const GURL& origin_url, |
| 1510 const std::string& accept_lang, | 1517 const std::string& accept_lang, |
| 1511 JavaScriptMessageType javascript_message_type, | 1518 JavaScriptMessageType javascript_message_type, |
| 1512 const string16& message_text, | 1519 const string16& message_text, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1526 browser_plugin::kMessageText, | 1533 browser_plugin::kMessageText, |
| 1527 base::Value::CreateStringValue(UTF16ToUTF8(message_text))); | 1534 base::Value::CreateStringValue(UTF16ToUTF8(message_text))); |
| 1528 request_info.Set( | 1535 request_info.Set( |
| 1529 browser_plugin::kMessageType, | 1536 browser_plugin::kMessageType, |
| 1530 base::Value::CreateStringValue( | 1537 base::Value::CreateStringValue( |
| 1531 JavaScriptMessageTypeToString(javascript_message_type))); | 1538 JavaScriptMessageTypeToString(javascript_message_type))); |
| 1532 request_info.Set( | 1539 request_info.Set( |
| 1533 browser_plugin::kURL, | 1540 browser_plugin::kURL, |
| 1534 base::Value::CreateStringValue(origin_url.spec())); | 1541 base::Value::CreateStringValue(origin_url.spec())); |
| 1535 | 1542 |
| 1536 RequestPermission(BrowserPluginPermissionTypeJavaScriptDialog, | 1543 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_JAVASCRIPT_DIALOG, |
| 1537 new JavaScriptDialogRequest(callback), | 1544 new JavaScriptDialogRequest(callback), |
| 1538 request_info); | 1545 request_info); |
| 1539 } | 1546 } |
| 1540 | 1547 |
| 1541 void BrowserPluginGuest::RunBeforeUnloadDialog( | 1548 void BrowserPluginGuest::RunBeforeUnloadDialog( |
| 1542 WebContents* web_contents, | 1549 WebContents* web_contents, |
| 1543 const string16& message_text, | 1550 const string16& message_text, |
| 1544 bool is_reload, | 1551 bool is_reload, |
| 1545 const DialogClosedCallback& callback) { | 1552 const DialogClosedCallback& callback) { |
| 1546 // This is called if the guest has a beforeunload event handler. | 1553 // This is called if the guest has a beforeunload event handler. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1623 if (url.empty()) { | 1630 if (url.empty()) { |
| 1624 callback.Run(false); | 1631 callback.Run(false); |
| 1625 return; | 1632 return; |
| 1626 } | 1633 } |
| 1627 | 1634 |
| 1628 base::DictionaryValue request_info; | 1635 base::DictionaryValue request_info; |
| 1629 request_info.Set(browser_plugin::kRequestMethod, | 1636 request_info.Set(browser_plugin::kRequestMethod, |
| 1630 base::Value::CreateStringValue(request_method)); | 1637 base::Value::CreateStringValue(request_method)); |
| 1631 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); | 1638 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); |
| 1632 | 1639 |
| 1633 RequestPermission(BrowserPluginPermissionTypeDownload, | 1640 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, |
| 1634 new DownloadRequest(callback), | 1641 new DownloadRequest(callback), |
| 1635 request_info); | 1642 request_info); |
| 1636 } | 1643 } |
| 1637 | 1644 |
| 1638 } // namespace content | 1645 } // namespace content |
| OLD | NEW |