Commit e4099e3d authored by gambard's avatar gambard Committed by Commit Bot

Reading List opening doesn't count for MostVisited

When the user opens a Reading List page, it should not be taken into
account for the computation of the Most Visited tiles.

Bug: 734067
Change-Id: Iec28e8086051777ab4c43a2e53778c7bab3d54b1
Reviewed-on: https://chromium-review.googlesource.com/596367
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarEric Noyau <noyau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491689}
parent bf4bb81b
......@@ -40,6 +40,7 @@ source_set("content_suggestions") {
"//ios/chrome/browser/ntp_snippets",
"//ios/chrome/browser/ntp_tiles",
"//ios/chrome/browser/reading_list",
"//ios/chrome/browser/tabs",
"//ios/chrome/browser/ui",
"//ios/chrome/browser/ui/alert_coordinator",
"//ios/chrome/browser/ui/collection_view/cells",
......
......@@ -10,7 +10,6 @@
#include "base/metrics/user_metrics_action.h"
#include "base/strings/sys_string_conversions.h"
#include "components/ntp_snippets/content_suggestions_service.h"
#include "components/ntp_snippets/ntp_snippets_constants.h"
#include "components/ntp_snippets/remote/remote_suggestions_scheduler.h"
#include "components/ntp_tiles/metrics.h"
#include "components/ntp_tiles/most_visited_sites.h"
......@@ -28,6 +27,7 @@
#include "ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory.h"
#include "ios/chrome/browser/ntp_tiles/ios_most_visited_sites_factory.h"
#include "ios/chrome/browser/reading_list/reading_list_model_factory.h"
#include "ios/chrome/browser/tabs/tab_constants.h"
#import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h"
#import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
#import "ios/chrome/browser/ui/commands/browser_commands.h"
......@@ -196,7 +196,7 @@ const char kNTPHelpURL[] = "https://support.google.com/chrome/?p=new_tab";
// Use a referrer with a specific URL to mark this entry as coming from
// ContentSuggestions.
web::Referrer referrer;
referrer.url = GURL(ntp_snippets::kContentSuggestionsApiScope);
referrer.url = GURL(tab_constants::kDoNotConsiderForMostVisited);
[self.URLLoader loadURL:suggestionItem.URL
referrer:referrer
......
......@@ -6,6 +6,7 @@ source_set("tabs") {
sources = [
"legacy_tab_helper.h",
"tab.h",
"tab_constants.h",
"tab_delegate.h",
"tab_dialog_delegate.h",
"tab_headers_delegate.h",
......@@ -39,6 +40,7 @@ source_set("tabs_internal") {
"legacy_tab_helper.mm",
"tab.h",
"tab.mm",
"tab_constants.cc",
"tab_helper_util.mm",
"tab_model.mm",
"tab_model_closing_web_state_observer.h",
......
......@@ -73,6 +73,7 @@
#import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h"
#import "ios/chrome/browser/snapshots/web_controller_snapshot_helper.h"
#import "ios/chrome/browser/tabs/legacy_tab_helper.h"
#include "ios/chrome/browser/tabs/tab_constants.h"
#import "ios/chrome/browser/tabs/tab_delegate.h"
#import "ios/chrome/browser/tabs/tab_dialog_delegate.h"
#import "ios/chrome/browser/tabs/tab_headers_delegate.h"
......@@ -163,10 +164,6 @@ class TabInfoBarObserver;
const char kRendererTerminationStateHistogram[] =
"Tab.StateAtRendererTermination";
// Referrer used for clicks on article suggestions on the NTP.
const char kChromeContentSuggestionsReferrer[] =
"https://www.googleapis.com/auth/chrome-content-suggestions";
// Enum corresponding to UMA's TabForegroundState, for
// Tab.StateAtRendererTermination. Must be kept in sync with the UMA enum.
enum class RendererTerminationTabState {
......@@ -882,7 +879,7 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
// Clicks on content suggestions on the NTP should not contribute to the
// Most Visited tiles in the NTP.
const bool considerForNTPMostVisited =
referrer.url != GURL(kChromeContentSuggestionsReferrer);
referrer.url != GURL(tab_constants::kDoNotConsiderForMostVisited);
history::HistoryAddPageArgs args(
url, item->GetTimestamp(), &_tabHistoryContext, item->GetUniqueID(),
referrer.url, redirects, item->GetTransitionType(),
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ios/chrome/browser/tabs/tab_constants.h"
namespace tab_constants {
const char kDoNotConsiderForMostVisited[] =
"chrome://do_not_consider_for_most_visited";
}
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_TABS_TAB_CONSTANTS_H_
#define IOS_CHROME_BROWSER_TABS_TAB_CONSTANTS_H_
namespace tab_constants {
// URL used in referrer to signal that the navigation should not be taken into
// consideration when computing the Most Visited sites.
extern const char kDoNotConsiderForMostVisited[];
} // namespace tab_constants
#endif // IOS_CHROME_BROWSER_TABS_TAB_CONSTANTS_H_
......@@ -34,6 +34,7 @@ source_set("reading_list") {
"//ios/chrome/browser/favicon",
"//ios/chrome/browser/feature_engagement",
"//ios/chrome/browser/reading_list",
"//ios/chrome/browser/tabs",
"//ios/chrome/browser/ui",
"//ios/chrome/browser/ui/alert_coordinator",
"//ios/chrome/browser/ui/favicon",
......
......@@ -18,6 +18,7 @@
#include "ios/chrome/browser/reading_list/reading_list_download_service.h"
#include "ios/chrome/browser/reading_list/reading_list_download_service_factory.h"
#include "ios/chrome/browser/reading_list/reading_list_model_factory.h"
#include "ios/chrome/browser/tabs/tab_constants.h"
#import "ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator.h"
#import "ios/chrome/browser/ui/reading_list/reading_list_collection_view_item.h"
#import "ios/chrome/browser/ui/reading_list/reading_list_mediator.h"
......@@ -251,8 +252,13 @@ readingListCollectionViewController:
[readingListCollectionViewController willBeDismissed];
// Use a referrer with a specific URL to signal that this entry should not be
// taken into account for the Most Visited tiles.
web::Referrer referrer;
referrer.url = GURL(tab_constants::kDoNotConsiderForMostVisited);
[self.URLLoader loadURL:entry->URL()
referrer:web::Referrer()
referrer:referrer
transition:ui::PAGE_TRANSITION_AUTO_BOOKMARK
rendererInitiated:NO];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment