| 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 "components/policy/core/common/cloud/cloud_policy_constants.h" | 5 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "components/policy/core/common/policy_switches.h" | 10 #include "components/policy/core/common/policy_switches.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 0xE6, 0xAF, 0x95, 0x66, 0xC1, 0x23, 0xDA, 0x23, 0x45, 0x36, 0x6E, 0x25, 0xF3, | 81 0xE6, 0xAF, 0x95, 0x66, 0xC1, 0x23, 0xDA, 0x23, 0x45, 0x36, 0x6E, 0x25, 0xF3, |
| 82 0xC7, 0xC0, 0x61, 0xFC, 0xEC, 0x66, 0x9D, 0x31, 0xD4, 0xD6, 0xB6, 0x36, 0xE3, | 82 0xC7, 0xC0, 0x61, 0xFC, 0xEC, 0x66, 0x9D, 0x31, 0xD4, 0xD6, 0xB6, 0x36, 0xE3, |
| 83 0x7F, 0x81, 0x87, 0x02, 0x03, 0x01, 0x00, 0x01 | 83 0x7F, 0x81, 0x87, 0x02, 0x03, 0x01, 0x00, 0x01 |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 const char kPolicyVerificationKeyHash[] = "1:356l7w"; | 86 const char kPolicyVerificationKeyHash[] = "1:356l7w"; |
| 87 | 87 |
| 88 std::string GetPolicyVerificationKey() { | 88 std::string GetPolicyVerificationKey() { |
| 89 // Disable key verification by default until production servers generate | 89 // Disable key verification by default until production servers generate |
| 90 // the proper signatures. | 90 // the proper signatures. |
| 91 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 91 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 92 if (command_line->HasSwitch(switches::kDisablePolicyKeyVerification)) { | 92 if (command_line->HasSwitch(switches::kDisablePolicyKeyVerification)) { |
| 93 return std::string(); | 93 return std::string(); |
| 94 } else { | 94 } else { |
| 95 return std::string(reinterpret_cast<const char*>(kPolicyVerificationKey), | 95 return std::string(reinterpret_cast<const char*>(kPolicyVerificationKey), |
| 96 sizeof(kPolicyVerificationKey)); | 96 sizeof(kPolicyVerificationKey)); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 const char* GetChromeUserPolicyType() { | 100 const char* GetChromeUserPolicyType() { |
| 101 #if defined(OS_ANDROID) || defined(OS_IOS) | 101 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 102 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 102 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 103 if (command_line->HasSwitch(switches::kFakeCloudPolicyType)) | 103 if (command_line->HasSwitch(switches::kFakeCloudPolicyType)) |
| 104 return "google/chrome/user"; | 104 return "google/chrome/user"; |
| 105 #endif | 105 #endif |
| 106 return dm_protocol::kChromeUserPolicyType; | 106 return dm_protocol::kChromeUserPolicyType; |
| 107 } | 107 } |
| 108 | 108 |
| 109 void SetManagementMode(em::PolicyData& policy_data, ManagementMode mode) { | 109 void SetManagementMode(em::PolicyData& policy_data, ManagementMode mode) { |
| 110 switch (mode) { | 110 switch (mode) { |
| 111 case MANAGEMENT_MODE_LOCAL_OWNER: | 111 case MANAGEMENT_MODE_LOCAL_OWNER: |
| 112 policy_data.set_management_mode(em::PolicyData::LOCAL_OWNER); | 112 policy_data.set_management_mode(em::PolicyData::LOCAL_OWNER); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 139 NOTREACHED(); | 139 NOTREACHED(); |
| 140 return MANAGEMENT_MODE_LOCAL_OWNER; | 140 return MANAGEMENT_MODE_LOCAL_OWNER; |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 | 143 |
| 144 return policy_data.has_request_token() ? | 144 return policy_data.has_request_token() ? |
| 145 MANAGEMENT_MODE_ENTERPRISE_MANAGED : MANAGEMENT_MODE_LOCAL_OWNER; | 145 MANAGEMENT_MODE_ENTERPRISE_MANAGED : MANAGEMENT_MODE_LOCAL_OWNER; |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace policy | 148 } // namespace policy |
| OLD | NEW |