OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cloud_print/service/win/service_utils.h" | 5 #include "cloud_print/service/win/service_utils.h" |
6 #include "google_apis/gaia/gaia_switches.h" | 6 #include "google_apis/gaia/gaia_switches.h" |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <security.h> // NOLINT | 9 #include <security.h> // NOLINT |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 if (result.empty()) | 21 if (result.empty()) |
22 return result; | 22 return result; |
23 if (!::GetComputerName(&result[0], &size)) | 23 if (!::GetComputerName(&result[0], &size)) |
24 return base::string16(); | 24 return base::string16(); |
25 result.resize(size); | 25 result.resize(size); |
26 return result; | 26 return result; |
27 } | 27 } |
28 | 28 |
29 base::string16 ReplaceLocalHostInName(const base::string16& user_name) { | 29 base::string16 ReplaceLocalHostInName(const base::string16& user_name) { |
30 static const wchar_t kLocalDomain[] = L".\\"; | 30 static const wchar_t kLocalDomain[] = L".\\"; |
31 if (base::StartsWith(user_name, kLocalDomain, true)) { | 31 if (base::StartsWith(user_name, kLocalDomain, |
| 32 base::CompareCase::SENSITIVE)) { |
32 return GetLocalComputerName() + | 33 return GetLocalComputerName() + |
33 user_name.substr(arraysize(kLocalDomain) - 2); | 34 user_name.substr(arraysize(kLocalDomain) - 2); |
34 } | 35 } |
35 return user_name; | 36 return user_name; |
36 } | 37 } |
37 | 38 |
38 base::string16 GetCurrentUserName() { | 39 base::string16 GetCurrentUserName() { |
39 ULONG size = 0; | 40 ULONG size = 0; |
40 base::string16 result; | 41 base::string16 result; |
41 ::GetUserNameEx(::NameSamCompatible, NULL, &size); | 42 ::GetUserNameEx(::NameSamCompatible, NULL, &size); |
(...skipping 14 matching lines...) Expand all Loading... |
56 switches::kEnableLogging, | 57 switches::kEnableLogging, |
57 switches::kIgnoreUrlFetcherCertRequests, | 58 switches::kIgnoreUrlFetcherCertRequests, |
58 switches::kLsoUrl, | 59 switches::kLsoUrl, |
59 switches::kV, | 60 switches::kV, |
60 }; | 61 }; |
61 destination->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(), | 62 destination->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(), |
62 kSwitchesToCopy, | 63 kSwitchesToCopy, |
63 arraysize(kSwitchesToCopy)); | 64 arraysize(kSwitchesToCopy)); |
64 } | 65 } |
65 | 66 |
OLD | NEW |