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

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

Issue 19733003: Implement cloud policy invalidations using the invalidation service framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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/user_cloud_policy_store_chromeos.h" 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.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/callback.h" 9 #include "base/callback.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 "Enterprise.UserPolicyValidationLoadStatus", 324 "Enterprise.UserPolicyValidationLoadStatus",
325 validation_status_, 325 validation_status_,
326 UserCloudPolicyValidator::VALIDATION_POLICY_PARSE_ERROR + 1); 326 UserCloudPolicyValidator::VALIDATION_POLICY_PARSE_ERROR + 1);
327 327
328 if (!validator->success()) { 328 if (!validator->success()) {
329 status_ = STATUS_VALIDATION_ERROR; 329 status_ = STATUS_VALIDATION_ERROR;
330 NotifyStoreError(); 330 NotifyStoreError();
331 return; 331 return;
332 } 332 }
333 333
334 InstallPolicy(validator->policy_data().Pass(), validator->payload().Pass()); 334 InstallPolicy(
335 validator->policy_data().Pass(),
336 validator->payload().Pass(),
337 validator->hash_value());
Joao da Silva 2013/07/23 20:44:47 This can be removed (and the change below too) if
Steve Condie 2013/07/24 01:42:04 Done.
335 status_ = STATUS_OK; 338 status_ = STATUS_OK;
336 339
337 // Policy has been loaded successfully. This indicates that new-style policy 340 // Policy has been loaded successfully. This indicates that new-style policy
338 // is working, so the legacy cache directory can be removed. 341 // is working, so the legacy cache directory can be removed.
339 if (!legacy_cache_dir_.empty()) { 342 if (!legacy_cache_dir_.empty()) {
340 content::BrowserThread::PostBlockingPoolTask( 343 content::BrowserThread::PostBlockingPoolTask(
341 FROM_HERE, 344 FROM_HERE,
342 base::Bind(&UserCloudPolicyStoreChromeOS::RemoveLegacyCacheDir, 345 base::Bind(&UserCloudPolicyStoreChromeOS::RemoveLegacyCacheDir,
343 legacy_cache_dir_)); 346 legacy_cache_dir_));
344 legacy_cache_dir_.clear(); 347 legacy_cache_dir_.clear();
(...skipping 23 matching lines...) Expand all
368 } 371 }
369 } 372 }
370 373
371 void UserCloudPolicyStoreChromeOS::OnLegacyPolicyValidated( 374 void UserCloudPolicyStoreChromeOS::OnLegacyPolicyValidated(
372 const std::string& dm_token, 375 const std::string& dm_token,
373 const std::string& device_id, 376 const std::string& device_id,
374 UserCloudPolicyValidator* validator) { 377 UserCloudPolicyValidator* validator) {
375 validation_status_ = validator->status(); 378 validation_status_ = validator->status();
376 if (validator->success()) { 379 if (validator->success()) {
377 status_ = STATUS_OK; 380 status_ = STATUS_OK;
378 InstallPolicy(validator->policy_data().Pass(), validator->payload().Pass()); 381 InstallPolicy(
382 validator->policy_data().Pass(),
383 validator->payload().Pass(),
384 validator->hash_value());
379 385
380 // Clear the public key version. The public key version field would 386 // Clear the public key version. The public key version field would
381 // otherwise indicate that we have key installed in the store when in fact 387 // otherwise indicate that we have key installed in the store when in fact
382 // we haven't. This may result in policy updates failing signature 388 // we haven't. This may result in policy updates failing signature
383 // verification. 389 // verification.
384 policy_->clear_public_key_version(); 390 policy_->clear_public_key_version();
385 } else { 391 } else {
386 status_ = STATUS_VALIDATION_ERROR; 392 status_ = STATUS_VALIDATION_ERROR;
387 } 393 }
388 394
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 !sanitized_username.empty()) { 494 !sanitized_username.empty()) {
489 policy_key_path_ = user_policy_key_dir_.Append( 495 policy_key_path_ = user_policy_key_dir_.Append(
490 base::StringPrintf(kPolicyKeyFile, sanitized_username.c_str())); 496 base::StringPrintf(kPolicyKeyFile, sanitized_username.c_str()));
491 } else { 497 } else {
492 SampleValidationFailure(VALIDATION_FAILURE_DBUS); 498 SampleValidationFailure(VALIDATION_FAILURE_DBUS);
493 } 499 }
494 ReloadPolicyKey(callback); 500 ReloadPolicyKey(callback);
495 } 501 }
496 502
497 } // namespace policy 503 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698