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