- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / safe_browsing / safe_browsing_tab_observer.h
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.
4
5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_
7
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"
11
12 namespace content {
13 class WebContents;
14 }
15
16 namespace safe_browsing {
17
18 class ClientSideDetectionHost;
19
20 // Per-tab class to handle safe-browsing functionality.
21 class SafeBrowsingTabObserver
22     : public content::WebContentsUserData<SafeBrowsingTabObserver> {
23  public:
24   virtual ~SafeBrowsingTabObserver();
25
26  private:
27   explicit SafeBrowsingTabObserver(content::WebContents* web_contents);
28   friend class content::WebContentsUserData<SafeBrowsingTabObserver>;
29
30   // Internal helpers ----------------------------------------------------------
31
32   // Create or destroy SafebrowsingDetectionHost as needed if the user's
33   // safe browsing preference has changed.
34   void UpdateSafebrowsingDetectionHost();
35
36   // Handles IPCs.
37   scoped_ptr<ClientSideDetectionHost> safebrowsing_detection_host_;
38
39   // Our owning WebContents.
40   content::WebContents* web_contents_;
41
42   PrefChangeRegistrar pref_change_registrar_;
43
44   DISALLOW_COPY_AND_ASSIGN(SafeBrowsingTabObserver);
45 };
46
47 }  // namespace safe_browsing
48
49 #endif  // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_