| 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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 | 384 |
| 385 void AppBannerManager::DidFinishLoad( | 385 void AppBannerManager::DidFinishLoad( |
| 386 content::RenderFrameHost* render_frame_host, | 386 content::RenderFrameHost* render_frame_host, |
| 387 const GURL& validated_url) { | 387 const GURL& validated_url) { |
| 388 // Don't start the banner flow unless the main frame has finished loading. | 388 // Don't start the banner flow unless the main frame has finished loading. |
| 389 if (render_frame_host->GetParent()) | 389 if (render_frame_host->GetParent()) |
| 390 return; | 390 return; |
| 391 | 391 |
| 392 load_finished_ = true; | 392 load_finished_ = true; |
| 393 validated_url_ = validated_url; | 393 validated_url_ = validated_url; |
| 394 // Start the pipeline immediately if: | 394 |
| 395 // 1. we have sufficient engagement, or | 395 // If the bypass flag is on, or if we require no engagement to trigger the |
| 396 // 2. 0 engagement is required, or | 396 // banner, the rest of the banner pipeline should operate as if the engagement |
| 397 // 3. the feature to start the installability check in load is enabled | 397 // threshold has been met. |
| 398 if (AppBannerSettingsHelper::HasSufficientEngagement(0)) |
| 399 has_sufficient_engagement_ = true; |
| 400 |
| 401 // Start the pipeline immediately if we pass (or bypass) the engagement check, |
| 402 // or if the feature to run the installability check on page load is enabled. |
| 398 if (has_sufficient_engagement_ || | 403 if (has_sufficient_engagement_ || |
| 399 AppBannerSettingsHelper::HasSufficientEngagement(0) || | |
| 400 base::FeatureList::IsEnabled( | 404 base::FeatureList::IsEnabled( |
| 401 features::kCheckInstallabilityForBannerOnLoad)) { | 405 features::kCheckInstallabilityForBannerOnLoad)) { |
| 402 RequestAppBanner(validated_url, false /* is_debug_mode */); | 406 RequestAppBanner(validated_url, false /* is_debug_mode */); |
| 403 } | 407 } |
| 404 } | 408 } |
| 405 | 409 |
| 406 void AppBannerManager::MediaStartedPlaying(const MediaPlayerInfo& media_info, | 410 void AppBannerManager::MediaStartedPlaying(const MediaPlayerInfo& media_info, |
| 407 const MediaPlayerId& id) { | 411 const MediaPlayerId& id) { |
| 408 active_media_players_.push_back(id); | 412 active_media_players_.push_back(id); |
| 409 } | 413 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 if (is_pending_event()) { | 554 if (is_pending_event()) { |
| 551 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner. | 555 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner. |
| 552 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_); | 556 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_); |
| 553 } else { | 557 } else { |
| 554 // Log that the prompt request was made for when we get the prompt reply. | 558 // Log that the prompt request was made for when we get the prompt reply. |
| 555 page_requested_prompt_ = true; | 559 page_requested_prompt_ = true; |
| 556 } | 560 } |
| 557 } | 561 } |
| 558 | 562 |
| 559 } // namespace banners | 563 } // namespace banners |
| OLD | NEW |