Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // The Safe Browsing service is responsible for downloading anti-phishing and | 5 // The Safe Browsing service is responsible for downloading anti-phishing and |
| 6 // anti-malware tables and checking urls against them. | 6 // anti-malware tables and checking urls against them. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ | 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ |
| 9 #define CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ | 9 #define CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "chrome/browser/safe_browsing/hit_report.h" | 19 #include "chrome/browser/safe_browsing/hit_report.h" |
| 20 #include "chrome/browser/safe_browsing/safe_browsing_util.h" | 20 #include "chrome/browser/safe_browsing/safe_browsing_util.h" |
| 21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 22 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 23 | 23 |
| 24 namespace base { | 24 namespace base { |
| 25 class Thread; | 25 class Thread; |
| 26 } // namespace base | 26 } // namespace base |
| 27 | 27 |
| 28 namespace content { | |
| 29 class NavigationEntry; | |
| 30 } // namespace content | |
| 31 | |
| 28 namespace net { | 32 namespace net { |
| 29 class SSLInfo; | 33 class SSLInfo; |
| 30 } // namespace net | 34 } // namespace net |
| 31 | 35 |
| 32 namespace safe_browsing { | 36 namespace safe_browsing { |
| 33 | 37 |
| 34 class SafeBrowsingService; | 38 class SafeBrowsingService; |
| 35 | 39 |
| 36 // Construction needs to happen on the main thread. | 40 // Construction needs to happen on the main thread. |
| 37 class SafeBrowsingUIManager | 41 class SafeBrowsingUIManager |
| 38 : public base::RefCountedThreadSafe<SafeBrowsingUIManager> { | 42 : public base::RefCountedThreadSafe<SafeBrowsingUIManager> { |
| 39 public: | 43 public: |
| 40 // Passed a boolean indicating whether or not it is OK to proceed with | 44 // Passed a boolean indicating whether or not it is OK to proceed with |
| 41 // loading an URL. | 45 // loading an URL. |
| 42 typedef base::Callback<void(bool /*proceed*/)> UrlCheckCallback; | 46 typedef base::Callback<void(bool /*proceed*/)> UrlCheckCallback; |
| 43 | 47 |
| 44 // Structure used to pass parameters between the IO and UI thread when | 48 // Structure used to pass parameters between the IO and UI thread when |
| 45 // interacting with the blocking page. | 49 // interacting with the blocking page. |
| 46 struct UnsafeResource { | 50 struct UnsafeResource { |
| 47 UnsafeResource(); | 51 UnsafeResource(); |
| 48 ~UnsafeResource(); | 52 ~UnsafeResource(); |
| 49 | 53 |
| 54 // Returns true if this UnsafeResource is a main frame load that was blocked | |
| 55 // while the navigation is still pending. Note that a main frame hit may not | |
| 56 // be blocking, eg. client side detection happens after the load is | |
| 57 // committed. | |
| 50 bool IsMainPageLoadBlocked() const; | 58 bool IsMainPageLoadBlocked() const; |
| 51 | 59 |
| 60 // Returns the NavigationEntry for this resource (for a main frame hit) or | |
| 61 // for the page which contains this resource (for a subresource hit). | |
| 62 // This method must not be used if any navigations have occured since the | |
|
Charlie Reis
2015/12/17 19:24:18
nit: occurred
mattm
2015/12/18 21:41:04
Done.
| |
| 63 // hit (eg, it should only be used while the interstitial is showing, or | |
|
Charlie Reis
2015/12/17 19:24:18
nit: Are there any other cases it could be used?
mattm
2015/12/18 21:41:04
Clarified.
| |
| 64 // during the OnSafeBrowsingHit observer.) | |
| 65 // Return value may be NULL. | |
| 66 content::NavigationEntry* GetNavigationEntryForResource() const; | |
| 67 | |
| 52 GURL url; | 68 GURL url; |
| 53 GURL original_url; | 69 GURL original_url; |
| 54 std::vector<GURL> redirect_urls; | 70 std::vector<GURL> redirect_urls; |
| 55 bool is_subresource; | 71 bool is_subresource; |
| 56 bool is_subframe; | 72 bool is_subframe; |
| 57 SBThreatType threat_type; | 73 SBThreatType threat_type; |
| 58 std::string threat_metadata; | 74 std::string threat_metadata; |
| 59 UrlCheckCallback callback; // This is called back on |callback_thread|. | 75 UrlCheckCallback callback; // This is called back on |callback_thread|. |
| 60 scoped_refptr<base::SingleThreadTaskRunner> callback_thread; | 76 scoped_refptr<base::SingleThreadTaskRunner> callback_thread; |
| 61 int render_process_host_id; | 77 int render_process_host_id; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 scoped_refptr<SafeBrowsingService> sb_service_; | 168 scoped_refptr<SafeBrowsingService> sb_service_; |
| 153 | 169 |
| 154 base::ObserverList<Observer> observer_list_; | 170 base::ObserverList<Observer> observer_list_; |
| 155 | 171 |
| 156 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); | 172 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); |
| 157 }; | 173 }; |
| 158 | 174 |
| 159 } // namespace safe_browsing | 175 } // namespace safe_browsing |
| 160 | 176 |
| 161 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ | 177 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ |
| OLD | NEW |