| 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/content_settings/host_content_settings_map.h" | 5 #include "chrome/browser/content_settings/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/browser_thread.h" | 10 #include "chrome/browser/browser_thread.h" | 
| 11 #include "chrome/browser/content_settings/content_settings_details.h" | 11 #include "chrome/browser/content_settings/content_settings_details.h" | 
| 12 #include "chrome/browser/content_settings/content_settings_provider.h" | 12 #include "chrome/browser/content_settings/content_settings_provider.h" | 
| 13 #include "chrome/browser/content_settings/policy_content_settings_provider.h" | 13 #include "chrome/browser/content_settings/policy_content_settings_provider.h" | 
| 14 #include "chrome/browser/content_settings/pref_content_settings_provider.h" | 14 #include "chrome/browser/content_settings/pref_content_settings_provider.h" | 
| 15 #include "chrome/browser/metrics/user_metrics.h" | 15 #include "chrome/browser/metrics/user_metrics.h" | 
| 16 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" | 
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" | 
| 18 #include "chrome/browser/prefs/scoped_pref_update.h" | 18 #include "chrome/browser/prefs/scoped_pref_update.h" | 
| 19 #include "chrome/common/notification_service.h" | 19 #include "chrome/common/notification_service.h" | 
| 20 #include "chrome/common/notification_source.h" | 20 #include "chrome/common/notification_source.h" | 
| 21 #include "chrome/common/notification_type.h" | 21 #include "chrome/common/notification_type.h" | 
| 22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" | 
| 23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" | 
| 24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" | 
| 25 #include "googleurl/src/gurl.h" | 25 #include "googleurl/src/gurl.h" | 
| 26 #include "net/base/net_util.h" | 26 #include "net/base/net_util.h" | 
| 27 #include "net/base/static_cookie_policy.h" | 27 #include "net/base/static_cookie_policy.h" | 
| 28 | 28 | 
|  | 29 using content_settings::DefaultContentSettingsProvider; | 
|  | 30 using content_settings::PrefDefaultContentSettingsProvider; | 
|  | 31 using content_settings::PolicyDefaultContentSettingsProvider; | 
|  | 32 | 
| 29 namespace { | 33 namespace { | 
| 30 | 34 | 
| 31 // The preference keys where resource identifiers are stored for | 35 // The preference keys where resource identifiers are stored for | 
| 32 // ContentSettingsType values that support resource identifiers. | 36 // ContentSettingsType values that support resource identifiers. | 
| 33 const char* kResourceTypeNames[CONTENT_SETTINGS_NUM_TYPES] = { | 37 const char* kResourceTypeNames[CONTENT_SETTINGS_NUM_TYPES] = { | 
| 34   NULL, | 38   NULL, | 
| 35   NULL, | 39   NULL, | 
| 36   NULL, | 40   NULL, | 
| 37   "per_plugin", | 41   "per_plugin", | 
| 38   NULL, | 42   NULL, | 
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 107     : profile_(profile), | 111     : profile_(profile), | 
| 108       is_off_the_record_(profile_->IsOffTheRecord()), | 112       is_off_the_record_(profile_->IsOffTheRecord()), | 
| 109       updating_preferences_(false), | 113       updating_preferences_(false), | 
| 110       block_third_party_cookies_(false), | 114       block_third_party_cookies_(false), | 
| 111       is_block_third_party_cookies_managed_(false) { | 115       is_block_third_party_cookies_managed_(false) { | 
| 112   // The order in which the content settings providers are created is critical, | 116   // The order in which the content settings providers are created is critical, | 
| 113   // as providers that are further down in the list (i.e. added later) override | 117   // as providers that are further down in the list (i.e. added later) override | 
| 114   // providers further up. | 118   // providers further up. | 
| 115   default_content_settings_providers_.push_back( | 119   default_content_settings_providers_.push_back( | 
| 116       DefaultContentSettingsProviderPtr( | 120       DefaultContentSettingsProviderPtr( | 
| 117           new PrefContentSettingsProvider(profile))); | 121           new PrefDefaultContentSettingsProvider(profile))); | 
| 118   default_content_settings_providers_.push_back( | 122   default_content_settings_providers_.push_back( | 
| 119       DefaultContentSettingsProviderPtr( | 123       DefaultContentSettingsProviderPtr( | 
| 120           new PolicyContentSettingsProvider(profile))); | 124           new PolicyDefaultContentSettingsProvider(profile))); | 
| 121 | 125 | 
| 122   PrefService* prefs = profile_->GetPrefs(); | 126   PrefService* prefs = profile_->GetPrefs(); | 
| 123 | 127 | 
| 124   MigrateObsoleteCookiePref(prefs); | 128   MigrateObsoleteCookiePref(prefs); | 
| 125 | 129 | 
| 126   MigrateObsoletePopupsPref(prefs); | 130   MigrateObsoletePopupsPref(prefs); | 
| 127 | 131 | 
| 128   MigrateObsoletePerhostPref(prefs); | 132   MigrateObsoletePerhostPref(prefs); | 
| 129 | 133 | 
| 130   // Read misc. global settings. | 134   // Read misc. global settings. | 
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 974   } | 978   } | 
| 975 | 979 | 
| 976   for (size_t i = 0; i < move_items.size(); ++i) { | 980   for (size_t i = 0; i < move_items.size(); ++i) { | 
| 977     Value* pattern_settings_dictionary = NULL; | 981     Value* pattern_settings_dictionary = NULL; | 
| 978     all_settings_dictionary->RemoveWithoutPathExpansion( | 982     all_settings_dictionary->RemoveWithoutPathExpansion( | 
| 979         move_items[i].first, &pattern_settings_dictionary); | 983         move_items[i].first, &pattern_settings_dictionary); | 
| 980     all_settings_dictionary->SetWithoutPathExpansion( | 984     all_settings_dictionary->SetWithoutPathExpansion( | 
| 981         move_items[i].second, pattern_settings_dictionary); | 985         move_items[i].second, pattern_settings_dictionary); | 
| 982   } | 986   } | 
| 983 } | 987 } | 
| OLD | NEW | 
|---|