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

Side by Side Diff: chrome/browser/android/contextualsearch/contextual_search_tab_helper.cc

Issue 1312153003: jni_generator: Pass object parameters as JavaParamRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/android/contextualsearch/contextual_search_tab_helper.h " 5 #include "chrome/browser/android/contextualsearch/contextual_search_tab_helper.h "
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/prefs/pref_change_registrar.h" 9 #include "base/prefs/pref_change_registrar.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 22 matching lines...) Expand all
33 void ContextualSearchTabHelper::OnContextualSearchPrefChanged() { 33 void ContextualSearchTabHelper::OnContextualSearchPrefChanged() {
34 JNIEnv* env = base::android::AttachCurrentThread(); 34 JNIEnv* env = base::android::AttachCurrentThread();
35 ScopedJavaLocalRef<jobject> jobj = weak_java_ref_.get(env); 35 ScopedJavaLocalRef<jobject> jobj = weak_java_ref_.get(env);
36 Java_ContextualSearchTabHelper_onContextualSearchPrefChanged(env, jobj.obj()); 36 Java_ContextualSearchTabHelper_onContextualSearchPrefChanged(env, jobj.obj());
37 } 37 }
38 38
39 void ContextualSearchTabHelper::Destroy(JNIEnv* env, jobject obj) { 39 void ContextualSearchTabHelper::Destroy(JNIEnv* env, jobject obj) {
40 delete this; 40 delete this;
41 } 41 }
42 42
43 static jlong Init(JNIEnv* env, jobject obj, jobject java_profile) { 43 static jlong Init(JNIEnv* env,
44 const JavaParamRef<jobject>& obj,
45 const JavaParamRef<jobject>& java_profile) {
44 Profile* profile = ProfileAndroid::FromProfileAndroid(java_profile); 46 Profile* profile = ProfileAndroid::FromProfileAndroid(java_profile);
45 CHECK(profile); 47 CHECK(profile);
46 ContextualSearchTabHelper* tab = new ContextualSearchTabHelper( 48 ContextualSearchTabHelper* tab = new ContextualSearchTabHelper(
47 env, obj, profile); 49 env, obj, profile);
48 return reinterpret_cast<intptr_t>(tab); 50 return reinterpret_cast<intptr_t>(tab);
49 } 51 }
50 52
51 bool RegisterContextualSearchTabHelper(JNIEnv* env) { 53 bool RegisterContextualSearchTabHelper(JNIEnv* env) {
52 return RegisterNativesImpl(env); 54 return RegisterNativesImpl(env);
53 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698