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

Unified Diff: components/safe_browsing/base_ui_manager.h

Issue 2623733002: Componentize SafeBrowsingBlockingPage for WebView use (Closed)
Patch Set: address comments from ntfischer Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: components/safe_browsing/base_ui_manager.h
diff --git a/components/safe_browsing/base_ui_manager.h b/components/safe_browsing/base_ui_manager.h
index 2c56060ac4b3472c085ac5296573574261371c14..43429c82250fd0ecf55afa0755723a230418132f 100644
--- a/components/safe_browsing/base_ui_manager.h
+++ b/components/safe_browsing/base_ui_manager.h
@@ -9,11 +9,8 @@
#include <vector>
#include "base/bind_helpers.h"
-#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/observer_list.h"
-#include "base/supports_user_data.h"
#include "base/time/time.h"
#include "components/security_interstitials/content/unsafe_resource.h"
@@ -24,6 +21,10 @@ class NavigationEntry;
class WebContents;
} // namespace content
+namespace history {
+class HistoryService;
+} // namespace history
+
namespace safe_browsing {
// Construction needs to happen on the main thread.
@@ -32,24 +33,6 @@ class BaseSafeBrowsingUIManager
public:
typedef security_interstitials::UnsafeResource UnsafeResource;
- // Observer class can be used to get notified when a SafeBrowsing hit
- // was found.
- class Observer {
- public:
- // The |resource| was classified as unsafe by SafeBrowsing, and is
- // not whitelisted.
- // The |resource| must not be accessed after OnSafeBrowsingHit returns.
- // This method will be called on the UI thread.
- virtual void OnSafeBrowsingHit(const UnsafeResource& resource) = 0;
-
- protected:
- Observer() {}
- virtual ~Observer() {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Observer);
- };
-
BaseSafeBrowsingUIManager();
// Called to stop or shutdown operations on the io_thread. This may be called
@@ -116,9 +99,14 @@ class BaseSafeBrowsingUIManager
content::WebContents* web_contents,
const GURL& main_frame_url);
- // Add and remove observers. These methods must be invoked on the UI thread.
- virtual void AddObserver(Observer* observer);
- virtual void RemoveObserver(Observer* remove);
+ virtual const std::string app_locale();
meacer 2017/01/10 21:18:21 const method
Jialiu Lin 2017/01/11 00:50:06 Done.
+
+ virtual history::HistoryService* history_service(
+ content::WebContents* web_contents);
+
+ // The default safe page when there is no entry in the history to go back to.
+ // e.g. about::blank page, or chrome's new tab page.
+ virtual const GURL default_safe_page();
meacer 2017/01/10 21:18:21 const method
Jialiu Lin 2017/01/11 00:50:06 Done.
protected:
virtual ~BaseSafeBrowsingUIManager();
@@ -141,7 +129,10 @@ class BaseSafeBrowsingUIManager
// Ensures that |web_contents| has its whitelist set in its userdata
static void EnsureWhitelistCreated(content::WebContents* web_contents);
- base::ObserverList<Observer> observer_list_;
+ // Returns the URL that should be used in a WhitelistUrlSet for the given
+ // |resource|.
+ static GURL GetMainFrameWhitelistUrlForResource(
+ const security_interstitials::UnsafeResource& resource);
private:
friend class base::RefCountedThreadSafe<BaseSafeBrowsingUIManager>;

Powered by Google App Engine
This is Rietveld 408576698