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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/content_settings/content_settings_utils.h" | 21 #include "chrome/browser/content_settings/content_settings_utils.h" |
22 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
23 #include "chrome/browser/prefs/pref_service.h" | 23 #include "chrome/browser/prefs/pref_service.h" |
24 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/common/content_settings_pattern.h" | 26 #include "chrome/common/content_settings_pattern.h" |
27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
28 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
29 #include "content/browser/browser_thread.h" | 29 #include "content/browser/browser_thread.h" |
30 #include "content/browser/user_metrics.h" | 30 #include "content/browser/user_metrics.h" |
31 #include "content/common/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
32 #include "content/public/browser/notification_source.h" | 32 #include "content/public/browser/notification_source.h" |
33 #include "content/public/common/content_switches.h" | 33 #include "content/public/common/content_switches.h" |
34 #include "googleurl/src/gurl.h" | 34 #include "googleurl/src/gurl.h" |
35 #include "net/base/net_errors.h" | 35 #include "net/base/net_errors.h" |
36 #include "net/base/static_cookie_policy.h" | 36 #include "net/base/static_cookie_policy.h" |
37 | 37 |
38 namespace { | 38 namespace { |
39 | 39 |
40 // Returns true if we should allow all content types for this URL. This is | 40 // Returns true if we should allow all content types for this URL. This is |
41 // true for various internal objects like chrome:// URLs, so UI and other | 41 // true for various internal objects like chrome:// URLs, so UI and other |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 | 473 |
474 void HostContentSettingsMap::OnContentSettingChanged( | 474 void HostContentSettingsMap::OnContentSettingChanged( |
475 ContentSettingsPattern primary_pattern, | 475 ContentSettingsPattern primary_pattern, |
476 ContentSettingsPattern secondary_pattern, | 476 ContentSettingsPattern secondary_pattern, |
477 ContentSettingsType content_type, | 477 ContentSettingsType content_type, |
478 std::string resource_identifier) { | 478 std::string resource_identifier) { |
479 const ContentSettingsDetails details(primary_pattern, | 479 const ContentSettingsDetails details(primary_pattern, |
480 secondary_pattern, | 480 secondary_pattern, |
481 content_type, | 481 content_type, |
482 resource_identifier); | 482 resource_identifier); |
483 NotificationService::current()->Notify( | 483 content::NotificationService::current()->Notify( |
484 chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, | 484 chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, |
485 content::Source<HostContentSettingsMap>(this), | 485 content::Source<HostContentSettingsMap>(this), |
486 content::Details<const ContentSettingsDetails>(&details)); | 486 content::Details<const ContentSettingsDetails>(&details)); |
487 } | 487 } |
488 | 488 |
489 void HostContentSettingsMap::Observe( | 489 void HostContentSettingsMap::Observe( |
490 int type, | 490 int type, |
491 const content::NotificationSource& source, | 491 const content::NotificationSource& source, |
492 const content::NotificationDetails& details) { | 492 const content::NotificationDetails& details) { |
493 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 493 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 ContentSettingsPattern wildcard = ContentSettingsPattern::Wildcard(); | 561 ContentSettingsPattern wildcard = ContentSettingsPattern::Wildcard(); |
562 while (rule_iterator->HasNext()) { | 562 while (rule_iterator->HasNext()) { |
563 const content_settings::Rule& rule = rule_iterator->Next(); | 563 const content_settings::Rule& rule = rule_iterator->Next(); |
564 settings->push_back(PatternSettingSourceTuple( | 564 settings->push_back(PatternSettingSourceTuple( |
565 rule.primary_pattern, rule.secondary_pattern, | 565 rule.primary_pattern, rule.secondary_pattern, |
566 content_settings::ValueToContentSetting(rule.value.get()), | 566 content_settings::ValueToContentSetting(rule.value.get()), |
567 kProviderNames[provider_type], | 567 kProviderNames[provider_type], |
568 incognito)); | 568 incognito)); |
569 } | 569 } |
570 } | 570 } |
OLD | NEW |