| 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 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/safe_browsing/client_side_detection_host.h" | |
| 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 12 #include "chrome/common/chrome_notification_types.h" | 11 #include "chrome/common/chrome_notification_types.h" |
| 13 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 14 #include "chrome/common/render_messages.h" | 13 #include "chrome/common/render_messages.h" |
| 15 #include "content/browser/renderer_host/render_view_host.h" | 14 #include "content/browser/renderer_host/render_view_host.h" |
| 16 #include "content/browser/tab_contents/tab_contents.h" | 15 #include "content/browser/tab_contents/tab_contents.h" |
| 17 #include "content/public/browser/notification_details.h" | 16 #include "content/public/browser/notification_details.h" |
| 18 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
| 19 | 18 |
| 19 #if defined(ENABLE_SAFE_BROWSING) |
| 20 #include "chrome/browser/safe_browsing/client_side_detection_host.h" |
| 21 #endif |
| 22 |
| 20 namespace safe_browsing { | 23 namespace safe_browsing { |
| 21 | 24 |
| 25 #if !defined(ENABLE_SAFE_BROWSING) |
| 26 // Provide a dummy implementation so that scoped_ptr<ClientSideDetectionHost> |
| 27 // has a concrete destructor to call. This is necessary because it is used |
| 28 // as a member of SafeBrowsingTabObserver, even if it only ever contains NULL. |
| 29 class ClientSideDetectionHost { }; |
| 30 #endif |
| 31 |
| 22 SafeBrowsingTabObserver::SafeBrowsingTabObserver( | 32 SafeBrowsingTabObserver::SafeBrowsingTabObserver( |
| 23 TabContentsWrapper* wrapper) : wrapper_(wrapper) { | 33 TabContentsWrapper* wrapper) : wrapper_(wrapper) { |
| 24 #if defined(ENABLE_SAFE_BROWSING) | 34 #if defined(ENABLE_SAFE_BROWSING) |
| 25 PrefService* prefs = wrapper_->profile()->GetPrefs(); | 35 PrefService* prefs = wrapper_->profile()->GetPrefs(); |
| 26 if (prefs) { | 36 if (prefs) { |
| 27 pref_change_registrar_.Init(prefs); | 37 pref_change_registrar_.Init(prefs); |
| 28 pref_change_registrar_.Add(prefs::kSafeBrowsingEnabled, this); | 38 pref_change_registrar_.Add(prefs::kSafeBrowsingEnabled, this); |
| 29 | 39 |
| 30 if (prefs->GetBoolean(prefs::kSafeBrowsingEnabled) && | 40 if (prefs->GetBoolean(prefs::kSafeBrowsingEnabled) && |
| 31 g_browser_process->safe_browsing_detection_service()) { | 41 g_browser_process->safe_browsing_detection_service()) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 safebrowsing_detection_host_.reset(); | 90 safebrowsing_detection_host_.reset(); |
| 81 } | 91 } |
| 82 | 92 |
| 83 RenderViewHost* rvh = wrapper_->tab_contents()->render_view_host(); | 93 RenderViewHost* rvh = wrapper_->tab_contents()->render_view_host(); |
| 84 rvh->Send(new ChromeViewMsg_SetClientSidePhishingDetection(rvh->routing_id(), | 94 rvh->Send(new ChromeViewMsg_SetClientSidePhishingDetection(rvh->routing_id(), |
| 85 safe_browsing)); | 95 safe_browsing)); |
| 86 #endif | 96 #endif |
| 87 } | 97 } |
| 88 | 98 |
| 89 } // namespace safe_browsing | 99 } // namespace safe_browsing |
| OLD | NEW |