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

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

Issue 12189011: Split up chrome/browser/policy subdirectory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_
6 #define CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/file_path.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h"
15 #include "chrome/browser/policy/cloud_policy_validator.h"
16 #include "chrome/browser/policy/user_cloud_policy_store_base.h"
17
18 namespace chromeos {
19 class SessionManagerClient;
20 }
21
22 namespace policy {
23
24 class LegacyPolicyCacheLoader;
25
26 // Implements a cloud policy store backed by the Chrome OS' session_manager,
27 // which takes care of persisting policy to disk and is accessed via DBus calls
28 // through SessionManagerClient.
29 //
30 // Additionally, this class drives legacy UserPolicyTokenCache and
31 // UserPolicyDiskCache instances, migrating policy from these to session_manager
32 // storage on the fly.
33 class UserCloudPolicyStoreChromeOS : public UserCloudPolicyStoreBase {
34 public:
35 UserCloudPolicyStoreChromeOS(
36 chromeos::SessionManagerClient* session_manager_client,
37 const std::string& username,
38 const FilePath& legacy_token_cache_file,
39 const FilePath& legacy_policy_cache_file);
40 virtual ~UserCloudPolicyStoreChromeOS();
41
42 // CloudPolicyStore:
43 virtual void Store(
44 const enterprise_management::PolicyFetchResponse& policy) OVERRIDE;
45 virtual void Load() OVERRIDE;
46
47 private:
48 // Called back from SessionManagerClient for policy load operations.
49 void OnPolicyRetrieved(const std::string& policy_blob);
50
51 // Completion handler for policy validation on the Load() path. Installs the
52 // policy and publishes it if validation succeeded.
53 void OnRetrievedPolicyValidated(UserCloudPolicyValidator* validator);
54
55 // Completion handler for policy validation on the Load() path. Starts a store
56 // operation if the validation succeeded.
57 void OnPolicyToStoreValidated(UserCloudPolicyValidator* validator);
58
59 // Called back from SessionManagerClient for policy store operations.
60 void OnPolicyStored(bool);
61
62 // Starts policy blob validation.
63 void Validate(
64 scoped_ptr<enterprise_management::PolicyFetchResponse> policy,
65 const UserCloudPolicyValidator::CompletionCallback& callback);
66
67 // Callback for loading legacy caches.
68 void OnLegacyLoadFinished(
69 const std::string& dm_token,
70 const std::string& device_id,
71 Status status,
72 scoped_ptr<enterprise_management::PolicyFetchResponse>);
73
74 // Completion callback for legacy policy validation.
75 void OnLegacyPolicyValidated(const std::string& dm_token,
76 const std::string& device_id,
77 UserCloudPolicyValidator* validator);
78
79 // Installs legacy tokens.
80 void InstallLegacyTokens(const std::string& dm_token,
81 const std::string& device_id);
82
83 // Removes the passed-in legacy cache directory.
84 static void RemoveLegacyCacheDir(const FilePath& dir);
85
86 chromeos::SessionManagerClient* session_manager_client_;
87 const std::string username_;
88
89 base::WeakPtrFactory<UserCloudPolicyStoreChromeOS> weak_factory_;
90
91 // TODO(mnissler): Remove all the legacy policy support members below after
92 // the number of pre-M20 clients drops back to zero.
93 FilePath legacy_cache_dir_;
94 scoped_ptr<LegacyPolicyCacheLoader> legacy_loader_;
95 bool legacy_caches_loaded_;
96
97 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreChromeOS);
98 };
99
100 } // namespace policy
101
102 #endif // CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698