| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ntp/ntp_snippets_bridge.h" | 5 #include "chrome/browser/android/ntp/ntp_snippets_bridge.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 ConvertUTF16ToJavaString(env, suggestion.snippet_text()), | 64 ConvertUTF16ToJavaString(env, suggestion.snippet_text()), |
| 65 ConvertUTF8ToJavaString(env, suggestion.url().spec()), | 65 ConvertUTF8ToJavaString(env, suggestion.url().spec()), |
| 66 suggestion.publish_date().ToJavaTime(), suggestion.score(), | 66 suggestion.publish_date().ToJavaTime(), suggestion.score(), |
| 67 suggestion.fetch_date().ToJavaTime()); | 67 suggestion.fetch_date().ToJavaTime()); |
| 68 if (suggestion.id().category().IsKnownCategory( | 68 if (suggestion.id().category().IsKnownCategory( |
| 69 KnownCategories::DOWNLOADS) && | 69 KnownCategories::DOWNLOADS) && |
| 70 suggestion.download_suggestion_extra() != nullptr) { | 70 suggestion.download_suggestion_extra() != nullptr) { |
| 71 if (suggestion.download_suggestion_extra()->is_download_asset) { | 71 if (suggestion.download_suggestion_extra()->is_download_asset) { |
| 72 Java_SnippetsBridge_setAssetDownloadDataForSuggestion( | 72 Java_SnippetsBridge_setAssetDownloadDataForSuggestion( |
| 73 env, java_suggestion, | 73 env, java_suggestion, |
| 74 ConvertUTF8ToJavaString( |
| 75 env, suggestion.download_suggestion_extra()->download_guid), |
| 74 ConvertUTF8ToJavaString(env, suggestion.download_suggestion_extra() | 76 ConvertUTF8ToJavaString(env, suggestion.download_suggestion_extra() |
| 75 ->target_file_path.value()), | 77 ->target_file_path.value()), |
| 76 ConvertUTF8ToJavaString( | 78 ConvertUTF8ToJavaString( |
| 77 env, suggestion.download_suggestion_extra()->mime_type)); | 79 env, suggestion.download_suggestion_extra()->mime_type)); |
| 78 } else { | 80 } else { |
| 79 Java_SnippetsBridge_setOfflinePageDownloadDataForSuggestion( | 81 Java_SnippetsBridge_setOfflinePageDownloadDataForSuggestion( |
| 80 env, java_suggestion, | 82 env, java_suggestion, |
| 81 suggestion.download_suggestion_extra()->offline_page_id); | 83 suggestion.download_suggestion_extra()->offline_page_id); |
| 82 } | 84 } |
| 83 } | 85 } |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 JNIEnv* env = AttachCurrentThread(); | 480 JNIEnv* env = AttachCurrentThread(); |
| 479 Java_SnippetsBridge_onMoreSuggestions( | 481 Java_SnippetsBridge_onMoreSuggestions( |
| 480 env, bridge_, category.id(), | 482 env, bridge_, category.id(), |
| 481 ToJavaSuggestionList(env, category, suggestions)); | 483 ToJavaSuggestionList(env, category, suggestions)); |
| 482 } | 484 } |
| 483 | 485 |
| 484 // static | 486 // static |
| 485 bool NTPSnippetsBridge::Register(JNIEnv* env) { | 487 bool NTPSnippetsBridge::Register(JNIEnv* env) { |
| 486 return RegisterNativesImpl(env); | 488 return RegisterNativesImpl(env); |
| 487 } | 489 } |
| OLD | NEW |