Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2699)

Unified Diff: chrome/browser/media/router/discovery/dial/dial_device_data.cc

Issue 2701633002: [Media Router] Add DialMediaSinkService and DeviceDescriptionService (Closed)
Patch Set: fix chromeos compile error Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/router/discovery/dial/dial_device_data.cc
diff --git a/chrome/browser/media/router/discovery/dial/dial_device_data.cc b/chrome/browser/media/router/discovery/dial/dial_device_data.cc
index c130b834a586cbc3eb188a860a7174748dde1764..56ca2136da8726a50822cc014ab63fed1850e465 100644
--- a/chrome/browser/media/router/discovery/dial/dial_device_data.cc
+++ b/chrome/browser/media/router/discovery/dial/dial_device_data.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "chrome/browser/media/router/discovery/dial/dial_device_data.h"
+#include "net/base/ip_address.h"
namespace media_router {
@@ -31,7 +32,16 @@ void DialDeviceData::set_device_description_url(const GURL& url) {
// static
bool DialDeviceData::IsDeviceDescriptionUrl(const GURL& url) {
- return url.is_valid() && !url.is_empty() && url.SchemeIsHTTPOrHTTPS();
+ if (!url.is_valid() || url.is_empty() || !url.SchemeIsHTTPOrHTTPS())
+ return false;
+
+ net::IPAddress address;
+ if (!net::ParseURLHostnameToAddress(url.host(), &address))
+ return false;
+
+ // TODO(crbug.com/679432): check that this IP address matches the address that
+ // we received the SSDP advertisement from.
+ return address.IsReserved();
}
bool DialDeviceData::UpdateFrom(const DialDeviceData& new_data) {

Powered by Google App Engine
This is Rietveld 408576698