| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/mac/mac_util.h" | 5 #include "base/mac/mac_util.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 #include <sys/utsname.h> | 9 #include <sys/utsname.h> |
| 10 | 10 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/mac/foundation_util.h" | 13 #include "base/mac/foundation_util.h" |
| 14 #include "base/mac/scoped_cftyperef.h" | 14 #include "base/mac/scoped_cftyperef.h" |
| 15 #include "base/memory/scoped_nsobject.h" | 15 #include "base/memory/scoped_nsobject.h" |
| 16 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
| 17 #include "base/string_piece.h" |
| 17 #include "base/sys_string_conversions.h" | 18 #include "base/sys_string_conversions.h" |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 namespace mac { | 21 namespace mac { |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 // The current count of outstanding requests for full screen mode from browser | 25 // The current count of outstanding requests for full screen mode from browser |
| 25 // windows, plugins, etc. | 26 // windows, plugins, etc. |
| 26 int g_full_screen_requests[kNumFullScreenModes] = { 0, 0, 0}; | 27 int g_full_screen_requests[kNumFullScreenModes] = { 0, 0, 0}; |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 } | 515 } |
| 515 | 516 |
| 516 if (strcmp(uname_info.sysname, "Darwin") != 0) { | 517 if (strcmp(uname_info.sysname, "Darwin") != 0) { |
| 517 DLOG(ERROR) << "unexpected uname sysname " << uname_info.sysname; | 518 DLOG(ERROR) << "unexpected uname sysname " << uname_info.sysname; |
| 518 return 0; | 519 return 0; |
| 519 } | 520 } |
| 520 | 521 |
| 521 int darwin_major_version = 0; | 522 int darwin_major_version = 0; |
| 522 char* dot = strchr(uname_info.release, '.'); | 523 char* dot = strchr(uname_info.release, '.'); |
| 523 if (dot) { | 524 if (dot) { |
| 524 if (!base::StringToInt(uname_info.release, dot, &darwin_major_version)) { | 525 if (!base::StringToInt(base::StringPiece(uname_info.release, |
| 526 dot - uname_info.release), |
| 527 &darwin_major_version)) { |
| 525 dot = NULL; | 528 dot = NULL; |
| 526 } | 529 } |
| 527 } | 530 } |
| 528 | 531 |
| 529 if (!dot) { | 532 if (!dot) { |
| 530 DLOG(ERROR) << "could not parse uname release " << uname_info.release; | 533 DLOG(ERROR) << "could not parse uname release " << uname_info.release; |
| 531 return 0; | 534 return 0; |
| 532 } | 535 } |
| 533 | 536 |
| 534 return darwin_major_version; | 537 return darwin_major_version; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 #endif | 616 #endif |
| 614 | 617 |
| 615 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7) | 618 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7) |
| 616 bool IsOSLaterThanLion() { | 619 bool IsOSLaterThanLion() { |
| 617 return MacOSXMinorVersion() > LION_MINOR_VERSION; | 620 return MacOSXMinorVersion() > LION_MINOR_VERSION; |
| 618 } | 621 } |
| 619 #endif | 622 #endif |
| 620 | 623 |
| 621 } // namespace mac | 624 } // namespace mac |
| 622 } // namespace base | 625 } // namespace base |
| OLD | NEW |