OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_COMMON_COMPONENT_FLASH_HINT_FILE_H_ | |
6 #define CHROME_COMMON_COMPONENT_FLASH_HINT_FILE_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/files/file_util.h" | |
12 #include "crypto/secure_hash.h" | |
13 | |
14 namespace chrome { | |
15 | |
16 // This class wraps the component updated flash hint file, which lives inside | |
17 // the PepperFlash folder of the user-data-dir, so that the Linux zygote | |
18 // process can preload the right version of flash. | |
19 class ComponentFlashHintFile { | |
20 public: | |
21 ComponentFlashHintFile() {} | |
jln (very slow on Chromium)
2015/08/04 01:08:33
Nit: add destructor explicitly.
Greg K
2015/08/04 18:30:00
Done.
| |
22 // Records a new flash update into the hint file. | |
23 // unpacked_plugin is the current location of the plugin. | |
24 // moved_plugin is the location where the plugin will be loaded from. | |
25 static bool RecordFlashUpdate(const base::FilePath& unpacked_plugin, | |
26 const base::FilePath& moved_plugin, | |
27 const std::string& version); | |
28 // Reports whether or not a hints file exists. | |
29 static bool DoesHintFileExist(); | |
30 // Return the path of the component updated flash plugin, only if the file has | |
31 // the correct hash sum. | |
32 static bool VerifyAndReturnFlashLocation(base::FilePath* path, | |
33 std::string* version); | |
34 | |
35 // Test if the specified plugin file can be mapped executable. | |
36 // This is useful to test if the flash plugin is in a directory mounted | |
37 // NOEXEC. | |
38 static bool TestExecutableMapping(const base::FilePath& path); | |
39 | |
40 private: | |
41 // This will serialize the file to disk as JSON. The format is: | |
42 // { | |
43 // "Version": 0x10, | |
44 // "HashAlgorithm": SecureHash::SHA256, | |
45 // "Hash": <Base64 Encoded Hash>, | |
46 // "PluginPath": /path/to/component/updated/flash.so, | |
47 // "PluginVersion": "1.0.0.1" | |
48 // } | |
49 static bool WriteToDisk(int version, | |
50 crypto::SecureHash::Algorithm algorithm, | |
51 const std::string& hash, | |
52 const base::FilePath& plugin_path, | |
53 const std::string& flash_version); | |
54 }; | |
jln (very slow on Chromium)
2015/08/04 01:08:33
DISALLOW_COPY_AND_ASSIGN
Greg K
2015/08/04 18:30:00
Done.
| |
55 | |
56 } // namespace chrome | |
57 | |
58 #endif // CHROME_COMMON_COMPONENT_FLASH_HINT_FILE_H_ | |
OLD | NEW |