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

Side by Side 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 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/policy/core/common/cloud/device_management_service.h" 5 #include "components/policy/core/common/cloud/device_management_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 : configuration_(std::move(configuration)), 571 : configuration_(std::move(configuration)),
572 initialized_(false), 572 initialized_(false),
573 task_runner_(base::ThreadTaskRunnerHandle::Get()), 573 task_runner_(base::ThreadTaskRunnerHandle::Get()),
574 weak_ptr_factory_(this) { 574 weak_ptr_factory_(this) {
575 DCHECK(configuration_); 575 DCHECK(configuration_);
576 } 576 }
577 577
578 void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job) { 578 void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job) {
579 DCHECK(thread_checker_.CalledOnValidThread()); 579 DCHECK(thread_checker_.CalledOnValidThread());
580 580
581 std::string server_url = GetServerUrl(); 581 GURL url = job->GetURL(GetServerUrl());
582 DCHECK(url.is_valid()) << "Maybe invalid --device-management-url was passed?";
583
582 net::URLFetcher* fetcher = 584 net::URLFetcher* fetcher =
583 net::URLFetcher::Create(kURLFetcherID, job->GetURL(server_url), 585 net::URLFetcher::Create(kURLFetcherID, std::move(url),
584 net::URLFetcher::POST, this).release(); 586 net::URLFetcher::POST, this)
587 .release();
585 data_use_measurement::DataUseUserData::AttachToFetcher( 588 data_use_measurement::DataUseUserData::AttachToFetcher(
586 fetcher, data_use_measurement::DataUseUserData::POLICY); 589 fetcher, data_use_measurement::DataUseUserData::POLICY);
587 job->ConfigureRequest(fetcher); 590 job->ConfigureRequest(fetcher);
588 pending_jobs_[fetcher] = job; 591 pending_jobs_[fetcher] = job;
589 fetcher->Start(); 592 fetcher->Start();
590 } 593 }
591 594
592 void DeviceManagementService::StartJobAfterDelay( 595 void DeviceManagementService::StartJobAfterDelay(
593 base::WeakPtr<DeviceManagementRequestJobImpl> job) { 596 base::WeakPtr<DeviceManagementRequestJobImpl> job) {
594 // Check if the job still exists (it is possible that it had been canceled 597 // Check if the job still exists (it is possible that it had been canceled
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 } 661 }
659 } 662 }
660 663
661 const JobQueue::iterator elem = 664 const JobQueue::iterator elem =
662 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); 665 std::find(queued_jobs_.begin(), queued_jobs_.end(), job);
663 if (elem != queued_jobs_.end()) 666 if (elem != queued_jobs_.end())
664 queued_jobs_.erase(elem); 667 queued_jobs_.erase(elem);
665 } 668 }
666 669
667 } // namespace policy 670 } // namespace policy
OLDNEW
« 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