Chromium Code Reviews| 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 DidBlockContentType(settings_type, base::string16()); | |
| 204 } | |
| 205 | |
| 206 void ContentSettingsObserver::DidBlockContentType( | |
| 207 ContentSettingsType settings_type, | |
| 208 const base::string16& details) { | |
| 203 if (!content_blocked_[settings_type]) { | 209 if (!content_blocked_[settings_type]) { |
|
Bernhard Bauer
2014/12/08 09:21:44
This check means you are only going to send this m
Will Harris
2014/12/08 21:11:46
send this IPC multiple times if details is not emp
| |
| 204 content_blocked_[settings_type] = true; | 210 content_blocked_[settings_type] = true; |
| 205 Send(new ChromeViewHostMsg_ContentBlocked(routing_id(), settings_type)); | 211 Send(new ChromeViewHostMsg_ContentBlocked(routing_id(), settings_type, |
| 212 details)); | |
| 206 } | 213 } |
| 207 } | 214 } |
| 208 | 215 |
| 209 bool ContentSettingsObserver::OnMessageReceived(const IPC::Message& message) { | 216 bool ContentSettingsObserver::OnMessageReceived(const IPC::Message& message) { |
| 210 bool handled = true; | 217 bool handled = true; |
| 211 IPC_BEGIN_MESSAGE_MAP(ContentSettingsObserver, message) | 218 IPC_BEGIN_MESSAGE_MAP(ContentSettingsObserver, message) |
| 212 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAsInterstitial, OnSetAsInterstitial) | 219 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAsInterstitial, OnSetAsInterstitial) |
| 213 IPC_MESSAGE_HANDLER(ChromeViewMsg_NPAPINotSupported, OnNPAPINotSupported) | 220 IPC_MESSAGE_HANDLER(ChromeViewMsg_NPAPINotSupported, OnNPAPINotSupported) |
| 214 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAllowDisplayingInsecureContent, | 221 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAllowDisplayingInsecureContent, |
| 215 OnSetAllowDisplayingInsecureContent) | 222 OnSetAllowDisplayingInsecureContent) |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 715 | 722 |
| 716 // If the scheme is file:, an empty file name indicates a directory listing, | 723 // If the scheme is file:, an empty file name indicates a directory listing, |
| 717 // which requires JavaScript to function properly. | 724 // which requires JavaScript to function properly. |
| 718 if (EqualsASCII(origin.protocol(), url::kFileScheme)) { | 725 if (EqualsASCII(origin.protocol(), url::kFileScheme)) { |
| 719 return document_url.SchemeIs(url::kFileScheme) && | 726 return document_url.SchemeIs(url::kFileScheme) && |
| 720 document_url.ExtractFileName().empty(); | 727 document_url.ExtractFileName().empty(); |
| 721 } | 728 } |
| 722 | 729 |
| 723 return false; | 730 return false; |
| 724 } | 731 } |
| OLD | NEW |