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

Side by Side Diff: content/public/android/java/src/org/chromium/content/app/UserAgent.java

Issue 10832235: Move Android user agent generation to native code (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Nit fix Created 8 years, 4 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
« no previous file with comments | « content/content_jni.gypi ('k') | webkit/glue/user_agent.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.content.app;
6
7 import android.os.Build;
8
9 import org.chromium.base.CalledByNative;
10
11 /**
12 * Provides necessary information for building the user agent string.
13 */
14 class UserAgent {
15 // TODO(yfriedman): Keep this reasonably up to date.
16 private static final String PREVIOUS_VERSION = "4.0.3";
17
18 @CalledByNative
19 static String getUserAgentOSInfo() {
20 String osInfo = "";
21 final String version = Build.VERSION.RELEASE;
22 if (version.length() > 0) {
23 if (Character.isDigit(version.charAt(0))) {
24 // Release is a version, eg "3.1"
25 osInfo += version;
26 } else {
27 // Release doesn't have a version number yet, eg "Honeycomb"
28 // In this case, use the previous release's version
29 osInfo += PREVIOUS_VERSION;
30 }
31 } else {
32 // default to "1.0"
33 osInfo += "1.0";
34 }
35 osInfo += ";";
36
37 if ("REL".equals(Build.VERSION.CODENAME)) {
38 final String model = Build.MODEL;
39 if (model.length() > 0) {
40 osInfo += " " + model;
41 }
42 }
43 final String id = Build.ID;
44 if (id.length() > 0) {
45 osInfo += " Build/" + id;
46 }
47
48 return osInfo;
49 }
50 }
OLDNEW
« no previous file with comments | « content/content_jni.gypi ('k') | webkit/glue/user_agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698