| 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/policy/browser_policy_connector.h" | 5 #include "chrome/browser/policy/browser_policy_connector.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 #if defined(OS_CHROMEOS) | 176 #if defined(OS_CHROMEOS) |
| 177 return install_attributes_.get() && install_attributes_->IsEnterpriseDevice(); | 177 return install_attributes_.get() && install_attributes_->IsEnterpriseDevice(); |
| 178 #else | 178 #else |
| 179 return false; | 179 return false; |
| 180 #endif | 180 #endif |
| 181 } | 181 } |
| 182 | 182 |
| 183 EnterpriseInstallAttributes::LockResult | 183 EnterpriseInstallAttributes::LockResult |
| 184 BrowserPolicyConnector::LockDevice(const std::string& user) { | 184 BrowserPolicyConnector::LockDevice(const std::string& user) { |
| 185 #if defined(OS_CHROMEOS) | 185 #if defined(OS_CHROMEOS) |
| 186 if (install_attributes_.get()) | 186 if (install_attributes_.get()) { |
| 187 return install_attributes_->LockDevice(user); | 187 return install_attributes_->LockDevice(user, |
| 188 device_data_store_->device_mode(), |
| 189 device_data_store_->device_id()); |
| 190 } |
| 188 #endif | 191 #endif |
| 189 | 192 |
| 190 return EnterpriseInstallAttributes::LOCK_BACKEND_ERROR; | 193 return EnterpriseInstallAttributes::LOCK_BACKEND_ERROR; |
| 191 } | 194 } |
| 192 | 195 |
| 193 // static | 196 // static |
| 194 std::string BrowserPolicyConnector::GetSerialNumber() { | 197 std::string BrowserPolicyConnector::GetSerialNumber() { |
| 195 std::string serial_number; | 198 std::string serial_number; |
| 196 #if defined(OS_CHROMEOS) | 199 #if defined(OS_CHROMEOS) |
| 197 chromeos::system::StatisticsProvider* provider = | 200 chromeos::system::StatisticsProvider* provider = |
| (...skipping 11 matching lines...) Expand all Loading... |
| 209 | 212 |
| 210 std::string BrowserPolicyConnector::GetEnterpriseDomain() { | 213 std::string BrowserPolicyConnector::GetEnterpriseDomain() { |
| 211 #if defined(OS_CHROMEOS) | 214 #if defined(OS_CHROMEOS) |
| 212 if (install_attributes_.get()) | 215 if (install_attributes_.get()) |
| 213 return install_attributes_->GetDomain(); | 216 return install_attributes_->GetDomain(); |
| 214 #endif | 217 #endif |
| 215 | 218 |
| 216 return std::string(); | 219 return std::string(); |
| 217 } | 220 } |
| 218 | 221 |
| 222 DeviceMode BrowserPolicyConnector::GetDeviceMode() { |
| 223 #if defined(OS_CHROMEOS) |
| 224 if (install_attributes_.get()) |
| 225 return install_attributes_->GetMode(); |
| 226 else |
| 227 return DEVICE_MODE_UNKNOWN; |
| 228 #endif |
| 229 |
| 230 // We only have the notion of "enterprise" device on ChromeOS for now. |
| 231 return DEVICE_MODE_CONSUMER; |
| 232 } |
| 233 |
| 219 void BrowserPolicyConnector::ResetDevicePolicy() { | 234 void BrowserPolicyConnector::ResetDevicePolicy() { |
| 220 #if defined(OS_CHROMEOS) | 235 #if defined(OS_CHROMEOS) |
| 221 if (device_cloud_policy_subsystem_.get()) | 236 if (device_cloud_policy_subsystem_.get()) |
| 222 device_cloud_policy_subsystem_->Reset(); | 237 device_cloud_policy_subsystem_->Reset(); |
| 223 #endif | 238 #endif |
| 224 } | 239 } |
| 225 | 240 |
| 226 void BrowserPolicyConnector::FetchCloudPolicy() { | 241 void BrowserPolicyConnector::FetchCloudPolicy() { |
| 227 #if defined(OS_CHROMEOS) | 242 #if defined(OS_CHROMEOS) |
| 228 if (device_cloud_policy_subsystem_.get()) | 243 if (device_cloud_policy_subsystem_.get()) |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 if (user_cloud_policy_subsystem_.get()) { | 346 if (user_cloud_policy_subsystem_.get()) { |
| 332 user_cloud_policy_subsystem_->GetCloudPolicyCacheBase()-> | 347 user_cloud_policy_subsystem_->GetCloudPolicyCacheBase()-> |
| 333 SetFetchingDone(); | 348 SetFetchingDone(); |
| 334 } | 349 } |
| 335 } else { | 350 } else { |
| 336 if (user_data_store_.get()) | 351 if (user_data_store_.get()) |
| 337 user_data_store_->SetOAuthToken(oauth_token); | 352 user_data_store_->SetOAuthToken(oauth_token); |
| 338 } | 353 } |
| 339 } | 354 } |
| 340 | 355 |
| 341 const CloudPolicyDataStore* | 356 CloudPolicyDataStore* BrowserPolicyConnector::GetDeviceCloudPolicyDataStore() { |
| 342 BrowserPolicyConnector::GetDeviceCloudPolicyDataStore() const { | |
| 343 #if defined(OS_CHROMEOS) | 357 #if defined(OS_CHROMEOS) |
| 344 return device_data_store_.get(); | 358 return device_data_store_.get(); |
| 345 #else | 359 #else |
| 346 return NULL; | 360 return NULL; |
| 347 #endif | 361 #endif |
| 348 } | 362 } |
| 349 | 363 |
| 350 const CloudPolicyDataStore* | 364 CloudPolicyDataStore* BrowserPolicyConnector::GetUserCloudPolicyDataStore() { |
| 351 BrowserPolicyConnector::GetUserCloudPolicyDataStore() const { | |
| 352 return user_data_store_.get(); | 365 return user_data_store_.get(); |
| 353 } | 366 } |
| 354 | 367 |
| 355 const ConfigurationPolicyHandlerList* | 368 const ConfigurationPolicyHandlerList* |
| 356 BrowserPolicyConnector::GetHandlerList() const { | 369 BrowserPolicyConnector::GetHandlerList() const { |
| 357 return &handler_list_; | 370 return &handler_list_; |
| 358 } | 371 } |
| 359 | 372 |
| 360 UserAffiliation BrowserPolicyConnector::GetUserAffiliation( | 373 UserAffiliation BrowserPolicyConnector::GetUserAffiliation( |
| 361 const std::string& user_name) { | 374 const std::string& user_name) { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 config_dir_path.Append(FILE_PATH_LITERAL("recommended"))); | 523 config_dir_path.Append(FILE_PATH_LITERAL("recommended"))); |
| 511 } else { | 524 } else { |
| 512 return NULL; | 525 return NULL; |
| 513 } | 526 } |
| 514 #else | 527 #else |
| 515 return NULL; | 528 return NULL; |
| 516 #endif | 529 #endif |
| 517 } | 530 } |
| 518 | 531 |
| 519 } // namespace policy | 532 } // namespace policy |
| OLD | NEW |