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

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

Issue 7831004: Add a method to the content_settings::ProviderInterface to return the content settings Value. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 #include "chrome/browser/content_settings/content_settings_policy_provider.h" 5 #include "chrome/browser/content_settings/content_settings_policy_provider.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 ContentSetting content_setting) { 384 ContentSetting content_setting) {
385 } 385 }
386 386
387 ContentSetting PolicyProvider::GetContentSetting( 387 ContentSetting PolicyProvider::GetContentSetting(
388 const GURL& primary_url, 388 const GURL& primary_url,
389 const GURL& secondary_url, 389 const GURL& secondary_url,
390 ContentSettingsType content_type, 390 ContentSettingsType content_type,
391 const ResourceIdentifier& resource_identifier) const { 391 const ResourceIdentifier& resource_identifier) const {
392 // Resource identifier are not supported by policies as long as the feature is 392 // Resource identifier are not supported by policies as long as the feature is
393 // behind a flag. So resource identifiers are simply ignored. 393 // behind a flag. So resource identifiers are simply ignored.
394 Value* value = value_map_.GetValue(primary_url, 394 Value* value = GetContentSettingValue(primary_url,
395 secondary_url, 395 secondary_url,
396 content_type, 396 content_type,
397 resource_identifier); 397 resource_identifier);
Bernhard Bauer 2011/09/01 13:33:19 Nit: indent
markusheintz_ 2011/09/01 14:32:49 Done.
398 ContentSetting setting = 398 ContentSetting setting =
399 value == NULL ? CONTENT_SETTING_DEFAULT : ValueToContentSetting(value); 399 value == NULL ? CONTENT_SETTING_DEFAULT : ValueToContentSetting(value);
400 if (setting == CONTENT_SETTING_DEFAULT && default_provider_) 400 if (setting == CONTENT_SETTING_DEFAULT && default_provider_)
401 setting = default_provider_->ProvideDefaultSetting(content_type); 401 setting = default_provider_->ProvideDefaultSetting(content_type);
402 return setting; 402 return setting;
403 } 403 }
404 404
405 Value* PolicyProvider::GetContentSettingValue(
406 const GURL& primary_url,
407 const GURL& secondary_url,
408 ContentSettingsType content_type,
409 const ResourceIdentifier& resource_identifier) const {
410 // Resource identifier are not supported by policies as long as the feature is
411 // behind a flag. So resource identifiers are simply ignored.
412 Value* value = value_map_.GetValue(primary_url,
413 secondary_url,
414 content_type,
415 resource_identifier);
416 return value ? value->DeepCopy() : NULL;
417 }
418
419
420
405 void PolicyProvider::GetAllContentSettingsRules( 421 void PolicyProvider::GetAllContentSettingsRules(
406 ContentSettingsType content_type, 422 ContentSettingsType content_type,
407 const ResourceIdentifier& resource_identifier, 423 const ResourceIdentifier& resource_identifier,
408 Rules* content_setting_rules) const { 424 Rules* content_setting_rules) const {
409 DCHECK_NE(RequiresResourceIdentifier(content_type), 425 DCHECK_NE(RequiresResourceIdentifier(content_type),
410 resource_identifier.empty()); 426 resource_identifier.empty());
411 DCHECK(content_setting_rules); 427 DCHECK(content_setting_rules);
412 content_setting_rules->clear(); 428 content_setting_rules->clear();
413 429
414 const OriginIdentifierValueMap* map_to_return = &value_map_; 430 const OriginIdentifierValueMap* map_to_return = &value_map_;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 ContentSettingsPattern(), 483 ContentSettingsPattern(),
468 CONTENT_SETTINGS_TYPE_DEFAULT, 484 CONTENT_SETTINGS_TYPE_DEFAULT,
469 std::string()); 485 std::string());
470 } 486 }
471 } else { 487 } else {
472 NOTREACHED() << "Unexpected notification"; 488 NOTREACHED() << "Unexpected notification";
473 } 489 }
474 } 490 }
475 491
476 } // namespace content_settings 492 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698