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