| 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/webapk/webapk_update_data_fetcher.h" | 5 #include "chrome/browser/android/webapk/webapk_update_data_fetcher.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // DidStopLoading() can be called multiple times for a single URL. Only fetch | 101 // DidStopLoading() can be called multiple times for a single URL. Only fetch |
| 102 // installable data the first time. | 102 // installable data the first time. |
| 103 if (url == last_fetched_url_) | 103 if (url == last_fetched_url_) |
| 104 return; | 104 return; |
| 105 last_fetched_url_ = url; | 105 last_fetched_url_ = url; |
| 106 | 106 |
| 107 if (!IsInScope(url, scope_)) | 107 if (!IsInScope(url, scope_)) |
| 108 return; | 108 return; |
| 109 | 109 |
| 110 InstallableParams params; | 110 InstallableParams params; |
| 111 params.ideal_icon_size_in_dp = | 111 params.ideal_icon_size_in_px = |
| 112 ShortcutHelper::GetIdealHomescreenIconSizeInDp(); | 112 ShortcutHelper::GetIdealHomescreenIconSizeInPx(); |
| 113 params.minimum_icon_size_in_dp = | 113 params.minimum_icon_size_in_px = |
| 114 ShortcutHelper::GetMinimumHomescreenIconSizeInDp(); | 114 ShortcutHelper::GetMinimumHomescreenIconSizeInPx(); |
| 115 params.check_installable = true; | 115 params.check_installable = true; |
| 116 params.fetch_valid_icon = true; | 116 params.fetch_valid_icon = true; |
| 117 InstallableManager::CreateForWebContents(web_contents()); | 117 InstallableManager::CreateForWebContents(web_contents()); |
| 118 InstallableManager* installable_manager = | 118 InstallableManager* installable_manager = |
| 119 InstallableManager::FromWebContents(web_contents()); | 119 InstallableManager::FromWebContents(web_contents()); |
| 120 installable_manager->GetData( | 120 installable_manager->GetData( |
| 121 params, | 121 params, |
| 122 base::Bind(&WebApkUpdateDataFetcher::OnDidGetInstallableData, | 122 base::Bind(&WebApkUpdateDataFetcher::OnDidGetInstallableData, |
| 123 weak_ptr_factory_.GetWeakPtr())); | 123 weak_ptr_factory_.GetWeakPtr())); |
| 124 } | 124 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 ScopedJavaLocalRef<jobjectArray> java_icon_urls = | 195 ScopedJavaLocalRef<jobjectArray> java_icon_urls = |
| 196 base::android::ToJavaArrayOfStrings(env, info.icon_urls); | 196 base::android::ToJavaArrayOfStrings(env, info.icon_urls); |
| 197 | 197 |
| 198 Java_WebApkUpdateDataFetcher_onDataAvailable( | 198 Java_WebApkUpdateDataFetcher_onDataAvailable( |
| 199 env, java_ref_, java_url, java_scope, java_name, java_short_name, | 199 env, java_ref_, java_url, java_scope, java_name, java_short_name, |
| 200 java_best_icon_url, java_best_icon_murmur2_hash, java_best_bitmap, | 200 java_best_icon_url, java_best_icon_murmur2_hash, java_best_bitmap, |
| 201 java_icon_urls, info.display, info.orientation, info.theme_color, | 201 java_icon_urls, info.display, info.orientation, info.theme_color, |
| 202 info.background_color); | 202 info.background_color); |
| 203 } | 203 } |
| OLD | NEW |