| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Contains functions for determining the product's InstallDetails at runtime. | 5 // Contains functions for determining the product's InstallDetails at runtime. |
| 6 | 6 |
| 7 #ifndef CHROME_INSTALL_STATIC_PRODUCT_INSTALL_DETAILS_H_ | 7 #ifndef CHROME_INSTALL_STATIC_PRODUCT_INSTALL_DETAILS_H_ |
| 8 #define CHROME_INSTALL_STATIC_PRODUCT_INSTALL_DETAILS_H_ | 8 #define CHROME_INSTALL_STATIC_PRODUCT_INSTALL_DETAILS_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 namespace install_static { | 13 namespace install_static { |
| 14 | 14 |
| 15 struct InstallConstants; | |
| 16 class PrimaryInstallDetails; | 15 class PrimaryInstallDetails; |
| 17 | 16 |
| 18 // Creates product details for the current process and sets them as the global | 17 // Creates product details for the current process and sets them as the global |
| 19 // InstallDetails for the process. This is intended to be called early in | 18 // InstallDetails for the process. This is intended to be called early in |
| 20 // process startup. A process's "primary" module may be the executable itself or | 19 // process startup. A process's "primary" module may be the executable itself or |
| 21 // may be another DLL that is loaded and initialized prior to executing the | 20 // may be another DLL that is loaded and initialized prior to executing the |
| 22 // executable's entrypoint (i.e., chrome_elf.dll). | 21 // executable's entrypoint (i.e., chrome_elf.dll). |
| 23 void InitializeProductDetailsForPrimaryModule(); | 22 void InitializeProductDetailsForPrimaryModule(); |
| 24 | 23 |
| 25 // Returns true if |parent| is a parent of |path|. Path separators at the end of | 24 // Returns true if |parent| is a parent of |path|. Path separators at the end of |
| 26 // |parent| are ignored. Returns false if |parent| is empty. | 25 // |parent| are ignored. Returns false if |parent| is empty. |
| 27 bool IsPathParentOf(const wchar_t* parent, | 26 bool IsPathParentOf(const wchar_t* parent, |
| 28 size_t parent_len, | 27 size_t parent_len, |
| 29 const std::wstring& path); | 28 const std::wstring& path); |
| 30 | 29 |
| 31 // Returns true if |path| is within C:\Program Files{, (x86)}. | 30 // Returns true if |path| is within C:\Program Files{, (x86)}. |
| 32 bool PathIsInProgramFiles(const std::wstring& path); | 31 bool PathIsInProgramFiles(const std::wstring& path); |
| 33 | 32 |
| 34 // Returns the install suffix embedded in |exe_path| or an empty string if none | 33 // Returns the install suffix embedded in |exe_path| or an empty string if none |
| 35 // is found. |exe_path| is expected be something similar to | 34 // is found. |exe_path| is expected be something similar to |
| 36 // "...\[kProductName][suffix]\Application". | 35 // "...\[kProductName][suffix]\Application". |
| 37 std::wstring GetInstallSuffix(const std::wstring& exe_path); | 36 std::wstring GetInstallSuffix(const std::wstring& exe_path); |
| 38 | 37 |
| 39 // Returns true if the browser of |mode| at |system_level| is registered as | |
| 40 // being multi-install. | |
| 41 bool IsMultiInstall(const InstallConstants& mode, bool system_level); | |
| 42 | |
| 43 // Creates product details for the process at |exe_path|. | 38 // Creates product details for the process at |exe_path|. |
| 44 std::unique_ptr<PrimaryInstallDetails> MakeProductDetails( | 39 std::unique_ptr<PrimaryInstallDetails> MakeProductDetails( |
| 45 const std::wstring& exe_path); | 40 const std::wstring& exe_path); |
| 46 | 41 |
| 47 } // namespace install_static | 42 } // namespace install_static |
| 48 | 43 |
| 49 #endif // CHROME_INSTALL_STATIC_PRODUCT_INSTALL_DETAILS_H_ | 44 #endif // CHROME_INSTALL_STATIC_PRODUCT_INSTALL_DETAILS_H_ |
| OLD | NEW |