| 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/renderer/content_settings_observer.h" | 5 #include "chrome/renderer/content_settings_observer.h" |
| 6 | 6 |
| 7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
| 8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
| 9 #include "content/public/renderer/navigation_state.h" | 9 #include "content/public/renderer/navigation_state.h" |
| 10 #include "content/public/renderer/render_view.h" | 10 #include "content/public/renderer/render_view.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 current_content_settings_ = settings; | 70 current_content_settings_ = settings; |
| 71 } | 71 } |
| 72 | 72 |
| 73 void ContentSettingsObserver::SetDefaultContentSettings( | 73 void ContentSettingsObserver::SetDefaultContentSettings( |
| 74 const ContentSettings& settings) { | 74 const ContentSettings& settings) { |
| 75 default_settings_ = settings; | 75 default_settings_ = settings; |
| 76 } | 76 } |
| 77 | 77 |
| 78 ContentSetting ContentSettingsObserver::GetContentSetting( | 78 ContentSetting ContentSettingsObserver::GetContentSetting( |
| 79 ContentSettingsType type) { | 79 ContentSettingsType type) { |
| 80 if (type == CONTENT_SETTINGS_TYPE_PLUGINS && | 80 // Don't call this for plug-ins. |
| 81 plugins_temporarily_allowed_) { | 81 DCHECK_NE(CONTENT_SETTINGS_TYPE_PLUGINS, type); |
| 82 return CONTENT_SETTING_ALLOW; | |
| 83 } | |
| 84 return current_content_settings_.settings[type]; | 82 return current_content_settings_.settings[type]; |
| 85 } | 83 } |
| 86 | 84 |
| 87 void ContentSettingsObserver::DidBlockContentType( | 85 void ContentSettingsObserver::DidBlockContentType( |
| 88 ContentSettingsType settings_type, | 86 ContentSettingsType settings_type, |
| 89 const std::string& resource_identifier) { | 87 const std::string& resource_identifier) { |
| 90 // Always send a message when |resource_identifier| is not empty, to tell the | 88 // Always send a message when |resource_identifier| is not empty, to tell the |
| 91 // browser which resource was blocked (otherwise the browser will only show | 89 // browser which resource was blocked (otherwise the browser will only show |
| 92 // the first resource to be blocked, and none that are blocked at a later | 90 // the first resource to be blocked, and none that are blocked at a later |
| 93 // time). | 91 // time). |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 // CONTENT_SETTING_ASK is only valid for cookies. | 288 // CONTENT_SETTING_ASK is only valid for cookies. |
| 291 return current_content_settings_.settings[settings_type] != | 289 return current_content_settings_.settings[settings_type] != |
| 292 CONTENT_SETTING_BLOCK; | 290 CONTENT_SETTING_BLOCK; |
| 293 } | 291 } |
| 294 | 292 |
| 295 void ContentSettingsObserver::ClearBlockedContentSettings() { | 293 void ContentSettingsObserver::ClearBlockedContentSettings() { |
| 296 for (size_t i = 0; i < arraysize(content_blocked_); ++i) | 294 for (size_t i = 0; i < arraysize(content_blocked_); ++i) |
| 297 content_blocked_[i] = false; | 295 content_blocked_[i] = false; |
| 298 cached_storage_permissions_.clear(); | 296 cached_storage_permissions_.clear(); |
| 299 } | 297 } |
| OLD | NEW |