| 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 "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" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 UserCloudPolicyManagerChromeOS::UserCloudPolicyManagerChromeOS( | 74 UserCloudPolicyManagerChromeOS::UserCloudPolicyManagerChromeOS( |
| 75 scoped_ptr<CloudPolicyStore> store, | 75 scoped_ptr<CloudPolicyStore> store, |
| 76 scoped_ptr<CloudExternalDataManager> external_data_manager, | 76 scoped_ptr<CloudExternalDataManager> external_data_manager, |
| 77 const base::FilePath& component_policy_cache_path, | 77 const base::FilePath& component_policy_cache_path, |
| 78 bool wait_for_policy_fetch, | 78 bool wait_for_policy_fetch, |
| 79 base::TimeDelta initial_policy_fetch_timeout, | 79 base::TimeDelta initial_policy_fetch_timeout, |
| 80 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 80 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
| 81 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner, | 81 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner, |
| 82 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner) | 82 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner) |
| 83 : CloudPolicyManager( | 83 : CloudPolicyManager(dm_protocol::kChromeUserPolicyType, |
| 84 PolicyNamespaceKey(dm_protocol::kChromeUserPolicyType, std::string()), | 84 std::string(), |
| 85 store.get(), | 85 store.get(), |
| 86 task_runner, | 86 task_runner, |
| 87 file_task_runner, | 87 file_task_runner, |
| 88 io_task_runner), | 88 io_task_runner), |
| 89 store_(store.Pass()), | 89 store_(store.Pass()), |
| 90 external_data_manager_(external_data_manager.Pass()), | 90 external_data_manager_(external_data_manager.Pass()), |
| 91 component_policy_cache_path_(component_policy_cache_path), | 91 component_policy_cache_path_(component_policy_cache_path), |
| 92 wait_for_policy_fetch_(wait_for_policy_fetch), | 92 wait_for_policy_fetch_(wait_for_policy_fetch), |
| 93 policy_fetch_timeout_(false, false) { | 93 policy_fetch_timeout_(false, false) { |
| 94 time_init_started_ = base::Time::Now(); | 94 time_init_started_ = base::Time::Now(); |
| 95 if (wait_for_policy_fetch_ && !initial_policy_fetch_timeout.is_max()) { | 95 if (wait_for_policy_fetch_ && !initial_policy_fetch_timeout.is_max()) { |
| 96 policy_fetch_timeout_.Start( | 96 policy_fetch_timeout_.Start( |
| 97 FROM_HERE, | 97 FROM_HERE, |
| 98 initial_policy_fetch_timeout, | 98 initial_policy_fetch_timeout, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 118 // from the Profile because Connect() is called before the profile is | 118 // from the Profile because Connect() is called before the profile is |
| 119 // fully initialized (required so we can perform the initial policy load). | 119 // fully initialized (required so we can perform the initial policy load). |
| 120 // TODO(atwilson): Change this to use a UserPolicyRequestContext once | 120 // TODO(atwilson): Change this to use a UserPolicyRequestContext once |
| 121 // Connect() is called after profile initialization. http://crbug.com/323591 | 121 // Connect() is called after profile initialization. http://crbug.com/323591 |
| 122 request_context = new SystemPolicyRequestContext( | 122 request_context = new SystemPolicyRequestContext( |
| 123 system_request_context, GetUserAgent()); | 123 system_request_context, GetUserAgent()); |
| 124 } | 124 } |
| 125 scoped_ptr<CloudPolicyClient> cloud_policy_client( | 125 scoped_ptr<CloudPolicyClient> cloud_policy_client( |
| 126 new CloudPolicyClient(std::string(), std::string(), | 126 new CloudPolicyClient(std::string(), std::string(), |
| 127 kPolicyVerificationKeyHash, user_affiliation, | 127 kPolicyVerificationKeyHash, user_affiliation, |
| 128 NULL, device_management_service, | 128 nullptr, device_management_service, |
| 129 request_context)); | 129 request_context)); |
| 130 core()->Connect(cloud_policy_client.Pass()); | 130 core()->Connect(cloud_policy_client.Pass()); |
| 131 client()->AddObserver(this); | 131 client()->AddObserver(this); |
| 132 | 132 |
| 133 external_data_manager_->Connect(request_context); | 133 external_data_manager_->Connect(request_context); |
| 134 | 134 |
| 135 CreateComponentCloudPolicyService(component_policy_cache_path_, | 135 CreateComponentCloudPolicyService(component_policy_cache_path_, |
| 136 request_context); | 136 request_context); |
| 137 | 137 |
| 138 // Determine the next step after the CloudPolicyService initializes. | 138 // Determine the next step after the CloudPolicyService initializes. |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 // OnComponentCloudPolicyUpdated() once it's ready. | 386 // OnComponentCloudPolicyUpdated() once it's ready. |
| 387 return; | 387 return; |
| 388 } | 388 } |
| 389 | 389 |
| 390 core()->StartRefreshScheduler(); | 390 core()->StartRefreshScheduler(); |
| 391 core()->TrackRefreshDelayPref(local_state_, | 391 core()->TrackRefreshDelayPref(local_state_, |
| 392 policy_prefs::kUserPolicyRefreshRate); | 392 policy_prefs::kUserPolicyRefreshRate); |
| 393 } | 393 } |
| 394 | 394 |
| 395 } // namespace policy | 395 } // namespace policy |
| OLD | NEW |