| 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/banners/app_banner_manager.h" | 5 #include "chrome/browser/banners/app_banner_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 InstallableParams ParamsToGetManifest() { | 36 InstallableParams ParamsToGetManifest() { |
| 37 return InstallableParams(); | 37 return InstallableParams(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 // Returns an InstallableParams object that requests all checks necessary for | 40 // Returns an InstallableParams object that requests all checks necessary for |
| 41 // a web app banner. | 41 // a web app banner. |
| 42 InstallableParams ParamsToPerformInstallableCheck(int ideal_icon_size_in_px, | 42 InstallableParams ParamsToPerformInstallableCheck(int ideal_icon_size_in_px, |
| 43 int minimum_icon_size_in_px) { | 43 int minimum_icon_size_in_px) { |
| 44 InstallableParams params; | 44 InstallableParams params; |
| 45 params.ideal_icon_size_in_px = ideal_icon_size_in_px; | 45 params.ideal_primary_icon_size_in_px = ideal_icon_size_in_px; |
| 46 params.minimum_icon_size_in_px = minimum_icon_size_in_px; | 46 params.minimum_primary_icon_size_in_px = minimum_icon_size_in_px; |
| 47 params.check_installable = true; | 47 params.check_installable = true; |
| 48 params.fetch_valid_icon = true; | 48 params.fetch_valid_primary_icon = true; |
| 49 | 49 |
| 50 return params; | 50 return params; |
| 51 } | 51 } |
| 52 | 52 |
| 53 } // anonymous namespace | 53 } // anonymous namespace |
| 54 | 54 |
| 55 namespace banners { | 55 namespace banners { |
| 56 | 56 |
| 57 // static | 57 // static |
| 58 base::Time AppBannerManager::GetCurrentTime() { | 58 base::Time AppBannerManager::GetCurrentTime() { |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 TrackDisplayEvent(DISPLAY_EVENT_LACKS_SERVICE_WORKER); | 267 TrackDisplayEvent(DISPLAY_EVENT_LACKS_SERVICE_WORKER); |
| 268 | 268 |
| 269 ReportStatus(web_contents(), data.error_code); | 269 ReportStatus(web_contents(), data.error_code); |
| 270 Stop(); | 270 Stop(); |
| 271 } | 271 } |
| 272 | 272 |
| 273 if (!is_active_) | 273 if (!is_active_) |
| 274 return; | 274 return; |
| 275 | 275 |
| 276 DCHECK(data.is_installable); | 276 DCHECK(data.is_installable); |
| 277 DCHECK(!data.icon_url.is_empty()); | 277 DCHECK(!data.primary_icon_url.is_empty()); |
| 278 DCHECK(data.icon); | 278 DCHECK(data.primary_icon); |
| 279 | 279 |
| 280 icon_url_ = data.icon_url; | 280 icon_url_ = data.primary_icon_url; |
| 281 icon_.reset(new SkBitmap(*data.icon)); | 281 icon_.reset(new SkBitmap(*data.primary_icon)); |
| 282 | 282 |
| 283 SendBannerPromptRequest(); | 283 SendBannerPromptRequest(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 void AppBannerManager::RecordDidShowBanner(const std::string& event_name) { | 286 void AppBannerManager::RecordDidShowBanner(const std::string& event_name) { |
| 287 content::WebContents* contents = web_contents(); | 287 content::WebContents* contents = web_contents(); |
| 288 DCHECK(contents); | 288 DCHECK(contents); |
| 289 | 289 |
| 290 AppBannerSettingsHelper::RecordBannerEvent( | 290 AppBannerSettingsHelper::RecordBannerEvent( |
| 291 contents, validated_url_, GetAppIdentifier(), | 291 contents, validated_url_, GetAppIdentifier(), |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner. | 536 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner. |
| 537 // Don't reset |was_canceled_by_page_| yet for metrics purposes. | 537 // Don't reset |was_canceled_by_page_| yet for metrics purposes. |
| 538 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_); | 538 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_); |
| 539 } else { | 539 } else { |
| 540 // Log that the prompt request was made for when we get the prompt reply. | 540 // Log that the prompt request was made for when we get the prompt reply. |
| 541 page_requested_prompt_ = true; | 541 page_requested_prompt_ = true; |
| 542 } | 542 } |
| 543 } | 543 } |
| 544 | 544 |
| 545 } // namespace banners | 545 } // namespace banners |
| OLD | NEW |