Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: chrome/browser/chromeos/policy/device_local_account_policy_store.cc

Issue 12218078: Implement a policy to autologin a public account. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: r3b@$3 Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/chromeos/policy/device_local_account_policy_store.h" 5 #include "chrome/browser/chromeos/policy/device_local_account_policy_store.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/policy/cloud/device_management_service.h" 9 #include "chrome/browser/policy/cloud/device_management_service.h"
10 #include "chrome/browser/policy/cloud/proto/device_management_backend.pb.h" 10 #include "chrome/browser/policy/cloud/proto/device_management_backend.pb.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 143 }
144 144
145 void DeviceLocalAccountPolicyStore::Validate( 145 void DeviceLocalAccountPolicyStore::Validate(
146 scoped_ptr<em::PolicyFetchResponse> policy_response, 146 scoped_ptr<em::PolicyFetchResponse> policy_response,
147 const UserCloudPolicyValidator::CompletionCallback& callback, 147 const UserCloudPolicyValidator::CompletionCallback& callback,
148 chromeos::DeviceSettingsService::OwnershipStatus ownership_status, 148 chromeos::DeviceSettingsService::OwnershipStatus ownership_status,
149 bool is_owner) { 149 bool is_owner) {
150 DCHECK_NE(chromeos::DeviceSettingsService::OWNERSHIP_UNKNOWN, 150 DCHECK_NE(chromeos::DeviceSettingsService::OWNERSHIP_UNKNOWN,
151 ownership_status); 151 ownership_status);
152 chromeos::OwnerKey* key = device_settings_service_->GetOwnerKey(); 152 chromeos::OwnerKey* key = device_settings_service_->GetOwnerKey();
153 if (!key->public_key()) { 153 if (!key || !key->public_key()) {
154 status_ = CloudPolicyStore::STATUS_BAD_STATE; 154 status_ = CloudPolicyStore::STATUS_BAD_STATE;
155 NotifyStoreLoaded(); 155 NotifyStoreLoaded();
156 return; 156 return;
157 } 157 }
158 158
159 scoped_ptr<UserCloudPolicyValidator> validator( 159 scoped_ptr<UserCloudPolicyValidator> validator(
160 UserCloudPolicyValidator::Create(policy_response.Pass())); 160 UserCloudPolicyValidator::Create(policy_response.Pass()));
161 validator->ValidateUsername(account_id_); 161 validator->ValidateUsername(account_id_);
162 validator->ValidatePolicyType(dm_protocol::kChromePublicAccountPolicyType); 162 validator->ValidatePolicyType(dm_protocol::kChromePublicAccountPolicyType);
163 validator->ValidateAgainstCurrentPolicy( 163 validator->ValidateAgainstCurrentPolicy(
164 policy(), 164 policy(),
165 CloudPolicyValidatorBase::TIMESTAMP_REQUIRED, 165 CloudPolicyValidatorBase::TIMESTAMP_REQUIRED,
166 CloudPolicyValidatorBase::DM_TOKEN_REQUIRED); 166 CloudPolicyValidatorBase::DM_TOKEN_REQUIRED);
167 validator->ValidatePayload(); 167 validator->ValidatePayload();
168 validator->ValidateSignature(*key->public_key(), false); 168 validator->ValidateSignature(*key->public_key(), false);
169 validator.release()->StartValidation(callback); 169 validator.release()->StartValidation(callback);
170 } 170 }
171 171
172 } // namespace policy 172 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/webui_screen_locker.cc ('k') | chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698