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

Side by Side Diff: chrome/browser/banners/app_banner_manager.cc

Issue 2833313002: Fix the ability to bypass app banner engagement checks. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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
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
395 // If the bypass flag is on, or if we require no engagement to trigger the
396 // banner, we can manually set |has_sufficient_engagement_| to true.
Matt Giuca 2017/04/24 03:34:30 Drop "we can". Also "set |has_sufficient_engageme
dominickn 2017/04/24 03:42:34 Done.
397 if (AppBannerSettingsHelper::HasSufficientEngagement(0))
398 has_sufficient_engagement_ = true;
399
394 // Start the pipeline immediately if: 400 // Start the pipeline immediately if:
395 // 1. we have sufficient engagement, or 401 // 1. we have sufficient engagement, or
Matt Giuca 2017/04/24 03:34:30 Change the 1., 2., 3. since it no longer correspon
dominickn 2017/04/24 03:42:34 Done.
396 // 2. 0 engagement is required, or 402 // 2. 0 engagement is required, or
397 // 3. the feature to start the installability check in load is enabled 403 // 3. the feature to start the installability check on page load is enabled.
398 if (has_sufficient_engagement_ || 404 if (has_sufficient_engagement_ ||
399 AppBannerSettingsHelper::HasSufficientEngagement(0) ||
400 base::FeatureList::IsEnabled( 405 base::FeatureList::IsEnabled(
401 features::kCheckInstallabilityForBannerOnLoad)) { 406 features::kCheckInstallabilityForBannerOnLoad)) {
402 RequestAppBanner(validated_url, false /* is_debug_mode */); 407 RequestAppBanner(validated_url, false /* is_debug_mode */);
403 } 408 }
404 } 409 }
405 410
406 void AppBannerManager::MediaStartedPlaying(const MediaPlayerInfo& media_info, 411 void AppBannerManager::MediaStartedPlaying(const MediaPlayerInfo& media_info,
407 const MediaPlayerId& id) { 412 const MediaPlayerId& id) {
408 active_media_players_.push_back(id); 413 active_media_players_.push_back(id);
409 } 414 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 if (is_pending_event()) { 555 if (is_pending_event()) {
551 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner. 556 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner.
552 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_); 557 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_);
553 } else { 558 } else {
554 // Log that the prompt request was made for when we get the prompt reply. 559 // Log that the prompt request was made for when we get the prompt reply.
555 page_requested_prompt_ = true; 560 page_requested_prompt_ = true;
556 } 561 }
557 } 562 }
558 563
559 } // namespace banners 564 } // namespace banners
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698