OLD | NEW |
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 "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 #import <IOKit/IOKitLib.h> | 8 #import <IOKit/IOKitLib.h> |
| 9 |
| 10 #include <cmath> |
9 #include <errno.h> | 11 #include <errno.h> |
10 #include <stddef.h> | 12 #include <stddef.h> |
11 #include <string.h> | 13 #include <string.h> |
12 #include <sys/utsname.h> | 14 #include <sys/utsname.h> |
13 #include <sys/xattr.h> | 15 #include <sys/xattr.h> |
14 | 16 |
15 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
16 #include "base/logging.h" | 18 #include "base/logging.h" |
17 #include "base/mac/bundle_locations.h" | 19 #include "base/mac/bundle_locations.h" |
18 #include "base/mac/foundation_util.h" | 20 #include "base/mac/foundation_util.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 DLOG(WARNING) << | 168 DLOG(WARNING) << |
167 "Couldn't get the main display's color space, using generic"; | 169 "Couldn't get the main display's color space, using generic"; |
168 } else { | 170 } else { |
169 DLOG(ERROR) << "Couldn't get any color space"; | 171 DLOG(ERROR) << "Couldn't get any color space"; |
170 } | 172 } |
171 } | 173 } |
172 | 174 |
173 return g_system_color_space; | 175 return g_system_color_space; |
174 } | 176 } |
175 | 177 |
| 178 bool IsCGFloatEqual(CGFloat a, CGFloat b) { |
| 179 return std::fabs(a - b) <= std::numeric_limits<CGFloat>::epsilon(); |
| 180 } |
| 181 |
176 // Add a request for full screen mode. Must be called on the main thread. | 182 // Add a request for full screen mode. Must be called on the main thread. |
177 void RequestFullScreen(FullScreenMode mode) { | 183 void RequestFullScreen(FullScreenMode mode) { |
178 DCHECK_LT(mode, kNumFullScreenModes); | 184 DCHECK_LT(mode, kNumFullScreenModes); |
179 if (mode >= kNumFullScreenModes) | 185 if (mode >= kNumFullScreenModes) |
180 return; | 186 return; |
181 | 187 |
182 DCHECK_GE(g_full_screen_requests[mode], 0); | 188 DCHECK_GE(g_full_screen_requests[mode], 0); |
183 if (mode < 0) | 189 if (mode < 0) |
184 return; | 190 return; |
185 | 191 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) | 481 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) |
476 return false; | 482 return false; |
477 *type = ident.substr(0, number_loc); | 483 *type = ident.substr(0, number_loc); |
478 *major = major_tmp; | 484 *major = major_tmp; |
479 *minor = minor_tmp; | 485 *minor = minor_tmp; |
480 return true; | 486 return true; |
481 } | 487 } |
482 | 488 |
483 } // namespace mac | 489 } // namespace mac |
484 } // namespace base | 490 } // namespace base |
OLD | NEW |