OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_NACL_BROWSER_NACL_BROWSER_H_ | 5 #ifndef COMPONENTS_NACL_BROWSER_NACL_BROWSER_H_ |
6 #define COMPONENTS_NACL_BROWSER_NACL_BROWSER_H_ | 6 #define COMPONENTS_NACL_BROWSER_NACL_BROWSER_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <deque> | 10 #include <deque> |
9 | 11 |
10 #include "base/bind.h" | 12 #include "base/bind.h" |
11 #include "base/containers/mru_cache.h" | 13 #include "base/containers/mru_cache.h" |
12 #include "base/files/file.h" | 14 #include "base/files/file.h" |
| 15 #include "base/macros.h" |
13 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
14 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
15 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "build/build_config.h" |
16 #include "components/nacl/browser/nacl_browser_delegate.h" | 20 #include "components/nacl/browser/nacl_browser_delegate.h" |
17 #include "components/nacl/browser/nacl_validation_cache.h" | 21 #include "components/nacl/browser/nacl_validation_cache.h" |
18 | 22 |
19 class URLPattern; | 23 class URLPattern; |
20 class GURL; | 24 class GURL; |
21 | 25 |
22 namespace base { | 26 namespace base { |
23 class FileProxy; | 27 class FileProxy; |
24 } | 28 } |
25 | 29 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // stored in a cache of bounded size, it is not guaranteed the browser process | 107 // stored in a cache of bounded size, it is not guaranteed the browser process |
104 // will be able to provide the requested information. In these cases, the | 108 // will be able to provide the requested information. In these cases, the |
105 // NaCl process must make conservative assumptions about the origin of the | 109 // NaCl process must make conservative assumptions about the origin of the |
106 // file. | 110 // file. |
107 // In theory, a compromised renderer could guess file tokens in an attempt to | 111 // In theory, a compromised renderer could guess file tokens in an attempt to |
108 // read files it normally doesn't have access to. This would not compromise | 112 // read files it normally doesn't have access to. This would not compromise |
109 // the NaCl sandbox, however, and only has a 1 in ~2**120 chance of success | 113 // the NaCl sandbox, however, and only has a 1 in ~2**120 chance of success |
110 // per guess. | 114 // per guess. |
111 // TODO(ncbray): move the cache onto NaClProcessHost so that we don't need to | 115 // TODO(ncbray): move the cache onto NaClProcessHost so that we don't need to |
112 // rely on tokens being unguessable by another process. | 116 // rely on tokens being unguessable by another process. |
113 void PutFilePath(const base::FilePath& path, uint64* file_token_lo, | 117 void PutFilePath(const base::FilePath& path, |
114 uint64* file_token_hi); | 118 uint64_t* file_token_lo, |
115 bool GetFilePath(uint64 file_token_lo, uint64 file_token_hi, | 119 uint64_t* file_token_hi); |
| 120 bool GetFilePath(uint64_t file_token_lo, |
| 121 uint64_t file_token_hi, |
116 base::FilePath* path); | 122 base::FilePath* path); |
117 | 123 |
118 bool QueryKnownToValidate(const std::string& signature, bool off_the_record); | 124 bool QueryKnownToValidate(const std::string& signature, bool off_the_record); |
119 void SetKnownToValidate(const std::string& signature, bool off_the_record); | 125 void SetKnownToValidate(const std::string& signature, bool off_the_record); |
120 void ClearValidationCache(const base::Closure& callback); | 126 void ClearValidationCache(const base::Closure& callback); |
121 #if defined(OS_WIN) | 127 #if defined(OS_WIN) |
122 // Get path to NaCl loader on the filesystem if possible. | 128 // Get path to NaCl loader on the filesystem if possible. |
123 // |exe_path| does not change if the method fails. | 129 // |exe_path| does not change if the method fails. |
124 bool GetNaCl64ExePath(base::FilePath* exe_path); | 130 bool GetNaCl64ExePath(base::FilePath* exe_path); |
125 #endif | 131 #endif |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 206 |
201 // Singletons get destroyed at shutdown. | 207 // Singletons get destroyed at shutdown. |
202 base::WeakPtrFactory<NaClBrowser> weak_factory_; | 208 base::WeakPtrFactory<NaClBrowser> weak_factory_; |
203 | 209 |
204 DISALLOW_COPY_AND_ASSIGN(NaClBrowser); | 210 DISALLOW_COPY_AND_ASSIGN(NaClBrowser); |
205 }; | 211 }; |
206 | 212 |
207 } // namespace nacl | 213 } // namespace nacl |
208 | 214 |
209 #endif // COMPONENTS_NACL_BROWSER_NACL_BROWSER_H_ | 215 #endif // COMPONENTS_NACL_BROWSER_NACL_BROWSER_H_ |
OLD | NEW |