Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: tool/input_sdk/lib/html/html_common/device.dart

Issue 1700153002: Wrapperless dart:html and friends (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: A couple more tweaks Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 html_common; 5 part of html_common;
6 6
7 /** 7 /**
8 * Utils for device detection. 8 * Utils for device detection.
9 */ 9 */
10 class Device { 10 class Device {
11 static bool _isOpera; 11 static bool _isOpera;
12 static bool _isIE; 12 static bool _isIE;
13 static bool _isFirefox; 13 static bool _isFirefox;
14 static bool _isWebKit; 14 static bool _isWebKit;
15 static String _cachedCssPrefix; 15 static String _cachedCssPrefix;
16 static String _cachedPropertyPrefix; 16 static String _cachedPropertyPrefix;
17 17
18 /** 18 /**
19 * Gets the browser's user agent. Using this function allows tests to inject 19 * Gets the browser's user agent. Using this function allows tests to inject
20 * the user agent. 20 * the user agent.
21 * Returns the user agent. 21 * Returns the user agent.
22 */ 22 */
23 static String get userAgent => window.navigator.raw.userAgent; 23 static String get userAgent => window.navigator.userAgent;
24 24
25 /** 25 /**
26 * Determines if the current device is running Opera. 26 * Determines if the current device is running Opera.
27 */ 27 */
28 static bool get isOpera { 28 static bool get isOpera {
29 if (_isOpera == null) { 29 if (_isOpera == null) {
30 _isOpera = userAgent.contains("Opera", 0); 30 _isOpera = userAgent.contains("Opera", 0);
31 } 31 }
32 return _isOpera; 32 return _isOpera;
33 } 33 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 */ 103 */
104 static bool isEventTypeSupported(String eventType) { 104 static bool isEventTypeSupported(String eventType) {
105 // Browsers throw for unsupported event names. 105 // Browsers throw for unsupported event names.
106 try { 106 try {
107 var e = new Event.eventType(eventType, ''); 107 var e = new Event.eventType(eventType, '');
108 return e is Event; 108 return e is Event;
109 } catch (_) { } 109 } catch (_) { }
110 return false; 110 return false;
111 } 111 }
112 } 112 }
OLDNEW
« no previous file with comments | « tool/input_sdk/lib/html/html_common/conversions_dart2js.dart ('k') | tool/input_sdk/lib/html/html_common/html_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698