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 "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" | 5 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
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" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 shortcut_info_(std::move(shortcut_info)), | 220 shortcut_info_(std::move(shortcut_info)), |
221 primary_icon_(primary_icon), | 221 primary_icon_(primary_icon), |
222 badge_icon_(badge_icon), | 222 badge_icon_(badge_icon), |
223 event_request_id_(event_request_id), | 223 event_request_id_(event_request_id), |
224 has_user_interaction_(false), | 224 has_user_interaction_(false), |
225 is_webapk_(is_webapk), | 225 is_webapk_(is_webapk), |
226 install_state_(INSTALL_NOT_STARTED), | 226 install_state_(INSTALL_NOT_STARTED), |
227 webapk_install_source_(webapk_install_source), | 227 webapk_install_source_(webapk_install_source), |
228 weak_ptr_factory_(this) { | 228 weak_ptr_factory_(this) { |
229 DCHECK(!IsInfoEmpty(shortcut_info_)); | 229 DCHECK(!IsInfoEmpty(shortcut_info_)); |
230 | |
231 // Explicitly update the source to separate WebAPKs installed from the banner | |
232 // from legacy PWAs that are installed from the banner. | |
233 if (is_webapk && webapk_install_source == webapk::INSTALL_SOURCE_BANNER) | |
234 shortcut_info_->UpdateSource(ShortcutInfo::SOURCE_APP_BANNER_WEBAPK); | |
pkotwicz
2017/04/12 15:46:01
I would rather if this code was in AppBannerManage
dominickn
2017/05/03 00:26:04
I'd rather keep WebAPK specific code in here. Soon
Xi Han
2017/05/03 18:07:50
AppBannerManagerAndroid has the |can_install_webap
dominickn
2017/05/04 00:33:59
Hmm, that's true. I forgot about that member entir
| |
230 CreateJavaDelegate(); | 235 CreateJavaDelegate(); |
231 } | 236 } |
232 | 237 |
233 AppBannerInfoBarDelegateAndroid::AppBannerInfoBarDelegateAndroid( | 238 AppBannerInfoBarDelegateAndroid::AppBannerInfoBarDelegateAndroid( |
234 const base::string16& app_title, | 239 const base::string16& app_title, |
235 const base::android::ScopedJavaGlobalRef<jobject>& native_app_data, | 240 const base::android::ScopedJavaGlobalRef<jobject>& native_app_data, |
236 const SkBitmap& icon, | 241 const SkBitmap& icon, |
237 const std::string& native_app_package, | 242 const std::string& native_app_package, |
238 const std::string& referrer, | 243 const std::string& referrer, |
239 int event_request_id) | 244 int event_request_id) |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
464 | 469 |
465 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); | 470 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); |
466 return true; | 471 return true; |
467 } | 472 } |
468 | 473 |
469 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { | 474 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { |
470 return RegisterNativesImpl(env); | 475 return RegisterNativesImpl(env); |
471 } | 476 } |
472 | 477 |
473 } // namespace banners | 478 } // namespace banners |
OLD | NEW |