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

Unified Diff: chrome/browser/safe_browsing/disk_image_type_sniffer_mac.h

Issue 2926473002: Mac Archive Type Sniffing (Closed)
Patch Set: avoiding multiple asynchronous calls in tester for mac Created 3 years, 6 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
« no previous file with comments | « chrome/browser/safe_browsing/BUILD.gn ('k') | chrome/browser/safe_browsing/disk_image_type_sniffer_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/disk_image_type_sniffer_mac.h
diff --git a/chrome/browser/safe_browsing/disk_image_type_sniffer_mac.h b/chrome/browser/safe_browsing/disk_image_type_sniffer_mac.h
new file mode 100644
index 0000000000000000000000000000000000000000..3044482971556e673498b0a3df4e2c219fbaa99f
--- /dev/null
+++ b/chrome/browser/safe_browsing/disk_image_type_sniffer_mac.h
@@ -0,0 +1,36 @@
+// Copyright 2017 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_BROWSER_SAFE_BROWSING_DISK_IMAGE_TYPE_SNIFFER_MAC_H_
+#define CHROME_BROWSER_SAFE_BROWSING_DISK_IMAGE_TYPE_SNIFFER_MAC_H_
+
+#include "base/files/file.h"
+#include "base/files/file_path.h"
+#include "base/memory/ref_counted.h"
+
+namespace safe_browsing {
+
+// This class is used to determine whether a given file is a Mac archive type,
+// regardless of file extension. It does so by determining whether the file has
+// the 'koly' signature typical of Mac archive files.
+class DiskImageTypeSnifferMac
+ : public base::RefCountedThreadSafe<DiskImageTypeSnifferMac> {
+ public:
+ DiskImageTypeSnifferMac();
+
+ // Reads trailer from file to see if it is a DMG type. Must be called on the
+ // FILE thread.
+ static bool IsAppleDiskImage(const base::FilePath& dmg_file);
+
+ private:
+ friend class base::RefCountedThreadSafe<DiskImageTypeSnifferMac>;
+
+ ~DiskImageTypeSnifferMac();
+
+ DISALLOW_COPY_AND_ASSIGN(DiskImageTypeSnifferMac);
+};
+
+} // namespace safe_browsing
+
+#endif // CHROME_BROWSER_SAFE_BROWSING_DISK_IMAGE_TYPE_SNIFFE_MAC_H_
« no previous file with comments | « chrome/browser/safe_browsing/BUILD.gn ('k') | chrome/browser/safe_browsing/disk_image_type_sniffer_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698