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 { | |
jln (very slow on Chromium)
2015/08/06 18:48:14
This class has only static members. You may want t
Greg K
2015/08/07 21:15:29
Done.
| |
20 public: | |
21 // Records a new flash update into the hint file. | |
22 // unpacked_plugin is the current location of the plugin. | |
jln (very slow on Chromium)
2015/08/06 18:48:14
Use |argument| to document argument "argument".
Greg K
2015/08/07 21:15:28
Done.
| |
23 // moved_plugin is the location where the plugin will be loaded from. | |
24 static bool RecordFlashUpdate(const base::FilePath& unpacked_plugin, | |
25 const base::FilePath& moved_plugin, | |
26 const std::string& version); | |
27 // Reports whether or not a hints file exists. | |
28 static bool DoesHintFileExist(); | |
29 // Return the path of the component updated flash plugin, only if the file has | |
30 // the correct hash sum. | |
jln (very slow on Chromium)
2015/08/06 18:48:14
Mention and document both arguments.
Greg K
2015/08/07 21:15:29
Done.
| |
31 static bool VerifyAndReturnFlashLocation(base::FilePath* path, | |
32 std::string* version); | |
33 | |
34 // Test if the specified plugin file can be mapped executable. | |
35 // This is useful to test if the flash plugin is in a directory mounted | |
36 // NOEXEC. | |
jln (very slow on Chromium)
2015/08/06 18:48:14
nit: "noexec". Explain why this matters.
See my o
Greg K
2015/08/07 21:15:28
It's useful so that Chrome can fall back to the bu
| |
37 static bool TestExecutableMapping(const base::FilePath& path); | |
38 | |
39 private: | |
40 // This will serialize the file to disk as JSON. The format is: | |
41 // { | |
42 // "Version": 0x10, | |
43 // "HashAlgorithm": SecureHash::SHA256, | |
44 // "Hash": <Base64 Encoded Hash>, | |
45 // "PluginPath": /path/to/component/updated/flash.so, | |
46 // "PluginVersion": "1.0.0.1" | |
47 // } | |
48 static bool WriteToDisk(const int version, | |
49 const crypto::SecureHash::Algorithm algorithm, | |
50 const std::string& hash, | |
51 const base::FilePath& plugin_path, | |
52 const std::string& flash_version); | |
53 DISALLOW_IMPLICIT_CONSTRUCTORS(ComponentFlashHintFile); | |
54 }; | |
55 | |
56 } // namespace chrome | |
57 | |
58 #endif // CHROME_COMMON_COMPONENT_FLASH_HINT_FILE_H_ | |
OLD | NEW |