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 #include "content/common/sandbox_mac.h" | 5 #include "content/common/sandbox_mac.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include <CoreFoundation/CFTimeZone.h> | 9 #include <CoreFoundation/CFTimeZone.h> |
10 extern "C" { | 10 extern "C" { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 // Mapping from sandbox process types to resource IDs containing the sandbox | 59 // Mapping from sandbox process types to resource IDs containing the sandbox |
60 // profile for all process types known to content. | 60 // profile for all process types known to content. |
61 SandboxTypeToResourceIDMapping kDefaultSandboxTypeToResourceIDMapping[] = { | 61 SandboxTypeToResourceIDMapping kDefaultSandboxTypeToResourceIDMapping[] = { |
62 { SANDBOX_TYPE_RENDERER, IDR_RENDERER_SANDBOX_PROFILE }, | 62 { SANDBOX_TYPE_RENDERER, IDR_RENDERER_SANDBOX_PROFILE }, |
63 { SANDBOX_TYPE_UTILITY, IDR_UTILITY_SANDBOX_PROFILE }, | 63 { SANDBOX_TYPE_UTILITY, IDR_UTILITY_SANDBOX_PROFILE }, |
64 { SANDBOX_TYPE_GPU, IDR_GPU_SANDBOX_PROFILE }, | 64 { SANDBOX_TYPE_GPU, IDR_GPU_SANDBOX_PROFILE }, |
65 { SANDBOX_TYPE_PPAPI, IDR_PPAPI_SANDBOX_PROFILE }, | 65 { SANDBOX_TYPE_PPAPI, IDR_PPAPI_SANDBOX_PROFILE }, |
66 }; | 66 }; |
67 | 67 |
68 COMPILE_ASSERT(arraysize(kDefaultSandboxTypeToResourceIDMapping) == \ | 68 static_assert(arraysize(kDefaultSandboxTypeToResourceIDMapping) == \ |
69 size_t(SANDBOX_TYPE_AFTER_LAST_TYPE), \ | 69 size_t(SANDBOX_TYPE_AFTER_LAST_TYPE), \ |
70 sandbox_type_to_resource_id_mapping_incorrect); | 70 "sandbox type to resource id mapping incorrect"); |
71 | 71 |
72 // Try to escape |c| as a "SingleEscapeCharacter" (\n, etc). If successful, | 72 // Try to escape |c| as a "SingleEscapeCharacter" (\n, etc). If successful, |
73 // returns true and appends the escape sequence to |dst|. | 73 // returns true and appends the escape sequence to |dst|. |
74 bool EscapeSingleChar(char c, std::string* dst) { | 74 bool EscapeSingleChar(char c, std::string* dst) { |
75 const char *append = NULL; | 75 const char *append = NULL; |
76 switch (c) { | 76 switch (c) { |
77 case '\b': | 77 case '\b': |
78 append = "\\b"; | 78 append = "\\b"; |
79 break; | 79 break; |
80 case '\f': | 80 case '\f': |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 if (HANDLE_EINTR(fcntl(fd.get(), F_GETPATH, canonical_path)) != 0) { | 636 if (HANDLE_EINTR(fcntl(fd.get(), F_GETPATH, canonical_path)) != 0) { |
637 DPLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " | 637 DPLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " |
638 << path.value(); | 638 << path.value(); |
639 return path; | 639 return path; |
640 } | 640 } |
641 | 641 |
642 return base::FilePath(canonical_path); | 642 return base::FilePath(canonical_path); |
643 } | 643 } |
644 | 644 |
645 } // namespace content | 645 } // namespace content |
OLD | NEW |