File: policy_path_parser.h

package info (click to toggle)
chromium-browser 57.0.2987.98-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 2,637,852 kB
  • ctags: 2,544,394
  • sloc: cpp: 12,815,961; ansic: 3,676,222; python: 1,147,112; asm: 526,608; java: 523,212; xml: 286,794; perl: 92,654; sh: 86,408; objc: 73,271; makefile: 27,698; cs: 18,487; yacc: 13,031; tcl: 12,957; pascal: 4,875; ml: 4,716; lex: 3,904; sql: 3,862; ruby: 1,982; lisp: 1,508; php: 1,368; exp: 404; awk: 325; csh: 117; jsp: 39; sed: 37
file content (78 lines) | stat: -rw-r--r-- 4,020 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright (c) 2012 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.

#ifndef CHROME_BROWSER_POLICY_POLICY_PATH_PARSER_H_
#define CHROME_BROWSER_POLICY_POLICY_PATH_PARSER_H_

#include <string>

#include "base/files/file_path.h"

namespace policy {

namespace path_parser {

// This function is used to expand the variables in policy strings that
// represent paths. The set of supported variables differs between platforms
// but generally covers most standard locations that might be needed in the
// existing used cases.
// All platforms:
//   ${user_name}       - The user that is running Chrome (respects suids).
//                        (example : "johndoe")
//   ${machine_name}    - The machine name possibly with domain (example :
//                        "johnny.cg1.cooldomain.org")
// Windows only:
//   ${documents}       - The "Documents" folder for the current user.
//                        (example : "C:\Users\Administrator\Documents")
//   ${local_app_data}  - The Application Data folder for the current user.
//                        (example : "C:\Users\Administrator\AppData\Local")
//   ${roaming_app_data}- The Roamed AppData folder for the current user.
//                        (example : "C:\Users\Administrator\AppData\Roaming")
//   ${profile}         - The home folder for the current user.
//                        (example : "C:\Users\Administrator")
//   ${global_app_data} - The system-wide Application Data folder.
//                        (example : "C:\Users\All Users\AppData")
//   ${program_files}   - The "Program Files" folder for the current process.
//                        Depends on whether it is 32 or 64 bit process.
//                        (example : "C:\Program Files (x86)")
//   ${windows}         - The Windows folder
//                        (example : "C:\WINNT" or "C:\Windows")
//   ${client_name}     - The name of the client as reported by the WTS system.
//                        (example : "clientone")
//   ${session_name}    - The name of the session as reported by the WTS system.
//                        (example : "WinSta0", "RDP-Tcp#1")
// MacOS only:
//   ${users}           - The folder where users profiles are stored
//                        (example : "/Users")
//   ${documents}       - The "Documents" folder of the current user.
//                        (example : "/Users/johndoe/Documents")
// Any non recognized variable is not being translated at all. Variables are
// translated only once in every string because for most of these there is no
// sense in concatenating them more than once in a single path.
base::FilePath::StringType ExpandPathVariables(
    const base::FilePath::StringType& untranslated_string);

// A helper function used to read the UserDataDir path policy without relying on
// any policy infrastructure. This is required because this policy is needed
// much earlier before the PrefService is initialized.
// The function will fill |user_data_dir| if the policy "UserDataDir" is set and
// leave it intact if the policy is missing. If the policy is set it should
// override any manual changes to the profile path the user might have made so
// this function should be used to verify no policy is specified whenever the
// profile path is not read from the PathService which already takes this into
// account.
void CheckUserDataDirPolicy(base::FilePath* user_data_dir);

// A helper function used to read the DiskCacheDir path policy without relying
// on any policy infrastructure. This is required because this policy may be
// needed much earlier before the PrefService is initialized on Windows.
// The function will fill |disk_cache_dir| if the policy "DiskCacheDir" is set
// and leave it intact if the policy is missing.
void CheckDiskCacheDirPolicy(base::FilePath* disk_cache_dir);

}  // namespace path_parser

}  // namespace policy

#endif  // CHROME_BROWSER_POLICY_POLICY_PATH_PARSER_H_