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/ui/webui/policy_ui_handler.h" | 5 #include "chrome/browser/ui/webui/policy_ui_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 public: | 284 public: |
| 285 DeviceLocalAccountPolicyStatusProvider( | 285 DeviceLocalAccountPolicyStatusProvider( |
| 286 const std::string& user_id, | 286 const std::string& user_id, |
| 287 policy::DeviceLocalAccountPolicyService* service); | 287 policy::DeviceLocalAccountPolicyService* service); |
| 288 ~DeviceLocalAccountPolicyStatusProvider() override; | 288 ~DeviceLocalAccountPolicyStatusProvider() override; |
| 289 | 289 |
| 290 // CloudPolicyStatusProvider implementation. | 290 // CloudPolicyStatusProvider implementation. |
| 291 void GetStatus(base::DictionaryValue* dict) override; | 291 void GetStatus(base::DictionaryValue* dict) override; |
| 292 | 292 |
| 293 // policy::DeviceLocalAccountPolicyService::Observer implementation. | 293 // policy::DeviceLocalAccountPolicyService::Observer implementation. |
| 294 void OnPolicyUpdated(const std::string& user_id) override; | 294 void OnPolicyUpdated(const std::string& user_id) override; |
|
stevenjb
2016/11/03 22:52:35
Is there an issue tracking migration of the policy
Alexander Alekseev
2016/11/03 22:55:23
This is the same issue. I am going to implement it
| |
| 295 void OnDeviceLocalAccountsChanged() override; | 295 void OnDeviceLocalAccountsChanged() override; |
| 296 | 296 |
| 297 private: | 297 private: |
| 298 const std::string user_id_; | 298 const std::string user_id_; |
| 299 policy::DeviceLocalAccountPolicyService* service_; | 299 policy::DeviceLocalAccountPolicyService* service_; |
| 300 | 300 |
| 301 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyStatusProvider); | 301 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyStatusProvider); |
| 302 }; | 302 }; |
| 303 #endif | 303 #endif |
| 304 | 304 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 469 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 469 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 470 if (connector->IsEnterpriseManaged()) | 470 if (connector->IsEnterpriseManaged()) |
| 471 device_status_provider_.reset(new DevicePolicyStatusProvider(connector)); | 471 device_status_provider_.reset(new DevicePolicyStatusProvider(connector)); |
| 472 | 472 |
| 473 const user_manager::UserManager* user_manager = | 473 const user_manager::UserManager* user_manager = |
| 474 user_manager::UserManager::Get(); | 474 user_manager::UserManager::Get(); |
| 475 if (user_manager->IsLoggedInAsPublicAccount()) { | 475 if (user_manager->IsLoggedInAsPublicAccount()) { |
| 476 policy::DeviceLocalAccountPolicyService* local_account_service = | 476 policy::DeviceLocalAccountPolicyService* local_account_service = |
| 477 connector->GetDeviceLocalAccountPolicyService(); | 477 connector->GetDeviceLocalAccountPolicyService(); |
| 478 if (local_account_service) { | 478 if (local_account_service) { |
| 479 user_status_provider_.reset( | 479 user_status_provider_.reset(new DeviceLocalAccountPolicyStatusProvider( |
| 480 new DeviceLocalAccountPolicyStatusProvider( | 480 user_manager->GetLoggedInUser()->GetAccountId().GetUserEmail(), |
| 481 user_manager->GetLoggedInUser()->email(), local_account_service)); | 481 local_account_service)); |
| 482 } | 482 } |
| 483 } else { | 483 } else { |
| 484 policy::UserCloudPolicyManagerChromeOS* user_cloud_policy_manager = | 484 policy::UserCloudPolicyManagerChromeOS* user_cloud_policy_manager = |
| 485 policy::UserCloudPolicyManagerFactoryChromeOS::GetForProfile( | 485 policy::UserCloudPolicyManagerFactoryChromeOS::GetForProfile( |
| 486 Profile::FromWebUI(web_ui())); | 486 Profile::FromWebUI(web_ui())); |
| 487 if (user_cloud_policy_manager) { | 487 if (user_cloud_policy_manager) { |
| 488 user_status_provider_.reset( | 488 user_status_provider_.reset( |
| 489 new UserPolicyStatusProvider(user_cloud_policy_manager->core())); | 489 new UserPolicyStatusProvider(user_cloud_policy_manager->core())); |
| 490 } | 490 } |
| 491 } | 491 } |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 743 } | 743 } |
| 744 | 744 |
| 745 void PolicyUIHandler::OnRefreshPoliciesDone() const { | 745 void PolicyUIHandler::OnRefreshPoliciesDone() const { |
| 746 web_ui()->CallJavascriptFunctionUnsafe("policy.Page.reloadPoliciesDone"); | 746 web_ui()->CallJavascriptFunctionUnsafe("policy.Page.reloadPoliciesDone"); |
| 747 } | 747 } |
| 748 | 748 |
| 749 policy::PolicyService* PolicyUIHandler::GetPolicyService() const { | 749 policy::PolicyService* PolicyUIHandler::GetPolicyService() const { |
| 750 return policy::ProfilePolicyConnectorFactory::GetForBrowserContext( | 750 return policy::ProfilePolicyConnectorFactory::GetForBrowserContext( |
| 751 web_ui()->GetWebContents()->GetBrowserContext())->policy_service(); | 751 web_ui()->GetWebContents()->GetBrowserContext())->policy_service(); |
| 752 } | 752 } |
| OLD | NEW |