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

Unified Diff: chrome/browser/android/browser_version.cc

Issue 492843003: [Android] Upstream BrowserVersion.java and related native code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/browser_version.cc
diff --git a/chrome/browser/android/browser_version.cc b/chrome/browser/android/browser_version.cc
new file mode 100644
index 0000000000000000000000000000000000000000..634af62c1eb55db36f3243a5f023251f35078d8f
--- /dev/null
+++ b/chrome/browser/android/browser_version.cc
@@ -0,0 +1,40 @@
+// Copyright 2011 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 "chrome/browser/android/browser_version.h"
+
+#include "base/android/jni_string.h"
+#include "base/logging.h"
Lei Zhang 2014/08/20 19:25:06 logging.h and resource_bundle.h are probably not n
Feng Qian 2014/08/20 21:34:29 Done.
+#include "grit/generated_resources.h"
+#include "grit/locale_settings.h"
+#include "jni/BrowserVersion_jni.h"
+#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/resource/resource_bundle.h"
+
+using base::android::ConvertUTF8ToJavaString;
+
+// This mimics the functionality in ContentView's browser_process_main.cc.
Yaron 2014/08/20 19:11:48 This whole comment looks historical, please remove
Feng Qian 2014/08/20 21:34:29 Done.
+// TODO(dfalcantara): If ContentView and Clank will always return the same
+// value for this, find a way to reuse the original.
+static jboolean IsOfficialBuild(JNIEnv* env, jclass /* clazz */) {
Lei Zhang 2014/08/20 19:25:06 Just call chrome::VersionInfo().IsOfficialBuild()
Feng Qian 2014/08/20 21:34:29 Done.
+#if defined(OFFICIAL_BUILD)
+ return true;
+#else
+ return false;
+#endif
+}
+
+static jstring GetTermsOfServiceHtml(JNIEnv* env, jclass /* clazz */) {
+ return ConvertUTF8ToJavaString(env,
+ l10n_util::GetStringUTF8(IDS_TERMS_HTML)).Release();
+}
+
+static jstring GetTermsOfServiceString(JNIEnv* env, jclass /* clazz */) {
+ return ConvertUTF8ToJavaString(env,
+ l10n_util::GetStringUTF8(IDS_FIRSTRUN_TOS_EXPLANATION)).Release();
+}
+
+bool RegisterBrowserVersion(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}

Powered by Google App Engine
This is Rietveld 408576698