Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / safe_browsing / safe_browsing_tab_observer.h
blob8047189fedd1a3a724f77660bcb7af1fbf4432f1
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/prefs/pref_change_registrar.h"
10 #include "content/public/browser/web_contents_user_data.h"
12 namespace content {
13 class WebContents;
16 namespace safe_browsing {
18 class ClientSideDetectionHost;
20 // Per-tab class to handle safe-browsing functionality.
21 class SafeBrowsingTabObserver
22 : public content::WebContentsUserData<SafeBrowsingTabObserver> {
23 public:
24 ~SafeBrowsingTabObserver() override;
26 // Forward to detection host, if safe-browsing is enabled.
27 bool DidPageReceiveSafeBrowsingMatch() const;
29 private:
30 explicit SafeBrowsingTabObserver(content::WebContents* web_contents);
31 friend class content::WebContentsUserData<SafeBrowsingTabObserver>;
33 // Internal helpers ----------------------------------------------------------
35 // Create or destroy SafebrowsingDetectionHost as needed if the user's
36 // safe browsing preference has changed.
37 void UpdateSafebrowsingDetectionHost();
39 // Handles IPCs.
40 scoped_ptr<ClientSideDetectionHost> safebrowsing_detection_host_;
42 // Our owning WebContents.
43 content::WebContents* web_contents_;
45 PrefChangeRegistrar pref_change_registrar_;
47 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingTabObserver);
50 } // namespace safe_browsing
52 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_