| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 | 356 |
| 357 void AppBannerManager::DidFinishLoad( | 357 void AppBannerManager::DidFinishLoad( |
| 358 content::RenderFrameHost* render_frame_host, | 358 content::RenderFrameHost* render_frame_host, |
| 359 const GURL& validated_url) { | 359 const GURL& validated_url) { |
| 360 // Don't start the banner flow unless the main frame has finished loading. | 360 // Don't start the banner flow unless the main frame has finished loading. |
| 361 if (render_frame_host->GetParent()) | 361 if (render_frame_host->GetParent()) |
| 362 return; | 362 return; |
| 363 | 363 |
| 364 load_finished_ = true; | 364 load_finished_ = true; |
| 365 validated_url_ = validated_url; | 365 validated_url_ = validated_url; |
| 366 // Start the pipeline immediately if we aren't using engagement, or if 0 |
| 367 // engagement is required. |
| 366 if (!AppBannerSettingsHelper::ShouldUseSiteEngagementScore() || | 368 if (!AppBannerSettingsHelper::ShouldUseSiteEngagementScore() || |
| 367 banner_request_queued_) { | 369 banner_request_queued_ || |
| 370 AppBannerSettingsHelper::HasSufficientEngagement(0)) { |
| 371 SiteEngagementObserver::Observe(nullptr); |
| 368 banner_request_queued_ = false; | 372 banner_request_queued_ = false; |
| 369 | 373 |
| 370 RequestAppBanner(validated_url, false /* is_debug_mode */); | 374 RequestAppBanner(validated_url, false /* is_debug_mode */); |
| 371 } | 375 } |
| 372 } | 376 } |
| 373 | 377 |
| 374 void AppBannerManager::MediaStartedPlaying(const MediaPlayerId& id) { | 378 void AppBannerManager::MediaStartedPlaying(const MediaPlayerId& id) { |
| 375 active_media_players_.push_back(id); | 379 active_media_players_.push_back(id); |
| 376 } | 380 } |
| 377 | 381 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 // Don't reset |was_canceled_by_page_| yet for metrics purposes. | 512 // Don't reset |was_canceled_by_page_| yet for metrics purposes. |
| 509 OnBannerPromptReply(render_frame_host, request_id, | 513 OnBannerPromptReply(render_frame_host, request_id, |
| 510 blink::WebAppBannerPromptReply::None, referrer_); | 514 blink::WebAppBannerPromptReply::None, referrer_); |
| 511 } else { | 515 } else { |
| 512 // Log that the prompt request was made for when we get the prompt reply. | 516 // Log that the prompt request was made for when we get the prompt reply. |
| 513 page_requested_prompt_ = true; | 517 page_requested_prompt_ = true; |
| 514 } | 518 } |
| 515 } | 519 } |
| 516 | 520 |
| 517 } // namespace banners | 521 } // namespace banners |
| OLD | NEW |