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

Unified Diff: chrome/browser/chromeos/policy/device_local_account_policy_store.cc

Issue 2801993002: Abandon user sign in when policy is retrieved before session started (Closed)
Patch Set: Fixed review comments Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/policy/device_local_account_policy_store.cc
diff --git a/chrome/browser/chromeos/policy/device_local_account_policy_store.cc b/chrome/browser/chromeos/policy/device_local_account_policy_store.cc
index 9374438e80d2a7de3080e0042486c8a7abb21b0e..b83a605f1d8ceadfd2671dfd1af4ea683b10e25f 100644
--- a/chrome/browser/chromeos/policy/device_local_account_policy_store.cc
+++ b/chrome/browser/chromeos/policy/device_local_account_policy_store.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/memory/ptr_util.h"
-#include "chromeos/dbus/session_manager_client.h"
#include "components/ownership/owner_key_util.h"
#include "components/policy/core/common/cloud/device_management_service.h"
#include "components/policy/core/common/external_data_fetcher.h"
@@ -18,6 +17,9 @@
#include "components/policy/proto/cloud_policy.pb.h"
#include "components/policy/proto/device_management_backend.pb.h"
+using RetrievePolicyResponseType =
+ chromeos::SessionManagerClient::RetrievePolicyResponseType;
+
namespace em = enterprise_management;
namespace policy {
@@ -56,10 +58,12 @@ void DeviceLocalAccountPolicyStore::LoadImmediately() {
// Cancel all running async loads.
weak_factory_.InvalidateWeakPtrs();
- const std::string policy_blob =
+ std::string policy_blob;
+ RetrievePolicyResponseType response =
session_manager_client_->BlockingRetrieveDeviceLocalAccountPolicy(
- account_id_);
- ValidateLoadedPolicyBlob(false /*validate_in_background*/, policy_blob);
+ account_id_, &policy_blob);
+ ValidateLoadedPolicyBlob(false /*validate_in_background*/, policy_blob,
+ response);
}
void DeviceLocalAccountPolicyStore::Store(
@@ -74,8 +78,10 @@ void DeviceLocalAccountPolicyStore::Store(
void DeviceLocalAccountPolicyStore::ValidateLoadedPolicyBlob(
bool validate_in_background,
- const std::string& policy_blob) {
- if (policy_blob.empty()) {
+ const std::string& policy_blob,
+ RetrievePolicyResponseType response_type) {
+ if (response_type != RetrievePolicyResponseType::SUCCESS ||
+ policy_blob.empty()) {
status_ = CloudPolicyStore::STATUS_LOAD_ERROR;
NotifyStoreError();
} else {

Powered by Google App Engine
This is Rietveld 408576698