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/macros.h" | 12 #include "base/macros.h" |
13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
16 #include "components/data_use_measurement/core/data_use_user_data.h" | 16 #include "components/data_use_measurement/core/data_use_user_data.h" |
17 #include "net/base/escape.h" | 17 #include "net/base/escape.h" |
18 #include "net/base/load_flags.h" | 18 #include "net/base/load_flags.h" |
19 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
20 #include "net/http/http_response_headers.h" | 20 #include "net/http/http_response_headers.h" |
| 21 #include "net/traffic_annotation/network_traffic_annotation.h" |
21 #include "net/url_request/url_fetcher.h" | 22 #include "net/url_request/url_fetcher.h" |
22 #include "net/url_request/url_request_context_getter.h" | 23 #include "net/url_request/url_request_context_getter.h" |
23 #include "net/url_request/url_request_status.h" | 24 #include "net/url_request/url_request_status.h" |
24 #include "url/gurl.h" | 25 #include "url/gurl.h" |
25 | 26 |
26 namespace em = enterprise_management; | 27 namespace em = enterprise_management; |
27 | 28 |
28 namespace policy { | 29 namespace policy { |
29 | 30 |
30 namespace { | 31 namespace { |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 weak_ptr_factory_(this) { | 583 weak_ptr_factory_(this) { |
583 DCHECK(configuration_); | 584 DCHECK(configuration_); |
584 } | 585 } |
585 | 586 |
586 void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job) { | 587 void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job) { |
587 DCHECK(thread_checker_.CalledOnValidThread()); | 588 DCHECK(thread_checker_.CalledOnValidThread()); |
588 | 589 |
589 GURL url = job->GetURL(GetServerUrl()); | 590 GURL url = job->GetURL(GetServerUrl()); |
590 DCHECK(url.is_valid()) << "Maybe invalid --device-management-url was passed?"; | 591 DCHECK(url.is_valid()) << "Maybe invalid --device-management-url was passed?"; |
591 | 592 |
| 593 net::NetworkTrafficAnnotationTag traffic_annotation = |
| 594 net::DefineNetworkTrafficAnnotation("device_management_service", R"( |
| 595 semantics { |
| 596 sender: "Cloud Policy" |
| 597 description: |
| 598 "Communication with the Cloud Policy backend, used to check for " |
| 599 "the existence of cloud policy for the signed-in account, and to " |
| 600 "load/update cloud policy if it exists." |
| 601 trigger: |
| 602 "Sign in to Chrome, also periodic refreshes." |
| 603 data: |
| 604 "During initial signin or device enrollment, auth data is sent up " |
| 605 "as part of registration. After initial signin/enrollment, if the " |
| 606 "session or device is managed, a unique device or profile ID is " |
| 607 "sent with every future request. On Chrome OS, other diagnostic " |
| 608 "information can be sent up for managed sessions, including which " |
| 609 "users have used the device, device hardware status, connected " |
| 610 "networks, CPU usage, etc." |
| 611 destination: GOOGLE_OWNED_SERVICE |
| 612 } |
| 613 policy { |
| 614 cookies_allowed: false |
| 615 setting: |
| 616 "This feature cannot be controlled by Chrome settings, but users " |
| 617 "can sign out of Chrome to disable it." |
| 618 chrome_policy { |
| 619 SigninAllowed { |
| 620 policy_options {mode: MANDATORY} |
| 621 SigninAllowed: false |
| 622 } |
| 623 } |
| 624 })"); |
592 net::URLFetcher* fetcher = | 625 net::URLFetcher* fetcher = |
593 net::URLFetcher::Create(kURLFetcherID, std::move(url), | 626 net::URLFetcher::Create(kURLFetcherID, std::move(url), |
594 net::URLFetcher::POST, this) | 627 net::URLFetcher::POST, this, traffic_annotation) |
595 .release(); | 628 .release(); |
596 data_use_measurement::DataUseUserData::AttachToFetcher( | 629 data_use_measurement::DataUseUserData::AttachToFetcher( |
597 fetcher, data_use_measurement::DataUseUserData::POLICY); | 630 fetcher, data_use_measurement::DataUseUserData::POLICY); |
598 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | | 631 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | |
599 net::LOAD_DO_NOT_SEND_COOKIES); | 632 net::LOAD_DO_NOT_SEND_COOKIES); |
600 job->ConfigureRequest(fetcher); | 633 job->ConfigureRequest(fetcher); |
601 pending_jobs_[fetcher] = job; | 634 pending_jobs_[fetcher] = job; |
602 fetcher->Start(); | 635 fetcher->Start(); |
603 } | 636 } |
604 | 637 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 } | 704 } |
672 } | 705 } |
673 | 706 |
674 const JobQueue::iterator elem = | 707 const JobQueue::iterator elem = |
675 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); | 708 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); |
676 if (elem != queued_jobs_.end()) | 709 if (elem != queued_jobs_.end()) |
677 queued_jobs_.erase(elem); | 710 queued_jobs_.erase(elem); |
678 } | 711 } |
679 | 712 |
680 } // namespace policy | 713 } // namespace policy |
OLD | NEW |