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

Unified Diff: client/base/Device.dart

Issue 9382027: Move client/{base, observable, layout, touch, util, view} to samples/ui_lib . (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/base/AnimationScheduler.dart ('k') | client/base/DomWrapper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/base/Device.dart
===================================================================
--- client/base/Device.dart (revision 4144)
+++ client/base/Device.dart (working copy)
@@ -1,82 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// TODO(jacobr): cache these results.
-// TODO(jacobr): figure out how to test this.
-/**
- * Utils for device detection.
- */
-class Device {
-
- /**
- * The regular expression for detecting an iPhone or iPod.
- */
- static final _IPHONE_REGEX = const RegExp('iPhone|iPod');
-
- /**
- * The regular expression for detecting an iPhone or iPod or iPad.
- */
- static final _MOBILE_SAFARI_REGEX = const RegExp('iPhone|iPod|iPad');
-
- /**
- * The regular expression for detecting an iPhone or iPod or iPad simulator.
- */
- static final _APPLE_SIM_REGEX = const RegExp('iP.*Simulator');
-
- /**
- * Gets the browser's user agent. Using this function allows tests to inject
- * the user agent.
- * Returns the user agent.
- */
- static String get userAgent() => window.navigator.userAgent;
-
- /**
- * Determines if the current device is an iPhone or iPod.
- * Returns true if the current device is an iPhone or iPod.
- */
- static bool get isIPhone() => _IPHONE_REGEX.hasMatch(userAgent);
-
- /**
- * Determines if the current device is an iPad.
- * Returns true if the current device is an iPad.
- */
- static bool get isIPad() => userAgent.contains("iPad", 0);
-
- /**
- * Determines if the current device is running Firefox.
- */
- static bool get isFirefox() => userAgent.contains("Firefox", 0);
-
- /**
- * Determines if the current device is an iPhone or iPod or iPad.
- * Returns true if the current device is an iPhone or iPod or iPad.
- */
- static bool get isMobileSafari() => _MOBILE_SAFARI_REGEX.hasMatch(userAgent);
-
- /**
- * Determines if the current device is the iP* Simulator.
- * Returns true if the current device is an iP* Simulator.
- */
- static bool get isAppleSimulator() => _APPLE_SIM_REGEX.hasMatch(userAgent);
-
- /**
- * Determines if the current device is an Android.
- * Returns true if the current device is an Android.
- */
- static bool get isAndroid() => userAgent.contains("Android", 0);
-
- /**
- * Determines if the current device is WebOS WebKit.
- * Returns true if the current device is WebOS WebKit.
- */
- static bool get isWebOs() => userAgent.contains("webOS", 0);
-
- static bool _supportsTouch;
- static bool get supportsTouch() {
- if (_supportsTouch == null) {
- _supportsTouch = isMobileSafari || isAndroid;
- }
- return _supportsTouch;
- }
-}
« no previous file with comments | « client/base/AnimationScheduler.dart ('k') | client/base/DomWrapper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698