| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/ownership/owner_settings_service_chromeos.h" | 5 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" |
| 6 | 6 |
| 7 #include <keyhi.h> | 7 #include <keyhi.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 policy->set_device_id(policy_data->device_id()); | 398 policy->set_device_id(policy_data->device_id()); |
| 399 } else { | 399 } else { |
| 400 // If there's no previous policy data, this is the first time the device | 400 // If there's no previous policy data, this is the first time the device |
| 401 // setting is set. We set the management mode to LOCAL_OWNER initially. | 401 // setting is set. We set the management mode to LOCAL_OWNER initially. |
| 402 policy->set_management_mode(em::PolicyData::LOCAL_OWNER); | 402 policy->set_management_mode(em::PolicyData::LOCAL_OWNER); |
| 403 } | 403 } |
| 404 policy->set_policy_type(policy::dm_protocol::kChromeDevicePolicyType); | 404 policy->set_policy_type(policy::dm_protocol::kChromeDevicePolicyType); |
| 405 policy->set_timestamp( | 405 policy->set_timestamp( |
| 406 (base::Time::Now() - base::Time::UnixEpoch()).InMilliseconds()); | 406 (base::Time::Now() - base::Time::UnixEpoch()).InMilliseconds()); |
| 407 policy->set_username(user_id); | 407 policy->set_username(user_id); |
| 408 if (policy_data->management_mode() == em::PolicyData::LOCAL_OWNER || | 408 if (policy_data->management_mode() == em::PolicyData::LOCAL_OWNER) |
| 409 policy_data->management_mode() == em::PolicyData::CONSUMER_MANAGED) { | |
| 410 FixupLocalOwnerPolicy(user_id, settings); | 409 FixupLocalOwnerPolicy(user_id, settings); |
| 411 } | |
| 412 if (!settings->SerializeToString(policy->mutable_policy_value())) | 410 if (!settings->SerializeToString(policy->mutable_policy_value())) |
| 413 return std::unique_ptr<em::PolicyData>(); | 411 return std::unique_ptr<em::PolicyData>(); |
| 414 | 412 |
| 415 return policy; | 413 return policy; |
| 416 } | 414 } |
| 417 | 415 |
| 418 // static | 416 // static |
| 419 void OwnerSettingsServiceChromeOS::FixupLocalOwnerPolicy( | 417 void OwnerSettingsServiceChromeOS::FixupLocalOwnerPolicy( |
| 420 const std::string& user_id, | 418 const std::string& user_id, |
| 421 enterprise_management::ChromeDeviceSettingsProto* settings) { | 419 enterprise_management::ChromeDeviceSettingsProto* settings) { |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 | 744 |
| 747 void OwnerSettingsServiceChromeOS::ReportStatusAndContinueStoring( | 745 void OwnerSettingsServiceChromeOS::ReportStatusAndContinueStoring( |
| 748 bool success) { | 746 bool success) { |
| 749 store_settings_factory_.InvalidateWeakPtrs(); | 747 store_settings_factory_.InvalidateWeakPtrs(); |
| 750 for (auto& observer : observers_) | 748 for (auto& observer : observers_) |
| 751 observer.OnSignedPolicyStored(success); | 749 observer.OnSignedPolicyStored(success); |
| 752 StorePendingChanges(); | 750 StorePendingChanges(); |
| 753 } | 751 } |
| 754 | 752 |
| 755 } // namespace chromeos | 753 } // namespace chromeos |
| OLD | NEW |