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

Side by Side Diff: components/policy/core/common/policy_loader_mac.h

Issue 1902633006: Convert //components/policy from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments and use namespace alias Created 4 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
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 COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_MAC_H_ 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_MAC_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_MAC_H_ 6 #define COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_MAC_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 29 matching lines...) Expand all
40 // instead of the default value of kCFPreferencesCurrentApplication. 40 // instead of the default value of kCFPreferencesCurrentApplication.
41 PolicyLoaderMac(scoped_refptr<base::SequencedTaskRunner> task_runner, 41 PolicyLoaderMac(scoped_refptr<base::SequencedTaskRunner> task_runner,
42 const base::FilePath& managed_policy_path, 42 const base::FilePath& managed_policy_path,
43 MacPreferences* preferences, 43 MacPreferences* preferences,
44 CFStringRef application_id); 44 CFStringRef application_id);
45 45
46 ~PolicyLoaderMac() override; 46 ~PolicyLoaderMac() override;
47 47
48 // AsyncPolicyLoader implementation. 48 // AsyncPolicyLoader implementation.
49 void InitOnBackgroundThread() override; 49 void InitOnBackgroundThread() override;
50 scoped_ptr<PolicyBundle> Load() override; 50 std::unique_ptr<PolicyBundle> Load() override;
51 base::Time LastModificationTime() override; 51 base::Time LastModificationTime() override;
52 52
53 #if defined(OS_MACOSX) && !defined(OS_IOS) 53 #if defined(OS_MACOSX) && !defined(OS_IOS)
54 // Gets the path to the preferences (.plist) file associated with the given 54 // Gets the path to the preferences (.plist) file associated with the given
55 // |bundle_id|. The file at the returned path might not exist (yet). 55 // |bundle_id|. The file at the returned path might not exist (yet).
56 // Returns an empty path upon failure. 56 // Returns an empty path upon failure.
57 static base::FilePath GetManagedPolicyPath(CFStringRef bundle_id); 57 static base::FilePath GetManagedPolicyPath(CFStringRef bundle_id);
58 #endif 58 #endif
59 59
60 private: 60 private:
61 // Callback for the FilePathWatcher. 61 // Callback for the FilePathWatcher.
62 void OnFileUpdated(const base::FilePath& path, bool error); 62 void OnFileUpdated(const base::FilePath& path, bool error);
63 63
64 // Loads policies for the components described in the current schema_map() 64 // Loads policies for the components described in the current schema_map()
65 // which belong to the domain |domain_name|, and stores them in the |bundle|. 65 // which belong to the domain |domain_name|, and stores them in the |bundle|.
66 void LoadPolicyForDomain( 66 void LoadPolicyForDomain(
67 PolicyDomain domain, 67 PolicyDomain domain,
68 const std::string& domain_name, 68 const std::string& domain_name,
69 PolicyBundle* bundle); 69 PolicyBundle* bundle);
70 70
71 // Loads the policies described in |schema| from the bundle identified by 71 // Loads the policies described in |schema| from the bundle identified by
72 // |bundle_id_string|, and stores them in |policy|. 72 // |bundle_id_string|, and stores them in |policy|.
73 void LoadPolicyForComponent(const std::string& bundle_id_string, 73 void LoadPolicyForComponent(const std::string& bundle_id_string,
74 const Schema& schema, 74 const Schema& schema,
75 PolicyMap* policy); 75 PolicyMap* policy);
76 76
77 scoped_ptr<MacPreferences> preferences_; 77 std::unique_ptr<MacPreferences> preferences_;
78 78
79 // Path to the managed preferences file for the current user, if it could 79 // Path to the managed preferences file for the current user, if it could
80 // be found. Updates of this file trigger a policy reload. 80 // be found. Updates of this file trigger a policy reload.
81 base::FilePath managed_policy_path_; 81 base::FilePath managed_policy_path_;
82 82
83 // Watches for events on the |managed_policy_path_|. 83 // Watches for events on the |managed_policy_path_|.
84 base::FilePathWatcher watcher_; 84 base::FilePathWatcher watcher_;
85 85
86 // Application ID to pass into Mac's Preference Utilities API. 86 // Application ID to pass into Mac's Preference Utilities API.
87 CFStringRef application_id_; 87 CFStringRef application_id_;
88 88
89 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderMac); 89 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderMac);
90 }; 90 };
91 91
92 } // namespace policy 92 } // namespace policy
93 93
94 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_MAC_H_ 94 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_MAC_H_
OLDNEW
« no previous file with comments | « components/policy/core/common/policy_loader_ios_unittest.mm ('k') | components/policy/core/common/policy_loader_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698