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

Side by Side Diff: components/content_settings/core/browser/host_content_settings_map.cc

Issue 1442083002: Stop inheriting push notification permissions from regular to incognito (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Annotate bool parameters Created 5 years 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
OLDNEW
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/host_content_settings_map.h" 5 #include "components/content_settings/core/browser/host_content_settings_map.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/time/clock.h" 15 #include "base/time/clock.h"
16 #include "components/content_settings/core/browser/content_settings_default_prov ider.h" 16 #include "components/content_settings/core/browser/content_settings_default_prov ider.h"
17 #include "components/content_settings/core/browser/content_settings_details.h" 17 #include "components/content_settings/core/browser/content_settings_details.h"
18 #include "components/content_settings/core/browser/content_settings_info.h" 18 #include "components/content_settings/core/browser/content_settings_info.h"
19 #include "components/content_settings/core/browser/content_settings_observable_p rovider.h" 19 #include "components/content_settings/core/browser/content_settings_observable_p rovider.h"
20 #include "components/content_settings/core/browser/content_settings_policy_provi der.h" 20 #include "components/content_settings/core/browser/content_settings_policy_provi der.h"
21 #include "components/content_settings/core/browser/content_settings_pref_provide r.h" 21 #include "components/content_settings/core/browser/content_settings_pref_provide r.h"
22 #include "components/content_settings/core/browser/content_settings_provider.h" 22 #include "components/content_settings/core/browser/content_settings_provider.h"
23 #include "components/content_settings/core/browser/content_settings_registry.h" 23 #include "components/content_settings/core/browser/content_settings_registry.h"
24 #include "components/content_settings/core/browser/content_settings_rule.h" 24 #include "components/content_settings/core/browser/content_settings_rule.h"
25 #include "components/content_settings/core/browser/content_settings_utils.h" 25 #include "components/content_settings/core/browser/content_settings_utils.h"
26 #include "components/content_settings/core/browser/website_settings_info.h"
27 #include "components/content_settings/core/browser/website_settings_registry.h"
26 #include "components/content_settings/core/common/content_settings_pattern.h" 28 #include "components/content_settings/core/common/content_settings_pattern.h"
27 #include "components/content_settings/core/common/pref_names.h" 29 #include "components/content_settings/core/common/pref_names.h"
28 #include "components/pref_registry/pref_registry_syncable.h" 30 #include "components/pref_registry/pref_registry_syncable.h"
29 #include "net/base/net_errors.h" 31 #include "net/base/net_errors.h"
30 #include "net/base/static_cookie_policy.h" 32 #include "net/base/static_cookie_policy.h"
31 #include "url/gurl.h" 33 #include "url/gurl.h"
32 34
33 namespace { 35 namespace {
34 36
35 typedef std::vector<content_settings::Rule> Rules; 37 typedef std::vector<content_settings::Rule> Rules;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 151
150 // Iterate through the list of providers and return the first non-NULL value 152 // Iterate through the list of providers and return the first non-NULL value
151 // that matches |primary_url| and |secondary_url|. 153 // that matches |primary_url| and |secondary_url|.
152 for (ConstProviderIterator provider = content_settings_providers_.begin(); 154 for (ConstProviderIterator provider = content_settings_providers_.begin();
153 provider != content_settings_providers_.end(); 155 provider != content_settings_providers_.end();
154 ++provider) { 156 ++provider) {
155 if (provider->first == PREF_PROVIDER) 157 if (provider->first == PREF_PROVIDER)
156 continue; 158 continue;
157 ContentSetting default_setting = 159 ContentSetting default_setting =
158 GetDefaultContentSettingFromProvider(content_type, provider->second); 160 GetDefaultContentSettingFromProvider(content_type, provider->second);
161 if (is_off_the_record_ && default_setting == CONTENT_SETTING_ALLOW) {
162 if (content_settings::WebsiteSettingsRegistry::GetInstance()
Michael van Ouwerkerk 2015/11/26 18:51:06 As this is a wrapped condition, it should have cur
johnme 2015/11/27 14:12:28 Removed this, but done elsewhere.
163 ->Get(content_type)->incognito_behavior()
164 == content_settings::WebsiteSettingsInfo
165 ::INHERIT_IN_INCOGNITO_EXCEPT_ALLOW)
Michael van Ouwerkerk 2015/11/26 18:51:06 This whole section is a bit hard to read because o
johnme 2015/11/27 14:12:29 I tidied this up.
166 default_setting = CONTENT_SETTING_ASK;
167 }
159 if (default_setting != CONTENT_SETTING_DEFAULT) { 168 if (default_setting != CONTENT_SETTING_DEFAULT) {
160 if (provider_id) 169 if (provider_id)
161 *provider_id = kProviderNamesSourceMap[provider->first].provider_name; 170 *provider_id = kProviderNamesSourceMap[provider->first].provider_name;
162 return default_setting; 171 return default_setting;
163 } 172 }
164 } 173 }
165 174
166 return CONTENT_SETTING_DEFAULT; 175 return CONTENT_SETTING_DEFAULT;
167 } 176 }
168 177
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 primary_pattern = &info->primary_pattern; 621 primary_pattern = &info->primary_pattern;
613 secondary_pattern = &info->secondary_pattern; 622 secondary_pattern = &info->secondary_pattern;
614 } 623 }
615 624
616 // The list of |content_settings_providers_| is ordered according to their 625 // The list of |content_settings_providers_| is ordered according to their
617 // precedence. 626 // precedence.
618 for (ConstProviderIterator provider = content_settings_providers_.begin(); 627 for (ConstProviderIterator provider = content_settings_providers_.begin();
619 provider != content_settings_providers_.end(); 628 provider != content_settings_providers_.end();
620 ++provider) { 629 ++provider) {
621 630
622 scoped_ptr<base::Value> value( 631 scoped_ptr<base::Value> value =
623 content_settings::GetContentSettingValueAndPatterns(provider->second, 632 content_settings::GetContentSettingValueAndPatterns(provider->second,
624 primary_url, 633 primary_url,
625 secondary_url, 634 secondary_url,
626 content_type, 635 content_type,
627 resource_identifier, 636 resource_identifier,
628 is_off_the_record_, 637 is_off_the_record_,
629 primary_pattern, 638 primary_pattern,
630 secondary_pattern)); 639 secondary_pattern);
631 if (value) { 640 if (value) {
632 if (info) 641 if (info)
633 info->source = kProviderNamesSourceMap[provider->first].provider_source; 642 info->source = kProviderNamesSourceMap[provider->first].provider_source;
634 return value.Pass(); 643 return value.Pass();
635 } 644 }
636 } 645 }
637 646
638 if (info) { 647 if (info) {
639 info->source = content_settings::SETTING_SOURCE_NONE; 648 info->source = content_settings::SETTING_SOURCE_NONE;
640 info->primary_pattern = ContentSettingsPattern(); 649 info->primary_pattern = ContentSettingsPattern();
641 info->secondary_pattern = ContentSettingsPattern(); 650 info->secondary_pattern = ContentSettingsPattern();
642 } 651 }
643 return scoped_ptr<base::Value>(); 652 return scoped_ptr<base::Value>();
644 } 653 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698