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

Side by Side Diff: trunk/src/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc

Issue 192283002: Revert 255858 "Simplify the user agent code some more since afte..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/metrics/sparse_histogram.h" 11 #include "base/metrics/sparse_histogram.h"
12 #include "base/sequenced_task_runner.h" 12 #include "base/sequenced_task_runner.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h" 14 #include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h"
15 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" 15 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h"
16 #include "chrome/browser/chromeos/policy/wildcard_login_checker.h" 16 #include "chrome/browser/chromeos/policy/wildcard_login_checker.h"
17 #include "chrome/browser/chromeos/profiles/profile_helper.h" 17 #include "chrome/browser/chromeos/profiles/profile_helper.h"
18 #include "chrome/browser/lifetime/application_lifetime.h" 18 #include "chrome/browser/lifetime/application_lifetime.h"
19 #include "chrome/common/chrome_content_client.h"
20 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" 19 #include "components/policy/core/common/cloud/cloud_external_data_manager.h"
21 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" 20 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h"
22 #include "components/policy/core/common/cloud/device_management_service.h" 21 #include "components/policy/core/common/cloud/device_management_service.h"
23 #include "components/policy/core/common/cloud/system_policy_request_context.h" 22 #include "components/policy/core/common/cloud/system_policy_request_context.h"
24 #include "components/policy/core/common/policy_pref_names.h" 23 #include "components/policy/core/common/policy_pref_names.h"
24 #include "content/public/common/content_client.h"
25 #include "net/url_request/url_request_context_getter.h" 25 #include "net/url_request/url_request_context_getter.h"
26 #include "url/gurl.h" 26 #include "url/gurl.h"
27 27
28 namespace em = enterprise_management; 28 namespace em = enterprise_management;
29 29
30 namespace policy { 30 namespace policy {
31 31
32 namespace { 32 namespace {
33 33
34 // UMA histogram names. 34 // UMA histogram names.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 local_state_ = local_state; 108 local_state_ = local_state;
109 scoped_refptr<net::URLRequestContextGetter> request_context; 109 scoped_refptr<net::URLRequestContextGetter> request_context;
110 if (system_request_context) { 110 if (system_request_context) {
111 // |system_request_context| can be null for tests. 111 // |system_request_context| can be null for tests.
112 // Use the system request context here instead of a context derived 112 // Use the system request context here instead of a context derived
113 // from the Profile because Connect() is called before the profile is 113 // from the Profile because Connect() is called before the profile is
114 // fully initialized (required so we can perform the initial policy load). 114 // fully initialized (required so we can perform the initial policy load).
115 // TODO(atwilson): Change this to use a UserPolicyRequestContext once 115 // TODO(atwilson): Change this to use a UserPolicyRequestContext once
116 // Connect() is called after profile initialization. http://crbug.com/323591 116 // Connect() is called after profile initialization. http://crbug.com/323591
117 request_context = new SystemPolicyRequestContext( 117 request_context = new SystemPolicyRequestContext(
118 system_request_context, GetUserAgent()); 118 system_request_context,
119 content::GetUserAgent(GURL(
120 device_management_service->GetServerUrl())));
119 } 121 }
120 scoped_ptr<CloudPolicyClient> cloud_policy_client( 122 scoped_ptr<CloudPolicyClient> cloud_policy_client(
121 new CloudPolicyClient(std::string(), std::string(), 123 new CloudPolicyClient(std::string(), std::string(),
122 kPolicyVerificationKeyHash, user_affiliation, 124 kPolicyVerificationKeyHash, user_affiliation,
123 NULL, device_management_service, 125 NULL, device_management_service,
124 request_context)); 126 request_context));
125 core()->Connect(cloud_policy_client.Pass()); 127 core()->Connect(cloud_policy_client.Pass());
126 client()->AddObserver(this); 128 client()->AddObserver(this);
127 129
128 external_data_manager_->Connect(request_context); 130 external_data_manager_->Connect(request_context);
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 // OnComponentCloudPolicyUpdated() once it's ready. 372 // OnComponentCloudPolicyUpdated() once it's ready.
371 return; 373 return;
372 } 374 }
373 375
374 core()->StartRefreshScheduler(); 376 core()->StartRefreshScheduler();
375 core()->TrackRefreshDelayPref(local_state_, 377 core()->TrackRefreshDelayPref(local_state_,
376 policy_prefs::kUserPolicyRefreshRate); 378 policy_prefs::kUserPolicyRefreshRate);
377 } 379 }
378 380
379 } // namespace policy 381 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698