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

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

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "chromeos/dbus/dbus_method_call_status.h" 17 #include "chromeos/dbus/dbus_method_call_status.h"
18 #include "components/policy/core/common/cloud/cloud_policy_validator.h" 18 #include "components/policy/core/common/cloud/cloud_policy_validator.h"
19 #include "components/policy/core/common/cloud/user_cloud_policy_store_base.h" 19 #include "components/policy/core/common/cloud/user_cloud_policy_store_base.h"
20 #include "components/user_manager/user_id.h"
20 21
21 namespace base { 22 namespace base {
22 class SequencedTaskRunner; 23 class SequencedTaskRunner;
23 } 24 }
24 25
25 namespace chromeos { 26 namespace chromeos {
26 class CryptohomeClient; 27 class CryptohomeClient;
27 class SessionManagerClient; 28 class SessionManagerClient;
28 } 29 }
29 30
30 namespace policy { 31 namespace policy {
31 32
32 class LegacyPolicyCacheLoader; 33 class LegacyPolicyCacheLoader;
33 34
34 // Implements a cloud policy store backed by the Chrome OS' session_manager, 35 // Implements a cloud policy store backed by the Chrome OS' session_manager,
35 // which takes care of persisting policy to disk and is accessed via DBus calls 36 // which takes care of persisting policy to disk and is accessed via DBus calls
36 // through SessionManagerClient. 37 // through SessionManagerClient.
37 // 38 //
38 // Additionally, this class drives legacy UserPolicyTokenCache and 39 // Additionally, this class drives legacy UserPolicyTokenCache and
39 // UserPolicyDiskCache instances, migrating policy from these to session_manager 40 // UserPolicyDiskCache instances, migrating policy from these to session_manager
40 // storage on the fly. 41 // storage on the fly.
41 class UserCloudPolicyStoreChromeOS : public UserCloudPolicyStoreBase { 42 class UserCloudPolicyStoreChromeOS : public UserCloudPolicyStoreBase {
42 public: 43 public:
43 UserCloudPolicyStoreChromeOS( 44 UserCloudPolicyStoreChromeOS(
44 chromeos::CryptohomeClient* cryptohome_client, 45 chromeos::CryptohomeClient* cryptohome_client,
45 chromeos::SessionManagerClient* session_manager_client, 46 chromeos::SessionManagerClient* session_manager_client,
46 scoped_refptr<base::SequencedTaskRunner> background_task_runner, 47 scoped_refptr<base::SequencedTaskRunner> background_task_runner,
47 const std::string& username, 48 const user_manager::UserID& user_id,
48 const base::FilePath& user_policy_key_dir, 49 const base::FilePath& user_policy_key_dir,
49 const base::FilePath& legacy_token_cache_file, 50 const base::FilePath& legacy_token_cache_file,
50 const base::FilePath& legacy_policy_cache_file); 51 const base::FilePath& legacy_policy_cache_file);
51 ~UserCloudPolicyStoreChromeOS() override; 52 ~UserCloudPolicyStoreChromeOS() override;
52 53
53 // CloudPolicyStore: 54 // CloudPolicyStore:
54 void Store(const enterprise_management::PolicyFetchResponse& policy) override; 55 void Store(const enterprise_management::PolicyFetchResponse& policy) override;
55 void Load() override; 56 void Load() override;
56 57
57 // Loads the policy synchronously on the current thread. 58 // Loads the policy synchronously on the current thread.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // Callback for getting the sanitized username from |cryptohome_client_|. 118 // Callback for getting the sanitized username from |cryptohome_client_|.
118 void OnGetSanitizedUsername(const base::Closure& callback, 119 void OnGetSanitizedUsername(const base::Closure& callback,
119 chromeos::DBusMethodCallStatus call_status, 120 chromeos::DBusMethodCallStatus call_status,
120 const std::string& sanitized_username); 121 const std::string& sanitized_username);
121 122
122 scoped_ptr<UserCloudPolicyValidator> CreateValidatorForLoad( 123 scoped_ptr<UserCloudPolicyValidator> CreateValidatorForLoad(
123 scoped_ptr<enterprise_management::PolicyFetchResponse> policy); 124 scoped_ptr<enterprise_management::PolicyFetchResponse> policy);
124 125
125 chromeos::CryptohomeClient* cryptohome_client_; 126 chromeos::CryptohomeClient* cryptohome_client_;
126 chromeos::SessionManagerClient* session_manager_client_; 127 chromeos::SessionManagerClient* session_manager_client_;
127 const std::string username_; 128 const user_manager::UserID user_id_;
128 base::FilePath user_policy_key_dir_; 129 base::FilePath user_policy_key_dir_;
129 130
130 // TODO(mnissler): Remove all the legacy policy support members below after 131 // TODO(mnissler): Remove all the legacy policy support members below after
131 // the number of pre-M20 clients drops back to zero. 132 // the number of pre-M20 clients drops back to zero.
132 base::FilePath legacy_cache_dir_; 133 base::FilePath legacy_cache_dir_;
133 scoped_ptr<LegacyPolicyCacheLoader> legacy_loader_; 134 scoped_ptr<LegacyPolicyCacheLoader> legacy_loader_;
134 bool legacy_caches_loaded_; 135 bool legacy_caches_loaded_;
135 136
136 bool policy_key_loaded_; 137 bool policy_key_loaded_;
137 base::FilePath policy_key_path_; 138 base::FilePath policy_key_path_;
138 std::string policy_key_; 139 std::string policy_key_;
139 140
140 base::WeakPtrFactory<UserCloudPolicyStoreChromeOS> weak_factory_; 141 base::WeakPtrFactory<UserCloudPolicyStoreChromeOS> weak_factory_;
141 142
142 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreChromeOS); 143 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreChromeOS);
143 }; 144 };
144 145
145 } // namespace policy 146 } // namespace policy
146 147
147 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ 148 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698