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

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

Issue 2478573004: Convert GURL::{host,path} to GURL::{host_piece,path_piece} for ==. (Closed)
Patch Set: rebase to #431874 Created 4 years, 1 month 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 | chrome/browser/chrome_content_browser_client.cc » ('j') | 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/callback.h" 10 #include "base/callback.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 void AppBannerManager::SetEngagementWeights(double direct_engagement, 74 void AppBannerManager::SetEngagementWeights(double direct_engagement,
75 double indirect_engagement) { 75 double indirect_engagement) {
76 AppBannerSettingsHelper::SetEngagementWeights(direct_engagement, 76 AppBannerSettingsHelper::SetEngagementWeights(direct_engagement,
77 indirect_engagement); 77 indirect_engagement);
78 } 78 }
79 79
80 // static 80 // static
81 bool AppBannerManager::URLsAreForTheSamePage(const GURL& first, 81 bool AppBannerManager::URLsAreForTheSamePage(const GURL& first,
82 const GURL& second) { 82 const GURL& second) {
83 return first.GetWithEmptyPath() == second.GetWithEmptyPath() && 83 return first.GetWithEmptyPath() == second.GetWithEmptyPath() &&
84 first.path() == second.path() && first.query() == second.query(); 84 first.path_piece() == second.path_piece() &&
85 first.query_piece() == second.query_piece();
85 } 86 }
86 87
87 void AppBannerManager::RequestAppBanner(const GURL& validated_url, 88 void AppBannerManager::RequestAppBanner(const GURL& validated_url,
88 bool is_debug_mode) { 89 bool is_debug_mode) {
89 // Don't start a redundant banner request. Otherwise, if one is running, 90 // Don't start a redundant banner request. Otherwise, if one is running,
90 // invalidate our weak pointers so it terminates. 91 // invalidate our weak pointers so it terminates.
91 content::WebContents* contents = web_contents(); 92 content::WebContents* contents = web_contents();
92 if (is_active_) { 93 if (is_active_) {
93 if (URLsAreForTheSamePage(validated_url, contents->GetLastCommittedURL())) 94 if (URLsAreForTheSamePage(validated_url, contents->GetLastCommittedURL()))
94 return; 95 return;
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner. 536 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner.
536 // Don't reset |was_canceled_by_page_| yet for metrics purposes. 537 // Don't reset |was_canceled_by_page_| yet for metrics purposes.
537 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_); 538 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_);
538 } else { 539 } else {
539 // 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.
540 page_requested_prompt_ = true; 541 page_requested_prompt_ = true;
541 } 542 }
542 } 543 }
543 544
544 } // namespace banners 545 } // namespace banners
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698