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

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

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 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_STORE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_STORE_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_STORE_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_STORE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 30 matching lines...) Expand all
41 chromeos::DeviceSettingsService* device_settings_service, 41 chromeos::DeviceSettingsService* device_settings_service,
42 scoped_refptr<base::SequencedTaskRunner> background_task_runner); 42 scoped_refptr<base::SequencedTaskRunner> background_task_runner);
43 ~DeviceLocalAccountPolicyStore() override; 43 ~DeviceLocalAccountPolicyStore() override;
44 44
45 const std::string& account_id() const { return account_id_; } 45 const std::string& account_id() const { return account_id_; }
46 46
47 // CloudPolicyStore: 47 // CloudPolicyStore:
48 void Store(const enterprise_management::PolicyFetchResponse& policy) override; 48 void Store(const enterprise_management::PolicyFetchResponse& policy) override;
49 void Load() override; 49 void Load() override;
50 50
51 // Loads the policy synchronously on the current thread.
52 void LoadImmediately();
53
51 private: 54 private:
52 // The callback invoked once policy validation is complete. Passed are the 55 // The callback invoked once policy validation is complete. Passed are the
53 // used public key and the validator. 56 // used public key and the validator.
54 using ValidateCompletionCallback = 57 using ValidateCompletionCallback =
55 base::Callback<void(const std::string&, UserCloudPolicyValidator*)>; 58 base::Callback<void(const std::string&, UserCloudPolicyValidator*)>;
56 59
57 // Called back by |session_manager_client_| after policy retrieval. Checks for 60 // Called back by |session_manager_client_| after policy retrieval. Checks for
58 // success and triggers policy validation. 61 // success and triggers policy validation.
59 void ValidateLoadedPolicyBlob(const std::string& policy_blob); 62 void ValidateLoadedPolicyBlob(const std::string& policy_blob);
60 63
(...skipping 16 matching lines...) Expand all
77 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy, 80 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy,
78 const ValidateCompletionCallback& callback); 81 const ValidateCompletionCallback& callback);
79 82
80 // Triggers policy validation. 83 // Triggers policy validation.
81 void Validate( 84 void Validate(
82 bool valid_timestamp_required, 85 bool valid_timestamp_required,
83 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy, 86 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy,
84 const ValidateCompletionCallback& callback, 87 const ValidateCompletionCallback& callback,
85 chromeos::DeviceSettingsService::OwnershipStatus ownership_status); 88 chromeos::DeviceSettingsService::OwnershipStatus ownership_status);
86 89
90 // Creates validator for checks on policy load.
91 std::unique_ptr<UserCloudPolicyValidator> CreateValidatorForLoad(
92 bool valid_timestamp_required,
93 const enterprise_management::PolicyData* device_policy_data,
94 scoped_refptr<ownership::PublicKey> key,
95 std::unique_ptr<enterprise_management::PolicyFetchResponse>
96 policy_response);
97
87 const std::string account_id_; 98 const std::string account_id_;
88 chromeos::SessionManagerClient* session_manager_client_; 99 chromeos::SessionManagerClient* session_manager_client_;
89 chromeos::DeviceSettingsService* device_settings_service_; 100 chromeos::DeviceSettingsService* device_settings_service_;
90 101
91 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; 102 scoped_refptr<base::SequencedTaskRunner> background_task_runner_;
92 103
93 base::WeakPtrFactory<DeviceLocalAccountPolicyStore> weak_factory_; 104 base::WeakPtrFactory<DeviceLocalAccountPolicyStore> weak_factory_;
94 105
95 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyStore); 106 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyStore);
96 }; 107 };
97 108
98 } // namespace policy 109 } // namespace policy
99 110
100 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_STORE_H_ 111 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698