OLD | NEW |
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 "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/profiles/profile_android.h" | 10 #include "chrome/browser/profiles/profile_android.h" |
11 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
12 #include "components/prefs/pref_change_registrar.h" | 12 #include "components/prefs/pref_change_registrar.h" |
13 #include "jni/ContextualSearchTabHelper_jni.h" | 13 #include "jni/ContextualSearchTabHelper_jni.h" |
14 | 14 |
| 15 using base::android::JavaParamRef; |
| 16 using base::android::ScopedJavaLocalRef; |
15 | 17 |
16 ContextualSearchTabHelper::ContextualSearchTabHelper(JNIEnv* env, | 18 ContextualSearchTabHelper::ContextualSearchTabHelper(JNIEnv* env, |
17 jobject obj, | 19 jobject obj, |
18 Profile* profile) | 20 Profile* profile) |
19 : weak_java_ref_(env, obj), | 21 : weak_java_ref_(env, obj), |
20 pref_change_registrar_(new PrefChangeRegistrar()), | 22 pref_change_registrar_(new PrefChangeRegistrar()), |
21 weak_factory_(this) { | 23 weak_factory_(this) { |
22 pref_change_registrar_->Init(profile->GetPrefs()); | 24 pref_change_registrar_->Init(profile->GetPrefs()); |
23 pref_change_registrar_->Add( | 25 pref_change_registrar_->Add( |
24 prefs::kContextualSearchEnabled, | 26 prefs::kContextualSearchEnabled, |
(...skipping 22 matching lines...) Expand all Loading... |
47 Profile* profile = ProfileAndroid::FromProfileAndroid(java_profile); | 49 Profile* profile = ProfileAndroid::FromProfileAndroid(java_profile); |
48 CHECK(profile); | 50 CHECK(profile); |
49 ContextualSearchTabHelper* tab = new ContextualSearchTabHelper( | 51 ContextualSearchTabHelper* tab = new ContextualSearchTabHelper( |
50 env, obj, profile); | 52 env, obj, profile); |
51 return reinterpret_cast<intptr_t>(tab); | 53 return reinterpret_cast<intptr_t>(tab); |
52 } | 54 } |
53 | 55 |
54 bool RegisterContextualSearchTabHelper(JNIEnv* env) { | 56 bool RegisterContextualSearchTabHelper(JNIEnv* env) { |
55 return RegisterNativesImpl(env); | 57 return RegisterNativesImpl(env); |
56 } | 58 } |
OLD | NEW |