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

Side by Side Diff: chrome/browser/android/banners/app_banner_manager_android.cc

Issue 2375503003: Pass WebAPK install source to AppBannerInfobarDelegateAndroid constructor. (Closed)
Patch Set: pkotwicz@'s comments. Created 4 years, 2 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
OLDNEW
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" 15 #include "chrome/browser/android/webapk/chrome_webapk_host.h"
16 #include "chrome/browser/android/webapk/webapk_metrics.h"
16 #include "chrome/browser/android/webapk/webapk_web_manifest_checker.h" 17 #include "chrome/browser/android/webapk/webapk_web_manifest_checker.h"
17 #include "chrome/browser/banners/app_banner_metrics.h" 18 #include "chrome/browser/banners/app_banner_metrics.h"
18 #include "chrome/browser/manifest/manifest_icon_downloader.h" 19 #include "chrome/browser/manifest/manifest_icon_downloader.h"
19 #include "chrome/browser/manifest/manifest_icon_selector.h" 20 #include "chrome/browser/manifest/manifest_icon_selector.h"
20 #include "chrome/common/chrome_constants.h" 21 #include "chrome/common/chrome_constants.h"
21 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
22 #include "content/public/common/frame_navigate_params.h" 23 #include "content/public/common/frame_navigate_params.h"
23 #include "jni/AppBannerManager_jni.h" 24 #include "jni/AppBannerManager_jni.h"
24 #include "net/base/url_util.h" 25 #include "net/base/url_util.h"
25 #include "third_party/skia/include/core/SkBitmap.h" 26 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 void AppBannerManagerAndroid::ShowBanner() { 193 void AppBannerManagerAndroid::ShowBanner() {
193 content::WebContents* contents = web_contents(); 194 content::WebContents* contents = web_contents();
194 DCHECK(contents); 195 DCHECK(contents);
195 196
196 if (native_app_data_.is_null()) { 197 if (native_app_data_.is_null()) {
197 if (AppBannerInfoBarDelegateAndroid::Create( 198 if (AppBannerInfoBarDelegateAndroid::Create(
198 contents, GetWeakPtr(), app_title_, 199 contents, GetWeakPtr(), app_title_,
199 CreateShortcutInfo(manifest_url_, manifest_, icon_url_), 200 CreateShortcutInfo(manifest_url_, manifest_, icon_url_),
200 std::move(icon_), event_request_id(), 201 std::move(icon_), event_request_id(),
201 ChromeWebApkHost::AreWebApkEnabled(), 202 ChromeWebApkHost::AreWebApkEnabled(),
202 false /* start_install_webapk */)) { 203 webapk::INSTALL_SOURCE_BANNER)) {
203 RecordDidShowBanner("AppBanner.WebApp.Shown"); 204 RecordDidShowBanner("AppBanner.WebApp.Shown");
204 TrackDisplayEvent(DISPLAY_EVENT_WEB_APP_BANNER_CREATED); 205 TrackDisplayEvent(DISPLAY_EVENT_WEB_APP_BANNER_CREATED);
205 ReportStatus(contents, SHOWING_WEB_APP_BANNER); 206 ReportStatus(contents, SHOWING_WEB_APP_BANNER);
206 } else { 207 } else {
207 ReportStatus(contents, FAILED_TO_CREATE_BANNER); 208 ReportStatus(contents, FAILED_TO_CREATE_BANNER);
208 } 209 }
209 } else { 210 } else {
210 if (AppBannerInfoBarDelegateAndroid::Create( 211 if (AppBannerInfoBarDelegateAndroid::Create(
211 contents, app_title_, native_app_data_, std::move(icon_), 212 contents, app_title_, native_app_data_, std::move(icon_),
212 native_app_package_, referrer_, event_request_id())) { 213 native_app_package_, referrer_, event_request_id())) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 } 315 }
315 316
316 // static 317 // static
317 void SetTimeDeltaForTesting(JNIEnv* env, 318 void SetTimeDeltaForTesting(JNIEnv* env,
318 const JavaParamRef<jclass>& clazz, 319 const JavaParamRef<jclass>& clazz,
319 jint days) { 320 jint days) {
320 AppBannerManager::SetTimeDeltaForTesting(days); 321 AppBannerManager::SetTimeDeltaForTesting(days);
321 } 322 }
322 323
323 } // namespace banners 324 } // namespace banners
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698