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_service.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "chrome/browser/safe_browsing/safe_browsing_database.h" | 25 #include "chrome/browser/safe_browsing/safe_browsing_database.h" |
26 #include "chrome/browser/tab_contents/tab_util.h" | 26 #include "chrome/browser/tab_contents/tab_util.h" |
27 #include "chrome/common/chrome_constants.h" | 27 #include "chrome/common/chrome_constants.h" |
28 #include "chrome/common/chrome_notification_types.h" | 28 #include "chrome/common/chrome_notification_types.h" |
29 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
30 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
31 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
32 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
33 #include "content/browser/browser_thread.h" | 33 #include "content/browser/browser_thread.h" |
34 #include "content/browser/tab_contents/tab_contents.h" | 34 #include "content/browser/tab_contents/tab_contents.h" |
35 #include "content/common/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
36 #include "content/public/browser/notification_types.h" | 36 #include "content/public/browser/notification_types.h" |
37 #include "net/base/registry_controlled_domain.h" | 37 #include "net/base/registry_controlled_domain.h" |
38 #include "net/url_request/url_request_context_getter.h" | 38 #include "net/url_request/url_request_context_getter.h" |
39 | 39 |
40 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
41 #include "chrome/installer/util/browser_distribution.h" | 41 #include "chrome/installer/util/browser_distribution.h" |
42 #endif | 42 #endif |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); | 203 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); |
204 for (size_t i = 0; i < profiles.size(); ++i) { | 204 for (size_t i = 0; i < profiles.size(); ++i) { |
205 if (profiles[i]->IsOffTheRecord()) | 205 if (profiles[i]->IsOffTheRecord()) |
206 continue; | 206 continue; |
207 AddPrefService(profiles[i]->GetPrefs()); | 207 AddPrefService(profiles[i]->GetPrefs()); |
208 } | 208 } |
209 } | 209 } |
210 | 210 |
211 // Track profile creation and destruction. | 211 // Track profile creation and destruction. |
212 prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED, | 212 prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED, |
213 NotificationService::AllSources()); | 213 content::NotificationService::AllSources()); |
214 prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, | 214 prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
215 NotificationService::AllSources()); | 215 content::NotificationService::AllSources()); |
216 } | 216 } |
217 | 217 |
218 void SafeBrowsingService::ShutDown() { | 218 void SafeBrowsingService::ShutDown() { |
219 if (download_service_.get()) { | 219 if (download_service_.get()) { |
220 // Disabling the download service first will ensure that it is | 220 // Disabling the download service first will ensure that it is |
221 // disabled before the SafeBrowsingService object becomes invalid. The | 221 // disabled before the SafeBrowsingService object becomes invalid. The |
222 // download service might stay around for a bit since it's | 222 // download service might stay around for a bit since it's |
223 // ref-counted but it won't do any harm because it will be | 223 // ref-counted but it won't do any harm because it will be |
224 // disabled. | 224 // disabled. |
225 download_service_->SetEnabled(false); | 225 download_service_->SetEnabled(false); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 534 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
535 if (enabled_) | 535 if (enabled_) |
536 return; | 536 return; |
537 DCHECK(!safe_browsing_thread_.get()); | 537 DCHECK(!safe_browsing_thread_.get()); |
538 safe_browsing_thread_.reset(new base::Thread("Chrome_SafeBrowsingThread")); | 538 safe_browsing_thread_.reset(new base::Thread("Chrome_SafeBrowsingThread")); |
539 if (!safe_browsing_thread_->Start()) | 539 if (!safe_browsing_thread_->Start()) |
540 return; | 540 return; |
541 enabled_ = true; | 541 enabled_ = true; |
542 | 542 |
543 registrar_.Add(this, content::NOTIFICATION_PURGE_MEMORY, | 543 registrar_.Add(this, content::NOTIFICATION_PURGE_MEMORY, |
544 NotificationService::AllSources()); | 544 content::NotificationService::AllSources()); |
545 | 545 |
546 MakeDatabaseAvailable(); | 546 MakeDatabaseAvailable(); |
547 | 547 |
548 // On Windows, get the safe browsing client name from the browser | 548 // On Windows, get the safe browsing client name from the browser |
549 // distribution classes in installer util. These classes don't yet have | 549 // distribution classes in installer util. These classes don't yet have |
550 // an analog on non-Windows builds so just keep the name specified here. | 550 // an analog on non-Windows builds so just keep the name specified here. |
551 #if defined(OS_WIN) | 551 #if defined(OS_WIN) |
552 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 552 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
553 std::string client_name(dist->GetSafeBrowsingName()); | 553 std::string client_name(dist->GetSafeBrowsingName()); |
554 #else | 554 #else |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 if (enable) | 1364 if (enable) |
1365 Start(); | 1365 Start(); |
1366 else | 1366 else |
1367 Stop(); | 1367 Stop(); |
1368 | 1368 |
1369 if (csd_service_.get()) | 1369 if (csd_service_.get()) |
1370 csd_service_->SetEnabledAndRefreshState(enable); | 1370 csd_service_->SetEnabledAndRefreshState(enable); |
1371 if (download_service_.get()) | 1371 if (download_service_.get()) |
1372 download_service_->SetEnabled(enable); | 1372 download_service_->SetEnabled(enable); |
1373 } | 1373 } |
OLD | NEW |