| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 // Don't start the banner flow unless the main frame has finished loading. | 421 // Don't start the banner flow unless the main frame has finished loading. |
| 422 if (render_frame_host->GetParent()) | 422 if (render_frame_host->GetParent()) |
| 423 return; | 423 return; |
| 424 | 424 |
| 425 load_finished_ = true; | 425 load_finished_ = true; |
| 426 validated_url_ = validated_url; | 426 validated_url_ = validated_url; |
| 427 | 427 |
| 428 // If the bypass flag is on, or if we require no engagement to trigger the | 428 // If the bypass flag is on, or if we require no engagement to trigger the |
| 429 // banner, the rest of the banner pipeline should operate as if the engagement | 429 // banner, the rest of the banner pipeline should operate as if the engagement |
| 430 // threshold has been met. | 430 // threshold has been met. |
| 431 if (AppBannerSettingsHelper::HasSufficientEngagement(0)) | 431 // Additionally, if the page already has enough engagement, trigger the |
| 432 // pipeline immediately. |
| 433 if (AppBannerSettingsHelper::HasSufficientEngagement(0) || |
| 434 AppBannerSettingsHelper::HasSufficientEngagement( |
| 435 GetSiteEngagementService()->GetScore(validated_url))) { |
| 432 has_sufficient_engagement_ = true; | 436 has_sufficient_engagement_ = true; |
| 437 } |
| 433 | 438 |
| 434 // Start the pipeline immediately if we pass (or bypass) the engagement check, | 439 // Start the pipeline immediately if we pass (or bypass) the engagement check, |
| 435 // or if the feature to run the installability check on page load is enabled. | 440 // or if the feature to run the installability check on page load is enabled. |
| 436 if (has_sufficient_engagement_ || | 441 if (has_sufficient_engagement_ || |
| 437 base::FeatureList::IsEnabled( | 442 base::FeatureList::IsEnabled( |
| 438 features::kCheckInstallabilityForBannerOnLoad)) { | 443 features::kCheckInstallabilityForBannerOnLoad)) { |
| 439 RequestAppBanner(validated_url, false /* is_debug_mode */); | 444 RequestAppBanner(validated_url, false /* is_debug_mode */); |
| 440 } | 445 } |
| 441 } | 446 } |
| 442 | 447 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 if (is_pending_event()) { | 592 if (is_pending_event()) { |
| 588 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner. | 593 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner. |
| 589 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_); | 594 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_); |
| 590 } else { | 595 } else { |
| 591 // Log that the prompt request was made for when we get the prompt reply. | 596 // Log that the prompt request was made for when we get the prompt reply. |
| 592 page_requested_prompt_ = true; | 597 page_requested_prompt_ = true; |
| 593 } | 598 } |
| 594 } | 599 } |
| 595 | 600 |
| 596 } // namespace banners | 601 } // namespace banners |
| OLD | NEW |