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/device_local_account_policy_service.h" | 5 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
22 #include "chrome/browser/chromeos/policy/device_local_account.h" | 22 #include "chrome/browser/chromeos/policy/device_local_account.h" |
23 #include "chrome/browser/chromeos/policy/device_local_account_external_data_serv ice.h" | 23 #include "chrome/browser/chromeos/policy/device_local_account_external_data_serv ice.h" |
24 #include "chrome/browser/chromeos/policy/device_local_account_policy_store.h" | 24 #include "chrome/browser/chromeos/policy/device_local_account_policy_store.h" |
25 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 25 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
26 #include "chrome/common/chrome_content_client.h" | 26 #include "chrome/common/chrome_content_client.h" |
27 #include "chromeos/chromeos_paths.h" | 27 #include "chromeos/chromeos_paths.h" |
28 #include "chromeos/dbus/session_manager_client.h" | 28 #include "chromeos/dbus/session_manager_client.h" |
29 #include "chromeos/settings/cros_settings_names.h" | 29 #include "chromeos/settings/cros_settings_names.h" |
30 #include "chromeos/settings/cros_settings_provider.h" | 30 #include "chromeos/settings/cros_settings_provider.h" |
31 #include "components/policy/core/browser/browser_policy_connector.h" | |
31 #include "components/policy/core/common/cloud/cloud_policy_client.h" | 32 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
32 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 33 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
33 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" | 34 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" |
34 #include "components/policy/core/common/cloud/device_management_service.h" | 35 #include "components/policy/core/common/cloud/device_management_service.h" |
35 #include "components/policy/core/common/cloud/resource_cache.h" | 36 #include "components/policy/core/common/cloud/resource_cache.h" |
36 #include "components/policy/core/common/cloud/system_policy_request_context.h" | 37 #include "components/policy/core/common/cloud/system_policy_request_context.h" |
37 #include "components/policy/core/common/policy_switches.h" | 38 #include "components/policy/core/common/policy_switches.h" |
38 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
39 #include "net/url_request/url_request_context_getter.h" | 40 #include "net/url_request/url_request_context_getter.h" |
40 #include "policy/policy_constants.h" | 41 #include "policy/policy_constants.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 const DeviceLocalAccount& account, | 119 const DeviceLocalAccount& account, |
119 const base::FilePath& component_policy_cache_path, | 120 const base::FilePath& component_policy_cache_path, |
120 scoped_ptr<DeviceLocalAccountPolicyStore> store, | 121 scoped_ptr<DeviceLocalAccountPolicyStore> store, |
121 scoped_refptr<DeviceLocalAccountExternalDataManager> external_data_manager, | 122 scoped_refptr<DeviceLocalAccountExternalDataManager> external_data_manager, |
122 const base::Closure& policy_update_callback, | 123 const base::Closure& policy_update_callback, |
123 const scoped_refptr<base::SequencedTaskRunner>& task_runner) | 124 const scoped_refptr<base::SequencedTaskRunner>& task_runner) |
124 : account_id_(account.account_id), | 125 : account_id_(account.account_id), |
125 user_id_(account.user_id), | 126 user_id_(account.user_id), |
126 component_policy_cache_path_(component_policy_cache_path), | 127 component_policy_cache_path_(component_policy_cache_path), |
127 store_(store.Pass()), | 128 store_(store.Pass()), |
129 extension_tracker_(account, store_.get(), &schema_registry_), | |
128 external_data_manager_(external_data_manager), | 130 external_data_manager_(external_data_manager), |
129 core_(PolicyNamespaceKey(dm_protocol::kChromePublicAccountPolicyType, | 131 core_(PolicyNamespaceKey(dm_protocol::kChromePublicAccountPolicyType, |
130 store_->account_id()), | 132 store_->account_id()), |
131 store_.get(), | 133 store_.get(), |
132 task_runner), | 134 task_runner), |
133 policy_update_callback_(policy_update_callback) { | 135 policy_update_callback_(policy_update_callback) { |
134 base::FilePath cache_root_dir; | 136 base::FilePath cache_root_dir; |
135 CHECK(PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS, | 137 CHECK(PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS, |
136 &cache_root_dir)); | 138 &cache_root_dir)); |
137 extension_loader_ = new chromeos::DeviceLocalAccountExternalPolicyLoader( | 139 extension_loader_ = new chromeos::DeviceLocalAccountExternalPolicyLoader( |
138 store_.get(), | 140 store_.get(), |
139 cache_root_dir.Append( | 141 cache_root_dir.Append( |
140 GetCacheSubdirectoryForAccountID(account.account_id))); | 142 GetCacheSubdirectoryForAccountID(account.account_id))); |
141 store_->AddObserver(this); | 143 store_->AddObserver(this); |
142 | 144 |
143 // Unblock the |schema_registry_| so that the |component_policy_service_| | 145 // Unblock the |schema_registry_| so that the |component_policy_service_| |
144 // starts using it. | 146 // starts using it. |
147 schema_registry_.RegisterComponent( | |
148 PolicyNamespace(POLICY_DOMAIN_CHROME, ""), | |
bartfab (slow)
2014/06/23 09:53:37
Nit: #include "components/policy/core/common/polic
Joao da Silva
2014/07/16 11:47:52
Done.
| |
149 g_browser_process->browser_policy_connector()->GetChromeSchema()); | |
145 schema_registry_.SetReady(POLICY_DOMAIN_CHROME); | 150 schema_registry_.SetReady(POLICY_DOMAIN_CHROME); |
146 schema_registry_.SetReady(POLICY_DOMAIN_EXTENSIONS); | 151 schema_registry_.SetReady(POLICY_DOMAIN_EXTENSIONS); |
147 } | 152 } |
148 | 153 |
149 DeviceLocalAccountPolicyBroker::~DeviceLocalAccountPolicyBroker() { | 154 DeviceLocalAccountPolicyBroker::~DeviceLocalAccountPolicyBroker() { |
150 store_->RemoveObserver(this); | 155 store_->RemoveObserver(this); |
151 external_data_manager_->SetPolicyStore(NULL); | 156 external_data_manager_->SetPolicyStore(NULL); |
152 external_data_manager_->Disconnect(); | 157 external_data_manager_->Disconnect(); |
153 } | 158 } |
154 | 159 |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
554 } | 559 } |
555 return NULL; | 560 return NULL; |
556 } | 561 } |
557 | 562 |
558 void DeviceLocalAccountPolicyService::NotifyPolicyUpdated( | 563 void DeviceLocalAccountPolicyService::NotifyPolicyUpdated( |
559 const std::string& user_id) { | 564 const std::string& user_id) { |
560 FOR_EACH_OBSERVER(Observer, observers_, OnPolicyUpdated(user_id)); | 565 FOR_EACH_OBSERVER(Observer, observers_, OnPolicyUpdated(user_id)); |
561 } | 566 } |
562 | 567 |
563 } // namespace policy | 568 } // namespace policy |
OLD | NEW |