Chromium Code Reviews| 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "chrome/browser/android/banners/app_banner_manager_android.h" | 7 #include "chrome/browser/android/banners/app_banner_manager_android.h" |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" | 13 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" |
| 14 #include "chrome/browser/android/shortcut_helper.h" | 14 #include "chrome/browser/android/shortcut_helper.h" |
| 15 #include "chrome/browser/android/webapk/chrome_webapk_host.h" | |
| 16 #include "chrome/browser/android/webapk/webapk_web_manifest_checker.h" | |
| 15 #include "chrome/browser/banners/app_banner_metrics.h" | 17 #include "chrome/browser/banners/app_banner_metrics.h" |
| 16 #include "chrome/browser/infobars/infobar_service.h" | 18 #include "chrome/browser/infobars/infobar_service.h" |
| 17 #include "chrome/browser/manifest/manifest_icon_downloader.h" | 19 #include "chrome/browser/manifest/manifest_icon_downloader.h" |
| 18 #include "chrome/browser/manifest/manifest_icon_selector.h" | 20 #include "chrome/browser/manifest/manifest_icon_selector.h" |
| 19 #include "chrome/browser/ui/android/infobars/app_banner_infobar_android.h" | 21 #include "chrome/browser/ui/android/infobars/app_banner_infobar_android.h" |
| 20 #include "chrome/common/chrome_constants.h" | 22 #include "chrome/common/chrome_constants.h" |
| 21 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 22 #include "content/public/common/frame_navigate_params.h" | 24 #include "content/public/common/frame_navigate_params.h" |
| 23 #include "jni/AppBannerManager_jni.h" | 25 #include "jni/AppBannerManager_jni.h" |
| 24 #include "third_party/skia/include/core/SkBitmap.h" | 26 #include "third_party/skia/include/core/SkBitmap.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 manifest_.related_applications.size()) { | 149 manifest_.related_applications.size()) { |
| 148 for (const auto& application : manifest_.related_applications) { | 150 for (const auto& application : manifest_.related_applications) { |
| 149 std::string platform = base::UTF16ToUTF8(application.platform.string()); | 151 std::string platform = base::UTF16ToUTF8(application.platform.string()); |
| 150 std::string id = base::UTF16ToUTF8(application.id.string()); | 152 std::string id = base::UTF16ToUTF8(application.id.string()); |
| 151 if (CanHandleNonWebApp(platform, application.url, id)) | 153 if (CanHandleNonWebApp(platform, application.url, id)) |
| 152 return; | 154 return; |
| 153 } | 155 } |
| 154 Stop(); | 156 Stop(); |
| 155 } | 157 } |
| 156 | 158 |
| 159 if (ChromeWebApkHost::AreWebApkEnabled()) { | |
| 160 InstallableStatusCode error_code = | |
| 161 CheckWebManifestUrlsWebApkCompatible(manifest_); | |
| 162 if (error_code != NO_ERROR_DETECTED) { | |
| 163 ReportStatus(web_contents(), error_code); | |
|
dominickn
2016/08/24 03:27:11
When CheckWebManifestUrlsWebApkCompatible returns
| |
| 164 Stop(); | |
| 165 return; | |
| 166 } | |
| 167 } | |
| 168 | |
| 157 // No native app banner was requested. Continue checking for a web app banner. | 169 // No native app banner was requested. Continue checking for a web app banner. |
| 158 AppBannerManager::PerformInstallableCheck(); | 170 AppBannerManager::PerformInstallableCheck(); |
| 159 } | 171 } |
| 160 | 172 |
| 161 void AppBannerManagerAndroid::OnAppIconFetched(const SkBitmap& bitmap) { | 173 void AppBannerManagerAndroid::OnAppIconFetched(const SkBitmap& bitmap) { |
| 162 if (bitmap.drawsNothing()) { | 174 if (bitmap.drawsNothing()) { |
| 163 ReportStatus(web_contents(), NO_ICON_AVAILABLE); | 175 ReportStatus(web_contents(), NO_ICON_AVAILABLE); |
| 164 Stop(); | 176 Stop(); |
| 165 } | 177 } |
| 166 | 178 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 } | 332 } |
| 321 | 333 |
| 322 // static | 334 // static |
| 323 void SetTimeDeltaForTesting(JNIEnv* env, | 335 void SetTimeDeltaForTesting(JNIEnv* env, |
| 324 const JavaParamRef<jclass>& clazz, | 336 const JavaParamRef<jclass>& clazz, |
| 325 jint days) { | 337 jint days) { |
| 326 AppBannerManager::SetTimeDeltaForTesting(days); | 338 AppBannerManager::SetTimeDeltaForTesting(days); |
| 327 } | 339 } |
| 328 | 340 |
| 329 } // namespace banners | 341 } // namespace banners |
| OLD | NEW |