summaryrefslogtreecommitdiffstats
path: root/device
diff options
context:
space:
mode:
authorrockot <rockot@chromium.org>2015-09-01 15:03:00 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-01 22:03:24 +0000
commit18369ddc65d93216f97c2cd86633692a9c061489 (patch)
treea9f36dfdd1490549678b6bbe373a672304108a1a /device
parent037f8fdb34fc72d62d3a78893dc143d870b0d7e5 (diff)
downloadchromium_src-18369ddc65d93216f97c2cd86633692a9c061489.zip
chromium_src-18369ddc65d93216f97c2cd86633692a9c061489.tar.gz
chromium_src-18369ddc65d93216f97c2cd86633692a9c061489.tar.bz2
Remove localhost from devices app whitelist
This removes localhost from the devices app's hardcoded whitelist of origins which may access all USB devices. BUG=None R=reillyg@chromium.org Review URL: https://codereview.chromium.org/1324873003 Cr-Commit-Position: refs/heads/master@{#346748}
Diffstat (limited to 'device')
-rw-r--r--device/devices_app/devices_app.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/device/devices_app/devices_app.cc b/device/devices_app/devices_app.cc
index 19f7ed8..1531651 100644
--- a/device/devices_app/devices_app.cc
+++ b/device/devices_app/devices_app.cc
@@ -30,6 +30,9 @@ const int64 kIdleTimeoutInSeconds = 10;
// A usb::DeviceManagerDelegate implementation which provides origin-based
// device access control.
+//
+// TODO(rockot/reillyg): We should just get rid of DeviceManagerDelegate, or
+// at least repurpose it as test support to provide device mocks.
class USBDeviceManagerDelegate : public usb::DeviceManagerDelegate {
public:
explicit USBDeviceManagerDelegate(const GURL& remote_url)
@@ -39,17 +42,10 @@ class USBDeviceManagerDelegate : public usb::DeviceManagerDelegate {
private:
// usb::DeviceManagerDelegate:
bool IsDeviceAllowed(const usb::DeviceInfo& device) override {
- // Limited set of conditions to allow localhost connection for testing. This
- // does not presume to catch all common local host strings.
- if (remote_url_.host() == "127.0.0.1" || remote_url_.host() == "localhost")
- return true;
-
// Also let browser apps and mojo apptests talk to all devices.
if (remote_url_.SchemeIs("system") ||
remote_url_ == GURL("mojo://devices_apptests/"))
return true;
-
- // TODO(rockot/reillyg): Implement origin-based device access control.
return false;
}