From abef4b33bc3d484621e28a70c141e6ca8ce7aa1e Mon Sep 17 00:00:00 2001 From: "dfalcantara@chromium.org" Date: Tue, 21 Aug 2012 23:55:52 +0000 Subject: 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 --- content/app/android/app_jni_registrar.cc | 2 -- content/app/android/content_main.cc | 3 --- content/app/android/user_agent.cc | 30 ------------------------------ content/app/android/user_agent.h | 21 --------------------- 4 files changed, 56 deletions(-) delete mode 100644 content/app/android/user_agent.cc delete mode 100644 content/app/android/user_agent.h (limited to 'content/app/android') 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 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 -#include - -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_ -- cgit v1.1