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

Side by Side Diff: chrome/browser/banners/app_banner_data_fetcher.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_manifest Created 4 years, 6 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/banners/app_banner_data_fetcher.h" 5 #include "chrome/browser/banners/app_banner_data_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 return; 195 return;
196 } 196 }
197 197
198 AppBannerSettingsHelper::RecordMinutesFromFirstVisitToShow( 198 AppBannerSettingsHelper::RecordMinutesFromFirstVisitToShow(
199 web_contents, validated_url_, GetAppIdentifier(), GetCurrentTime()); 199 web_contents, validated_url_, GetAppIdentifier(), GetCurrentTime());
200 200
201 // Definitely going to show the banner now. 201 // Definitely going to show the banner now.
202 FOR_EACH_OBSERVER(Observer, observer_list_, 202 FOR_EACH_OBSERVER(Observer, observer_list_,
203 OnDecidedWhetherToShow(this, true)); 203 OnDecidedWhetherToShow(this, true));
204 204
205 ShowBanner(app_icon_.get(), app_title_, referrer); 205 ShowBanner(app_icon_url_, app_icon_.get(), app_title_, referrer);
206 is_active_ = false; 206 is_active_ = false;
207 } 207 }
208 208
209 void AppBannerDataFetcher::OnRequestShowAppBanner( 209 void AppBannerDataFetcher::OnRequestShowAppBanner(
210 content::RenderFrameHost* render_frame_host, 210 content::RenderFrameHost* render_frame_host,
211 int request_id) { 211 int request_id) {
212 if (was_canceled_by_page_) { 212 if (was_canceled_by_page_) {
213 // Simulate an "OK" from the website to restart the banner display pipeline. 213 // Simulate an "OK" from the website to restart the banner display pipeline.
214 was_canceled_by_page_ = false; 214 was_canceled_by_page_ = false;
215 OnBannerPromptReply(render_frame_host, request_id, 215 OnBannerPromptReply(render_frame_host, request_id,
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 Cancel(); 362 Cancel();
363 } else if (!FetchAppIcon(web_contents, icon_url)) { 363 } else if (!FetchAppIcon(web_contents, icon_url)) {
364 OutputDeveloperNotShownMessage(web_contents, kCannotDownloadIcon, 364 OutputDeveloperNotShownMessage(web_contents, kCannotDownloadIcon,
365 is_debug_mode_); 365 is_debug_mode_);
366 Cancel(); 366 Cancel();
367 } 367 }
368 } 368 }
369 369
370 bool AppBannerDataFetcher::FetchAppIcon(content::WebContents* web_contents, 370 bool AppBannerDataFetcher::FetchAppIcon(content::WebContents* web_contents,
371 const GURL& icon_url) { 371 const GURL& icon_url) {
372 app_icon_url_ = icon_url;
372 return ManifestIconDownloader::Download( 373 return ManifestIconDownloader::Download(
373 web_contents, 374 web_contents, icon_url, ideal_icon_size_in_dp_, minimum_icon_size_in_dp_,
374 icon_url, 375 base::Bind(&AppBannerDataFetcher::OnAppIconFetched, this));
375 ideal_icon_size_in_dp_,
376 minimum_icon_size_in_dp_,
377 base::Bind(&AppBannerDataFetcher::OnAppIconFetched,
378 this));
379 } 376 }
380 377
381 void AppBannerDataFetcher::OnAppIconFetched(const SkBitmap& bitmap) { 378 void AppBannerDataFetcher::OnAppIconFetched(const SkBitmap& bitmap) {
382 if (!is_active_) return; 379 if (!is_active_) return;
383 380
384 content::WebContents* web_contents = GetWebContents(); 381 content::WebContents* web_contents = GetWebContents();
385 if (!CheckFetcherIsStillAlive(web_contents)) { 382 if (!CheckFetcherIsStillAlive(web_contents)) {
386 Cancel(); 383 Cancel();
387 return; 384 return;
388 } 385 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 476
480 if (!DoesManifestContainRequiredIcon(manifest)) { 477 if (!DoesManifestContainRequiredIcon(manifest)) {
481 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon, 478 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon,
482 is_debug_mode); 479 is_debug_mode);
483 return false; 480 return false;
484 } 481 }
485 return true; 482 return true;
486 } 483 }
487 484
488 } // namespace banners 485 } // namespace banners
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698