OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/prefs/pref_change_registrar.h" | 10 #include "chrome/browser/prefs/pref_change_registrar.h" |
11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
12 | 12 |
13 class TabContents; | 13 class TabContents; |
14 typedef TabContents TabContentsWrapper; | |
15 | 14 |
16 namespace safe_browsing { | 15 namespace safe_browsing { |
17 | 16 |
18 class ClientSideDetectionHost; | 17 class ClientSideDetectionHost; |
19 | 18 |
20 // Per-tab class to handle safe-browsing functionality. | 19 // Per-tab class to handle safe-browsing functionality. |
21 class SafeBrowsingTabObserver : public content::NotificationObserver { | 20 class SafeBrowsingTabObserver : public content::NotificationObserver { |
22 public: | 21 public: |
23 explicit SafeBrowsingTabObserver(TabContentsWrapper* wrapper); | 22 explicit SafeBrowsingTabObserver(TabContents* tab_contents); |
24 virtual ~SafeBrowsingTabObserver(); | 23 virtual ~SafeBrowsingTabObserver(); |
25 | 24 |
26 private: | 25 private: |
27 // content::NotificationObserver overrides: | 26 // content::NotificationObserver overrides: |
28 virtual void Observe(int type, | 27 virtual void Observe(int type, |
29 const content::NotificationSource& source, | 28 const content::NotificationSource& source, |
30 const content::NotificationDetails& details) OVERRIDE; | 29 const content::NotificationDetails& details) OVERRIDE; |
31 | 30 |
32 // Internal helpers ---------------------------------------------------------- | 31 // Internal helpers ---------------------------------------------------------- |
33 | 32 |
34 // Create or destroy SafebrowsingDetectionHost as needed if the user's | 33 // Create or destroy SafebrowsingDetectionHost as needed if the user's |
35 // safe browsing preference has changed. | 34 // safe browsing preference has changed. |
36 void UpdateSafebrowsingDetectionHost(); | 35 void UpdateSafebrowsingDetectionHost(); |
37 | 36 |
38 // Handles IPCs. | 37 // Handles IPCs. |
39 scoped_ptr<ClientSideDetectionHost> safebrowsing_detection_host_; | 38 scoped_ptr<ClientSideDetectionHost> safebrowsing_detection_host_; |
40 | 39 |
41 // Our owning TabContentsWrapper. | 40 // Our owning TabContents. |
42 TabContentsWrapper* wrapper_; | 41 TabContents* tab_contents_; |
43 | 42 |
44 PrefChangeRegistrar pref_change_registrar_; | 43 PrefChangeRegistrar pref_change_registrar_; |
45 | 44 |
46 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingTabObserver); | 45 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingTabObserver); |
47 }; | 46 }; |
48 | 47 |
49 } // namespace safe_browsing | 48 } // namespace safe_browsing |
50 | 49 |
51 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_ | 50 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_ |
OLD | NEW |