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

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

Issue 6840014: Support decoding GenericNamedValue based policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit test broken by patch set 2 Created 9 years, 8 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_USER_POLICY_CACHE_H_ 5 #ifndef CHROME_BROWSER_POLICY_USER_POLICY_CACHE_H_
6 #define CHROME_BROWSER_POLICY_USER_POLICY_CACHE_H_ 6 #define CHROME_BROWSER_POLICY_USER_POLICY_CACHE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string>
10
9 #include "base/file_path.h" 11 #include "base/file_path.h"
10 #include "chrome/browser/policy/cloud_policy_cache_base.h" 12 #include "chrome/browser/policy/cloud_policy_cache_base.h"
11 13
14 // <Old-style policy support> (see comment below)
15 namespace enterprise_management {
16 class GenericValue;
17 } // namespace enterprise_management
18 // </Old-style policy support>
19
12 namespace policy { 20 namespace policy {
13 21
14 // CloudPolicyCacheBase implementation that persists policy information 22 // CloudPolicyCacheBase implementation that persists policy information
15 // into the file specified by the c'tor parameter |backing_file_path|. 23 // into the file specified by the c'tor parameter |backing_file_path|.
16 class UserPolicyCache : public CloudPolicyCacheBase { 24 class UserPolicyCache : public CloudPolicyCacheBase {
17 public: 25 public:
18 explicit UserPolicyCache(const FilePath& backing_file_path); 26 explicit UserPolicyCache(const FilePath& backing_file_path);
19 virtual ~UserPolicyCache(); 27 virtual ~UserPolicyCache();
20 28
21 // CloudPolicyCacheBase implementation: 29 // CloudPolicyCacheBase implementation:
22 virtual void Load() OVERRIDE; 30 virtual void Load() OVERRIDE;
23 virtual void SetPolicy(const em::PolicyFetchResponse& policy) OVERRIDE; 31 virtual void SetPolicy(const em::PolicyFetchResponse& policy) OVERRIDE;
24 virtual void SetUnmanaged() OVERRIDE; 32 virtual void SetUnmanaged() OVERRIDE;
25 33
26 private: 34 private:
27 void PersistPolicy(const em::PolicyFetchResponse& policy, 35 void PersistPolicy(const em::PolicyFetchResponse& policy,
28 const base::Time& timestamp); 36 const base::Time& timestamp);
29 37
30 // CloudPolicyCacheBase implementation: 38 // CloudPolicyCacheBase implementation:
31 virtual bool DecodePolicyData(const em::PolicyData& policy_data, 39 virtual bool DecodePolicyData(const em::PolicyData& policy_data,
32 PolicyMap* mandatory, 40 PolicyMap* mandatory,
33 PolicyMap* recommended) OVERRIDE; 41 PolicyMap* recommended) OVERRIDE;
34 42
43 // <Old-style policy support>
44 // The following member functions are needed to support old-style policy and
45 // can be removed once all server-side components (CPanel, D3) have been
46 // migrated to providing the new policy format.
47
48 // If |mandatory| and |recommended| are both empty, and |policy_data|
49 // contains a field named "repeated GenericNamedValue named_value = 2;",
50 // this field is decoded into |mandatory|.
51 void MaybeDecodeOldstylePolicy(const std::string& policy_data,
52 PolicyMap* mandatory,
53 PolicyMap* recommended);
54
55 Value* DecodeIntegerValue(google::protobuf::int64 value) const;
56 Value* DecodeValue(const em::GenericValue& value) const;
57
58 // </Old-style policy support>
59
35 // The file in which we store a cached version of the policy information. 60 // The file in which we store a cached version of the policy information.
36 const FilePath backing_file_path_; 61 const FilePath backing_file_path_;
37 62
38 DISALLOW_COPY_AND_ASSIGN(UserPolicyCache); 63 DISALLOW_COPY_AND_ASSIGN(UserPolicyCache);
39 }; 64 };
40 65
41 } // namespace policy 66 } // namespace policy
42 67
43 #endif // CHROME_BROWSER_POLICY_USER_POLICY_CACHE_H_ 68 #endif // CHROME_BROWSER_POLICY_USER_POLICY_CACHE_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/proto/old_generic_format.proto ('k') | chrome/browser/policy/user_policy_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698