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/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" |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 setting == CONTENT_SETTING_BLOCK) { | 493 setting == CONTENT_SETTING_BLOCK) { |
494 return false; | 494 return false; |
495 } | 495 } |
496 | 496 |
497 // We don't support ALLOW for media default setting. | 497 // We don't support ALLOW for media default setting. |
498 if (content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM && | 498 if (content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM && |
499 setting == CONTENT_SETTING_ALLOW) { | 499 setting == CONTENT_SETTING_ALLOW) { |
500 return false; | 500 return false; |
501 } | 501 } |
502 | 502 |
503 #if defined(OS_ANDROID) | |
504 // App banners store a dictionary. | 503 // App banners store a dictionary. |
505 if (content_type == CONTENT_SETTINGS_TYPE_APP_BANNER) | 504 if (content_type == CONTENT_SETTINGS_TYPE_APP_BANNER) |
506 return false; | 505 return false; |
507 #endif | |
508 | 506 |
509 // DEFAULT, ALLOW and BLOCK are always allowed. | 507 // DEFAULT, ALLOW and BLOCK are always allowed. |
510 if (setting == CONTENT_SETTING_DEFAULT || | 508 if (setting == CONTENT_SETTING_DEFAULT || |
511 setting == CONTENT_SETTING_ALLOW || | 509 setting == CONTENT_SETTING_ALLOW || |
512 setting == CONTENT_SETTING_BLOCK) { | 510 setting == CONTENT_SETTING_BLOCK) { |
513 return true; | 511 return true; |
514 } | 512 } |
515 switch (content_type) { | 513 switch (content_type) { |
516 case CONTENT_SETTINGS_TYPE_COOKIES: | 514 case CONTENT_SETTINGS_TYPE_COOKIES: |
517 return setting == CONTENT_SETTING_SESSION_ONLY; | 515 return setting == CONTENT_SETTING_SESSION_ONLY; |
(...skipping 17 matching lines...) Expand all Loading... |
535 } | 533 } |
536 | 534 |
537 // static | 535 // static |
538 bool HostContentSettingsMap::ContentTypeHasCompoundValue( | 536 bool HostContentSettingsMap::ContentTypeHasCompoundValue( |
539 ContentSettingsType type) { | 537 ContentSettingsType type) { |
540 // Values for content type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, | 538 // Values for content type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, |
541 // CONTENT_SETTINGS_TYPE_MEDIASTREAM, and | 539 // CONTENT_SETTINGS_TYPE_MEDIASTREAM, and |
542 // CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS are of type dictionary/map. | 540 // CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS are of type dictionary/map. |
543 // Compound types like dictionaries can't be mapped to the type | 541 // Compound types like dictionaries can't be mapped to the type |
544 // |ContentSetting|. | 542 // |ContentSetting|. |
545 #if defined(OS_ANDROID) | |
546 if (type == CONTENT_SETTINGS_TYPE_APP_BANNER) | 543 if (type == CONTENT_SETTINGS_TYPE_APP_BANNER) |
547 return true; | 544 return true; |
548 #endif | |
549 | 545 |
550 return (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE || | 546 return (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE || |
551 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM || | 547 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM || |
552 type == CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS); | 548 type == CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS); |
553 } | 549 } |
554 | 550 |
555 void HostContentSettingsMap::OnContentSettingChanged( | 551 void HostContentSettingsMap::OnContentSettingChanged( |
556 const ContentSettingsPattern& primary_pattern, | 552 const ContentSettingsPattern& primary_pattern, |
557 const ContentSettingsPattern& secondary_pattern, | 553 const ContentSettingsPattern& secondary_pattern, |
558 ContentSettingsType content_type, | 554 ContentSettingsType content_type, |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 } | 742 } |
747 } | 743 } |
748 | 744 |
749 if (info) { | 745 if (info) { |
750 info->source = content_settings::SETTING_SOURCE_NONE; | 746 info->source = content_settings::SETTING_SOURCE_NONE; |
751 info->primary_pattern = ContentSettingsPattern(); | 747 info->primary_pattern = ContentSettingsPattern(); |
752 info->secondary_pattern = ContentSettingsPattern(); | 748 info->secondary_pattern = ContentSettingsPattern(); |
753 } | 749 } |
754 return scoped_ptr<base::Value>(); | 750 return scoped_ptr<base::Value>(); |
755 } | 751 } |
OLD | NEW |