| 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 "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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |