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

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

Issue 397853002: Refactor safe-browsing build-config definitions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup gn files Created 6 years, 5 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
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 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_ 6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/prefs/pref_change_registrar.h" 9 #include "base/prefs/pref_change_registrar.h"
10 #include "content/public/browser/web_contents_user_data.h" 10 #include "content/public/browser/web_contents_user_data.h"
11 11
12 namespace content { 12 namespace content {
13 class WebContents; 13 class WebContents;
14 } 14 }
15 15
16 namespace safe_browsing { 16 namespace safe_browsing {
17 17
18 class ClientSideDetectionHost; 18 class ClientSideDetectionHost;
19 19
20 // Per-tab class to handle safe-browsing functionality. 20 // Per-tab class to handle safe-browsing functionality.
21 class SafeBrowsingTabObserver 21 class SafeBrowsingTabObserver
22 : public content::WebContentsUserData<SafeBrowsingTabObserver> { 22 : public content::WebContentsUserData<SafeBrowsingTabObserver> {
23 public: 23 public:
24 virtual ~SafeBrowsingTabObserver(); 24 virtual ~SafeBrowsingTabObserver();
25 25
26 ClientSideDetectionHost* detection_host() { 26 // Forward to detection host, if safe-browsing is enabled.
27 return safebrowsing_detection_host_.get(); 27 bool DidPageReceiveSafeBrowsingMatch() const;
28 }
29
30 const ClientSideDetectionHost* detection_host() const {
31 return safebrowsing_detection_host_.get();
32 }
33 28
34 private: 29 private:
35 explicit SafeBrowsingTabObserver(content::WebContents* web_contents); 30 explicit SafeBrowsingTabObserver(content::WebContents* web_contents);
36 friend class content::WebContentsUserData<SafeBrowsingTabObserver>; 31 friend class content::WebContentsUserData<SafeBrowsingTabObserver>;
37 32
38 // Internal helpers ---------------------------------------------------------- 33 // Internal helpers ----------------------------------------------------------
39 34
40 // Create or destroy SafebrowsingDetectionHost as needed if the user's 35 // Create or destroy SafebrowsingDetectionHost as needed if the user's
41 // safe browsing preference has changed. 36 // safe browsing preference has changed.
42 void UpdateSafebrowsingDetectionHost(); 37 void UpdateSafebrowsingDetectionHost();
43 38
44 // Handles IPCs. 39 // Handles IPCs.
45 scoped_ptr<ClientSideDetectionHost> safebrowsing_detection_host_; 40 scoped_ptr<ClientSideDetectionHost> safebrowsing_detection_host_;
46 41
47 // Our owning WebContents. 42 // Our owning WebContents.
48 content::WebContents* web_contents_; 43 content::WebContents* web_contents_;
49 44
50 PrefChangeRegistrar pref_change_registrar_; 45 PrefChangeRegistrar pref_change_registrar_;
51 46
52 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingTabObserver); 47 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingTabObserver);
53 }; 48 };
54 49
55 } // namespace safe_browsing 50 } // namespace safe_browsing
56 51
57 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_ 52 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698