Commit d9bca519 authored by Livvie Lin's avatar Livvie Lin Committed by Commit Bot

Rename LookalikeUrlInterstitialPage to LookalikeUrlBlockingPage

Match the naming convention of SSL blocking pages for consistency.

Design doc: go/security-interstitial-cleanup

Bug: 1042467
Change-Id: Ie6f26e8f5494bfcbdc3cd7a76e99dbd967f74dc4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2076759Reviewed-by: default avatarJoe DeBlasio <jdeblasio@chromium.org>
Reviewed-by: default avatarMustafa Emre Acer <meacer@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Commit-Queue: Livvie Lin <livvielin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746260}
parent 7dc570ba
......@@ -653,10 +653,10 @@ jumbo_static_library("browser") {
"local_search_service/local_search_service_proxy.h",
"local_search_service/local_search_service_proxy_factory.cc",
"local_search_service/local_search_service_proxy_factory.h",
"lookalikes/lookalike_url_blocking_page.cc",
"lookalikes/lookalike_url_blocking_page.h",
"lookalikes/lookalike_url_controller_client.cc",
"lookalikes/lookalike_url_controller_client.h",
"lookalikes/lookalike_url_interstitial_page.cc",
"lookalikes/lookalike_url_interstitial_page.h",
"lookalikes/lookalike_url_navigation_throttle.cc",
"lookalikes/lookalike_url_navigation_throttle.h",
"lookalikes/lookalike_url_service.cc",
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/lookalikes/lookalike_url_interstitial_page.h"
#include "chrome/browser/lookalikes/lookalike_url_blocking_page.h"
#include <utility>
......@@ -23,10 +23,10 @@ using security_interstitials::MetricsHelper;
// static
const content::InterstitialPageDelegate::TypeID
LookalikeUrlInterstitialPage::kTypeForTesting =
&LookalikeUrlInterstitialPage::kTypeForTesting;
LookalikeUrlBlockingPage::kTypeForTesting =
&LookalikeUrlBlockingPage::kTypeForTesting;
LookalikeUrlInterstitialPage::LookalikeUrlInterstitialPage(
LookalikeUrlBlockingPage::LookalikeUrlBlockingPage(
content::WebContents* web_contents,
const GURL& request_url,
ukm::SourceId source_id,
......@@ -45,9 +45,9 @@ LookalikeUrlInterstitialPage::LookalikeUrlInterstitialPage(
MetricsHelper::TOTAL_VISITS);
}
LookalikeUrlInterstitialPage::~LookalikeUrlInterstitialPage() {}
LookalikeUrlBlockingPage::~LookalikeUrlBlockingPage() {}
void LookalikeUrlInterstitialPage::ReportUkmIfNeeded(UserAction action) {
void LookalikeUrlBlockingPage::ReportUkmIfNeeded(UserAction action) {
// We rely on the saved SourceId because deconstruction happens after the next
// navigation occurs, so web contents points to the new destination.
if (source_id_ != ukm::kInvalidSourceId) {
......@@ -57,10 +57,10 @@ void LookalikeUrlInterstitialPage::ReportUkmIfNeeded(UserAction action) {
}
// static
void LookalikeUrlInterstitialPage::RecordUkmEvent(
void LookalikeUrlBlockingPage::RecordUkmEvent(
ukm::SourceId source_id,
LookalikeUrlInterstitialPage::MatchType match_type,
LookalikeUrlInterstitialPage::UserAction user_action) {
LookalikeUrlBlockingPage::MatchType match_type,
LookalikeUrlBlockingPage::UserAction user_action) {
ukm::UkmRecorder* ukm_recorder = ukm::UkmRecorder::Get();
CHECK(ukm_recorder);
......@@ -71,15 +71,15 @@ void LookalikeUrlInterstitialPage::RecordUkmEvent(
}
content::InterstitialPageDelegate::TypeID
LookalikeUrlInterstitialPage::GetTypeForTesting() {
return LookalikeUrlInterstitialPage::kTypeForTesting;
LookalikeUrlBlockingPage::GetTypeForTesting() {
return LookalikeUrlBlockingPage::kTypeForTesting;
}
bool LookalikeUrlInterstitialPage::ShouldCreateNewNavigation() const {
bool LookalikeUrlBlockingPage::ShouldCreateNewNavigation() const {
return true;
}
void LookalikeUrlInterstitialPage::PopulateInterstitialStrings(
void LookalikeUrlBlockingPage::PopulateInterstitialStrings(
base::DictionaryValue* load_time_data) {
CHECK(load_time_data);
......@@ -103,16 +103,16 @@ void LookalikeUrlInterstitialPage::PopulateInterstitialStrings(
l10n_util::GetStringFUTF16(IDS_LOOKALIKE_URL_CONTINUE, hostname));
}
void LookalikeUrlInterstitialPage::OnInterstitialClosing() {
void LookalikeUrlBlockingPage::OnInterstitialClosing() {
ReportUkmIfNeeded(UserAction::kCloseOrBack);
}
bool LookalikeUrlInterstitialPage::ShouldDisplayURL() const {
bool LookalikeUrlBlockingPage::ShouldDisplayURL() const {
return false;
}
// This handles the commands sent from the interstitial JavaScript.
void LookalikeUrlInterstitialPage::CommandReceived(const std::string& command) {
void LookalikeUrlBlockingPage::CommandReceived(const std::string& command) {
if (command == "\"pageLoadComplete\"") {
// content::WaitForRenderFrameReady sends this message when the page
// load completes. Ignore it.
......@@ -158,11 +158,11 @@ void LookalikeUrlInterstitialPage::CommandReceived(const std::string& command) {
}
}
int LookalikeUrlInterstitialPage::GetHTMLTemplateId() {
int LookalikeUrlBlockingPage::GetHTMLTemplateId() {
return IDR_SECURITY_INTERSTITIAL_HTML;
}
void LookalikeUrlInterstitialPage::PopulateStringsForSharedHTML(
void LookalikeUrlBlockingPage::PopulateStringsForSharedHTML(
base::DictionaryValue* load_time_data) {
load_time_data->SetBoolean("lookalike_url", true);
load_time_data->SetBoolean("overridable", false);
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_LOOKALIKES_LOOKALIKE_URL_INTERSTITIAL_PAGE_H_
#define CHROME_BROWSER_LOOKALIKES_LOOKALIKE_URL_INTERSTITIAL_PAGE_H_
#ifndef CHROME_BROWSER_LOOKALIKES_LOOKALIKE_URL_BLOCKING_PAGE_H_
#define CHROME_BROWSER_LOOKALIKES_LOOKALIKE_URL_BLOCKING_PAGE_H_
#include <memory>
#include <string>
......@@ -19,7 +19,7 @@ class GURL;
// This class is responsible for showing/hiding the interstitial page that
// occurs when a new domain is visited and it looks suspiciously like another
// more popular domain.
class LookalikeUrlInterstitialPage
class LookalikeUrlBlockingPage
: public security_interstitials::SecurityInterstitialPage {
public:
// Interstitial type, used in tests.
......@@ -50,7 +50,7 @@ class LookalikeUrlInterstitialPage
kMaxValue = kCloseOrBack,
};
LookalikeUrlInterstitialPage(
LookalikeUrlBlockingPage(
content::WebContents* web_contents,
const GURL& request_url,
ukm::SourceId source_id,
......@@ -59,7 +59,7 @@ class LookalikeUrlInterstitialPage
security_interstitials::SecurityInterstitialControllerClient>
controller);
~LookalikeUrlInterstitialPage() override;
~LookalikeUrlBlockingPage() override;
// InterstitialPageDelegate method:
InterstitialPageDelegate::TypeID GetTypeForTesting() override;
......@@ -93,7 +93,7 @@ class LookalikeUrlInterstitialPage
ukm::SourceId source_id_;
MatchType match_type_;
DISALLOW_COPY_AND_ASSIGN(LookalikeUrlInterstitialPage);
DISALLOW_COPY_AND_ASSIGN(LookalikeUrlBlockingPage);
};
#endif // CHROME_BROWSER_LOOKALIKES_LOOKALIKE_URL_INTERSTITIAL_PAGE_H_
#endif // CHROME_BROWSER_LOOKALIKES_LOOKALIKE_URL_BLOCKING_PAGE_H_
......@@ -17,8 +17,8 @@
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/engagement/site_engagement_service.h"
#include "chrome/browser/lookalikes/lookalike_url_blocking_page.h"
#include "chrome/browser/lookalikes/lookalike_url_controller_client.h"
#include "chrome/browser/lookalikes/lookalike_url_interstitial_page.h"
#include "chrome/browser/lookalikes/lookalike_url_service.h"
#include "chrome/browser/lookalikes/lookalike_url_tab_storage.h"
#include "chrome/browser/prerender/prerender_contents.h"
......@@ -36,8 +36,8 @@ namespace {
const base::FeatureParam<bool> kEnableInterstitialForTopSites{
&features::kLookalikeUrlNavigationSuggestionsUI, "topsites", true};
using MatchType = LookalikeUrlInterstitialPage::MatchType;
using UserAction = LookalikeUrlInterstitialPage::UserAction;
using MatchType = LookalikeUrlBlockingPage::MatchType;
using UserAction = LookalikeUrlBlockingPage::UserAction;
using url_formatter::TopDomainEntry;
typedef content::NavigationThrottle::ThrottleCheckResult ThrottleCheckResult;
......@@ -405,9 +405,9 @@ ThrottleCheckResult LookalikeUrlNavigationThrottle::ShowInterstitial(
auto controller = std::make_unique<LookalikeUrlControllerClient>(
web_contents, url, safe_url);
std::unique_ptr<LookalikeUrlInterstitialPage> blocking_page(
new LookalikeUrlInterstitialPage(web_contents, safe_url, source_id,
match_type, std::move(controller)));
std::unique_ptr<LookalikeUrlBlockingPage> blocking_page(
new LookalikeUrlBlockingPage(web_contents, safe_url, source_id,
match_type, std::move(controller)));
base::Optional<std::string> error_page_contents =
blocking_page->GetHTMLContents();
......@@ -609,8 +609,8 @@ ThrottleCheckResult LookalikeUrlNavigationThrottle::PerformChecks(
}
// Interstitial normally records UKM, but still record when it's not shown.
LookalikeUrlInterstitialPage::RecordUkmEvent(
source_id, match_type, UserAction::kInterstitialNotShown);
LookalikeUrlBlockingPage::RecordUkmEvent(source_id, match_type,
UserAction::kInterstitialNotShown);
return content::NavigationThrottle::PROCEED;
}
......@@ -11,7 +11,7 @@
#include "base/memory/weak_ptr.h"
#include "chrome/browser/engagement/site_engagement_details.mojom.h"
#include "chrome/browser/lookalikes/lookalike_url_interstitial_page.h"
#include "chrome/browser/lookalikes/lookalike_url_blocking_page.h"
#include "components/url_formatter/url_formatter.h"
#include "content/public/browser/navigation_throttle.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
......@@ -75,7 +75,7 @@ class LookalikeUrlNavigationThrottle : public content::NavigationThrottle {
MaybeCreateNavigationThrottle(content::NavigationHandle* navigation_handle);
static bool ShouldDisplayInterstitial(
LookalikeUrlInterstitialPage::MatchType match_type,
LookalikeUrlBlockingPage::MatchType match_type,
const DomainInfo& navigated_domain);
// Returns true if a domain is visually similar to the hostname of |url|. The
......@@ -87,7 +87,7 @@ class LookalikeUrlNavigationThrottle : public content::NavigationThrottle {
const DomainInfo& navigated_domain,
const std::vector<DomainInfo>& engaged_sites,
std::string* matched_domain,
LookalikeUrlInterstitialPage::MatchType* match_type);
LookalikeUrlBlockingPage::MatchType* match_type);
private:
FRIEND_TEST_ALL_PREFIXES(LookalikeUrlNavigationThrottleTest,
......@@ -116,7 +116,7 @@ class LookalikeUrlNavigationThrottle : public content::NavigationThrottle {
const GURL& safe_domain,
const GURL& url,
ukm::SourceId source_id,
LookalikeUrlInterstitialPage::MatchType match_type);
LookalikeUrlBlockingPage::MatchType match_type);
bool interstitials_enabled_;
......
......@@ -11,7 +11,7 @@
#include "chrome/browser/engagement/site_engagement_service.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/history/history_test_utils.h"
#include "chrome/browser/lookalikes/lookalike_url_interstitial_page.h"
#include "chrome/browser/lookalikes/lookalike_url_blocking_page.h"
#include "chrome/browser/lookalikes/lookalike_url_navigation_throttle.h"
#include "chrome/browser/lookalikes/lookalike_url_service.h"
#include "chrome/browser/ui/browser.h"
......@@ -38,8 +38,8 @@ using security_interstitials::MetricsHelper;
using security_interstitials::SecurityInterstitialCommand;
using UkmEntry = ukm::builders::LookalikeUrl_NavigationSuggestion;
using MatchType = LookalikeUrlInterstitialPage::MatchType;
using UserAction = LookalikeUrlInterstitialPage::UserAction;
using MatchType = LookalikeUrlBlockingPage::MatchType;
using UserAction = LookalikeUrlBlockingPage::UserAction;
enum class UIStatus {
// Enabled for all heuristics.
......@@ -127,7 +127,7 @@ void LoadAndCheckInterstitialAt(Browser* browser, const GURL& url) {
EXPECT_EQ(nullptr, GetCurrentInterstitial(web_contents));
NavigateToURLSync(browser, url);
EXPECT_EQ(LookalikeUrlInterstitialPage::kTypeForTesting,
EXPECT_EQ(LookalikeUrlBlockingPage::kTypeForTesting,
GetInterstitialType(web_contents));
EXPECT_FALSE(IsUrlShowing(browser));
}
......@@ -143,7 +143,7 @@ void SendInterstitialCommandSync(Browser* browser,
content::WebContents* web_contents =
browser->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(LookalikeUrlInterstitialPage::kTypeForTesting,
EXPECT_EQ(LookalikeUrlBlockingPage::kTypeForTesting,
GetInterstitialType(web_contents));
content::TestNavigationObserver navigation_observer(web_contents, 1);
......@@ -384,7 +384,7 @@ class LookalikeUrlNavigationThrottleBrowserTest
base::SimpleTestClock test_clock_;
};
class LookalikeUrlInterstitialPageBrowserTest
class LookalikeUrlBlockingPageBrowserTest
: public LookalikeUrlNavigationThrottleBrowserTest {
protected:
UIStatus ui_status() const override { return UIStatus::kEnabled; }
......@@ -912,7 +912,7 @@ IN_PROC_BROWSER_TEST_P(LookalikeUrlNavigationThrottleBrowserTest,
// Navigate to lookalike domains that redirect to benign domains and ensure that
// we display an interstitial along the way.
IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
IN_PROC_BROWSER_TEST_F(LookalikeUrlBlockingPageBrowserTest,
Interstitial_CapturesRedirects) {
{
// Verify it works when the lookalike domain is the first in the chain
......@@ -961,7 +961,7 @@ IN_PROC_BROWSER_TEST_P(LookalikeUrlNavigationThrottleBrowserTest,
// Verify that the user action in UKM is recorded even when we navigate away
// from the interstitial without interacting with it.
IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
IN_PROC_BROWSER_TEST_F(LookalikeUrlBlockingPageBrowserTest,
UkmRecordedAfterNavigateAway) {
const GURL navigated_url = GetURL("googlé.com");
const GURL subsequent_url = GetURL("example.com");
......@@ -973,7 +973,7 @@ IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
// Verify that the user action in UKM is recorded properly when the user accepts
// the navigation suggestion.
IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
IN_PROC_BROWSER_TEST_F(LookalikeUrlBlockingPageBrowserTest,
UkmRecordedAfterSuggestionAccepted) {
const GURL navigated_url = GetURL("googlé.com");
......@@ -985,7 +985,7 @@ IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
// Verify that the user action in UKM is recorded properly when the user ignores
// the navigation suggestion.
IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
IN_PROC_BROWSER_TEST_F(LookalikeUrlBlockingPageBrowserTest,
UkmRecordedAfterSuggestionIgnored) {
const GURL navigated_url = GetURL("googlé.com");
......@@ -996,7 +996,7 @@ IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
}
// Verify that the URL shows normally on pages after a lookalike interstitial.
IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
IN_PROC_BROWSER_TEST_F(LookalikeUrlBlockingPageBrowserTest,
UrlShownAfterInterstitial) {
LoadAndCheckInterstitialAt(browser(), GetURL("googlé.com"));
......@@ -1006,7 +1006,7 @@ IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
}
// Verify that bypassing warnings in the main profile does not affect incognito.
IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
IN_PROC_BROWSER_TEST_F(LookalikeUrlBlockingPageBrowserTest,
MainProfileDoesNotAffectIncognito) {
const GURL kNavigatedUrl = GetURL("googlé.com");
......@@ -1024,7 +1024,7 @@ IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
}
// Verify that bypassing warnings in incognito does not affect the main profile.
IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
IN_PROC_BROWSER_TEST_F(LookalikeUrlBlockingPageBrowserTest,
IncognitoDoesNotAffectMainProfile) {
const GURL kNavigatedUrl = GetURL("sité1.com");
const GURL kEngagedUrl = GetURL("site1.com");
......@@ -1046,7 +1046,7 @@ IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
// Verify reloading the page does not result in dismissing an interstitial.
// Regression test for crbug/941886.
IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
IN_PROC_BROWSER_TEST_F(LookalikeUrlBlockingPageBrowserTest,
RefreshDoesntDismiss) {
// Verify it works when the lookalike domain is the first in the chain.
const GURL kNavigatedUrl =
......@@ -1064,7 +1064,7 @@ IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB);
navigation_observer.Wait();
EXPECT_EQ(LookalikeUrlInterstitialPage::kTypeForTesting,
EXPECT_EQ(LookalikeUrlBlockingPage::kTypeForTesting,
GetInterstitialType(web_contents));
EXPECT_FALSE(IsUrlShowing(browser()));
}
......
......@@ -6,7 +6,7 @@
#include "base/metrics/field_trial_params.h"
#include "base/strings/string_split.h"
#include "chrome/browser/lookalikes/lookalike_url_interstitial_page.h"
#include "chrome/browser/lookalikes/lookalike_url_blocking_page.h"
#include "chrome/browser/lookalikes/lookalike_url_navigation_throttle.h"
#include "chrome/browser/lookalikes/lookalike_url_service.h"
#include "chrome/common/chrome_features.h"
......@@ -16,7 +16,7 @@
namespace {
using MatchType = LookalikeUrlInterstitialPage::MatchType;
using MatchType = LookalikeUrlBlockingPage::MatchType;
const base::FeatureParam<bool> kEnableLookalikeTopSites{
&security_state::features::kSafetyTipUI, "topsites", true};
......
......@@ -11,7 +11,7 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/singleton.h"
#include "chrome/browser/lookalikes/lookalike_url_interstitial_page.h"
#include "chrome/browser/lookalikes/lookalike_url_blocking_page.h"
#include "chrome/browser/lookalikes/lookalike_url_navigation_throttle.h"
#include "chrome/browser/lookalikes/lookalike_url_service.h"
#include "chrome/browser/profiles/incognito_helpers.h"
......
......@@ -12,8 +12,8 @@
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/lookalikes/lookalike_url_blocking_page.h"
#include "chrome/browser/lookalikes/lookalike_url_controller_client.h"
#include "chrome/browser/lookalikes/lookalike_url_interstitial_page.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
......@@ -258,14 +258,14 @@ std::unique_ptr<BadClockBlockingPage> CreateBadClockBlockingPage(
clock_state, nullptr);
}
std::unique_ptr<LookalikeUrlInterstitialPage> CreateLookalikeInterstitialPage(
std::unique_ptr<LookalikeUrlBlockingPage> CreateLookalikeInterstitialPage(
content::WebContents* web_contents) {
GURL request_url("https://example.net");
GURL safe_url("https://example.com");
return std::make_unique<LookalikeUrlInterstitialPage>(
return std::make_unique<LookalikeUrlBlockingPage>(
web_contents, safe_url, ukm::kInvalidSourceId,
LookalikeUrlInterstitialPage::MatchType::kNone,
LookalikeUrlBlockingPage::MatchType::kNone,
std::make_unique<LookalikeUrlControllerClient>(web_contents, request_url,
safe_url));
}
......
......@@ -4793,14 +4793,14 @@ be describing additional metrics about the same event.
<metric name="MatchType">
<summary>
An enum value representing the type of the match (popular domain, engaged
domain, etc.). The enum is defined in |LookalikeUrlInterstitialPage|.
domain, etc.). The enum is defined in |LookalikeUrlBlockingPage|.
</summary>
</metric>
<metric name="UserAction">
<summary>
An enum value representing the decision the user made when shown an
interstitial (ignored, suggestion_accepted, etc.). The enum is defined in
|LookalikeUrlInterstitialPage|.
|LookalikeUrlBlockingPage|.
</summary>
</metric>
</event>
......
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