Chromium Code Reviews| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 | 54 |
| 55 namespace content { | 55 namespace content { |
| 56 | 56 |
| 57 // static | 57 // static |
| 58 BrowserPluginHostFactory* BrowserPluginGuest::factory_ = NULL; | 58 BrowserPluginHostFactory* BrowserPluginGuest::factory_ = NULL; |
| 59 | 59 |
| 60 // Parent class for the various types of permission requests, each of which | 60 // Parent class for the various types of permission requests, each of which |
| 61 // should be able to handle the response to their permission request. | 61 // should be able to handle the response to their permission request. |
| 62 class BrowserPluginGuest::PermissionRequest { | 62 class BrowserPluginGuest::PermissionRequest { |
| 63 public: | 63 public: |
| 64 virtual void Respond(bool should_allow) = 0; | 64 virtual void Respond(bool should_allow, const std::string& user_input) = 0; |
| 65 virtual ~PermissionRequest() {} | 65 virtual ~PermissionRequest() {} |
| 66 virtual BrowserPluginPermissionType GetType() const = 0; | 66 virtual BrowserPluginPermissionType GetType() const = 0; |
| 67 protected: | 67 protected: |
| 68 PermissionRequest() { | 68 PermissionRequest() { |
| 69 RecordAction(UserMetricsAction("BrowserPlugin.Guest.PermissionRequest")); | 69 RecordAction(UserMetricsAction("BrowserPlugin.Guest.PermissionRequest")); |
| 70 } | 70 } |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 class BrowserPluginGuest::DownloadRequest : public PermissionRequest { | 73 class BrowserPluginGuest::DownloadRequest : public PermissionRequest { |
| 74 public: | 74 public: |
| 75 explicit DownloadRequest(base::Callback<void(bool)> callback) | 75 explicit DownloadRequest(base::Callback<void(bool)> callback) |
| 76 : callback_(callback) { | 76 : callback_(callback) { |
| 77 RecordAction( | 77 RecordAction( |
| 78 UserMetricsAction("BrowserPlugin.Guest.PermissionRequest.Download")); | 78 UserMetricsAction("BrowserPlugin.Guest.PermissionRequest.Download")); |
| 79 } | 79 } |
| 80 | 80 virtual void Respond(bool should_allow, |
| 81 virtual void Respond(bool should_allow) OVERRIDE { | 81 const std::string& user_input) OVERRIDE { |
| 82 callback_.Run(should_allow); | 82 callback_.Run(should_allow); |
| 83 } | 83 } |
| 84 | 84 |
| 85 virtual BrowserPluginPermissionType GetType() const OVERRIDE { | 85 virtual BrowserPluginPermissionType GetType() const OVERRIDE { |
| 86 return BrowserPluginPermissionTypeDownload; | 86 return BrowserPluginPermissionTypeDownload; |
| 87 } | 87 } |
| 88 | 88 |
| 89 virtual ~DownloadRequest() {} | 89 virtual ~DownloadRequest() {} |
| 90 private: | 90 private: |
| 91 base::Callback<void(bool)> callback_; | 91 base::Callback<void(bool)> callback_; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 class BrowserPluginGuest::GeolocationRequest : public PermissionRequest { | 94 class BrowserPluginGuest::GeolocationRequest : public PermissionRequest { |
| 95 public: | 95 public: |
| 96 GeolocationRequest(GeolocationCallback callback, | 96 GeolocationRequest(GeolocationCallback callback, |
| 97 int bridge_id, | 97 int bridge_id, |
| 98 BrowserPluginGuest* guest, | 98 BrowserPluginGuest* guest, |
| 99 base::WeakPtrFactory<BrowserPluginGuest>* weak_ptr_factory) | 99 base::WeakPtrFactory<BrowserPluginGuest>* weak_ptr_factory) |
| 100 : callback_(callback), | 100 : callback_(callback), |
| 101 bridge_id_(bridge_id), | 101 bridge_id_(bridge_id), |
| 102 guest_(guest), | 102 guest_(guest), |
| 103 weak_ptr_factory_(weak_ptr_factory) { | 103 weak_ptr_factory_(weak_ptr_factory) { |
| 104 RecordAction( | 104 RecordAction( |
| 105 UserMetricsAction("BrowserPlugin.Guest.PermissionRequest.Geolocation")); | 105 UserMetricsAction("BrowserPlugin.Guest.PermissionRequest.Geolocation")); |
| 106 } | 106 } |
| 107 | 107 |
| 108 virtual void Respond(bool should_allow) OVERRIDE { | 108 virtual void Respond(bool should_allow, |
| 109 const std::string& user_input) OVERRIDE { | |
| 109 WebContents* web_contents = guest_->embedder_web_contents(); | 110 WebContents* web_contents = guest_->embedder_web_contents(); |
| 110 if (should_allow && web_contents) { | 111 if (should_allow && web_contents) { |
| 111 // If renderer side embedder decides to allow gelocation, we need to check | 112 // If renderer side embedder decides to allow gelocation, we need to check |
| 112 // if the app/embedder itself has geolocation access. | 113 // if the app/embedder itself has geolocation access. |
| 113 BrowserContext* browser_context = web_contents->GetBrowserContext(); | 114 BrowserContext* browser_context = web_contents->GetBrowserContext(); |
| 114 if (browser_context) { | 115 if (browser_context) { |
| 115 GeolocationPermissionContext* geolocation_context = | 116 GeolocationPermissionContext* geolocation_context = |
| 116 browser_context->GetGeolocationPermissionContext(); | 117 browser_context->GetGeolocationPermissionContext(); |
| 117 if (geolocation_context) { | 118 if (geolocation_context) { |
| 118 base::Callback<void(bool)> geolocation_callback = base::Bind( | 119 base::Callback<void(bool)> geolocation_callback = base::Bind( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 MediaRequest(const MediaStreamRequest& request, | 155 MediaRequest(const MediaStreamRequest& request, |
| 155 const MediaResponseCallback& callback, | 156 const MediaResponseCallback& callback, |
| 156 BrowserPluginGuest* guest) | 157 BrowserPluginGuest* guest) |
| 157 : request_(request), | 158 : request_(request), |
| 158 callback_(callback), | 159 callback_(callback), |
| 159 guest_(guest) { | 160 guest_(guest) { |
| 160 RecordAction( | 161 RecordAction( |
| 161 UserMetricsAction("BrowserPlugin.Guest.PermissionRequest.Media")); | 162 UserMetricsAction("BrowserPlugin.Guest.PermissionRequest.Media")); |
| 162 } | 163 } |
| 163 | 164 |
| 164 virtual void Respond(bool should_allow) OVERRIDE { | 165 virtual void Respond(bool should_allow, |
| 166 const std::string& user_input) OVERRIDE { | |
| 165 WebContentsImpl* web_contents = guest_->embedder_web_contents(); | 167 WebContentsImpl* web_contents = guest_->embedder_web_contents(); |
| 166 if (should_allow && web_contents) { | 168 if (should_allow && web_contents) { |
| 167 // Re-route the request to the embedder's WebContents; the guest gets the | 169 // Re-route the request to the embedder's WebContents; the guest gets the |
| 168 // permission this way. | 170 // permission this way. |
| 169 web_contents->RequestMediaAccessPermission(request_, callback_); | 171 web_contents->RequestMediaAccessPermission(request_, callback_); |
| 170 } else { | 172 } else { |
| 171 // Deny the request. | 173 // Deny the request. |
| 172 callback_.Run(MediaStreamDevices(), scoped_ptr<MediaStreamUI>()); | 174 callback_.Run(MediaStreamDevices(), scoped_ptr<MediaStreamUI>()); |
| 173 } | 175 } |
| 174 } | 176 } |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 186 | 188 |
| 187 class BrowserPluginGuest::NewWindowRequest : public PermissionRequest { | 189 class BrowserPluginGuest::NewWindowRequest : public PermissionRequest { |
| 188 public: | 190 public: |
| 189 NewWindowRequest(int instance_id, BrowserPluginGuest* guest) | 191 NewWindowRequest(int instance_id, BrowserPluginGuest* guest) |
| 190 : instance_id_(instance_id), | 192 : instance_id_(instance_id), |
| 191 guest_(guest) { | 193 guest_(guest) { |
| 192 RecordAction( | 194 RecordAction( |
| 193 UserMetricsAction("BrowserPlugin.Guest.PermissionRequest.NewWindow")); | 195 UserMetricsAction("BrowserPlugin.Guest.PermissionRequest.NewWindow")); |
| 194 } | 196 } |
| 195 | 197 |
| 196 virtual void Respond(bool should_allow) OVERRIDE { | 198 virtual void Respond(bool should_allow, |
| 199 const std::string& user_input) OVERRIDE { | |
| 197 int embedder_render_process_id = | 200 int embedder_render_process_id = |
| 198 guest_->embedder_web_contents()->GetRenderProcessHost()->GetID(); | 201 guest_->embedder_web_contents()->GetRenderProcessHost()->GetID(); |
| 199 BrowserPluginGuest* guest = | 202 BrowserPluginGuest* guest = |
| 200 guest_->GetWebContents()->GetBrowserPluginGuestManager()-> | 203 guest_->GetWebContents()->GetBrowserPluginGuestManager()-> |
| 201 GetGuestByInstanceID(instance_id_, embedder_render_process_id); | 204 GetGuestByInstanceID(instance_id_, embedder_render_process_id); |
| 202 if (!guest) { | 205 if (!guest) { |
| 203 LOG(INFO) << "Guest not found. Instance ID: " << instance_id_; | 206 LOG(INFO) << "Guest not found. Instance ID: " << instance_id_; |
| 204 return; | 207 return; |
| 205 } | 208 } |
| 206 | 209 |
| 207 // If we do not destroy the guest then we allow the new window. | 210 // If we do not destroy the guest then we allow the new window. |
| 208 if (!should_allow) | 211 if (!should_allow) |
| 209 guest->Destroy(); | 212 guest->Destroy(); |
| 210 } | 213 } |
| 211 | 214 |
| 212 virtual BrowserPluginPermissionType GetType() const OVERRIDE { | 215 virtual BrowserPluginPermissionType GetType() const OVERRIDE { |
| 213 return BrowserPluginPermissionTypeNewWindow; | 216 return BrowserPluginPermissionTypeNewWindow; |
| 214 } | 217 } |
| 215 | 218 |
| 216 virtual ~NewWindowRequest() {} | 219 virtual ~NewWindowRequest() {} |
| 217 private: | 220 private: |
| 218 int instance_id_; | 221 int instance_id_; |
| 219 BrowserPluginGuest* guest_; | 222 BrowserPluginGuest* guest_; |
| 220 }; | 223 }; |
| 221 | 224 |
| 225 class BrowserPluginGuest::JavaScriptDialogRequest : public PermissionRequest { | |
| 226 public: | |
| 227 JavaScriptDialogRequest(const DialogClosedCallback& callback) | |
| 228 : callback_(callback) { | |
| 229 RecordAction( | |
| 230 UserMetricsAction( | |
| 231 "BrowserPlugin.Guest.PermissionRequest.JavaScriptDialog")); | |
| 232 } | |
| 233 | |
| 234 virtual void Respond(bool should_allow, | |
| 235 const std::string& user_input) OVERRIDE { | |
| 236 callback_.Run(should_allow, UTF8ToUTF16(user_input)); | |
| 237 } | |
| 238 | |
| 239 virtual BrowserPluginPermissionType GetType() const OVERRIDE { | |
| 240 return BrowserPluginPermissionTypeJavaScriptDialog; | |
| 241 } | |
| 242 | |
| 243 virtual ~JavaScriptDialogRequest() {} | |
| 244 private: | |
|
lazyboy
2013/07/23 18:45:01
Indent
Fady Samuel
2013/07/23 19:40:52
Done.
| |
| 245 DialogClosedCallback callback_; | |
| 246 }; | |
| 247 | |
| 222 class BrowserPluginGuest::PointerLockRequest : public PermissionRequest { | 248 class BrowserPluginGuest::PointerLockRequest : public PermissionRequest { |
| 223 public: | 249 public: |
| 224 PointerLockRequest(BrowserPluginGuest* guest) | 250 PointerLockRequest(BrowserPluginGuest* guest) |
| 225 : guest_(guest) { | 251 : guest_(guest) { |
| 226 RecordAction( | 252 RecordAction( |
| 227 UserMetricsAction("BrowserPlugin.Guest.PermissionRequest.PointerLock")); | 253 UserMetricsAction("BrowserPlugin.Guest.PermissionRequest.PointerLock")); |
| 228 } | 254 } |
| 229 | 255 |
| 230 virtual void Respond(bool should_allow) OVERRIDE { | 256 virtual void Respond(bool should_allow, |
| 257 const std::string& user_input) OVERRIDE { | |
| 231 guest_->SendMessageToEmbedder( | 258 guest_->SendMessageToEmbedder( |
| 232 new BrowserPluginMsg_SetMouseLock(guest_->instance_id(), should_allow)); | 259 new BrowserPluginMsg_SetMouseLock(guest_->instance_id(), should_allow)); |
| 233 } | 260 } |
| 234 | 261 |
| 235 virtual BrowserPluginPermissionType GetType() const OVERRIDE { | 262 virtual BrowserPluginPermissionType GetType() const OVERRIDE { |
| 236 return BrowserPluginPermissionTypePointerLock; | 263 return BrowserPluginPermissionTypePointerLock; |
| 237 } | 264 } |
| 238 | 265 |
| 239 virtual ~PointerLockRequest() {} | 266 virtual ~PointerLockRequest() {} |
| 240 private: | 267 private: |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 260 case NEW_WINDOW: | 287 case NEW_WINDOW: |
| 261 return "new_window"; | 288 return "new_window"; |
| 262 case NEW_POPUP: | 289 case NEW_POPUP: |
| 263 return "new_popup"; | 290 return "new_popup"; |
| 264 default: | 291 default: |
| 265 NOTREACHED() << "Unknown Window Open Disposition"; | 292 NOTREACHED() << "Unknown Window Open Disposition"; |
| 266 return "ignore"; | 293 return "ignore"; |
| 267 } | 294 } |
| 268 } | 295 } |
| 269 | 296 |
| 297 static std::string JavaScriptMessageTypeToString( | |
| 298 JavaScriptMessageType message_type) { | |
| 299 switch (message_type) { | |
| 300 case JAVASCRIPT_MESSAGE_TYPE_ALERT: | |
|
lazyboy
2013/07/23 18:45:01
Fix indent.
Fady Samuel
2013/07/23 19:40:52
Done.
| |
| 301 return "alert"; | |
| 302 case JAVASCRIPT_MESSAGE_TYPE_CONFIRM: | |
| 303 return "confirm"; | |
| 304 case JAVASCRIPT_MESSAGE_TYPE_PROMPT: | |
| 305 return "prompt"; | |
| 306 default: | |
| 307 NOTREACHED() << "Unknown JavaScript Message Type."; | |
| 308 return "unknown"; | |
| 309 } | |
| 310 } | |
| 311 | |
| 270 // Called on IO thread. | 312 // Called on IO thread. |
| 271 static std::string RetrieveDownloadURLFromRequestId( | 313 static std::string RetrieveDownloadURLFromRequestId( |
| 272 RenderViewHost* render_view_host, | 314 RenderViewHost* render_view_host, |
| 273 int url_request_id) { | 315 int url_request_id) { |
| 274 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 316 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 275 | 317 |
| 276 int render_process_id = render_view_host->GetProcess()->GetID(); | 318 int render_process_id = render_view_host->GetProcess()->GetID(); |
| 277 GlobalRequestID global_id(render_process_id, url_request_id); | 319 GlobalRequestID global_id(render_process_id, url_request_id); |
| 278 net::URLRequest* url_request = | 320 net::URLRequest* url_request = |
| 279 ResourceDispatcherHostImpl::Get()->GetURLRequest(global_id); | 321 ResourceDispatcherHostImpl::Get()->GetURLRequest(global_id); |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 604 permission_request_id)); | 646 permission_request_id)); |
| 605 } | 647 } |
| 606 | 648 |
| 607 void BrowserPluginGuest::CloseContents(WebContents* source) { | 649 void BrowserPluginGuest::CloseContents(WebContents* source) { |
| 608 if (!delegate_) | 650 if (!delegate_) |
| 609 return; | 651 return; |
| 610 | 652 |
| 611 delegate_->Close(); | 653 delegate_->Close(); |
| 612 } | 654 } |
| 613 | 655 |
| 656 JavaScriptDialogManager* BrowserPluginGuest::GetJavaScriptDialogManager() { | |
| 657 return this; | |
| 658 } | |
| 659 | |
| 614 bool BrowserPluginGuest::HandleContextMenu(const ContextMenuParams& params) { | 660 bool BrowserPluginGuest::HandleContextMenu(const ContextMenuParams& params) { |
| 615 // TODO(fsamuel): We show the regular page context menu handler for now until | 661 // TODO(fsamuel): We show the regular page context menu handler for now until |
| 616 // we implement the Apps Context Menu API for Browser Plugin (see | 662 // we implement the Apps Context Menu API for Browser Plugin (see |
| 617 // http://crbug.com/140315). | 663 // http://crbug.com/140315). |
| 618 return false; // Will be handled by WebContentsViewGuest. | 664 return false; // Will be handled by WebContentsViewGuest. |
| 619 } | 665 } |
| 620 | 666 |
| 621 void BrowserPluginGuest::HandleKeyboardEvent( | 667 void BrowserPluginGuest::HandleKeyboardEvent( |
| 622 WebContents* source, | 668 WebContents* source, |
| 623 const NativeWebKeyboardEvent& event) { | 669 const NativeWebKeyboardEvent& event) { |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1337 guest_visible_ = visible; | 1383 guest_visible_ = visible; |
| 1338 if (embedder_visible_ && guest_visible_) | 1384 if (embedder_visible_ && guest_visible_) |
| 1339 GetWebContents()->WasShown(); | 1385 GetWebContents()->WasShown(); |
| 1340 else | 1386 else |
| 1341 GetWebContents()->WasHidden(); | 1387 GetWebContents()->WasHidden(); |
| 1342 } | 1388 } |
| 1343 | 1389 |
| 1344 void BrowserPluginGuest::OnRespondPermission( | 1390 void BrowserPluginGuest::OnRespondPermission( |
| 1345 int instance_id, | 1391 int instance_id, |
| 1346 int request_id, | 1392 int request_id, |
| 1347 bool should_allow) { | 1393 bool should_allow, |
| 1394 const std::string& user_input) { | |
| 1348 RequestMap::iterator request_itr = permission_request_map_.find(request_id); | 1395 RequestMap::iterator request_itr = permission_request_map_.find(request_id); |
| 1349 if (request_itr == permission_request_map_.end()) { | 1396 if (request_itr == permission_request_map_.end()) { |
| 1350 LOG(INFO) << "Not a valid request ID."; | 1397 LOG(INFO) << "Not a valid request ID."; |
| 1351 return; | 1398 return; |
| 1352 } | 1399 } |
| 1353 BrowserPluginPermissionType permission_type = request_itr->second->GetType(); | 1400 BrowserPluginPermissionType permission_type = request_itr->second->GetType(); |
| 1354 request_itr->second->Respond(should_allow); | 1401 request_itr->second->Respond(should_allow, user_input); |
| 1355 | 1402 |
| 1356 // Geolocation requests have to hang around for a while, so we don't delete | 1403 // Geolocation requests have to hang around for a while, so we don't delete |
| 1357 // them here. | 1404 // them here. |
| 1358 if (permission_type != BrowserPluginPermissionTypeGeolocation) { | 1405 if (permission_type != BrowserPluginPermissionTypeGeolocation) { |
| 1359 delete request_itr->second; | 1406 delete request_itr->second; |
| 1360 permission_request_map_.erase(request_itr); | 1407 permission_request_map_.erase(request_itr); |
| 1361 } | 1408 } |
| 1362 } | 1409 } |
| 1363 | 1410 |
| 1364 void BrowserPluginGuest::OnSwapBuffersACK(int instance_id, | 1411 void BrowserPluginGuest::OnSwapBuffersACK(int instance_id, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1472 | 1519 |
| 1473 base::DictionaryValue request_info; | 1520 base::DictionaryValue request_info; |
| 1474 request_info.Set( | 1521 request_info.Set( |
| 1475 browser_plugin::kURL, | 1522 browser_plugin::kURL, |
| 1476 base::Value::CreateStringValue(request.security_origin.spec())); | 1523 base::Value::CreateStringValue(request.security_origin.spec())); |
| 1477 SendMessageToEmbedder(new BrowserPluginMsg_RequestPermission( | 1524 SendMessageToEmbedder(new BrowserPluginMsg_RequestPermission( |
| 1478 instance_id(), BrowserPluginPermissionTypeMedia, | 1525 instance_id(), BrowserPluginPermissionTypeMedia, |
| 1479 request_id, request_info)); | 1526 request_id, request_info)); |
| 1480 } | 1527 } |
| 1481 | 1528 |
| 1529 void BrowserPluginGuest::RunJavaScriptDialog( | |
| 1530 WebContents* web_contents, | |
| 1531 const GURL& origin_url, | |
| 1532 const std::string& accept_lang, | |
| 1533 JavaScriptMessageType javascript_message_type, | |
| 1534 const string16& message_text, | |
| 1535 const string16& default_prompt_text, | |
| 1536 const DialogClosedCallback& callback, | |
| 1537 bool* did_suppress_message) { | |
| 1538 if (permission_request_map_.size() >= kNumMaxOutstandingPermissionRequests) { | |
| 1539 // Cancel the dialog. | |
| 1540 callback.Run(false, string16()); | |
| 1541 return; | |
| 1542 } | |
| 1543 int request_id = next_permission_request_id_++; | |
| 1544 permission_request_map_[request_id] = new JavaScriptDialogRequest(callback); | |
| 1545 base::DictionaryValue request_info; | |
| 1546 request_info.Set( | |
| 1547 browser_plugin::kDefaultPromptText, | |
| 1548 base::Value::CreateStringValue(UTF16ToUTF8(default_prompt_text))); | |
| 1549 request_info.Set( | |
| 1550 browser_plugin::kMessageText, | |
| 1551 base::Value::CreateStringValue(UTF16ToUTF8(message_text))); | |
| 1552 request_info.Set( | |
| 1553 browser_plugin::kMessageType, | |
| 1554 base::Value::CreateStringValue( | |
| 1555 JavaScriptMessageTypeToString(javascript_message_type))); | |
| 1556 request_info.Set( | |
| 1557 browser_plugin::kURL, | |
| 1558 base::Value::CreateStringValue(origin_url.spec())); | |
| 1559 SendMessageToEmbedder(new BrowserPluginMsg_RequestPermission( | |
| 1560 instance_id(), BrowserPluginPermissionTypeJavaScriptDialog, | |
| 1561 request_id, request_info)); | |
| 1562 } | |
| 1563 | |
| 1564 void BrowserPluginGuest::RunBeforeUnloadDialog( | |
| 1565 WebContents* web_contents, | |
| 1566 const string16& message_text, | |
| 1567 bool is_reload, | |
| 1568 const DialogClosedCallback& callback) { | |
| 1569 // This is called if the guest has a beforeunload event handler. | |
|
lazyboy
2013/07/23 18:45:01
Can you also say what happens when callbark.Run is
Fady Samuel
2013/07/23 19:40:52
Done.
| |
| 1570 callback.Run(true, string16()); | |
| 1571 } | |
| 1572 | |
| 1573 bool BrowserPluginGuest::HandleJavaScriptDialog( | |
| 1574 WebContents* web_contents, | |
| 1575 bool accept, | |
| 1576 const string16* prompt_override) { | |
| 1577 return false; | |
| 1578 } | |
| 1579 | |
| 1580 void BrowserPluginGuest::ResetJavaScriptState(WebContents* web_contents) { | |
| 1581 } | |
| 1582 | |
| 1482 void BrowserPluginGuest::OnUpdateRect( | 1583 void BrowserPluginGuest::OnUpdateRect( |
| 1483 const ViewHostMsg_UpdateRect_Params& params) { | 1584 const ViewHostMsg_UpdateRect_Params& params) { |
| 1484 BrowserPluginMsg_UpdateRect_Params relay_params; | 1585 BrowserPluginMsg_UpdateRect_Params relay_params; |
| 1485 relay_params.view_size = params.view_size; | 1586 relay_params.view_size = params.view_size; |
| 1486 relay_params.scale_factor = params.scale_factor; | 1587 relay_params.scale_factor = params.scale_factor; |
| 1487 relay_params.is_resize_ack = ViewHostMsg_UpdateRect_Flags::is_resize_ack( | 1588 relay_params.is_resize_ack = ViewHostMsg_UpdateRect_Flags::is_resize_ack( |
| 1488 params.flags); | 1589 params.flags); |
| 1489 relay_params.needs_ack = params.needs_ack; | 1590 relay_params.needs_ack = params.needs_ack; |
| 1490 | 1591 |
| 1491 // HW accelerated case, acknowledge resize only | 1592 // HW accelerated case, acknowledge resize only |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1531 | 1632 |
| 1532 SendMessageToEmbedder( | 1633 SendMessageToEmbedder( |
| 1533 new BrowserPluginMsg_UpdateRect(instance_id(), relay_params)); | 1634 new BrowserPluginMsg_UpdateRect(instance_id(), relay_params)); |
| 1534 } | 1635 } |
| 1535 | 1636 |
| 1536 void BrowserPluginGuest::DidRetrieveDownloadURLFromRequestId( | 1637 void BrowserPluginGuest::DidRetrieveDownloadURLFromRequestId( |
| 1537 const std::string& request_method, | 1638 const std::string& request_method, |
| 1538 int permission_request_id, | 1639 int permission_request_id, |
| 1539 const std::string& url) { | 1640 const std::string& url) { |
| 1540 if (url.empty()) { | 1641 if (url.empty()) { |
| 1541 OnRespondPermission(instance_id(), permission_request_id, false); | 1642 OnRespondPermission(instance_id(), permission_request_id, |
| 1643 false, std::string()); | |
| 1542 return; | 1644 return; |
| 1543 } | 1645 } |
| 1544 | 1646 |
| 1545 base::DictionaryValue request_info; | 1647 base::DictionaryValue request_info; |
| 1546 request_info.Set(browser_plugin::kRequestMethod, | 1648 request_info.Set(browser_plugin::kRequestMethod, |
| 1547 base::Value::CreateStringValue(request_method)); | 1649 base::Value::CreateStringValue(request_method)); |
| 1548 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); | 1650 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); |
| 1549 | 1651 |
| 1550 SendMessageToEmbedder( | 1652 SendMessageToEmbedder( |
| 1551 new BrowserPluginMsg_RequestPermission(instance_id(), | 1653 new BrowserPluginMsg_RequestPermission(instance_id(), |
| 1552 BrowserPluginPermissionTypeDownload, permission_request_id, | 1654 BrowserPluginPermissionTypeDownload, permission_request_id, |
| 1553 request_info)); | 1655 request_info)); |
| 1554 } | 1656 } |
| 1555 | 1657 |
| 1556 } // namespace content | 1658 } // namespace content |
| OLD | NEW |