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

Unified Diff: content/browser/android/content_view_statics.cc

Issue 10706004: Adds helper methods for WebView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: My repo was out of sync with the latest upstream tree Created 8 years, 6 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: content/browser/android/content_view_statics.cc
diff --git a/content/browser/android/content_view_statics.cc b/content/browser/android/content_view_statics.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f8fc4dc5beefc03f14bd62e71cba80e5519d1cec
--- /dev/null
+++ b/content/browser/android/content_view_statics.cc
@@ -0,0 +1,31 @@
+// 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 <jni.h>
+
+#include "base/android/jni_android.h"
+#include "base/android/jni_string.h"
+#include "base/android/scoped_java_ref.h"
+#include "base/basictypes.h"
+#include "base/logging.h"
+#include "content/browser/android/content_view_statics.h"
+#include "content/common/android/address_parser.h"
+#include "jni/content_view_statics_jni.h"
+
+using base::android::ConvertJavaStringToUTF16;
+using base::android::ConvertUTF16ToJavaString;
+using base::android::ScopedJavaLocalRef;
+using namespace content::address_parser;
John Grabowski 2012/06/28 17:08:06 chrome style doesn't like "using namespace". List
aurimas (slooooooooow) 2012/06/28 23:00:07 Done.
+
+static jstring FindAddress(JNIEnv* env, jclass clazz, jstring addr) {
John Grabowski 2012/06/28 17:08:06 chrome style prefers anon namespaces to static fun
aurimas (slooooooooow) 2012/06/28 23:00:07 I tried putting this function in a anon namespace,
+ string16 content_16 = ConvertJavaStringToUTF16(env, addr);
+ string16 result_16;
+ if (FindAddress(content_16, &result_16))
+ return ConvertUTF16ToJavaString(env, result_16).Release();
+ return NULL;
+}
+
+bool RegisterWebViewStatics(JNIEnv* env) {
John Grabowski 2012/06/28 17:08:06 all in content napespace
aurimas (slooooooooow) 2012/06/28 23:00:07 Done.
+ return RegisterNativesImpl(env) >= 0;
+}

Powered by Google App Engine
This is Rietveld 408576698