OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of base; | 5 part of base; |
6 | 6 |
7 // TODO(jacobr): cache these results. | 7 // TODO(jacobr): cache these results. |
8 // TODO(jacobr): figure out how to test this. | 8 // TODO(jacobr): figure out how to test this. |
9 /** | 9 /** |
10 * Utils for device detection. | 10 * Utils for device detection. |
11 */ | 11 */ |
12 class Device { | 12 class Device { |
13 | |
14 /** | 13 /** |
15 * The regular expression for detecting an iPhone or iPod. | 14 * The regular expression for detecting an iPhone or iPod. |
16 */ | 15 */ |
17 static final _IPHONE_REGEX = new RegExp('iPhone|iPod'); | 16 static final _IPHONE_REGEX = new RegExp('iPhone|iPod'); |
18 | 17 |
19 /** | 18 /** |
20 * The regular expression for detecting an iPhone or iPod or iPad. | 19 * The regular expression for detecting an iPhone or iPod or iPad. |
21 */ | 20 */ |
22 static final _MOBILE_SAFARI_REGEX = new RegExp('iPhone|iPod|iPad'); | 21 static final _MOBILE_SAFARI_REGEX = new RegExp('iPhone|iPod|iPad'); |
23 | 22 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 static bool get isWebOs => userAgent.contains("webOS", 0); | 74 static bool get isWebOs => userAgent.contains("webOS", 0); |
76 | 75 |
77 static bool _supportsTouch; | 76 static bool _supportsTouch; |
78 static bool get supportsTouch { | 77 static bool get supportsTouch { |
79 if (_supportsTouch == null) { | 78 if (_supportsTouch == null) { |
80 _supportsTouch = isMobileSafari || isAndroid; | 79 _supportsTouch = isMobileSafari || isAndroid; |
81 } | 80 } |
82 return _supportsTouch; | 81 return _supportsTouch; |
83 } | 82 } |
84 } | 83 } |
OLD | NEW |