Chromium Code Reviews| 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 <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 #include "chrome/browser/chromeos/policy/device_local_account_external_data_serv ice.h" | 25 #include "chrome/browser/chromeos/policy/device_local_account_external_data_serv ice.h" |
| 26 #include "chrome/browser/chromeos/policy/device_local_account_policy_store.h" | 26 #include "chrome/browser/chromeos/policy/device_local_account_policy_store.h" |
| 27 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 27 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 28 #include "chrome/common/chrome_content_client.h" | 28 #include "chrome/common/chrome_content_client.h" |
| 29 #include "chromeos/chromeos_paths.h" | 29 #include "chromeos/chromeos_paths.h" |
| 30 #include "chromeos/dbus/session_manager_client.h" | 30 #include "chromeos/dbus/session_manager_client.h" |
| 31 #include "chromeos/settings/cros_settings_names.h" | 31 #include "chromeos/settings/cros_settings_names.h" |
| 32 #include "chromeos/settings/cros_settings_provider.h" | 32 #include "chromeos/settings/cros_settings_provider.h" |
| 33 #include "components/policy/core/browser/browser_policy_connector.h" | 33 #include "components/policy/core/browser/browser_policy_connector.h" |
| 34 #include "components/policy/core/common/cloud/cloud_policy_client.h" | 34 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
| 35 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | |
|
emaxx
2016/11/29 14:24:58
nit: I think it's still necessary, e.g. for dm_pro
Thiemo Nagel
2016/11/29 15:16:38
Done.
| |
| 36 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" | 35 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" |
| 37 #include "components/policy/core/common/cloud/device_management_service.h" | 36 #include "components/policy/core/common/cloud/device_management_service.h" |
| 38 #include "components/policy/core/common/cloud/resource_cache.h" | 37 #include "components/policy/core/common/cloud/resource_cache.h" |
| 39 #include "components/policy/core/common/policy_namespace.h" | 38 #include "components/policy/core/common/policy_namespace.h" |
| 40 #include "components/policy/core/common/policy_switches.h" | 39 #include "components/policy/core/common/policy_switches.h" |
| 41 #include "components/policy/policy_constants.h" | 40 #include "components/policy/policy_constants.h" |
| 42 #include "components/policy/proto/device_management_backend.pb.h" | 41 #include "components/policy/proto/device_management_backend.pb.h" |
| 43 #include "content/public/browser/browser_thread.h" | 42 #include "content/public/browser/browser_thread.h" |
| 44 #include "net/url_request/url_request_context_getter.h" | 43 #include "net/url_request/url_request_context_getter.h" |
| 45 #include "url/gurl.h" | 44 #include "url/gurl.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 59 scoped_refptr<net::URLRequestContextGetter> system_request_context) { | 58 scoped_refptr<net::URLRequestContextGetter> system_request_context) { |
| 60 const em::PolicyData* policy_data = device_settings_service->policy_data(); | 59 const em::PolicyData* policy_data = device_settings_service->policy_data(); |
| 61 if (!policy_data || | 60 if (!policy_data || |
| 62 !policy_data->has_request_token() || | 61 !policy_data->has_request_token() || |
| 63 !policy_data->has_device_id() || | 62 !policy_data->has_device_id() || |
| 64 !device_management_service) { | 63 !device_management_service) { |
| 65 return std::unique_ptr<CloudPolicyClient>(); | 64 return std::unique_ptr<CloudPolicyClient>(); |
| 66 } | 65 } |
| 67 | 66 |
| 68 std::unique_ptr<CloudPolicyClient> client(new CloudPolicyClient( | 67 std::unique_ptr<CloudPolicyClient> client(new CloudPolicyClient( |
| 69 std::string(), std::string(), kPolicyVerificationKeyHash, | 68 std::string(), std::string(), device_management_service, |
| 70 device_management_service, system_request_context, | 69 system_request_context, nullptr /* signing_service */)); |
| 71 nullptr /* signing_service */)); | |
| 72 client->SetupRegistration(policy_data->request_token(), | 70 client->SetupRegistration(policy_data->request_token(), |
| 73 policy_data->device_id()); | 71 policy_data->device_id()); |
| 74 return client; | 72 return client; |
| 75 } | 73 } |
| 76 | 74 |
| 77 // Get the subdirectory of the force-installed extension cache and the component | 75 // Get the subdirectory of the force-installed extension cache and the component |
| 78 // policy cache used for |account_id|. | 76 // policy cache used for |account_id|. |
| 79 std::string GetCacheSubdirectoryForAccountID(const std::string& account_id) { | 77 std::string GetCacheSubdirectoryForAccountID(const std::string& account_id) { |
| 80 return base::HexEncode(account_id.c_str(), account_id.size()); | 78 return base::HexEncode(account_id.c_str(), account_id.size()); |
| 81 } | 79 } |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 568 return nullptr; | 566 return nullptr; |
| 569 } | 567 } |
| 570 | 568 |
| 571 void DeviceLocalAccountPolicyService::NotifyPolicyUpdated( | 569 void DeviceLocalAccountPolicyService::NotifyPolicyUpdated( |
| 572 const std::string& user_id) { | 570 const std::string& user_id) { |
| 573 for (auto& observer : observers_) | 571 for (auto& observer : observers_) |
| 574 observer.OnPolicyUpdated(user_id); | 572 observer.OnPolicyUpdated(user_id); |
| 575 } | 573 } |
| 576 | 574 |
| 577 } // namespace policy | 575 } // namespace policy |
| OLD | NEW |