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

Unified Diff: components/policy/core/common/cloud/device_management_service.cc

Issue 2514263004: Add DCHECK() for invalid URL in DeviceManagementService::StartJob() (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/common/cloud/device_management_service.cc
diff --git a/components/policy/core/common/cloud/device_management_service.cc b/components/policy/core/common/cloud/device_management_service.cc
index 24fa9c120bfb8e023a3ab47b6075ad1811c89578..30e26c3a38a3e70553ba8397025d31f93a124dfd 100644
--- a/components/policy/core/common/cloud/device_management_service.cc
+++ b/components/policy/core/common/cloud/device_management_service.cc
@@ -578,10 +578,13 @@ DeviceManagementService::DeviceManagementService(
void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job) {
DCHECK(thread_checker_.CalledOnValidThread());
- std::string server_url = GetServerUrl();
+ GURL url = job->GetURL(GetServerUrl());
+ DCHECK(url.is_valid()) << "Maybe invalid --device-management-url was passed?";
+
net::URLFetcher* fetcher =
- net::URLFetcher::Create(kURLFetcherID, job->GetURL(server_url),
- net::URLFetcher::POST, this).release();
+ net::URLFetcher::Create(kURLFetcherID, std::move(url),
+ net::URLFetcher::POST, this)
+ .release();
data_use_measurement::DataUseUserData::AttachToFetcher(
fetcher, data_use_measurement::DataUseUserData::POLICY);
job->ConfigureRequest(fetcher);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698