| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Windows Vista uses the Native Wifi (WLAN) API for accessing WiFi cards. See | 5 // Windows Vista uses the Native Wifi (WLAN) API for accessing WiFi cards. See |
| 6 // http://msdn.microsoft.com/en-us/library/ms705945(VS.85).aspx. Windows XP | 6 // http://msdn.microsoft.com/en-us/library/ms705945(VS.85).aspx. Windows XP |
| 7 // Service Pack 3 (and Windows XP Service Pack 2, if upgraded with a hot fix) | 7 // Service Pack 3 (and Windows XP Service Pack 2, if upgraded with a hot fix) |
| 8 // also support a limited version of the WLAN API. See | 8 // also support a limited version of the WLAN API. See |
| 9 // http://msdn.microsoft.com/en-us/library/bb204766.aspx. The WLAN API uses | 9 // http://msdn.microsoft.com/en-us/library/bb204766.aspx. The WLAN API uses |
| 10 // wlanapi.h, which is not part of the SDK used by Gears, so is replicated | 10 // wlanapi.h, which is not part of the SDK used by Gears, so is replicated |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 return buffer != NULL; | 610 return buffer != NULL; |
| 611 } | 611 } |
| 612 | 612 |
| 613 bool GetSystemDirectory(base::string16* path) { | 613 bool GetSystemDirectory(base::string16* path) { |
| 614 DCHECK(path); | 614 DCHECK(path); |
| 615 // Return value includes terminating NULL. | 615 // Return value includes terminating NULL. |
| 616 int buffer_size = ::GetSystemDirectory(NULL, 0); | 616 int buffer_size = ::GetSystemDirectory(NULL, 0); |
| 617 if (buffer_size == 0) { | 617 if (buffer_size == 0) { |
| 618 return false; | 618 return false; |
| 619 } | 619 } |
| 620 scoped_ptr<char16[]> buffer(new char16[buffer_size]); | 620 scoped_ptr<base::char16[]> buffer(new base::char16[buffer_size]); |
| 621 | 621 |
| 622 // Return value excludes terminating NULL. | 622 // Return value excludes terminating NULL. |
| 623 int characters_written = ::GetSystemDirectory(buffer.get(), buffer_size); | 623 int characters_written = ::GetSystemDirectory(buffer.get(), buffer_size); |
| 624 if (characters_written == 0) { | 624 if (characters_written == 0) { |
| 625 return false; | 625 return false; |
| 626 } | 626 } |
| 627 DCHECK_EQ(buffer_size - 1, characters_written); | 627 DCHECK_EQ(buffer_size - 1, characters_written); |
| 628 | 628 |
| 629 path->assign(buffer.get(), characters_written); | 629 path->assign(buffer.get(), characters_written); |
| 630 | 630 |
| 631 if (*path->rbegin() != L'\\') { | 631 if (*path->rbegin() != L'\\') { |
| 632 path->append(L"\\"); | 632 path->append(L"\\"); |
| 633 } | 633 } |
| 634 DCHECK_EQ(L'\\', *path->rbegin()); | 634 DCHECK_EQ(L'\\', *path->rbegin()); |
| 635 return true; | 635 return true; |
| 636 } | 636 } |
| 637 } // namespace | 637 } // namespace |
| 638 | 638 |
| 639 } // namespace content | 639 } // namespace content |
| OLD | NEW |