Chromium Code Reviews| Index: chrome/common/component_flash_hint_file.h |
| diff --git a/chrome/common/component_flash_hint_file.h b/chrome/common/component_flash_hint_file.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0f852f840dc6ec8254adfd10f381eef1f5c95a23 |
| --- /dev/null |
| +++ b/chrome/common/component_flash_hint_file.h |
| @@ -0,0 +1,58 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_COMMON_COMPONENT_FLASH_HINT_FILE_H_ |
| +#define CHROME_COMMON_COMPONENT_FLASH_HINT_FILE_H_ |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/files/file_util.h" |
| +#include "crypto/secure_hash.h" |
| + |
| +namespace chrome { |
| + |
| +// This class wraps the component updated flash hint file, which lives inside |
| +// the PepperFlash folder of the user-data-dir, so that the Linux zygote |
| +// process can preload the right version of flash. |
| +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.
|
| + public: |
| + // Records a new flash update into the hint file. |
| + // 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.
|
| + // moved_plugin is the location where the plugin will be loaded from. |
| + static bool RecordFlashUpdate(const base::FilePath& unpacked_plugin, |
| + const base::FilePath& moved_plugin, |
| + const std::string& version); |
| + // Reports whether or not a hints file exists. |
| + static bool DoesHintFileExist(); |
| + // Return the path of the component updated flash plugin, only if the file has |
| + // 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.
|
| + static bool VerifyAndReturnFlashLocation(base::FilePath* path, |
| + std::string* version); |
| + |
| + // Test if the specified plugin file can be mapped executable. |
| + // This is useful to test if the flash plugin is in a directory mounted |
| + // 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
|
| + static bool TestExecutableMapping(const base::FilePath& path); |
| + |
| + private: |
| + // This will serialize the file to disk as JSON. The format is: |
| + // { |
| + // "Version": 0x10, |
| + // "HashAlgorithm": SecureHash::SHA256, |
| + // "Hash": <Base64 Encoded Hash>, |
| + // "PluginPath": /path/to/component/updated/flash.so, |
| + // "PluginVersion": "1.0.0.1" |
| + // } |
| + static bool WriteToDisk(const int version, |
| + const crypto::SecureHash::Algorithm algorithm, |
| + const std::string& hash, |
| + const base::FilePath& plugin_path, |
| + const std::string& flash_version); |
| + DISALLOW_IMPLICIT_CONSTRUCTORS(ComponentFlashHintFile); |
| +}; |
| + |
| +} // namespace chrome |
| + |
| +#endif // CHROME_COMMON_COMPONENT_FLASH_HINT_FILE_H_ |