Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: chrome/browser/content_settings/host_content_settings_map.h

Issue 7218073: Explicitly ShutdownOnUIThread the HostContentSettingsMap when destroying the Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // Maps hostnames to custom content settings. Written on the UI thread and read 5 // Maps hostnames to custom content settings. Written on the UI thread and read
6 // on any thread. One instance per profile. 6 // on any thread. One instance per profile.
7 7
8 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ 8 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_
9 #define CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ 9 #define CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_
10 #pragma once 10 #pragma once
(...skipping 20 matching lines...) Expand all
31 } // namespace content_settings 31 } // namespace content_settings
32 32
33 class ContentSettingsDetails; 33 class ContentSettingsDetails;
34 class DictionaryValue; 34 class DictionaryValue;
35 class GURL; 35 class GURL;
36 class PrefService; 36 class PrefService;
37 class Profile; 37 class Profile;
38 38
39 class HostContentSettingsMap 39 class HostContentSettingsMap
40 : public NotificationObserver, 40 : public NotificationObserver,
41 public base::RefCountedThreadSafe<HostContentSettingsMap, 41 public base::RefCountedThreadSafe<HostContentSettingsMap> {
42 BrowserThread::DeleteOnUIThread> {
43 public: 42 public:
44 typedef Tuple3<ContentSettingsPattern, ContentSetting, std::string> 43 typedef Tuple3<ContentSettingsPattern, ContentSetting, std::string>
45 PatternSettingSourceTriple; 44 PatternSettingSourceTriple;
46 typedef std::vector<PatternSettingSourceTriple> SettingsForOneType; 45 typedef std::vector<PatternSettingSourceTriple> SettingsForOneType;
47 46
48 explicit HostContentSettingsMap(Profile* profile); 47 explicit HostContentSettingsMap(Profile* profile);
49 48
50 static void RegisterUserPrefs(PrefService* prefs); 49 static void RegisterUserPrefs(PrefService* prefs);
51 50
52 // Returns the default setting for a particular content type. 51 // Returns the default setting for a particular content type.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // Afterwards, none of the methods above that should only be called on the UI 191 // Afterwards, none of the methods above that should only be called on the UI
193 // thread should be called anymore. 192 // thread should be called anymore.
194 void ShutdownOnUIThread(); 193 void ShutdownOnUIThread();
195 194
196 // NotificationObserver implementation. 195 // NotificationObserver implementation.
197 virtual void Observe(NotificationType type, 196 virtual void Observe(NotificationType type,
198 const NotificationSource& source, 197 const NotificationSource& source,
199 const NotificationDetails& details); 198 const NotificationDetails& details);
200 199
201 private: 200 private:
202 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; 201 friend class base::RefCountedThreadSafe<HostContentSettingsMap>;
203 friend class DeleteTask<HostContentSettingsMap>;
204 202
205 virtual ~HostContentSettingsMap(); 203 virtual ~HostContentSettingsMap();
206 204
207 ContentSetting GetContentSettingInternal( 205 ContentSetting GetContentSettingInternal(
208 const GURL& primary_url, 206 const GURL& primary_url,
209 const GURL& secondary_url, 207 const GURL& secondary_url,
210 ContentSettingsType content_type, 208 ContentSettingsType content_type,
211 const std::string& resource_identifier) const; 209 const std::string& resource_identifier) const;
212 210
213 void UnregisterObservers();
214
215 // Various migration methods (old cookie, popup and per-host data gets 211 // Various migration methods (old cookie, popup and per-host data gets
216 // migrated to the new format). 212 // migrated to the new format).
217 void MigrateObsoleteCookiePref(PrefService* prefs); 213 void MigrateObsoleteCookiePref();
218 214
219 // The profile we're associated with. 215 // Weak; owned by the Profile.
220 Profile* profile_; 216 PrefService* prefs_;
221 217
222 NotificationRegistrar notification_registrar_;
223 PrefChangeRegistrar pref_change_registrar_; 218 PrefChangeRegistrar pref_change_registrar_;
224 219
225 // Whether this settings map is for an OTR session. 220 // Whether this settings map is for an OTR session.
226 bool is_off_the_record_; 221 bool is_off_the_record_;
227 222
228 // Whether we are currently updating preferences, this is used to ignore 223 // Whether we are currently updating preferences, this is used to ignore
229 // notifications from the preferences service that we triggered ourself. 224 // notifications from the preferences service that we triggered ourself.
230 bool updating_preferences_; 225 bool updating_preferences_;
231 226
232 // Default content setting providers. 227 // Default content setting providers.
233 std::vector<linked_ptr<content_settings::DefaultProviderInterface> > 228 std::vector<linked_ptr<content_settings::DefaultProviderInterface> >
234 default_content_settings_providers_; 229 default_content_settings_providers_;
235 230
236 // Content setting providers. 231 // Content setting providers.
237 std::vector<linked_ptr<content_settings::ProviderInterface> > 232 std::vector<linked_ptr<content_settings::ProviderInterface> >
238 content_settings_providers_; 233 content_settings_providers_;
239 234
240 // Used around accesses to the following objects to guarantee thread safety. 235 // Used around accesses to the following objects to guarantee thread safety.
241 mutable base::Lock lock_; 236 mutable base::Lock lock_;
242 237
243 // Misc global settings. 238 // Misc global settings.
244 bool block_third_party_cookies_; 239 bool block_third_party_cookies_;
245 bool is_block_third_party_cookies_managed_; 240 bool is_block_third_party_cookies_managed_;
246 241
247 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); 242 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap);
248 }; 243 };
249 244
250 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ 245 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698