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