| OLD | NEW |
| 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_POLICY_CLOUD_USER_CLOUD_POLICY_STORE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_STORE_H_ |
| 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_STORE_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_STORE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 Profile* profile, | 32 Profile* profile, |
| 33 const base::FilePath& policy_file, | 33 const base::FilePath& policy_file, |
| 34 scoped_refptr<base::SequencedTaskRunner> background_task_runner); | 34 scoped_refptr<base::SequencedTaskRunner> background_task_runner); |
| 35 virtual ~UserCloudPolicyStore(); | 35 virtual ~UserCloudPolicyStore(); |
| 36 | 36 |
| 37 // Factory method for creating a UserCloudPolicyStore for |profile|. | 37 // Factory method for creating a UserCloudPolicyStore for |profile|. |
| 38 static scoped_ptr<UserCloudPolicyStore> Create( | 38 static scoped_ptr<UserCloudPolicyStore> Create( |
| 39 Profile* profile, | 39 Profile* profile, |
| 40 scoped_refptr<base::SequencedTaskRunner> background_task_runner); | 40 scoped_refptr<base::SequencedTaskRunner> background_task_runner); |
| 41 | 41 |
| 42 // Sets the username from signin for validation of the policy. |
| 43 void SetSigninUsername(const std::string& username); |
| 44 |
| 42 // Loads policy immediately on the current thread. Virtual for mocks. | 45 // Loads policy immediately on the current thread. Virtual for mocks. |
| 43 virtual void LoadImmediately(); | 46 virtual void LoadImmediately(); |
| 44 | 47 |
| 45 // Deletes any existing policy blob and notifies observers via OnStoreLoaded() | 48 // Deletes any existing policy blob and notifies observers via OnStoreLoaded() |
| 46 // that the blob has changed. Virtual for mocks. | 49 // that the blob has changed. Virtual for mocks. |
| 47 virtual void Clear(); | 50 virtual void Clear(); |
| 48 | 51 |
| 49 // CloudPolicyStore implementation. | 52 // CloudPolicyStore implementation. |
| 50 virtual void Load() OVERRIDE; | 53 virtual void Load() OVERRIDE; |
| 51 virtual void Store( | 54 virtual void Store( |
| 52 const enterprise_management::PolicyFetchResponse& policy) OVERRIDE; | 55 const enterprise_management::PolicyFetchResponse& policy) OVERRIDE; |
| 53 | 56 |
| 57 protected: |
| 58 std::string signin_username_; |
| 59 |
| 54 private: | 60 private: |
| 55 // Callback invoked when a new policy has been loaded from disk. If | 61 // Callback invoked when a new policy has been loaded from disk. If |
| 56 // |validate_in_background| is true, then policy is validated via a background | 62 // |validate_in_background| is true, then policy is validated via a background |
| 57 // thread. | 63 // thread. |
| 58 void PolicyLoaded(bool validate_in_background, | 64 void PolicyLoaded(bool validate_in_background, |
| 59 struct PolicyLoadResult policy_load_result); | 65 struct PolicyLoadResult policy_load_result); |
| 60 | 66 |
| 61 // Starts policy blob validation. |callback| is invoked once validation is | 67 // Starts policy blob validation. |callback| is invoked once validation is |
| 62 // complete. If |validate_in_background| is true, then the validation work | 68 // complete. If |validate_in_background| is true, then the validation work |
| 63 // occurs on a background thread (results are sent back to the calling | 69 // occurs on a background thread (results are sent back to the calling |
| (...skipping 18 matching lines...) Expand all Loading... |
| 82 | 88 |
| 83 // Path to file where we store persisted policy. | 89 // Path to file where we store persisted policy. |
| 84 base::FilePath backing_file_path_; | 90 base::FilePath backing_file_path_; |
| 85 | 91 |
| 86 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStore); | 92 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStore); |
| 87 }; | 93 }; |
| 88 | 94 |
| 89 } // namespace policy | 95 } // namespace policy |
| 90 | 96 |
| 91 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_STORE_H_ | 97 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_STORE_H_ |
| OLD | NEW |