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

Unified Diff: chromeos/dbus/session_manager_client.cc

Issue 2714493002: Load DeviceLocalAccount policy and DeviceSettings immediately on restore after Chrome crash. (Closed)
Patch Set: add flag to correctly process LoadImmediately() call Created 3 years, 10 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: chromeos/dbus/session_manager_client.cc
diff --git a/chromeos/dbus/session_manager_client.cc b/chromeos/dbus/session_manager_client.cc
index dd5c642a9b2fa1548a9358e1137be26f35e37b5c..a21b5a9770b2c6a4381e45071b4b596c6b84b630 100644
--- a/chromeos/dbus/session_manager_client.cc
+++ b/chromeos/dbus/session_manager_client.cc
@@ -208,6 +208,17 @@ class SessionManagerClientImpl : public SessionManagerClient {
callback));
}
+ std::string BlockingRetrieveDevicePolicy() override {
+ dbus::MethodCall method_call(login_manager::kSessionManagerInterface,
+ login_manager::kSessionManagerRetrievePolicy);
+ std::unique_ptr<dbus::Response> response =
+ blocking_method_caller_->CallMethodAndBlock(&method_call);
+ std::string policy;
+ ExtractString(login_manager::kSessionManagerRetrievePolicy, response.get(),
+ &policy);
+ return policy;
+ }
+
void RetrievePolicyForUser(const cryptohome::Identification& cryptohome_id,
const RetrievePolicyCallback& callback) override {
CallRetrievePolicyByUsername(
@@ -240,6 +251,22 @@ class SessionManagerClientImpl : public SessionManagerClient {
callback);
}
+ std::string BlockingRetrieveDeviceLocalAccountPolicy(
+ const std::string& account_name) override {
+ dbus::MethodCall method_call(
+ login_manager::kSessionManagerInterface,
+ login_manager::kSessionManagerRetrieveDeviceLocalAccountPolicy);
+ dbus::MessageWriter writer(&method_call);
+ writer.AppendString(account_name);
+ std::unique_ptr<dbus::Response> response =
+ blocking_method_caller_->CallMethodAndBlock(&method_call);
+ std::string policy;
+ ExtractString(
+ login_manager::kSessionManagerRetrieveDeviceLocalAccountPolicy,
+ response.get(), &policy);
+ return policy;
+ }
+
void StoreDevicePolicy(const std::string& policy_blob,
const StorePolicyCallback& callback) override {
dbus::MethodCall method_call(login_manager::kSessionManagerInterface,
@@ -843,6 +870,15 @@ class SessionManagerClientStubImpl : public SessionManagerClient {
.MayBlock(),
base::Bind(&GetFileContent, device_policy_path), callback);
}
+ std::string BlockingRetrieveDevicePolicy() override {
+ base::FilePath owner_key_path;
+ if (!PathService::Get(chromeos::FILE_OWNER_KEY, &owner_key_path)) {
+ return "";
+ }
+ base::FilePath device_policy_path =
+ owner_key_path.DirName().AppendASCII("stub_device_policy");
emaxx 2017/02/22 17:24:34 nit: Maybe define a constant for this string? Or e
Sergey Poromov 2017/02/28 14:01:17 Done.
+ return GetFileContent(device_policy_path);
+ }
void RetrievePolicyForUser(const cryptohome::Identification& cryptohome_id,
const RetrievePolicyCallback& callback) override {
base::PostTaskWithTraitsAndReplyWithResult(
@@ -864,6 +900,11 @@ class SessionManagerClientStubImpl : public SessionManagerClient {
RetrievePolicyForUser(cryptohome::Identification::FromString(account_id),
callback);
}
+ std::string BlockingRetrieveDeviceLocalAccountPolicy(
+ const std::string& account_id) override {
+ return BlockingRetrievePolicyForUser(
+ cryptohome::Identification::FromString(account_id));
+ }
void StoreDevicePolicy(const std::string& policy_blob,
const StorePolicyCallback& callback) override {
enterprise_management::PolicyFetchResponse response;
« chromeos/dbus/session_manager_client.h ('K') | « chromeos/dbus/session_manager_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698