1 // Copyright 2014 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.
5 #include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_analyzer.h"
7 #include "base/files/file_path.h"
8 #include "base/logging.h"
9 #include "base/path_service.h"
10 #include "version.h" // NOLINT
12 namespace safe_browsing
{
14 std::vector
<base::FilePath
> GetCriticalBinariesPath() {
15 static const base::FilePath::CharType
* const kUnversionedFiles
[] = {
16 FILE_PATH_LITERAL("chrome.exe"),
18 static const base::FilePath::CharType
* const kVersionedFiles
[] = {
19 FILE_PATH_LITERAL("chrome.dll"),
20 FILE_PATH_LITERAL("chrome_child.dll"),
21 FILE_PATH_LITERAL("chrome_elf.dll"),
24 // Find where chrome.exe is installed.
25 base::FilePath chrome_exe_dir
;
26 if (!PathService::Get(base::DIR_EXE
, &chrome_exe_dir
))
29 std::vector
<base::FilePath
> critical_binaries
;
30 critical_binaries
.reserve(arraysize(kUnversionedFiles
) +
31 arraysize(kVersionedFiles
));
33 for (size_t i
= 0; i
< arraysize(kUnversionedFiles
); ++i
) {
34 critical_binaries
.push_back(chrome_exe_dir
.Append(kUnversionedFiles
[i
]));
37 base::FilePath
version_dir(
38 chrome_exe_dir
.AppendASCII(CHROME_VERSION_STRING
));
39 for (size_t i
= 0; i
< arraysize(kVersionedFiles
); ++i
) {
40 critical_binaries
.push_back(version_dir
.Append(kVersionedFiles
[i
]));
43 return critical_binaries
;
46 } // namespace safe_browsing