| 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 #include "chrome/install_static/product_install_details.h" | 5 #include "chrome/install_static/product_install_details.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <assert.h> | 8 #include <assert.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 return &mode; | 35 return &mode; |
| 36 } | 36 } |
| 37 // The first mode is always the default if all else fails. | 37 // The first mode is always the default if all else fails. |
| 38 return &kInstallModes[0]; | 38 return &kInstallModes[0]; |
| 39 } | 39 } |
| 40 | 40 |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 void InitializeProductDetailsForPrimaryModule() { | 43 void InitializeProductDetailsForPrimaryModule() { |
| 44 InstallDetails::SetForProcess(MakeProductDetails(GetCurrentProcessExePath())); | 44 InstallDetails::SetForProcess(MakeProductDetails(GetCurrentProcessExePath())); |
| 45 std::wstring user_data_dir, invalid_user_data_dir; |
| 46 GetUserDataDirectoryUsingProcessCommandLine(&user_data_dir, |
| 47 &invalid_user_data_dir); |
| 48 PrimaryInstallDetails::GetMutable()->set_user_data_dir(user_data_dir); |
| 49 if (!invalid_user_data_dir.empty()) { |
| 50 PrimaryInstallDetails::GetMutable()->set_invalid_user_data_dir( |
| 51 invalid_user_data_dir); |
| 52 } |
| 45 } | 53 } |
| 46 | 54 |
| 47 bool IsPathParentOf(const wchar_t* parent, | 55 bool IsPathParentOf(const wchar_t* parent, |
| 48 size_t parent_len, | 56 size_t parent_len, |
| 49 const std::wstring& path) { | 57 const std::wstring& path) { |
| 50 // Ignore all terminating path separators in |parent|. | 58 // Ignore all terminating path separators in |parent|. |
| 51 while (parent_len && parent[parent_len - 1] == L'\\') | 59 while (parent_len && parent[parent_len - 1] == L'\\') |
| 52 --parent_len; | 60 --parent_len; |
| 53 // Pass if the parent was all separators. | 61 // Pass if the parent was all separators. |
| 54 if (!parent_len) | 62 if (!parent_len) |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 147 |
| 140 details->set_mode(mode); | 148 details->set_mode(mode); |
| 141 details->set_system_level(system_level); | 149 details->set_system_level(system_level); |
| 142 details->set_multi_install(multi_install); | 150 details->set_multi_install(multi_install); |
| 143 details->set_channel(DetermineChannel(*mode, system_level, multi_install)); | 151 details->set_channel(DetermineChannel(*mode, system_level, multi_install)); |
| 144 | 152 |
| 145 return details; | 153 return details; |
| 146 } | 154 } |
| 147 | 155 |
| 148 } // namespace install_static | 156 } // namespace install_static |
| OLD | NEW |