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

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: wrap Validator in unique_ptr Created 3 years, 9 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(bool validate_in_background,
63 const std::string& policy_blob);
60 64
61 // Updates state after validation and notifies observers. 65 // Updates state after validation and notifies observers.
62 void UpdatePolicy(const std::string& signature_validation_public_key, 66 void UpdatePolicy(const std::string& signature_validation_public_key,
63 UserCloudPolicyValidator* validator); 67 UserCloudPolicyValidator* validator);
64 68
65 // Sends the policy blob to session_manager for storing after validation. 69 // Sends the policy blob to session_manager for storing after validation.
66 void StoreValidatedPolicy( 70 void StoreValidatedPolicy(
67 const std::string& signature_validation_public_key_unused, 71 const std::string& signature_validation_public_key_unused,
68 UserCloudPolicyValidator* validator); 72 UserCloudPolicyValidator* validator);
69 73
70 // Called back when a store operation completes, updates state and reloads the 74 // Called back when a store operation completes, updates state and reloads the
71 // policy if applicable. 75 // policy if applicable.
72 void HandleStoreResult(bool result); 76 void HandleStoreResult(bool result);
73 77
74 // Gets the owner key and triggers policy validation. 78 // Gets the owner key and triggers policy validation.
75 void CheckKeyAndValidate( 79 void CheckKeyAndValidate(
76 bool valid_timestamp_required, 80 bool valid_timestamp_required,
77 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy, 81 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy,
82 bool validate_in_background,
78 const ValidateCompletionCallback& callback); 83 const ValidateCompletionCallback& callback);
79 84
80 // Triggers policy validation. 85 // Triggers policy validation.
81 void Validate( 86 void Validate(
82 bool valid_timestamp_required, 87 bool valid_timestamp_required,
83 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy, 88 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy,
84 const ValidateCompletionCallback& callback, 89 const ValidateCompletionCallback& callback,
90 bool validate_in_background,
85 chromeos::DeviceSettingsService::OwnershipStatus ownership_status); 91 chromeos::DeviceSettingsService::OwnershipStatus ownership_status);
86 92
87 const std::string account_id_; 93 const std::string account_id_;
88 chromeos::SessionManagerClient* session_manager_client_; 94 chromeos::SessionManagerClient* session_manager_client_;
89 chromeos::DeviceSettingsService* device_settings_service_; 95 chromeos::DeviceSettingsService* device_settings_service_;
90 96
91 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; 97 scoped_refptr<base::SequencedTaskRunner> background_task_runner_;
92 98
93 base::WeakPtrFactory<DeviceLocalAccountPolicyStore> weak_factory_; 99 base::WeakPtrFactory<DeviceLocalAccountPolicyStore> weak_factory_;
94 100
95 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyStore); 101 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyStore);
96 }; 102 };
97 103
98 } // namespace policy 104 } // namespace policy
99 105
100 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_STORE_H_ 106 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698