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

Side by Side Diff: chrome/browser/safe_browsing/client_side_detection_host.h

Issue 6014003: Intergration of the client-side phishing detection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove comment Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_HOST_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_HOST_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/gtest_prod_util.h"
Brian Ryner 2011/02/16 22:37:10 I don't think this one is needed anymore.
noelutz 2011/02/16 23:22:36 Done.
11 #include "base/ref_counted.h"
12 #include "base/scoped_callback_factory.h"
13 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
14 #include "chrome/browser/tab_contents/tab_contents_observer.h"
15 #include "googleurl/src/gurl.h"
16
17 class TabContents;
18
19 namespace safe_browsing {
20
21 class ClientSideDetectionService;
22
23 // This class is used to receive the IPC from the renderer which
24 // notifies the browser that a URL was classified as phishing. This
25 // class relays this information to the client-side detection service
26 // class which sends a ping to a server to validate the verdict.
27 // TODO(noelutz): move all client-side detection IPCs to this class.
28 class ClientSideDetectionHost : public TabContentsObserver {
29 public:
30 // The caller keeps ownership of the tab object and is responsible for
31 // ensuring that it stays valid for the entire lifetime of this object.
32 explicit ClientSideDetectionHost(TabContents* tab);
33 virtual ~ClientSideDetectionHost();
34
35 // From TabContentsObserver.
36 virtual bool OnMessageReceived(const IPC::Message& message);
37
38 // From TabContentsObserver. If we navigate away we cancel all pending
39 // callbacks that could show an interstitial.
40 virtual void DidNavigateMainFramePostCommit(
41 const NavigationController::LoadCommittedDetails& details,
42 const ViewHostMsg_FrameNavigate_Params& params);
43
44 private:
45 friend class ClientSideDetectionHostTest;
46
47 void OnDetectedPhishingSite(const GURL& phishing_url, double phishing_score);
48
49 // Callback that is called when the server ping back is
50 // done. Display an interstitial if |is_phishing| is true.
51 // Otherwise, we do nothgin. Called in UI thread.
52 void MaybeShowPhishingWarning(GURL phishing_url, bool is_phishing);
53
54 // Used for testing. This function does not take ownership of the service
55 // class.
56 void set_client_side_detection_service(ClientSideDetectionService* service);
57
58 // Used for testing. This function does not take ownership of the service
59 // class.
60 void set_safe_browsing_service(SafeBrowsingService* service);
61
62 // We are not responsible for deleting these objects. The tab contents as
63 // well as the service object outlive this object.
64 TabContents* tab_;
65 // This pointer may be NULL if client-side phishing detection is disabled.
66 ClientSideDetectionService* service_;
67 // This pointer may be NULL if SafeBrowsing is disabled.
68 scoped_refptr<SafeBrowsingService> sb_service_;
69
70 base::ScopedCallbackFactory<ClientSideDetectionHost> cb_factory_;
71
72 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionHost);
73 };
74
75 } // namespace safe_browsing
76
77 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698