Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2462)

Unified Diff: chrome/common/component_flash_hint_file.h

Issue 1261333004: Add support for Flash Player Component updates on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..c8c9e7768f59c23ce2e75dd5b976c723bcb6775f
--- /dev/null
+++ b/chrome/common/component_flash_hint_file.h
@@ -0,0 +1,61 @@
+// 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 {
+ public:
+ ComponentFlashHintFile();
+ // Records a new flash update into the hint file.
+ // unpacked_plugin is the current location of the plugin.
+ // moved_plugin is the location where the plugin will be loaded from.
+ bool RecordFlashUpdate(base::FilePath& unpacked_plugin,
+ base::FilePath& moved_plugin,
+ const std::string& version);
+ // Attempts to revert the flash hint file to its previous state, before this
+ // update.
+ bool Revert();
+ // 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.
+ static bool VerifyAndReturnFlashLocation(base::FilePath* path,
+ std::string* version);
+
+ 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"
+ // }
+ bool WriteToDisk(int version,
+ crypto::SecureHash::Algorithm algorithm,
+ const std::string& hash,
+ base::FilePath& plugin_path,
+ const std::string& flash_version);
+ // Indicates whether or not a hint file existed prior to this file being
+ // written.
+ bool was_previous_hint_file_;
+ // Contains the contents of the previous hint file.
+ std::string previous_hint_file_;
+};
+
+} // namespace chrome
+
+#endif // CHROME_COMMON_COMPONENT_FLASH_HINT_FILE_H_

Powered by Google App Engine
This is Rietveld 408576698