OLD | NEW |
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 CONTENT_COMMON_SANDBOX_MAC_H_ | 5 #ifndef CONTENT_COMMON_SANDBOX_MAC_H_ |
6 #define CONTENT_COMMON_SANDBOX_MAC_H_ | 6 #define CONTENT_COMMON_SANDBOX_MAC_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 // |allowed_dir| - directory to allow access to, currently the only sandbox | 36 // |allowed_dir| - directory to allow access to, currently the only sandbox |
37 // profile that supports this is SANDBOX_TYPE_UTILITY . | 37 // profile that supports this is SANDBOX_TYPE_UTILITY . |
38 // | 38 // |
39 // Returns true on success, false if an error occurred enabling the sandbox. | 39 // Returns true on success, false if an error occurred enabling the sandbox. |
40 static bool EnableSandbox(int sandbox_type, | 40 static bool EnableSandbox(int sandbox_type, |
41 const base::FilePath& allowed_dir); | 41 const base::FilePath& allowed_dir); |
42 | 42 |
43 // Returns true if the sandbox has been enabled for the current process. | 43 // Returns true if the sandbox has been enabled for the current process. |
44 static bool SandboxIsCurrentlyActive(); | 44 static bool SandboxIsCurrentlyActive(); |
45 | 45 |
| 46 // Allow the application to continue execution if launchservicesd cannot be |
| 47 // connected to. Without this call, the application will crash unless the |
| 48 // sandbox allows launchservicesd connections. |
| 49 static void LaunchServicesNotAvailable(); |
| 50 |
46 private: | 51 private: |
47 // Convert provided path into a "canonical" path matching what the Sandbox | 52 // Convert provided path into a "canonical" path matching what the Sandbox |
48 // expects i.e. one without symlinks. | 53 // expects i.e. one without symlinks. |
49 // This path is not necessarily unique e.g. in the face of hardlinks. | 54 // This path is not necessarily unique e.g. in the face of hardlinks. |
50 static base::FilePath GetCanonicalSandboxPath(const base::FilePath& path); | 55 static base::FilePath GetCanonicalSandboxPath(const base::FilePath& path); |
51 | 56 |
52 FRIEND_TEST_ALL_PREFIXES(MacDirAccessSandboxTest, StringEscape); | 57 FRIEND_TEST_ALL_PREFIXES(MacDirAccessSandboxTest, StringEscape); |
53 FRIEND_TEST_ALL_PREFIXES(MacDirAccessSandboxTest, RegexEscape); | 58 FRIEND_TEST_ALL_PREFIXES(MacDirAccessSandboxTest, RegexEscape); |
54 FRIEND_TEST_ALL_PREFIXES(MacDirAccessSandboxTest, SandboxAccess); | 59 FRIEND_TEST_ALL_PREFIXES(MacDirAccessSandboxTest, SandboxAccess); |
55 | 60 |
56 DISALLOW_IMPLICIT_CONSTRUCTORS(Sandbox); | 61 DISALLOW_IMPLICIT_CONSTRUCTORS(Sandbox); |
57 }; | 62 }; |
58 | 63 |
59 } // namespace content | 64 } // namespace content |
60 | 65 |
61 #endif // CONTENT_COMMON_SANDBOX_MAC_H_ | 66 #endif // CONTENT_COMMON_SANDBOX_MAC_H_ |
OLD | NEW |