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

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

Issue 18308004: Update CrOS to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 5 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/policy_types.h" 10 #include "chrome/browser/policy/policy_types.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 callback)); 152 callback));
153 } 153 }
154 154
155 void DeviceLocalAccountPolicyStore::Validate( 155 void DeviceLocalAccountPolicyStore::Validate(
156 scoped_ptr<em::PolicyFetchResponse> policy_response, 156 scoped_ptr<em::PolicyFetchResponse> policy_response,
157 const UserCloudPolicyValidator::CompletionCallback& callback, 157 const UserCloudPolicyValidator::CompletionCallback& callback,
158 chromeos::DeviceSettingsService::OwnershipStatus ownership_status, 158 chromeos::DeviceSettingsService::OwnershipStatus ownership_status,
159 bool is_owner) { 159 bool is_owner) {
160 DCHECK_NE(chromeos::DeviceSettingsService::OWNERSHIP_UNKNOWN, 160 DCHECK_NE(chromeos::DeviceSettingsService::OWNERSHIP_UNKNOWN,
161 ownership_status); 161 ownership_status);
162 chromeos::OwnerKey* key = device_settings_service_->GetOwnerKey(); 162 scoped_refptr<chromeos::OwnerKey> key =
163 if (!key || !key->public_key()) { 163 device_settings_service_->GetOwnerKey();
164 if (!key.get() || !key->public_key()) {
164 status_ = CloudPolicyStore::STATUS_BAD_STATE; 165 status_ = CloudPolicyStore::STATUS_BAD_STATE;
165 NotifyStoreLoaded(); 166 NotifyStoreLoaded();
166 return; 167 return;
167 } 168 }
168 169
169 scoped_ptr<UserCloudPolicyValidator> validator( 170 scoped_ptr<UserCloudPolicyValidator> validator(
170 UserCloudPolicyValidator::Create(policy_response.Pass())); 171 UserCloudPolicyValidator::Create(policy_response.Pass()));
171 validator->ValidateUsername(account_id_); 172 validator->ValidateUsername(account_id_);
172 validator->ValidatePolicyType(dm_protocol::kChromePublicAccountPolicyType); 173 validator->ValidatePolicyType(dm_protocol::kChromePublicAccountPolicyType);
173 validator->ValidateAgainstCurrentPolicy( 174 validator->ValidateAgainstCurrentPolicy(
174 policy(), 175 policy(),
175 CloudPolicyValidatorBase::TIMESTAMP_REQUIRED, 176 CloudPolicyValidatorBase::TIMESTAMP_REQUIRED,
176 CloudPolicyValidatorBase::DM_TOKEN_REQUIRED); 177 CloudPolicyValidatorBase::DM_TOKEN_REQUIRED);
177 validator->ValidatePayload(); 178 validator->ValidatePayload();
178 validator->ValidateSignature(*key->public_key(), false); 179 validator->ValidateSignature(*key->public_key(), false);
179 validator.release()->StartValidation(callback); 180 validator.release()->StartValidation(callback);
180 } 181 }
181 182
182 } // namespace policy 183 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698