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 "chrome/renderer/content_settings_observer.h" | 5 #include "chrome/renderer/content_settings_observer.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // If the empty string is in here, it means all plug-ins are allowed. | 193 // If the empty string is in here, it means all plug-ins are allowed. |
194 // TODO(bauerb): Remove this once we only pass in explicit identifiers. | 194 // TODO(bauerb): Remove this once we only pass in explicit identifiers. |
195 return (temporarily_allowed_plugins_.find(identifier) != | 195 return (temporarily_allowed_plugins_.find(identifier) != |
196 temporarily_allowed_plugins_.end()) || | 196 temporarily_allowed_plugins_.end()) || |
197 (temporarily_allowed_plugins_.find(std::string()) != | 197 (temporarily_allowed_plugins_.find(std::string()) != |
198 temporarily_allowed_plugins_.end()); | 198 temporarily_allowed_plugins_.end()); |
199 } | 199 } |
200 | 200 |
201 void ContentSettingsObserver::DidBlockContentType( | 201 void ContentSettingsObserver::DidBlockContentType( |
202 ContentSettingsType settings_type) { | 202 ContentSettingsType settings_type) { |
203 if (!content_blocked_[settings_type]) { | 203 DidBlockContentType(settings_type, base::string16()); |
| 204 } |
| 205 |
| 206 void ContentSettingsObserver::DidBlockContentType( |
| 207 ContentSettingsType settings_type, |
| 208 const base::string16& details) { |
| 209 // Send multiple ContentBlocked messages if details are provided. |
| 210 if (!content_blocked_[settings_type] || !details.empty()) { |
204 content_blocked_[settings_type] = true; | 211 content_blocked_[settings_type] = true; |
205 Send(new ChromeViewHostMsg_ContentBlocked(routing_id(), settings_type)); | 212 Send(new ChromeViewHostMsg_ContentBlocked(routing_id(), settings_type, |
| 213 details)); |
206 } | 214 } |
207 } | 215 } |
208 | 216 |
209 bool ContentSettingsObserver::OnMessageReceived(const IPC::Message& message) { | 217 bool ContentSettingsObserver::OnMessageReceived(const IPC::Message& message) { |
210 bool handled = true; | 218 bool handled = true; |
211 IPC_BEGIN_MESSAGE_MAP(ContentSettingsObserver, message) | 219 IPC_BEGIN_MESSAGE_MAP(ContentSettingsObserver, message) |
212 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAsInterstitial, OnSetAsInterstitial) | 220 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAsInterstitial, OnSetAsInterstitial) |
213 IPC_MESSAGE_HANDLER(ChromeViewMsg_NPAPINotSupported, OnNPAPINotSupported) | 221 IPC_MESSAGE_HANDLER(ChromeViewMsg_NPAPINotSupported, OnNPAPINotSupported) |
214 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAllowDisplayingInsecureContent, | 222 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAllowDisplayingInsecureContent, |
215 OnSetAllowDisplayingInsecureContent) | 223 OnSetAllowDisplayingInsecureContent) |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 | 723 |
716 // If the scheme is file:, an empty file name indicates a directory listing, | 724 // If the scheme is file:, an empty file name indicates a directory listing, |
717 // which requires JavaScript to function properly. | 725 // which requires JavaScript to function properly. |
718 if (EqualsASCII(origin.protocol(), url::kFileScheme)) { | 726 if (EqualsASCII(origin.protocol(), url::kFileScheme)) { |
719 return document_url.SchemeIs(url::kFileScheme) && | 727 return document_url.SchemeIs(url::kFileScheme) && |
720 document_url.ExtractFileName().empty(); | 728 document_url.ExtractFileName().empty(); |
721 } | 729 } |
722 | 730 |
723 return false; | 731 return false; |
724 } | 732 } |
OLD | NEW |