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

Unified Diff: third_party/document_image_extractor/third_party/closure-library/closure/goog/labs/useragent/util.js

Issue 1138123002: Update third_party/document_image_extractor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
Index: third_party/document_image_extractor/third_party/closure-library/closure/goog/labs/useragent/util.js
diff --git a/third_party/document_image_extractor/third_party/closure-library/closure/goog/labs/useragent/util.js b/third_party/document_image_extractor/third_party/closure-library/closure/goog/labs/useragent/util.js
deleted file mode 100644
index ebba9b540c2e75c2398b617bf7849ff41b06e44d..0000000000000000000000000000000000000000
--- a/third_party/document_image_extractor/third_party/closure-library/closure/goog/labs/useragent/util.js
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright 2013 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/**
- * @fileoverview Utilities used by goog.labs.userAgent tools. These functions
- * should not be used outside of goog.labs.userAgent.*.
- *
- *
- * @author nnaze@google.com (Nathan Naze)
- */
-
-goog.provide('goog.labs.userAgent.util');
-
-goog.require('goog.string');
-
-
-/**
- * Gets the native userAgent string from navigator if it exists.
- * If navigator or navigator.userAgent string is missing, returns an empty
- * string.
- * @return {string}
- * @private
- */
-goog.labs.userAgent.util.getNativeUserAgentString_ = function() {
- var navigator = goog.labs.userAgent.util.getNavigator_();
- if (navigator) {
- var userAgent = navigator.userAgent;
- if (userAgent) {
- return userAgent;
- }
- }
- return '';
-};
-
-
-/**
- * Getter for the native navigator.
- * This is a separate function so it can be stubbed out in testing.
- * @return {Navigator}
- * @private
- */
-goog.labs.userAgent.util.getNavigator_ = function() {
- return goog.global.navigator;
-};
-
-
-/**
- * A possible override for applications which wish to not check
- * navigator.userAgent but use a specified value for detection instead.
- * @private {string}
- */
-goog.labs.userAgent.util.userAgent_ =
- goog.labs.userAgent.util.getNativeUserAgentString_();
-
-
-/**
- * Applications may override browser detection on the built in
- * navigator.userAgent object by setting this string. Set to null to use the
- * browser object instead.
- * @param {?string=} opt_userAgent The User-Agent override.
- */
-goog.labs.userAgent.util.setUserAgent = function(opt_userAgent) {
- goog.labs.userAgent.util.userAgent_ = opt_userAgent ||
- goog.labs.userAgent.util.getNativeUserAgentString_();
-};
-
-
-/**
- * @return {string} The user agent string.
- */
-goog.labs.userAgent.util.getUserAgent = function() {
- return goog.labs.userAgent.util.userAgent_;
-};
-
-
-/**
- * @param {string} str
- * @return {boolean} Whether the user agent contains the given string, ignoring
- * case.
- */
-goog.labs.userAgent.util.matchUserAgent = function(str) {
- var userAgent = goog.labs.userAgent.util.getUserAgent();
- return goog.string.contains(userAgent, str);
-};
-
-
-/**
- * @param {string} str
- * @return {boolean} Whether the user agent contains the given string.
- */
-goog.labs.userAgent.util.matchUserAgentIgnoreCase = function(str) {
- var userAgent = goog.labs.userAgent.util.getUserAgent();
- return goog.string.caseInsensitiveContains(userAgent, str);
-};
-
-
-/**
- * Parses the user agent into tuples for each section.
- * @param {string} userAgent
- * @return {!Array<!Array<string>>} Tuples of key, version, and the contents
- * of the parenthetical.
- */
-goog.labs.userAgent.util.extractVersionTuples = function(userAgent) {
- // Matches each section of a user agent string.
- // Example UA:
- // Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us)
- // AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405
- // This has three version tuples: Mozilla, AppleWebKit, and Mobile.
-
- var versionRegExp = new RegExp(
- // Key. Note that a key may have a space.
- // (i.e. 'Mobile Safari' in 'Mobile Safari/5.0')
- '(\\w[\\w ]+)' +
-
- '/' + // slash
- '([^\\s]+)' + // version (i.e. '5.0b')
- '\\s*' + // whitespace
- '(?:\\((.*?)\\))?', // parenthetical info. parentheses not matched.
- 'g');
-
- var data = [];
- var match;
-
- // Iterate and collect the version tuples. Each iteration will be the
- // next regex match.
- while (match = versionRegExp.exec(userAgent)) {
- data.push([
- match[1], // key
- match[2], // value
- // || undefined as this is not undefined in IE7 and IE8
- match[3] || undefined // info
- ]);
- }
-
- return data;
-};
-

Powered by Google App Engine
This is Rietveld 408576698