OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/privacy_blacklist/blacklist_manager.h" | 5 #include "chrome/browser/privacy_blacklist/blacklist_manager.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "base/thread.h" | 10 #include "base/thread.h" |
11 #include "chrome/browser/privacy_blacklist/blacklist.h" | 11 #include "chrome/browser/privacy_blacklist/blacklist.h" |
12 #include "chrome/browser/privacy_blacklist/blacklist_io.h" | 12 #include "chrome/browser/privacy_blacklist/blacklist_io.h" |
13 #include "chrome/browser/profile.h" | 13 #include "chrome/browser/profile.h" |
14 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
15 #include "chrome/common/notification_service.h" | 15 #include "chrome/common/notification_service.h" |
16 #include "chrome/common/notification_source.h" | 16 #include "chrome/common/notification_source.h" |
17 #include "chrome/common/notification_type.h" | 17 #include "chrome/common/notification_type.h" |
18 | 18 |
19 BlacklistPathProvider::~BlacklistPathProvider() { | 19 BlacklistPathProvider::~BlacklistPathProvider() { |
20 } | 20 } |
21 | 21 |
22 BlacklistManager::BlacklistManager(Profile* profile, | 22 BlacklistManager::BlacklistManager() |
23 BlacklistPathProvider* path_provider) | |
24 : first_read_finished_(false), | 23 : first_read_finished_(false), |
25 profile_(profile), | 24 profile_(NULL), |
26 compiled_blacklist_path_( | 25 path_provider_(NULL) { |
27 profile->GetPath().Append(chrome::kPrivacyBlacklistFileName)), | |
28 path_provider_(path_provider) { | |
29 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 26 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
| 27 } |
| 28 |
| 29 void BlacklistManager::Initialize(Profile* profile, |
| 30 BlacklistPathProvider* path_provider) { |
| 31 profile_ = profile; |
| 32 compiled_blacklist_path_ = |
| 33 profile->GetPath().Append(chrome::kPrivacyBlacklistFileName); |
| 34 path_provider_ = path_provider; |
30 | 35 |
31 registrar_.Add(this, | 36 registrar_.Add(this, |
32 NotificationType::EXTENSION_LOADED, | 37 NotificationType::EXTENSION_LOADED, |
33 Source<Profile>(profile)); | 38 Source<Profile>(profile)); |
34 registrar_.Add(this, | 39 registrar_.Add(this, |
35 NotificationType::EXTENSION_UNLOADED, | 40 NotificationType::EXTENSION_UNLOADED, |
36 Source<Profile>(profile)); | 41 Source<Profile>(profile)); |
37 ReadBlacklist(); | 42 ReadBlacklist(); |
38 } | 43 } |
39 | 44 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 return; | 164 return; |
160 } | 165 } |
161 first_read_finished_ = true; | 166 first_read_finished_ = true; |
162 compiled_blacklist_.reset(blacklist); | 167 compiled_blacklist_.reset(blacklist); |
163 | 168 |
164 NotificationService::current()->Notify( | 169 NotificationService::current()->Notify( |
165 NotificationType::BLACKLIST_MANAGER_BLACKLIST_READ_FINISHED, | 170 NotificationType::BLACKLIST_MANAGER_BLACKLIST_READ_FINISHED, |
166 Source<Profile>(profile_), | 171 Source<Profile>(profile_), |
167 Details<Blacklist>(blacklist)); | 172 Details<Blacklist>(blacklist)); |
168 } | 173 } |
OLD | NEW |