Chromium Code Reviews| 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/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 | 303 |
| 304 // static | 304 // static |
| 305 bool HostContentSettingsMap::IsSettingAllowedForType( | 305 bool HostContentSettingsMap::IsSettingAllowedForType( |
| 306 ContentSetting setting, ContentSettingsType content_type) { | 306 ContentSetting setting, ContentSettingsType content_type) { |
| 307 // Intents content settings are hidden behind a switch for now. | 307 // Intents content settings are hidden behind a switch for now. |
| 308 if (content_type == CONTENT_SETTINGS_TYPE_INTENTS && | 308 if (content_type == CONTENT_SETTINGS_TYPE_INTENTS && |
| 309 !CommandLine::ForCurrentProcess()->HasSwitch( | 309 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 310 switches::kEnableWebIntents)) | 310 switches::kEnableWebIntents)) |
| 311 return false; | 311 return false; |
| 312 | 312 |
| 313 // BLOCK semantics are not implemented for fullscreen. | |
| 314 if (content_type == CONTENT_SETTINGS_TYPE_FULLSCREEN && | |
| 315 setting == CONTENT_SETTING_BLOCK) { | |
| 316 return false; | |
| 317 } | |
| 318 | |
| 313 // DEFAULT, ALLOW and BLOCK are always allowed. | 319 // DEFAULT, ALLOW and BLOCK are always allowed. |
| 314 if (setting == CONTENT_SETTING_DEFAULT || | 320 if (setting == CONTENT_SETTING_DEFAULT || |
| 315 setting == CONTENT_SETTING_ALLOW || | 321 setting == CONTENT_SETTING_ALLOW || |
| 316 setting == CONTENT_SETTING_BLOCK) { | 322 setting == CONTENT_SETTING_BLOCK) { |
| 317 return true; | 323 return true; |
| 318 } | 324 } |
| 319 switch (content_type) { | 325 switch (content_type) { |
| 320 case CONTENT_SETTINGS_TYPE_COOKIES: | 326 case CONTENT_SETTINGS_TYPE_COOKIES: |
| 321 return (setting == CONTENT_SETTING_SESSION_ONLY); | 327 return setting == CONTENT_SETTING_SESSION_ONLY; |
| 322 case CONTENT_SETTINGS_TYPE_PLUGINS: | 328 case CONTENT_SETTINGS_TYPE_PLUGINS: |
| 323 return (setting == CONTENT_SETTING_ASK && | 329 return setting == CONTENT_SETTING_ASK && |
| 324 CommandLine::ForCurrentProcess()->HasSwitch( | 330 CommandLine::ForCurrentProcess()->HasSwitch( |
| 325 switches::kEnableClickToPlay)); | 331 switches::kEnableClickToPlay); |
| 326 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 332 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
| 327 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 333 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| 328 case CONTENT_SETTINGS_TYPE_INTENTS: | 334 case CONTENT_SETTINGS_TYPE_INTENTS: |
| 329 return (setting == CONTENT_SETTING_ASK); | 335 case CONTENT_SETTINGS_TYPE_FULLSCREEN: |
| 336 return setting == CONTENT_SETTING_ASK; | |
|
jochen (gone - plz use gerrit)
2011/11/18 00:00:53
hum, didn't you say you've removed ask?
koz (OOO until 15th September)
2011/11/18 00:07:59
Ah, only from the UI. Done.
| |
| 330 default: | 337 default: |
| 331 return false; | 338 return false; |
| 332 } | 339 } |
| 333 } | 340 } |
| 334 | 341 |
| 335 void HostContentSettingsMap::OnContentSettingChanged( | 342 void HostContentSettingsMap::OnContentSettingChanged( |
| 336 ContentSettingsPattern primary_pattern, | 343 ContentSettingsPattern primary_pattern, |
| 337 ContentSettingsPattern secondary_pattern, | 344 ContentSettingsPattern secondary_pattern, |
| 338 ContentSettingsType content_type, | 345 ContentSettingsType content_type, |
| 339 std::string resource_identifier) { | 346 std::string resource_identifier) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 444 } | 451 } |
| 445 } | 452 } |
| 446 | 453 |
| 447 if (info) { | 454 if (info) { |
| 448 info->source = content_settings::SETTING_SOURCE_NONE; | 455 info->source = content_settings::SETTING_SOURCE_NONE; |
| 449 info->primary_pattern = ContentSettingsPattern(); | 456 info->primary_pattern = ContentSettingsPattern(); |
| 450 info->secondary_pattern = ContentSettingsPattern(); | 457 info->secondary_pattern = ContentSettingsPattern(); |
| 451 } | 458 } |
| 452 return NULL; | 459 return NULL; |
| 453 } | 460 } |
| OLD | NEW |