| 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.h" | 5 #include "chrome/browser/ui/webui/policy_ui.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/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "content/public/browser/web_ui_message_handler.h" | 48 #include "content/public/browser/web_ui_message_handler.h" |
| 49 #include "google_apis/gaia/gaia_auth_util.h" | 49 #include "google_apis/gaia/gaia_auth_util.h" |
| 50 #include "grit/browser_resources.h" | 50 #include "grit/browser_resources.h" |
| 51 #include "grit/components_strings.h" | 51 #include "grit/components_strings.h" |
| 52 #include "policy/policy_constants.h" | 52 #include "policy/policy_constants.h" |
| 53 #include "policy/proto/device_management_backend.pb.h" | 53 #include "policy/proto/device_management_backend.pb.h" |
| 54 #include "ui/base/l10n/l10n_util.h" | 54 #include "ui/base/l10n/l10n_util.h" |
| 55 #include "ui/base/l10n/time_format.h" | 55 #include "ui/base/l10n/time_format.h" |
| 56 | 56 |
| 57 #if defined(OS_CHROMEOS) | 57 #if defined(OS_CHROMEOS) |
| 58 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 59 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 58 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 60 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 59 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
| 61 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 60 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
| 62 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 61 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 63 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 62 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
| 63 #include "components/user_manager/user_manager.h" |
| 64 #else | 64 #else |
| 65 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 65 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 66 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 66 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
| 67 #include "content/public/browser/web_contents.h" | 67 #include "content/public/browser/web_contents.h" |
| 68 #endif | 68 #endif |
| 69 | 69 |
| 70 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 70 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 71 #include "chrome/browser/extensions/extension_service.h" | 71 #include "chrome/browser/extensions/extension_service.h" |
| 72 #include "extensions/browser/extension_system.h" | 72 #include "extensions/browser/extension_system.h" |
| 73 #include "extensions/common/extension.h" | 73 #include "extensions/common/extension.h" |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 GetPolicyService()->RemoveObserver(policy::POLICY_DOMAIN_EXTENSIONS, this); | 529 GetPolicyService()->RemoveObserver(policy::POLICY_DOMAIN_EXTENSIONS, this); |
| 530 } | 530 } |
| 531 | 531 |
| 532 void PolicyUIHandler::RegisterMessages() { | 532 void PolicyUIHandler::RegisterMessages() { |
| 533 #if defined(OS_CHROMEOS) | 533 #if defined(OS_CHROMEOS) |
| 534 policy::BrowserPolicyConnectorChromeOS* connector = | 534 policy::BrowserPolicyConnectorChromeOS* connector = |
| 535 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 535 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 536 if (connector->IsEnterpriseManaged()) | 536 if (connector->IsEnterpriseManaged()) |
| 537 device_status_provider_.reset(new DevicePolicyStatusProvider(connector)); | 537 device_status_provider_.reset(new DevicePolicyStatusProvider(connector)); |
| 538 | 538 |
| 539 const chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | 539 const user_manager::UserManager* user_manager = |
| 540 user_manager::UserManager::Get(); |
| 540 if (user_manager->IsLoggedInAsPublicAccount()) { | 541 if (user_manager->IsLoggedInAsPublicAccount()) { |
| 541 policy::DeviceLocalAccountPolicyService* local_account_service = | 542 policy::DeviceLocalAccountPolicyService* local_account_service = |
| 542 connector->GetDeviceLocalAccountPolicyService(); | 543 connector->GetDeviceLocalAccountPolicyService(); |
| 543 if (local_account_service) { | 544 if (local_account_service) { |
| 544 user_status_provider_.reset( | 545 user_status_provider_.reset( |
| 545 new DeviceLocalAccountPolicyStatusProvider( | 546 new DeviceLocalAccountPolicyStatusProvider( |
| 546 user_manager->GetLoggedInUser()->email(), local_account_service)); | 547 user_manager->GetLoggedInUser()->email(), local_account_service)); |
| 547 } | 548 } |
| 548 } else { | 549 } else { |
| 549 policy::UserCloudPolicyManagerChromeOS* user_cloud_policy_manager = | 550 policy::UserCloudPolicyManagerChromeOS* user_cloud_policy_manager = |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 } | 789 } |
| 789 | 790 |
| 790 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 791 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 791 web_ui->AddMessageHandler(new PolicyUIHandler); | 792 web_ui->AddMessageHandler(new PolicyUIHandler); |
| 792 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), | 793 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), |
| 793 CreatePolicyUIHTMLSource()); | 794 CreatePolicyUIHTMLSource()); |
| 794 } | 795 } |
| 795 | 796 |
| 796 PolicyUI::~PolicyUI() { | 797 PolicyUI::~PolicyUI() { |
| 797 } | 798 } |
| OLD | NEW |