1 // Copyright 2018 The Chromium Authors
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/notification_helper/notification_helper_util.h"
7 #include "base/base_paths.h"
8 #include "base/files/file_util.h"
9 #include "base/path_service.h"
10 #include "chrome/common/chrome_constants.h"
12 namespace notification_helper {
14 base::FilePath GetChromeExePath() {
15 // Look for chrome.exe one folder above notification_helper.exe (as expected
16 // in Chrome installs). Failing that, look for it alonside
17 // notification_helper.exe.
18 base::FilePath dir_exe;
19 if (!base::PathService::Get(base::DIR_EXE, &dir_exe))
20 return base::FilePath();
22 base::FilePath chrome_exe =
23 dir_exe.DirName().Append(chrome::kBrowserProcessExecutableName);
25 if (!base::PathExists(chrome_exe)) {
26 chrome_exe = dir_exe.Append(chrome::kBrowserProcessExecutableName);
27 if (!base::PathExists(chrome_exe))
28 return base::FilePath();
33 } // namespace notification_helper