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

Side by Side Diff: chrome/browser/android/omnibox/autocomplete_controller_android.cc

Issue 292073002: [AiS] Bring Answers from C++ to Java. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review fixes. Created 6 years, 7 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxSuggestion.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/android/omnibox/autocomplete_controller_android.h" 5 #include "chrome/browser/android/omnibox/autocomplete_controller_android.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_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 } 374 }
375 375
376 ScopedJavaLocalRef<jobject> 376 ScopedJavaLocalRef<jobject>
377 AutocompleteControllerAndroid::BuildOmniboxSuggestion( 377 AutocompleteControllerAndroid::BuildOmniboxSuggestion(
378 JNIEnv* env, 378 JNIEnv* env,
379 const AutocompleteMatch& match) { 379 const AutocompleteMatch& match) {
380 ScopedJavaLocalRef<jstring> contents = 380 ScopedJavaLocalRef<jstring> contents =
381 ConvertUTF16ToJavaString(env, match.contents); 381 ConvertUTF16ToJavaString(env, match.contents);
382 ScopedJavaLocalRef<jstring> description = 382 ScopedJavaLocalRef<jstring> description =
383 ConvertUTF16ToJavaString(env, match.description); 383 ConvertUTF16ToJavaString(env, match.description);
384 ScopedJavaLocalRef<jstring> answer_contents =
385 ConvertUTF16ToJavaString(env, match.answer_contents);
386 ScopedJavaLocalRef<jstring> answer_type =
387 ConvertUTF16ToJavaString(env, match.answer_type);
384 ScopedJavaLocalRef<jstring> fill_into_edit = 388 ScopedJavaLocalRef<jstring> fill_into_edit =
385 ConvertUTF16ToJavaString(env, match.fill_into_edit); 389 ConvertUTF16ToJavaString(env, match.fill_into_edit);
386 ScopedJavaLocalRef<jstring> destination_url = 390 ScopedJavaLocalRef<jstring> destination_url =
387 ConvertUTF8ToJavaString(env, match.destination_url.spec()); 391 ConvertUTF8ToJavaString(env, match.destination_url.spec());
388 // Note that we are also removing 'www' host from formatted url. 392 // Note that we are also removing 'www' host from formatted url.
389 ScopedJavaLocalRef<jstring> formatted_url = ConvertUTF16ToJavaString(env, 393 ScopedJavaLocalRef<jstring> formatted_url = ConvertUTF16ToJavaString(env,
390 FormatURLUsingAcceptLanguages(match.stripped_destination_url)); 394 FormatURLUsingAcceptLanguages(match.stripped_destination_url));
391 return Java_AutocompleteController_buildOmniboxSuggestion( 395 return Java_AutocompleteController_buildOmniboxSuggestion(
392 env, 396 env,
393 match.type, 397 match.type,
394 match.relevance, 398 match.relevance,
395 match.transition, 399 match.transition,
396 contents.obj(), 400 contents.obj(),
397 description.obj(), 401 description.obj(),
402 answer_contents.obj(),
403 answer_type.obj(),
398 fill_into_edit.obj(), 404 fill_into_edit.obj(),
399 destination_url.obj(), 405 destination_url.obj(),
400 formatted_url.obj(), 406 formatted_url.obj(),
401 match.starred, 407 match.starred,
402 match.SupportsDeletion()); 408 match.SupportsDeletion());
403 } 409 }
404 410
405 base::string16 AutocompleteControllerAndroid::FormatURLUsingAcceptLanguages( 411 base::string16 AutocompleteControllerAndroid::FormatURLUsingAcceptLanguages(
406 GURL url) { 412 GURL url) {
407 if (profile_ == NULL) 413 if (profile_ == NULL)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 return; 499 return;
494 500
495 // ZeroSuggestPrefetcher deletes itself after it's done prefetching. 501 // ZeroSuggestPrefetcher deletes itself after it's done prefetching.
496 new ZeroSuggestPrefetcher(profile); 502 new ZeroSuggestPrefetcher(profile);
497 } 503 }
498 504
499 // Register native methods 505 // Register native methods
500 bool RegisterAutocompleteControllerAndroid(JNIEnv* env) { 506 bool RegisterAutocompleteControllerAndroid(JNIEnv* env) {
501 return RegisterNativesImpl(env); 507 return RegisterNativesImpl(env);
502 } 508 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxSuggestion.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698