Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: components/policy/core/common/cloud/device_management_service.cc

Issue 2800653002: Network traffic annotation added to common/cloud. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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("...", R"(
595 semantics {
596 sender: "..."
pastarmovj 2017/04/07 09:58:45 Cloud Policy
Ramin Halavati 2017/04/19 05:21:57 Done.
597 description: "..."
Andrew T Wilson (Slow) 2017/04/18 12:01:31 Communication with the Cloud Policy backend - used
Ramin Halavati 2017/04/19 05:21:57 Done.
598 trigger: "..."
Andrew T Wilson (Slow) 2017/04/18 12:01:31 Sign in to Chrome, then also periodic refreshes.
Ramin Halavati 2017/04/19 05:21:57 Done.
599 data: "..."
Andrew T Wilson (Slow) 2017/04/18 12:01:31 Encoded policy settings.
Ramin Halavati 2017/04/19 05:21:57 Could you please elaborate on this, +insisting on
Andrew T Wilson (Slow) 2017/04/25 13:48:01 I'm not certain what should be described here - is
Ramin Halavati 2017/04/26 05:28:06 There isn't a well defined document, we will defin
Andrew T Wilson (Slow) 2017/04/26 09:34:11 Ah, OK, I get it. In theory, all kinds of data cou
Ramin Halavati 2017/04/26 09:44:41 Done.
600 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER
pastarmovj 2017/04/07 09:58:46 GOOGLE_OWNED_SERVICE
Ramin Halavati 2017/04/26 05:28:06 Done.
601 }
602 policy {
603 cookies_allowed: false/true
pastarmovj 2017/04/07 09:58:45 true?
Andrew T Wilson (Slow) 2017/04/18 12:01:31 Yes, true, although we don't really use them.
Ramin Halavati 2017/04/19 05:21:57 If you don't use it, I can add a CL to disable it.
Andrew T Wilson (Slow) 2017/04/25 13:48:01 Happy to review such a CL and/or revert it if it t
Ramin Halavati 2017/04/26 05:28:06 Done in https://codereview.chromium.org/2837123005
604 cookies_store: "..."
pastarmovj 2017/04/07 09:58:46 system?
Andrew T Wilson (Slow) 2017/04/18 12:01:31 Yes system
Ramin Halavati 2017/04/19 05:21:57 Done.
605 setting: "..."
pastarmovj 2017/04/07 09:58:46 NA?
Andrew T Wilson (Slow) 2017/04/18 12:01:31 Cannot be controlled by user settings.
Ramin Halavati 2017/04/19 05:21:57 Done.
606 chrome_policy {
pastarmovj 2017/04/07 09:58:46 empty.
Ramin Halavati 2017/04/19 05:21:57 Acknowledged.
607 [POLICY_NAME] {
Andrew T Wilson (Slow) 2017/04/18 12:01:31 SigninAllowed
Ramin Halavati 2017/04/19 05:21:57 Done.
608 policy_options {mode: MANDATORY/RECOMMENDED/UNSET}
Andrew T Wilson (Slow) 2017/04/18 12:01:31 MANDATORY
Ramin Halavati 2017/04/19 05:21:57 Done.
609 [POLICY_NAME]: ... //(value to disable it)
Andrew T Wilson (Slow) 2017/04/18 12:01:31 SigninAllowed: false
Ramin Halavati 2017/04/19 05:21:57 Done.
610 }
611 }
612 policy_exception_justification: "..."
pastarmovj 2017/04/07 09:58:46 This request is part of the policy fetcher itself.
Ramin Halavati 2017/04/19 05:21:57 Acknowledged.
613 })");
592 net::URLFetcher* fetcher = 614 net::URLFetcher* fetcher =
593 net::URLFetcher::Create(kURLFetcherID, std::move(url), 615 net::URLFetcher::Create(kURLFetcherID, std::move(url),
594 net::URLFetcher::POST, this) 616 net::URLFetcher::POST, this, traffic_annotation)
595 .release(); 617 .release();
596 data_use_measurement::DataUseUserData::AttachToFetcher( 618 data_use_measurement::DataUseUserData::AttachToFetcher(
597 fetcher, data_use_measurement::DataUseUserData::POLICY); 619 fetcher, data_use_measurement::DataUseUserData::POLICY);
598 job->ConfigureRequest(fetcher); 620 job->ConfigureRequest(fetcher);
599 pending_jobs_[fetcher] = job; 621 pending_jobs_[fetcher] = job;
600 fetcher->Start(); 622 fetcher->Start();
601 } 623 }
602 624
603 void DeviceManagementService::StartJobAfterDelay( 625 void DeviceManagementService::StartJobAfterDelay(
604 base::WeakPtr<DeviceManagementRequestJobImpl> job) { 626 base::WeakPtr<DeviceManagementRequestJobImpl> job) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 } 691 }
670 } 692 }
671 693
672 const JobQueue::iterator elem = 694 const JobQueue::iterator elem =
673 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); 695 std::find(queued_jobs_.begin(), queued_jobs_.end(), job);
674 if (elem != queued_jobs_.end()) 696 if (elem != queued_jobs_.end())
675 queued_jobs_.erase(elem); 697 queued_jobs_.erase(elem);
676 } 698 }
677 699
678 } // namespace policy 700 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698