| 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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 445 |
| 446 DeviceManagementService::DeviceManagementService( | 446 DeviceManagementService::DeviceManagementService( |
| 447 scoped_ptr<Configuration> configuration) | 447 scoped_ptr<Configuration> configuration) |
| 448 : configuration_(configuration.Pass()), | 448 : configuration_(configuration.Pass()), |
| 449 initialized_(false), | 449 initialized_(false), |
| 450 weak_ptr_factory_(this) { | 450 weak_ptr_factory_(this) { |
| 451 DCHECK(configuration_); | 451 DCHECK(configuration_); |
| 452 } | 452 } |
| 453 | 453 |
| 454 void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job) { | 454 void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job) { |
| 455 std::string server_url = GetServerURL(); | 455 std::string server_url = GetServerUrl(); |
| 456 net::URLFetcher* fetcher = net::URLFetcher::Create( | 456 net::URLFetcher* fetcher = net::URLFetcher::Create( |
| 457 kURLFetcherID, job->GetURL(server_url), net::URLFetcher::POST, this); | 457 kURLFetcherID, job->GetURL(server_url), net::URLFetcher::POST, this); |
| 458 job->ConfigureRequest(fetcher); | 458 job->ConfigureRequest(fetcher); |
| 459 pending_jobs_[fetcher] = job; | 459 pending_jobs_[fetcher] = job; |
| 460 fetcher->Start(); | 460 fetcher->Start(); |
| 461 } | 461 } |
| 462 | 462 |
| 463 std::string DeviceManagementService::GetServerURL() { | 463 std::string DeviceManagementService::GetServerUrl() { |
| 464 return configuration_->GetServerUrl(); | 464 return configuration_->GetServerUrl(); |
| 465 } | 465 } |
| 466 | 466 |
| 467 void DeviceManagementService::OnURLFetchComplete( | 467 void DeviceManagementService::OnURLFetchComplete( |
| 468 const net::URLFetcher* source) { | 468 const net::URLFetcher* source) { |
| 469 JobFetcherMap::iterator entry(pending_jobs_.find(source)); | 469 JobFetcherMap::iterator entry(pending_jobs_.find(source)); |
| 470 if (entry == pending_jobs_.end()) { | 470 if (entry == pending_jobs_.end()) { |
| 471 NOTREACHED() << "Callback from foreign URL fetcher"; | 471 NOTREACHED() << "Callback from foreign URL fetcher"; |
| 472 return; | 472 return; |
| 473 } | 473 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 } | 506 } |
| 507 } | 507 } |
| 508 | 508 |
| 509 const JobQueue::iterator elem = | 509 const JobQueue::iterator elem = |
| 510 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); | 510 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); |
| 511 if (elem != queued_jobs_.end()) | 511 if (elem != queued_jobs_.end()) |
| 512 queued_jobs_.erase(elem); | 512 queued_jobs_.erase(elem); |
| 513 } | 513 } |
| 514 | 514 |
| 515 } // namespace policy | 515 } // namespace policy |
| OLD | NEW |