OLD | NEW |
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 <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "components/prefs/pref_change_registrar.h" | 11 #include "components/prefs/pref_change_registrar.h" |
11 #include "content/public/browser/web_contents_user_data.h" | 12 #include "content/public/browser/web_contents_user_data.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 class WebContents; | 15 class WebContents; |
15 } | 16 } |
16 | 17 |
17 namespace safe_browsing { | 18 namespace safe_browsing { |
18 | 19 |
19 class ClientSideDetectionHost; | 20 class ClientSideDetectionHost; |
20 | 21 |
21 // Per-tab class to handle safe-browsing functionality. | 22 // Per-tab class to handle safe-browsing functionality. |
22 class SafeBrowsingTabObserver | 23 class SafeBrowsingTabObserver |
23 : public content::WebContentsUserData<SafeBrowsingTabObserver> { | 24 : public content::WebContentsUserData<SafeBrowsingTabObserver> { |
24 public: | 25 public: |
25 ~SafeBrowsingTabObserver() override; | 26 ~SafeBrowsingTabObserver() override; |
26 | 27 |
27 private: | 28 private: |
28 explicit SafeBrowsingTabObserver(content::WebContents* web_contents); | 29 explicit SafeBrowsingTabObserver(content::WebContents* web_contents); |
29 friend class content::WebContentsUserData<SafeBrowsingTabObserver>; | 30 friend class content::WebContentsUserData<SafeBrowsingTabObserver>; |
30 | 31 |
31 // Internal helpers ---------------------------------------------------------- | 32 // Internal helpers ---------------------------------------------------------- |
32 | 33 |
33 // Create or destroy SafebrowsingDetectionHost as needed if the user's | 34 // Create or destroy SafebrowsingDetectionHost as needed if the user's |
34 // safe browsing preference has changed. | 35 // safe browsing preference has changed. |
35 void UpdateSafebrowsingDetectionHost(); | 36 void UpdateSafebrowsingDetectionHost(); |
36 | 37 |
37 // Handles IPCs. | 38 // Handles IPCs. |
38 scoped_ptr<ClientSideDetectionHost> safebrowsing_detection_host_; | 39 std::unique_ptr<ClientSideDetectionHost> safebrowsing_detection_host_; |
39 | 40 |
40 // Our owning WebContents. | 41 // Our owning WebContents. |
41 content::WebContents* web_contents_; | 42 content::WebContents* web_contents_; |
42 | 43 |
43 PrefChangeRegistrar pref_change_registrar_; | 44 PrefChangeRegistrar pref_change_registrar_; |
44 | 45 |
45 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingTabObserver); | 46 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingTabObserver); |
46 }; | 47 }; |
47 | 48 |
48 } // namespace safe_browsing | 49 } // namespace safe_browsing |
49 | 50 |
50 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_ | 51 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_ |
OLD | NEW |