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