OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/host_content_settings_map.h" | 5 #include "chrome/browser/host_content_settings_map.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 key.erase(kDomainWildcardLength, next_dot - kDomainWildcardLength + 1); | 333 key.erase(kDomainWildcardLength, next_dot - kDomainWildcardLength + 1); |
334 } | 334 } |
335 | 335 |
336 return CONTENT_SETTING_DEFAULT; | 336 return CONTENT_SETTING_DEFAULT; |
337 } | 337 } |
338 | 338 |
339 ContentSettings HostContentSettingsMap::GetContentSettings( | 339 ContentSettings HostContentSettingsMap::GetContentSettings( |
340 const GURL& url) const { | 340 const GURL& url) const { |
341 ContentSettings output = GetNonDefaultContentSettings(url); | 341 ContentSettings output = GetNonDefaultContentSettings(url); |
342 | 342 |
| 343 AutoLock auto_lock(lock_); |
| 344 |
343 // Make the remaining defaults explicit. | 345 // Make the remaining defaults explicit. |
344 for (int j = 0; j < CONTENT_SETTINGS_NUM_TYPES; ++j) | 346 for (int j = 0; j < CONTENT_SETTINGS_NUM_TYPES; ++j) |
345 if (output.settings[j] == CONTENT_SETTING_DEFAULT || | 347 if (output.settings[j] == CONTENT_SETTING_DEFAULT || |
346 RequiresResourceIdentifier(ContentSettingsType(j))) | 348 RequiresResourceIdentifier(ContentSettingsType(j))) |
347 output.settings[j] = default_content_settings_.settings[j]; | 349 output.settings[j] = default_content_settings_.settings[j]; |
348 | 350 |
349 return output; | 351 return output; |
350 } | 352 } |
351 | 353 |
352 ContentSettings HostContentSettingsMap::GetNonDefaultContentSettings( | 354 ContentSettings HostContentSettingsMap::GetNonDefaultContentSettings( |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 if (!profile_) | 878 if (!profile_) |
877 return; | 879 return; |
878 PrefService* prefs = profile_->GetPrefs(); | 880 PrefService* prefs = profile_->GetPrefs(); |
879 prefs->RemovePrefObserver(prefs::kDefaultContentSettings, this); | 881 prefs->RemovePrefObserver(prefs::kDefaultContentSettings, this); |
880 prefs->RemovePrefObserver(prefs::kContentSettingsPatterns, this); | 882 prefs->RemovePrefObserver(prefs::kContentSettingsPatterns, this); |
881 prefs->RemovePrefObserver(prefs::kBlockThirdPartyCookies, this); | 883 prefs->RemovePrefObserver(prefs::kBlockThirdPartyCookies, this); |
882 notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, | 884 notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, |
883 Source<Profile>(profile_)); | 885 Source<Profile>(profile_)); |
884 profile_ = NULL; | 886 profile_ = NULL; |
885 } | 887 } |
OLD | NEW |