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" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
14 #include "components/data_use_measurement/core/data_use_user_data.h" | |
15 #include "net/base/escape.h" | 14 #include "net/base/escape.h" |
16 #include "net/base/load_flags.h" | 15 #include "net/base/load_flags.h" |
17 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
18 #include "net/http/http_response_headers.h" | 17 #include "net/http/http_response_headers.h" |
19 #include "net/url_request/url_fetcher.h" | 18 #include "net/url_request/url_fetcher.h" |
20 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
21 #include "net/url_request/url_request_status.h" | 20 #include "net/url_request/url_request_status.h" |
22 #include "url/gurl.h" | 21 #include "url/gurl.h" |
23 | 22 |
24 namespace em = enterprise_management; | 23 namespace em = enterprise_management; |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 initialized_(false), | 456 initialized_(false), |
458 weak_ptr_factory_(this) { | 457 weak_ptr_factory_(this) { |
459 DCHECK(configuration_); | 458 DCHECK(configuration_); |
460 } | 459 } |
461 | 460 |
462 void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job) { | 461 void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job) { |
463 std::string server_url = GetServerUrl(); | 462 std::string server_url = GetServerUrl(); |
464 net::URLFetcher* fetcher = | 463 net::URLFetcher* fetcher = |
465 net::URLFetcher::Create(kURLFetcherID, job->GetURL(server_url), | 464 net::URLFetcher::Create(kURLFetcherID, job->GetURL(server_url), |
466 net::URLFetcher::POST, this).release(); | 465 net::URLFetcher::POST, this).release(); |
467 data_use_measurement::DataUseUserData::AttachToFetcher( | |
468 fetcher, data_use_measurement::DataUseUserData::POLICY); | |
469 job->ConfigureRequest(fetcher); | 466 job->ConfigureRequest(fetcher); |
470 pending_jobs_[fetcher] = job; | 467 pending_jobs_[fetcher] = job; |
471 fetcher->Start(); | 468 fetcher->Start(); |
472 } | 469 } |
473 | 470 |
474 std::string DeviceManagementService::GetServerUrl() { | 471 std::string DeviceManagementService::GetServerUrl() { |
475 return configuration_->GetServerUrl(); | 472 return configuration_->GetServerUrl(); |
476 } | 473 } |
477 | 474 |
478 void DeviceManagementService::OnURLFetchComplete( | 475 void DeviceManagementService::OnURLFetchComplete( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 } | 514 } |
518 } | 515 } |
519 | 516 |
520 const JobQueue::iterator elem = | 517 const JobQueue::iterator elem = |
521 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); | 518 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); |
522 if (elem != queued_jobs_.end()) | 519 if (elem != queued_jobs_.end()) |
523 queued_jobs_.erase(elem); | 520 queued_jobs_.erase(elem); |
524 } | 521 } |
525 | 522 |
526 } // namespace policy | 523 } // namespace policy |
OLD | NEW |