Chromium Code Reviews| Index: remoting/host/policy_hack/policy_service_watcher_mac.mm |
| diff --git a/remoting/host/policy_hack/policy_service_watcher_mac.mm b/remoting/host/policy_hack/policy_service_watcher_mac.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..20cf67d0f5b87d9c096d2623e5ea34e2fcbc12b4 |
| --- /dev/null |
| +++ b/remoting/host/policy_hack/policy_service_watcher_mac.mm |
| @@ -0,0 +1,32 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/files/file_path.h" |
| +#include "base/files/file_util.h" |
| +#include "base/mac/foundation_util.h" |
| + |
| +namespace remoting { |
| +namespace policy_hack { |
| + |
| +// This function is based on handling of DIR_MANAGED_PREFS key by |
| +// PathService::Get in chrome/common/chrome_paths.cc. |
|
Mattias Nissler (ping if slow)
2015/01/06 09:06:12
It might be cleaner to move DIR_MANAGED_PREFS over
Łukasz Anforowicz
2015/01/07 17:54:15
Since DIR_MANAGED_PREFS was used only GetManagedPo
Mattias Nissler (ping if slow)
2015/01/08 09:58:36
For background, a common use for using path keys i
Łukasz Anforowicz
2015/01/08 23:09:26
Thanks for the explanation. I see that the PathSe
|
| +bool GetManagedPrefsDir(base::FilePath* result) { |
| + base::FilePath cur; |
| + if (!base::mac::GetLocalDirectory(NSLibraryDirectory, &cur)) { |
| + return false; |
| + } |
| + cur = cur.Append(FILE_PATH_LITERAL("Managed Preferences")); |
| + char* login = getlogin(); |
| + if (!login) |
| + return false; |
| + cur = cur.AppendASCII(login); |
| + if (!base::PathExists(cur)) // We don't want to create this. |
|
Mattias Nissler (ping if slow)
2015/01/06 09:06:12
nit: This comment is a copy-and-paste artifact tha
Łukasz Anforowicz
2015/01/07 17:54:15
I don't understand. This is indeed a copy&pasted
Mattias Nissler (ping if slow)
2015/01/08 09:58:36
IIRC, in the path resolution logic the return valu
Łukasz Anforowicz
2015/01/08 23:09:26
A comment for PathService::Get from base/path_serv
|
| + return false; |
| + |
| + *result = cur; |
| + return true; |
| +} |
| + |
| +} // namespace policy_hack |
| +} // namespace remoting |