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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 void BrowserPluginGuest::OnLockMouseAck(int instance_id, bool succeeded) { | 1334 void BrowserPluginGuest::OnLockMouseAck(int instance_id, bool succeeded) { |
1335 Send(new ViewMsg_LockMouse_ACK(routing_id(), succeeded)); | 1335 Send(new ViewMsg_LockMouse_ACK(routing_id(), succeeded)); |
1336 pending_lock_request_ = false; | 1336 pending_lock_request_ = false; |
1337 if (succeeded) | 1337 if (succeeded) |
1338 mouse_locked_ = true; | 1338 mouse_locked_ = true; |
1339 } | 1339 } |
1340 | 1340 |
1341 void BrowserPluginGuest::OnNavigateGuest( | 1341 void BrowserPluginGuest::OnNavigateGuest( |
1342 int instance_id, | 1342 int instance_id, |
1343 const std::string& src) { | 1343 const std::string& src) { |
1344 GURL url(src); | 1344 GURL url = delegate_ ? delegate_->ResolveURL(src) : GURL(src); |
1345 // We do not load empty urls in web_contents. | 1345 // We do not load empty urls in web_contents. |
1346 // If a guest sets empty src attribute after it has navigated to some | 1346 // If a guest sets empty src attribute after it has navigated to some |
1347 // non-empty page, the action is considered no-op. This empty src navigation | 1347 // non-empty page, the action is considered no-op. This empty src navigation |
1348 // should never be sent to BrowserPluginGuest (browser process). | 1348 // should never be sent to BrowserPluginGuest (browser process). |
1349 DCHECK(!src.empty()); | 1349 DCHECK(!src.empty()); |
1350 if (src.empty()) | 1350 if (src.empty()) |
1351 return; | 1351 return; |
1352 | 1352 |
1353 // Do not allow navigating a guest to schemes other than known safe schemes. | 1353 // Do not allow navigating a guest to schemes other than known safe schemes. |
1354 // This will block the embedder trying to load unwanted schemes, e.g. | 1354 // This will block the embedder trying to load unwanted schemes, e.g. |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 request_info.Set(browser_plugin::kRequestMethod, | 1731 request_info.Set(browser_plugin::kRequestMethod, |
1732 base::Value::CreateStringValue(request_method)); | 1732 base::Value::CreateStringValue(request_method)); |
1733 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); | 1733 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); |
1734 | 1734 |
1735 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, | 1735 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, |
1736 new DownloadRequest(callback), | 1736 new DownloadRequest(callback), |
1737 request_info); | 1737 request_info); |
1738 } | 1738 } |
1739 | 1739 |
1740 } // namespace content | 1740 } // namespace content |
OLD | NEW |