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

Side by Side Diff: chrome/browser/content_settings/content_settings_pref_provider.cc

Issue 7167007: Use empty resource identifier unless --enable-resource-content-settings is set. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/content_settings/host_content_settings_map.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/content_settings/content_settings_pref_provider.h" 5 #include "chrome/browser/content_settings/content_settings_pref_provider.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 if (value) 451 if (value)
452 return ValueToContentSetting(value); 452 return ValueToContentSetting(value);
453 453
454 return CONTENT_SETTING_DEFAULT; 454 return CONTENT_SETTING_DEFAULT;
455 } 455 }
456 456
457 void PrefProvider::GetAllContentSettingsRules( 457 void PrefProvider::GetAllContentSettingsRules(
458 ContentSettingsType content_type, 458 ContentSettingsType content_type,
459 const ResourceIdentifier& resource_identifier, 459 const ResourceIdentifier& resource_identifier,
460 Rules* content_setting_rules) const { 460 Rules* content_setting_rules) const {
461 DCHECK_NE(RequiresResourceIdentifier(content_type),
462 resource_identifier.empty());
463 DCHECK(content_setting_rules); 461 DCHECK(content_setting_rules);
464 content_setting_rules->clear(); 462 content_setting_rules->clear();
465 463
466 const OriginIdentifierValueMap* map_to_return = 464 const OriginIdentifierValueMap* map_to_return =
467 is_incognito_ ? &incognito_value_map_ : &value_map_; 465 is_incognito_ ? &incognito_value_map_ : &value_map_;
468 466
469 base::AutoLock auto_lock(lock_); 467 base::AutoLock auto_lock(lock_);
470 for (OriginIdentifierValueMap::const_iterator entry = map_to_return->begin(); 468 for (OriginIdentifierValueMap::const_iterator entry = map_to_return->begin();
471 entry != map_to_return->end(); 469 entry != map_to_return->end();
472 ++entry) { 470 ++entry) {
(...skipping 13 matching lines...) Expand all
486 const ContentSettingsPattern& requesting_pattern, 484 const ContentSettingsPattern& requesting_pattern,
487 const ContentSettingsPattern& embedding_pattern, 485 const ContentSettingsPattern& embedding_pattern,
488 ContentSettingsType content_type, 486 ContentSettingsType content_type,
489 const ResourceIdentifier& resource_identifier, 487 const ResourceIdentifier& resource_identifier,
490 ContentSetting setting) { 488 ContentSetting setting) {
491 // Support for embedding_patterns is not implemented yet. 489 // Support for embedding_patterns is not implemented yet.
492 DCHECK(requesting_pattern == embedding_pattern); 490 DCHECK(requesting_pattern == embedding_pattern);
493 491
494 DCHECK(kTypeNames[content_type] != NULL); // Don't call this for Geolocation. 492 DCHECK(kTypeNames[content_type] != NULL); // Don't call this for Geolocation.
495 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 493 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
496 DCHECK_NE(RequiresResourceIdentifier(content_type),
497 resource_identifier.empty());
498 DCHECK(content_type != CONTENT_SETTINGS_TYPE_PLUGINS ||
499 setting != CONTENT_SETTING_ASK ||
500 CommandLine::ForCurrentProcess()->HasSwitch(
501 switches::kEnableClickToPlay));
502 494
503 updating_preferences_ = true; 495 updating_preferences_ = true;
504 { 496 {
505 DictionaryPrefUpdate update(profile_ ? profile_->GetPrefs() : NULL, 497 DictionaryPrefUpdate update(profile_ ? profile_->GetPrefs() : NULL,
506 prefs::kContentSettingsPatterns); 498 prefs::kContentSettingsPatterns);
507 DictionaryValue* all_settings_dictionary = NULL; 499 DictionaryValue* all_settings_dictionary = NULL;
508 500
509 OriginIdentifierValueMap* map_to_modify = &incognito_value_map_; 501 OriginIdentifierValueMap* map_to_modify = &incognito_value_map_;
510 if (!is_incognito_) { 502 if (!is_incognito_) {
511 map_to_modify = &value_map_; 503 map_to_modify = &value_map_;
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 ContentSettingsPattern::FromString(host), 937 ContentSettingsPattern::FromString(host),
946 CONTENT_SETTINGS_TYPE_POPUPS, 938 CONTENT_SETTINGS_TYPE_POPUPS,
947 "", 939 "",
948 CONTENT_SETTING_ALLOW); 940 CONTENT_SETTING_ALLOW);
949 } 941 }
950 prefs->ClearPref(prefs::kPopupWhitelistedHosts); 942 prefs->ClearPref(prefs::kPopupWhitelistedHosts);
951 } 943 }
952 } 944 }
953 945
954 } // namespace content_settings 946 } // namespace content_settings
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/content_settings/host_content_settings_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698