summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authordfalcantara@chromium.org <dfalcantara@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-21 23:55:52 +0000
committerdfalcantara@chromium.org <dfalcantara@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-21 23:55:52 +0000
commitabef4b33bc3d484621e28a70c141e6ca8ce7aa1e (patch)
treed495c173007c3ecb45efe288f072bd23d26537a1 /content
parentb7c8d6c560adc7cddfcf23ad73e3c4378ef65ea4 (diff)
downloadchromium_src-abef4b33bc3d484621e28a70c141e6ca8ce7aa1e.zip
chromium_src-abef4b33bc3d484621e28a70c141e6ca8ce7aa1e.tar.gz
chromium_src-abef4b33bc3d484621e28a70c141e6ca8ce7aa1e.tar.bz2
Move Android user agent generation to native code
Gets rid of a pathway that forced us to set the user agent from the Java side, replacing it with one that's entirely native. Functions have been added to base to allow accessing information about the device and Android build, while the user agent generation code was moved to the webkit_glue namespace. BUG=131312 Review URL: https://chromiumcodereview.appspot.com/10832235 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152675 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/app/android/app_jni_registrar.cc2
-rw-r--r--content/app/android/content_main.cc3
-rw-r--r--content/app/android/user_agent.cc30
-rw-r--r--content/app/android/user_agent.h21
-rw-r--r--content/content_app.gypi2
-rw-r--r--content/content_jni.gypi1
-rw-r--r--content/public/android/java/src/org/chromium/content/app/UserAgent.java50
7 files changed, 0 insertions, 109 deletions
diff --git a/content/app/android/app_jni_registrar.cc b/content/app/android/app_jni_registrar.cc
index 699b618..ee0863a 100644
--- a/content/app/android/app_jni_registrar.cc
+++ b/content/app/android/app_jni_registrar.cc
@@ -8,14 +8,12 @@
#include "base/android/jni_registrar.h"
#include "content/app/android/content_main.h"
#include "content/app/android/sandboxed_process_service.h"
-#include "content/app/android/user_agent.h"
namespace {
base::android::RegistrationMethod kContentRegisteredMethods[] = {
{ "ContentMain", content::RegisterContentMain },
{ "SandboxedProcessService", content::RegisterSandboxedProcessService },
- { "UserAgent", content::RegisterUserAgent },
};
} // namespace
diff --git a/content/app/android/content_main.cc b/content/app/android/content_main.cc
index f373186..1371617 100644
--- a/content/app/android/content_main.cc
+++ b/content/app/android/content_main.cc
@@ -8,7 +8,6 @@
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/lazy_instance.h"
-#include "content/app/android/user_agent.h"
#include "content/public/app/content_main_delegate.h"
#include "content/public/app/content_main_runner.h"
#include "content/public/common/content_switches.h"
@@ -47,8 +46,6 @@ static jint Start(JNIEnv* env, jclass clazz) {
base::debug::WaitForDebugger(24*60*60, false);
}
- webkit_glue::SetUserAgentOSInfo(content::GetUserAgentOSInfo());
-
DCHECK(!g_content_runner.Get().get());
g_content_runner.Get().reset(ContentMainRunner::Create());
g_content_runner.Get()->Initialize(0, NULL,
diff --git a/content/app/android/user_agent.cc b/content/app/android/user_agent.cc
deleted file mode 100644
index 7a1c49b..0000000
--- a/content/app/android/user_agent.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/app/android/user_agent.h"
-
-#include "base/android/jni_android.h"
-#include "base/android/jni_string.h"
-#include "base/android/scoped_java_ref.h"
-#include "jni/UserAgent_jni.h"
-
-using base::android::AttachCurrentThread;
-using base::android::ScopedJavaLocalRef;
-using base::android::ConvertJavaStringToUTF8;
-using base::android::GetApplicationContext;
-
-namespace content {
-
-std::string GetUserAgentOSInfo() {
- JNIEnv* env = AttachCurrentThread();
- ScopedJavaLocalRef<jstring> os_info =
- Java_UserAgent_getUserAgentOSInfo(env);
- return ConvertJavaStringToUTF8(os_info);
-}
-
-bool RegisterUserAgent(JNIEnv* env) {
- return RegisterNativesImpl(env);
-}
-
-} // namespace content
diff --git a/content/app/android/user_agent.h b/content/app/android/user_agent.h
deleted file mode 100644
index 374c5fb..0000000
--- a/content/app/android/user_agent.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_APP_ANDROID_USER_AGENT_H_
-#define CONTENT_APP_ANDROID_USER_AGENT_H_
-
-#include <jni.h>
-#include <string>
-
-namespace content {
-
-// Returns the OS information component required by user agent composition.
-std::string GetUserAgentOSInfo();
-
-// Register JNI method.
-bool RegisterUserAgent(JNIEnv* env);
-
-} // namespace content
-
-#endif // CONTENT_APP_ANDROID_USER_AGENT_H_
diff --git a/content/content_app.gypi b/content/content_app.gypi
index 023bd00..adc924c 100644
--- a/content/content_app.gypi
+++ b/content/content_app.gypi
@@ -20,8 +20,6 @@
'app/android/library_loader_hooks.cc',
'app/android/sandboxed_process_service.cc',
'app/android/sandboxed_process_service.h',
- 'app/android/user_agent.cc',
- 'app/android/user_agent.h',
'app/content_main.cc',
'app/content_main_runner.cc',
'app/startup_helper_win.cc',
diff --git a/content/content_jni.gypi b/content/content_jni.gypi
index 30ac54d..929fb83 100644
--- a/content/content_jni.gypi
+++ b/content/content_jni.gypi
@@ -11,7 +11,6 @@
'public/android/java/src/org/chromium/content/app/ContentMain.java',
'public/android/java/src/org/chromium/content/app/LibraryLoader.java',
'public/android/java/src/org/chromium/content/app/SandboxedProcessService.java',
- 'public/android/java/src/org/chromium/content/app/UserAgent.java',
'public/android/java/src/org/chromium/content/browser/AndroidBrowserProcess.java',
'public/android/java/src/org/chromium/content/browser/ContentSettings.java',
'public/android/java/src/org/chromium/content/browser/ContentVideoView.java',
diff --git a/content/public/android/java/src/org/chromium/content/app/UserAgent.java b/content/public/android/java/src/org/chromium/content/app/UserAgent.java
deleted file mode 100644
index 36d328d..0000000
--- a/content/public/android/java/src/org/chromium/content/app/UserAgent.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.content.app;
-
-import android.os.Build;
-
-import org.chromium.base.CalledByNative;
-
-/**
- * Provides necessary information for building the user agent string.
- */
-class UserAgent {
- // TODO(yfriedman): Keep this reasonably up to date.
- private static final String PREVIOUS_VERSION = "4.0.3";
-
- @CalledByNative
- static String getUserAgentOSInfo() {
- String osInfo = "";
- final String version = Build.VERSION.RELEASE;
- if (version.length() > 0) {
- if (Character.isDigit(version.charAt(0))) {
- // Release is a version, eg "3.1"
- osInfo += version;
- } else {
- // Release doesn't have a version number yet, eg "Honeycomb"
- // In this case, use the previous release's version
- osInfo += PREVIOUS_VERSION;
- }
- } else {
- // default to "1.0"
- osInfo += "1.0";
- }
- osInfo += ";";
-
- if ("REL".equals(Build.VERSION.CODENAME)) {
- final String model = Build.MODEL;
- if (model.length() > 0) {
- osInfo += " " + model;
- }
- }
- final String id = Build.ID;
- if (id.length() > 0) {
- osInfo += " Build/" + id;
- }
-
- return osInfo;
- }
-}