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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 #include "extensions/common/extension.h" | 73 #include "extensions/common/extension.h" |
| 74 #include "extensions/common/manifest.h" | 74 #include "extensions/common/manifest.h" |
| 75 #include "extensions/common/manifest_constants.h" | 75 #include "extensions/common/manifest_constants.h" |
| 76 #endif | 76 #endif |
| 77 | 77 |
| 78 namespace em = enterprise_management; | 78 namespace em = enterprise_management; |
| 79 | 79 |
| 80 namespace { | 80 namespace { |
| 81 | 81 |
| 82 // Strings that map from PolicySource enum to i18n string keys and their IDs. | 82 // Strings that map from PolicySource enum to i18n string keys and their IDs. |
| 83 // Their order has to follow the order of the policy::PolicySource enum. | 83 // Their order has to follow the order of the policy::PolicySource enum. |
|
Thiemo Nagel
2016/11/22 10:55:09
Actually I was too mechanical here. The order nee
| |
| 84 const PolicyStringMap kPolicySources[policy::POLICY_SOURCE_COUNT] = { | 84 const PolicyStringMap kPolicySources[policy::POLICY_SOURCE_COUNT] = { |
| 85 {"sourceActiveDirectory", IDS_POLICY_SOURCE_ACTIVE_DIRECTORY}, | |
| 85 {"sourceEnterpriseDefault", IDS_POLICY_SOURCE_ENTERPRISE_DEFAULT}, | 86 {"sourceEnterpriseDefault", IDS_POLICY_SOURCE_ENTERPRISE_DEFAULT}, |
| 86 {"sourceCloud", IDS_POLICY_SOURCE_CLOUD}, | 87 {"sourceCloud", IDS_POLICY_SOURCE_CLOUD}, |
| 87 {"sourceActiveDirectory", IDS_POLICY_SOURCE_ACTIVE_DIRECTORY}, | |
| 88 {"sourcePublicSessionOverride", IDS_POLICY_SOURCE_PUBLIC_SESSION_OVERRIDE}, | 88 {"sourcePublicSessionOverride", IDS_POLICY_SOURCE_PUBLIC_SESSION_OVERRIDE}, |
| 89 {"sourcePlatform", IDS_POLICY_SOURCE_PLATFORM}, | 89 {"sourcePlatform", IDS_POLICY_SOURCE_PLATFORM}, |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 // Formats the association state indicated by |data|. If |data| is NULL, the | 92 // Formats the association state indicated by |data|. If |data| is NULL, the |
| 93 // state is considered to be UNMANAGED. | 93 // state is considered to be UNMANAGED. |
| 94 base::string16 FormatAssociationState(const em::PolicyData* data) { | 94 base::string16 FormatAssociationState(const em::PolicyData* data) { |
| 95 if (data) { | 95 if (data) { |
| 96 switch (data->state()) { | 96 switch (data->state()) { |
| 97 case em::PolicyData::ACTIVE: | 97 case em::PolicyData::ACTIVE: |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 public: | 313 public: |
| 314 explicit DeviceActiveDirectoryPolicyStatusProvider( | 314 explicit DeviceActiveDirectoryPolicyStatusProvider( |
| 315 policy::DeviceActiveDirectoryPolicyManager* manager); | 315 policy::DeviceActiveDirectoryPolicyManager* manager); |
| 316 ~DeviceActiveDirectoryPolicyStatusProvider() override; | 316 ~DeviceActiveDirectoryPolicyStatusProvider() override; |
| 317 | 317 |
| 318 // PolicyStatusProvider implementation. | 318 // PolicyStatusProvider implementation. |
| 319 void GetStatus(base::DictionaryValue* dict) override; | 319 void GetStatus(base::DictionaryValue* dict) override; |
| 320 | 320 |
| 321 private: | 321 private: |
| 322 const policy::CloudPolicyStore* store_; | 322 const policy::CloudPolicyStore* store_; |
| 323 | |
| 324 DISALLOW_COPY_AND_ASSIGN(DeviceActiveDirectoryPolicyStatusProvider); | |
| 323 }; | 325 }; |
| 324 #endif | 326 #endif |
| 325 | 327 |
| 326 PolicyStatusProvider::PolicyStatusProvider() {} | 328 PolicyStatusProvider::PolicyStatusProvider() {} |
| 327 | 329 |
| 328 PolicyStatusProvider::~PolicyStatusProvider() {} | 330 PolicyStatusProvider::~PolicyStatusProvider() {} |
| 329 | 331 |
| 330 void PolicyStatusProvider::SetStatusChangeCallback( | 332 void PolicyStatusProvider::SetStatusChangeCallback( |
| 331 const base::Closure& callback) { | 333 const base::Closure& callback) { |
| 332 callback_ = callback; | 334 callback_ = callback; |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 792 } | 794 } |
| 793 | 795 |
| 794 void PolicyUIHandler::OnRefreshPoliciesDone() const { | 796 void PolicyUIHandler::OnRefreshPoliciesDone() const { |
| 795 web_ui()->CallJavascriptFunctionUnsafe("policy.Page.reloadPoliciesDone"); | 797 web_ui()->CallJavascriptFunctionUnsafe("policy.Page.reloadPoliciesDone"); |
| 796 } | 798 } |
| 797 | 799 |
| 798 policy::PolicyService* PolicyUIHandler::GetPolicyService() const { | 800 policy::PolicyService* PolicyUIHandler::GetPolicyService() const { |
| 799 return policy::ProfilePolicyConnectorFactory::GetForBrowserContext( | 801 return policy::ProfilePolicyConnectorFactory::GetForBrowserContext( |
| 800 web_ui()->GetWebContents()->GetBrowserContext())->policy_service(); | 802 web_ui()->GetWebContents()->GetBrowserContext())->policy_service(); |
| 801 } | 803 } |
| OLD | NEW |