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

Side by Side Diff: base/base_paths_win.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove redundant base:: prefix Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <windows.h> 5 #include <windows.h>
6 #include <shlobj.h> 6 #include <shlobj.h>
7 7
8 #include "base/base_paths.h" 8 #include "base/base_paths.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 case base::DIR_PROGRAM_FILES: 66 case base::DIR_PROGRAM_FILES:
67 if (FAILED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, 67 if (FAILED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL,
68 SHGFP_TYPE_CURRENT, system_buffer))) 68 SHGFP_TYPE_CURRENT, system_buffer)))
69 return false; 69 return false;
70 cur = FilePath(system_buffer); 70 cur = FilePath(system_buffer);
71 break; 71 break;
72 case base::DIR_PROGRAM_FILES6432: 72 case base::DIR_PROGRAM_FILES6432:
73 #if !defined(_WIN64) 73 #if !defined(_WIN64)
74 if (base::win::OSInfo::GetInstance()->wow64_status() == 74 if (base::win::OSInfo::GetInstance()->wow64_status() ==
75 base::win::OSInfo::WOW64_ENABLED) { 75 base::win::OSInfo::WOW64_ENABLED) {
76 scoped_ptr<base::Environment> env(base::Environment::Create()); 76 std::unique_ptr<base::Environment> env(base::Environment::Create());
77 std::string programfiles_w6432; 77 std::string programfiles_w6432;
78 // 32-bit process running in WOW64 sets ProgramW6432 environment 78 // 32-bit process running in WOW64 sets ProgramW6432 environment
79 // variable. See 79 // variable. See
80 // https://msdn.microsoft.com/library/windows/desktop/aa384274.aspx. 80 // https://msdn.microsoft.com/library/windows/desktop/aa384274.aspx.
81 if (!env->GetVar("ProgramW6432", &programfiles_w6432)) 81 if (!env->GetVar("ProgramW6432", &programfiles_w6432))
82 return false; 82 return false;
83 // GetVar returns UTF8 - convert back to Wide. 83 // GetVar returns UTF8 - convert back to Wide.
84 cur = FilePath(UTF8ToWide(programfiles_w6432)); 84 cur = FilePath(UTF8ToWide(programfiles_w6432));
85 break; 85 break;
86 } 86 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 break; 188 break;
189 default: 189 default:
190 return false; 190 return false;
191 } 191 }
192 192
193 *result = cur; 193 *result = cur;
194 return true; 194 return true;
195 } 195 }
196 196
197 } // namespace base 197 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698