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 && |
Evan Stade
2011/11/17 23:07:37
as long as you are removing random parens, can you
koz (OOO until 15th September)
2011/11/17 23:37:53
Done.
| |
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 return setting == CONTENT_SETTING_ASK; |
336 case CONTENT_SETTINGS_TYPE_FULLSCREEN: | |
Evan Stade
2011/11/17 23:07:37
why is this separate from the above cases?
koz (OOO until 15th September)
2011/11/17 23:37:53
Done.
| |
337 return setting == CONTENT_SETTING_ASK; | |
330 default: | 338 default: |
331 return false; | 339 return false; |
332 } | 340 } |
333 } | 341 } |
334 | 342 |
335 void HostContentSettingsMap::OnContentSettingChanged( | 343 void HostContentSettingsMap::OnContentSettingChanged( |
336 ContentSettingsPattern primary_pattern, | 344 ContentSettingsPattern primary_pattern, |
337 ContentSettingsPattern secondary_pattern, | 345 ContentSettingsPattern secondary_pattern, |
338 ContentSettingsType content_type, | 346 ContentSettingsType content_type, |
339 std::string resource_identifier) { | 347 std::string resource_identifier) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
444 } | 452 } |
445 } | 453 } |
446 | 454 |
447 if (info) { | 455 if (info) { |
448 info->source = content_settings::SETTING_SOURCE_NONE; | 456 info->source = content_settings::SETTING_SOURCE_NONE; |
449 info->primary_pattern = ContentSettingsPattern(); | 457 info->primary_pattern = ContentSettingsPattern(); |
450 info->secondary_pattern = ContentSettingsPattern(); | 458 info->secondary_pattern = ContentSettingsPattern(); |
451 } | 459 } |
452 return NULL; | 460 return NULL; |
453 } | 461 } |
OLD | NEW |