| Index: chrome/browser/safe_browsing/safe_browsing_blocking_page.h
|
| diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h
|
| index 93ce1114be7947a456641d41fc9891a383b66ba4..5967954de49e7bb0098e9acdc1fbb83beeaf0c2b 100644
|
| --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h
|
| +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h
|
| @@ -32,25 +32,18 @@
|
| #include <string>
|
| #include <vector>
|
|
|
| -#include <stdint.h>
|
| -
|
| #include "base/gtest_prod_util.h"
|
| #include "base/macros.h"
|
| #include "base/task/cancelable_task_tracker.h"
|
| -#include "chrome/browser/interstitials/chrome_metrics_helper.h"
|
| #include "chrome/browser/safe_browsing/ui_manager.h"
|
| -#include "components/security_interstitials/content/security_interstitial_page.h"
|
| -#include "components/security_interstitials/core/safe_browsing_error_ui.h"
|
| -#include "content/public/browser/interstitial_page_delegate.h"
|
| -#include "url/gurl.h"
|
| +#include "components/safe_browsing/base_safe_browsing_blocking_page.h"
|
|
|
| namespace safe_browsing {
|
|
|
| class SafeBrowsingBlockingPageFactory;
|
| class ThreatDetails;
|
|
|
| -class SafeBrowsingBlockingPage
|
| - : public security_interstitials::SecurityInterstitialPage {
|
| +class SafeBrowsingBlockingPage : public BaseSafeBrowsingBlockingPage {
|
| public:
|
| typedef security_interstitials::UnsafeResource UnsafeResource;
|
| typedef security_interstitials::SafeBrowsingErrorUI SafeBrowsingErrorUI;
|
| @@ -65,7 +58,7 @@ class SafeBrowsingBlockingPage
|
| // Creates a blocking page. Use ShowBlockingPage if you don't need to access
|
| // the blocking page directly.
|
| static SafeBrowsingBlockingPage* CreateBlockingPage(
|
| - SafeBrowsingUIManager* ui_manager,
|
| + BaseSafeBrowsingUIManager* ui_manager,
|
| content::WebContents* web_contents,
|
| const GURL& main_frame_url,
|
| const UnsafeResource& unsafe_resource);
|
| @@ -75,8 +68,8 @@ class SafeBrowsingBlockingPage
|
| // You can call this method several times, if an interstitial is already
|
| // showing, the new one will be queued and displayed if the user decides
|
| // to proceed on the currently showing interstitial.
|
| - static void ShowBlockingPage(
|
| - SafeBrowsingUIManager* ui_manager, const UnsafeResource& resource);
|
| + static void ShowBlockingPage(BaseSafeBrowsingUIManager* ui_manager,
|
| + const UnsafeResource& resource);
|
|
|
| // Makes the passed |factory| the factory used to instantiate
|
| // SafeBrowsingBlockingPage objects. Useful for tests.
|
| @@ -86,8 +79,6 @@ class SafeBrowsingBlockingPage
|
|
|
| // InterstitialPageDelegate method:
|
| void OnProceed() override;
|
| - void OnDontProceed() override;
|
| - void CommandReceived(const std::string& command) override;
|
| void OverrideRendererPrefs(content::RendererPreferences* prefs) override;
|
| content::InterstitialPageDelegate::TypeID GetTypeForTesting() const override;
|
|
|
| @@ -115,15 +106,12 @@ class SafeBrowsingBlockingPage
|
| void UpdateReportingPref(); // Used for the transition from old to new pref.
|
|
|
| // Don't instantiate this class directly, use ShowBlockingPage instead.
|
| - SafeBrowsingBlockingPage(SafeBrowsingUIManager* ui_manager,
|
| - content::WebContents* web_contents,
|
| - const GURL& main_frame_url,
|
| - const UnsafeResourceList& unsafe_resources);
|
| -
|
| - // SecurityInterstitialPage methods:
|
| - bool ShouldCreateNewNavigation() const override;
|
| - void PopulateInterstitialStrings(
|
| - base::DictionaryValue* load_time_data) override;
|
| + SafeBrowsingBlockingPage(
|
| + BaseSafeBrowsingUIManager* ui_manager,
|
| + content::WebContents* web_contents,
|
| + const GURL& main_frame_url,
|
| + const UnsafeResourceList& unsafe_resources,
|
| + SafeBrowsingErrorUI::SBErrorDisplayOptions* display_options);
|
|
|
| // After a safe browsing interstitial where the user opted-in to the
|
| // report but clicked "proceed anyway", we delay the call to
|
| @@ -135,65 +123,28 @@ class SafeBrowsingBlockingPage
|
| // pending threat details object, we look at the user's
|
| // preferences, and if the option to send threat details is
|
| // enabled, the report is scheduled to be sent on the |ui_manager_|.
|
| - void FinishThreatDetails(int64_t delay_ms, bool did_proceed, int num_visits);
|
| -
|
| - // A list of SafeBrowsingUIManager::UnsafeResource for a tab that the user
|
| - // should be warned about. They are queued when displaying more than one
|
| - // interstitial at a time.
|
| - static UnsafeResourceMap* GetUnsafeResourcesMap();
|
| -
|
| - // Returns true if the passed |unsafe_resources| is blocking the load of
|
| - // the main page.
|
| - static bool IsMainPageLoadBlocked(
|
| - const UnsafeResourceList& unsafe_resources);
|
| -
|
| - // For reporting back user actions.
|
| - SafeBrowsingUIManager* ui_manager_;
|
| -
|
| - // For displaying safe browsing interstitial.
|
| - std::unique_ptr<SafeBrowsingErrorUI> sb_error_ui_;
|
| -
|
| - // The URL of the main frame that caused the warning.
|
| - GURL main_frame_url_;
|
| -
|
| - // The index of a navigation entry that should be removed when DontProceed()
|
| - // is invoked, -1 if not entry should be removed.
|
| - int navigation_entry_index_to_remove_;
|
| -
|
| - // The list of unsafe resources this page is warning about.
|
| - UnsafeResourceList unsafe_resources_;
|
| + void FinishThreatDetails(int64_t delay_ms,
|
| + bool did_proceed,
|
| + int num_visits) override;
|
|
|
| // A ThreatDetails object that we start generating when the
|
| // blocking page is shown. The object will be sent when the warning
|
| // is gone (if the user enables the feature).
|
| scoped_refptr<ThreatDetails> threat_details_;
|
|
|
| - bool proceeded_;
|
| -
|
| - // Which type of Safe Browsing interstitial this is.
|
| - SafeBrowsingErrorUI::SBInterstitialReason interstitial_reason_;
|
| -
|
| // The factory used to instantiate SafeBrowsingBlockingPage objects.
|
| // Useful for tests, so they can provide their own implementation of
|
| // SafeBrowsingBlockingPage.
|
| static SafeBrowsingBlockingPageFactory* factory_;
|
|
|
| private:
|
| - static std::string GetMetricPrefix(
|
| - const UnsafeResourceList& unsafe_resources,
|
| - SafeBrowsingErrorUI::SBInterstitialReason interstitial_reason);
|
| - static std::string GetExtraMetricsSuffix(
|
| - const UnsafeResourceList& unsafe_resources);
|
| static std::string GetSamplingEventName(
|
| SafeBrowsingErrorUI::SBInterstitialReason interstitial_reason);
|
|
|
| - static SafeBrowsingErrorUI::SBInterstitialReason GetInterstitialReason(
|
| - const UnsafeResourceList& unsafe_resources);
|
| -
|
| - std::unique_ptr<security_interstitials::SecurityInterstitialControllerClient>
|
| - CreateControllerClient(
|
| - content::WebContents* web_contents,
|
| - const UnsafeResourceList& unsafe_resources);
|
| + static std::unique_ptr<
|
| + security_interstitials::SecurityInterstitialControllerClient>
|
| + CreateControllerClient(content::WebContents* web_contents,
|
| + const UnsafeResourceList& unsafe_resources);
|
|
|
| DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPage);
|
| };
|
| @@ -204,7 +155,7 @@ class SafeBrowsingBlockingPageFactory {
|
| virtual ~SafeBrowsingBlockingPageFactory() { }
|
|
|
| virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage(
|
| - SafeBrowsingUIManager* ui_manager,
|
| + BaseSafeBrowsingUIManager* ui_manager,
|
| content::WebContents* web_contents,
|
| const GURL& main_frame_url,
|
| const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0;
|
|
|