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

Unified Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 6014003: Intergration of the client-side phishing detection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. Created 9 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: chrome/browser/tab_contents/tab_contents.cc
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index b73ef97f6fc17f709294ad75ade597e2cbf53bf3..09968b033c02d5419e9840f468ac86d05cde6cfa 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -63,6 +63,7 @@
#include "chrome/browser/renderer_host/site_instance.h"
#include "chrome/browser/renderer_host/web_cache_manager.h"
#include "chrome/browser/renderer_preferences_util.h"
+#include "chrome/browser/safe_browsing/client_side_detection_service.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_fetcher.h"
#include "chrome/browser/search_engines/template_url_fetcher_ui_callbacks.h"
@@ -3154,6 +3155,32 @@ void TabContents::UpdateContentRestrictions(int restrictions) {
delegate()->ContentRestrictionsChanged(this);
}
+void TabContents::DetectedPhishingSite(const GURL& phishing_url,
+ double phishing_score) {
+ // There is something seriously wrong if there is no service class but
+ // this method is called. The renderer should not start phishing detection
+ // if there isn't any service class in the browser.
Brian Ryner 2011/01/20 23:36:40 Checking this is still a good idea though, since w
noelutz 2011/02/10 01:16:23 Yeah. Good point.
+ safe_browsing::ClientSideDetectionService* service =
+ g_browser_process->safe_browsing_detection_service();
+ DCHECK(service);
+ if (service) {
+ // The client object will delete itself once nobody needs it anymore.
+ safe_browsing::CsdClient* client = new safe_browsing::CsdClient(
+ GetRenderProcessHost()->id(), render_view_host()->routing_id());
+
+ // If the user navigates away from the current page we want to know about it
+ // so that we won't show an interstitial. Note: we remove the client as an
+ // observer in MaybeShowPhishingInterstitial.
+ AddNavigationObserver(client);
+
+ service->SendClientReportPhishingRequest(
+ phishing_url,
+ phishing_score,
+ NewCallback(client,
+ &safe_browsing::CsdClient::MaybeShowPhishingInterstitial));
+ }
+}
+
void TabContents::BeforeUnloadFiredFromRenderManager(
bool proceed,
bool* proceed_to_fire_unload) {

Powered by Google App Engine
This is Rietveld 408576698