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

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

Issue 2064943002: Pass in extra parameters to WebApkBuilder#buildWebApkAsync() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into webapk_manifest000 Created 4 years, 5 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 "chrome/browser/android/banners/app_banner_data_fetcher_android.h" 5 #include "chrome/browser/android/banners/app_banner_data_fetcher_android.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 return native_app_data_.is_null() 58 return native_app_data_.is_null()
59 ? AppBannerDataFetcher::GetAppIdentifier() : native_app_package_; 59 ? AppBannerDataFetcher::GetAppIdentifier() : native_app_package_;
60 } 60 }
61 61
62 base::Closure AppBannerDataFetcherAndroid::FetchWebappSplashScreenImageCallback( 62 base::Closure AppBannerDataFetcherAndroid::FetchWebappSplashScreenImageCallback(
63 const std::string& webapp_id) { 63 const std::string& webapp_id) {
64 content::WebContents* web_contents = GetWebContents(); 64 content::WebContents* web_contents = GetWebContents();
65 DCHECK(web_contents); 65 DCHECK(web_contents);
66 66
67 GURL image_url = ManifestIconSelector::FindBestMatchingIcon( 67 GURL image_url = ManifestIconSelector::FindBestMatchingIcon(
68 web_app_data().icons, ideal_splash_image_size_in_dp_, 68 manifest().icons, ideal_splash_image_size_in_dp_,
69 minimum_splash_image_size_in_dp_); 69 minimum_splash_image_size_in_dp_);
70 70
71 return base::Bind(&ShortcutHelper::FetchSplashScreenImage, 71 return base::Bind(&ShortcutHelper::FetchSplashScreenImage,
72 web_contents, image_url, ideal_splash_image_size_in_dp_, 72 web_contents, image_url, ideal_splash_image_size_in_dp_,
73 minimum_splash_image_size_in_dp_, webapp_id); 73 minimum_splash_image_size_in_dp_, webapp_id);
74 } 74 }
75 75
76 void AppBannerDataFetcherAndroid::ShowBanner(const SkBitmap* icon, 76 void AppBannerDataFetcherAndroid::ShowBanner(const GURL& icon_url,
77 const SkBitmap* icon,
77 const base::string16& title, 78 const base::string16& title,
78 const std::string& referrer) { 79 const std::string& referrer) {
79 content::WebContents* web_contents = GetWebContents(); 80 content::WebContents* web_contents = GetWebContents();
80 DCHECK(web_contents); 81 DCHECK(web_contents);
81 82
82 infobars::InfoBar* infobar = nullptr; 83 infobars::InfoBar* infobar = nullptr;
83 if (native_app_data_.is_null()) { 84 if (native_app_data_.is_null()) {
84 std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate( 85 std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate(
85 new AppBannerInfoBarDelegateAndroid(event_request_id(), this, title, 86 new AppBannerInfoBarDelegateAndroid(event_request_id(), this, title,
86 new SkBitmap(*icon), 87 icon_url, new SkBitmap(*icon),
87 web_app_data())); 88 manifest_url(), manifest()));
88 89
89 infobar = new AppBannerInfoBarAndroid(std::move(delegate), 90 infobar = new AppBannerInfoBarAndroid(std::move(delegate),
90 web_app_data().start_url); 91 manifest().start_url);
91 if (infobar) { 92 if (infobar) {
92 RecordDidShowBanner("AppBanner.WebApp.Shown"); 93 RecordDidShowBanner("AppBanner.WebApp.Shown");
93 TrackDisplayEvent(DISPLAY_EVENT_WEB_APP_BANNER_CREATED); 94 TrackDisplayEvent(DISPLAY_EVENT_WEB_APP_BANNER_CREATED);
94 } 95 }
95 } else { 96 } else {
96 std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate( 97 std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate(
97 new AppBannerInfoBarDelegateAndroid( 98 new AppBannerInfoBarDelegateAndroid(
98 event_request_id(), title, new SkBitmap(*icon), native_app_data_, 99 event_request_id(), title, new SkBitmap(*icon), native_app_data_,
99 native_app_package_, referrer)); 100 native_app_package_, referrer));
100 infobar = 101 infobar =
101 new AppBannerInfoBarAndroid(std::move(delegate), native_app_data_); 102 new AppBannerInfoBarAndroid(std::move(delegate), native_app_data_);
102 if (infobar) { 103 if (infobar) {
103 RecordDidShowBanner("AppBanner.NativeApp.Shown"); 104 RecordDidShowBanner("AppBanner.NativeApp.Shown");
104 TrackDisplayEvent(DISPLAY_EVENT_NATIVE_APP_BANNER_CREATED); 105 TrackDisplayEvent(DISPLAY_EVENT_NATIVE_APP_BANNER_CREATED);
105 } 106 }
106 } 107 }
107 InfoBarService::FromWebContents(web_contents) 108 InfoBarService::FromWebContents(web_contents)
108 ->AddInfoBar(base::WrapUnique(infobar)); 109 ->AddInfoBar(base::WrapUnique(infobar));
109 } 110 }
110 111
111 } // namespace banners 112 } // namespace banners
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698