Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/android/toolbar/toolbar_model_android.h" | 5 #include "chrome/browser/ui/android/toolbar/toolbar_model_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/search/search.h" | |
| 9 #include "chrome/browser/search_engines/search_terms_data.h" | 10 #include "chrome/browser/search_engines/search_terms_data.h" |
| 10 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" | 11 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" |
| 11 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 12 #include "jni/ToolbarModel_jni.h" | 13 #include "jni/ToolbarModel_jni.h" |
| 13 | 14 |
| 14 using base::android::ScopedJavaLocalRef; | 15 using base::android::ScopedJavaLocalRef; |
| 15 | 16 |
| 16 ToolbarModelAndroid::ToolbarModelAndroid(JNIEnv* env, jobject jdelegate) | 17 ToolbarModelAndroid::ToolbarModelAndroid(JNIEnv* env, jobject jdelegate) |
| 17 : toolbar_model_(new ToolbarModelImpl(this)), | 18 : toolbar_model_(new ToolbarModelImpl(this)), |
| 18 weak_java_delegate_(env, jdelegate) { | 19 weak_java_delegate_(env, jdelegate) { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 34 ScopedJavaLocalRef<jstring> ToolbarModelAndroid::GetQueryExtractionParam( | 35 ScopedJavaLocalRef<jstring> ToolbarModelAndroid::GetQueryExtractionParam( |
| 35 JNIEnv* env, | 36 JNIEnv* env, |
| 36 jobject obj) { | 37 jobject obj) { |
| 37 content::WebContents* web_contents = GetActiveWebContents(); | 38 content::WebContents* web_contents = GetActiveWebContents(); |
| 38 if (!web_contents) | 39 if (!web_contents) |
| 39 return ScopedJavaLocalRef<jstring>(); | 40 return ScopedJavaLocalRef<jstring>(); |
| 40 Profile* profile = | 41 Profile* profile = |
| 41 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 42 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 42 UIThreadSearchTermsData search_terms_data(profile); | 43 UIThreadSearchTermsData search_terms_data(profile); |
| 43 return base::android::ConvertUTF8ToJavaString( | 44 return base::android::ConvertUTF8ToJavaString( |
| 44 env, | 45 env, chrome::InstantExtendedEnabledParam(false)); |
|
Yusuf
2014/02/04 19:02:54
I do agree with samarth we should be returning tru
kmadhusu
2014/02/04 19:39:54
Done. As we discussed offline, I filed crbug.com/3
| |
| 45 search_terms_data.InstantExtendedEnabledParam()); | |
| 46 } | 46 } |
| 47 | 47 |
| 48 ScopedJavaLocalRef<jstring> ToolbarModelAndroid::GetCorpusChipText( | 48 ScopedJavaLocalRef<jstring> ToolbarModelAndroid::GetCorpusChipText( |
| 49 JNIEnv* env, | 49 JNIEnv* env, |
| 50 jobject obj) { | 50 jobject obj) { |
| 51 return base::android::ConvertUTF16ToJavaString( | 51 return base::android::ConvertUTF16ToJavaString( |
| 52 env, | 52 env, |
| 53 toolbar_model_->GetCorpusNameForMobile()); | 53 toolbar_model_->GetCorpusNameForMobile()); |
| 54 } | 54 } |
| 55 | 55 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 70 // static | 70 // static |
| 71 bool ToolbarModelAndroid::RegisterToolbarModelAndroid(JNIEnv* env) { | 71 bool ToolbarModelAndroid::RegisterToolbarModelAndroid(JNIEnv* env) { |
| 72 return RegisterNativesImpl(env); | 72 return RegisterNativesImpl(env); |
| 73 } | 73 } |
| 74 | 74 |
| 75 // static | 75 // static |
| 76 jlong Init(JNIEnv* env, jobject obj, jobject delegate) { | 76 jlong Init(JNIEnv* env, jobject obj, jobject delegate) { |
| 77 ToolbarModelAndroid* toolbar_model = new ToolbarModelAndroid(env, delegate); | 77 ToolbarModelAndroid* toolbar_model = new ToolbarModelAndroid(env, delegate); |
| 78 return reinterpret_cast<intptr_t>(toolbar_model); | 78 return reinterpret_cast<intptr_t>(toolbar_model); |
| 79 } | 79 } |
| OLD | NEW |