| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/content_settings/core/browser/content_settings_default_prov
ider.h" | 5 #include "components/content_settings/core/browser/content_settings_default_prov
ider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // If the changed setting is syncable, write it to the old dictionary | 260 // If the changed setting is syncable, write it to the old dictionary |
| 261 // preference as well, so it can be synced to older versions of Chrome. | 261 // preference as well, so it can be synced to older versions of Chrome. |
| 262 // TODO(msramek): Remove this after two stable releases. | 262 // TODO(msramek): Remove this after two stable releases. |
| 263 if (kDefaultSettings[content_type].syncable) | 263 if (kDefaultSettings[content_type].syncable) |
| 264 WriteDictionaryPref(content_type, value.get()); | 264 WriteDictionaryPref(content_type, value.get()); |
| 265 } | 265 } |
| 266 | 266 |
| 267 NotifyObservers(ContentSettingsPattern(), | 267 NotifyObservers(ContentSettingsPattern(), |
| 268 ContentSettingsPattern(), | 268 ContentSettingsPattern(), |
| 269 content_type, | 269 content_type, |
| 270 std::string()); | 270 ResourceIdentifier()); |
| 271 | 271 |
| 272 return true; | 272 return true; |
| 273 } | 273 } |
| 274 | 274 |
| 275 RuleIterator* DefaultProvider::GetRuleIterator( | 275 RuleIterator* DefaultProvider::GetRuleIterator( |
| 276 ContentSettingsType content_type, | 276 ContentSettingsType content_type, |
| 277 const ResourceIdentifier& resource_identifier, | 277 const ResourceIdentifier& resource_identifier, |
| 278 bool incognito) const { | 278 bool incognito) const { |
| 279 base::AutoLock lock(lock_); | 279 base::AutoLock lock(lock_); |
| 280 if (resource_identifier.empty()) { | 280 if (resource_identifier.empty()) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 ChangeSetting(content_type, ReadIndividualPref(content_type).get()); | 416 ChangeSetting(content_type, ReadIndividualPref(content_type).get()); |
| 417 if (kDefaultSettings[content_type].syncable) | 417 if (kDefaultSettings[content_type].syncable) |
| 418 WriteDictionaryPref(content_type, default_settings_[content_type].get()); | 418 WriteDictionaryPref(content_type, default_settings_[content_type].get()); |
| 419 to_notify.push_back(content_type); | 419 to_notify.push_back(content_type); |
| 420 } | 420 } |
| 421 | 421 |
| 422 for (const ContentSettingsType content_type : to_notify) { | 422 for (const ContentSettingsType content_type : to_notify) { |
| 423 NotifyObservers(ContentSettingsPattern(), | 423 NotifyObservers(ContentSettingsPattern(), |
| 424 ContentSettingsPattern(), | 424 ContentSettingsPattern(), |
| 425 content_type, | 425 content_type, |
| 426 std::string()); | 426 ResourceIdentifier()); |
| 427 } | 427 } |
| 428 } | 428 } |
| 429 | 429 |
| 430 scoped_ptr<base::Value> DefaultProvider::ReadIndividualPref( | 430 scoped_ptr<base::Value> DefaultProvider::ReadIndividualPref( |
| 431 ContentSettingsType content_type) { | 431 ContentSettingsType content_type) { |
| 432 int int_value = prefs_->GetInteger(kDefaultSettings[content_type].pref_name); | 432 int int_value = prefs_->GetInteger(kDefaultSettings[content_type].pref_name); |
| 433 return ContentSettingToValue(IntToContentSetting(int_value)).Pass(); | 433 return ContentSettingToValue(IntToContentSetting(int_value)).Pass(); |
| 434 } | 434 } |
| 435 | 435 |
| 436 scoped_ptr<DefaultProvider::ValueMap> DefaultProvider::ReadDictionaryPref() { | 436 scoped_ptr<DefaultProvider::ValueMap> DefaultProvider::ReadDictionaryPref() { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 scoped_ptr<base::Value> value = ReadIndividualPref( | 519 scoped_ptr<base::Value> value = ReadIndividualPref( |
| 520 CONTENT_SETTINGS_TYPE_MEDIASTREAM); | 520 CONTENT_SETTINGS_TYPE_MEDIASTREAM); |
| 521 WriteIndividualPref(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, value.get()); | 521 WriteIndividualPref(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, value.get()); |
| 522 WriteIndividualPref(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, value.get()); | 522 WriteIndividualPref(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, value.get()); |
| 523 WriteIndividualPref(CONTENT_SETTINGS_TYPE_MEDIASTREAM, NULL); | 523 WriteIndividualPref(CONTENT_SETTINGS_TYPE_MEDIASTREAM, NULL); |
| 524 | 524 |
| 525 prefs_->SetBoolean(prefs::kMigratedDefaultMediaStreamSetting, true); | 525 prefs_->SetBoolean(prefs::kMigratedDefaultMediaStreamSetting, true); |
| 526 } | 526 } |
| 527 | 527 |
| 528 } // namespace content_settings | 528 } // namespace content_settings |
| OLD | NEW |