| 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/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } else { | 179 } else { |
| 180 providers.push_back(&user_cloud_policy_provider_); | 180 providers.push_back(&user_cloud_policy_provider_); |
| 181 } | 181 } |
| 182 | 182 |
| 183 return new PolicyServiceImpl(providers); | 183 return new PolicyServiceImpl(providers); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void BrowserPolicyConnector::RegisterForDevicePolicy( | 186 void BrowserPolicyConnector::RegisterForDevicePolicy( |
| 187 const std::string& owner_email, | 187 const std::string& owner_email, |
| 188 const std::string& token, | 188 const std::string& token, |
| 189 bool known_machine_id) { | 189 bool known_machine_id, |
| 190 bool reregister) { |
| 190 #if defined(OS_CHROMEOS) | 191 #if defined(OS_CHROMEOS) |
| 191 if (device_data_store_.get()) { | 192 if (device_data_store_.get()) { |
| 192 if (!device_data_store_->device_token().empty()) { | 193 if (!device_data_store_->device_token().empty()) { |
| 193 LOG(ERROR) << "Device policy data store already has a DMToken; " | 194 LOG(ERROR) << "Device policy data store already has a DMToken; " |
| 194 << "RegisterForDevicePolicy won't trigger a new registration."; | 195 << "RegisterForDevicePolicy won't trigger a new registration."; |
| 195 } | 196 } |
| 197 |
| 196 device_data_store_->set_user_name(owner_email); | 198 device_data_store_->set_user_name(owner_email); |
| 197 device_data_store_->set_known_machine_id(known_machine_id); | 199 device_data_store_->set_known_machine_id(known_machine_id); |
| 200 if (reregister) { |
| 201 device_data_store_->set_device_id(install_attributes_->GetDeviceId()); |
| 202 device_data_store_->set_reregister(true); |
| 203 } |
| 198 device_data_store_->set_policy_fetching_enabled(false); | 204 device_data_store_->set_policy_fetching_enabled(false); |
| 199 device_data_store_->SetOAuthToken(token); | 205 device_data_store_->SetOAuthToken(token); |
| 200 } | 206 } |
| 201 #endif | 207 #endif |
| 202 } | 208 } |
| 203 | 209 |
| 204 bool BrowserPolicyConnector::IsEnterpriseManaged() { | 210 bool BrowserPolicyConnector::IsEnterpriseManaged() { |
| 205 #if defined(OS_CHROMEOS) | 211 #if defined(OS_CHROMEOS) |
| 206 return install_attributes_.get() && install_attributes_->IsEnterpriseDevice(); | 212 return install_attributes_.get() && install_attributes_->IsEnterpriseDevice(); |
| 207 #else | 213 #else |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 return new AsyncPolicyProvider(loader.Pass()); | 577 return new AsyncPolicyProvider(loader.Pass()); |
| 572 } else { | 578 } else { |
| 573 return NULL; | 579 return NULL; |
| 574 } | 580 } |
| 575 #else | 581 #else |
| 576 return NULL; | 582 return NULL; |
| 577 #endif | 583 #endif |
| 578 } | 584 } |
| 579 | 585 |
| 580 } // namespace policy | 586 } // namespace policy |
| OLD | NEW |