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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 bool ContentSettingsObserver::IsPluginTemporarilyAllowed( | 191 bool ContentSettingsObserver::IsPluginTemporarilyAllowed( |
| 192 const std::string& identifier) { | 192 const std::string& identifier) { |
| 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( |
|
Lei Zhang
2014/12/05 22:18:05
This method can just call the one below.
Will Harris
2014/12/08 00:21:11
Done.
| |
| 202 ContentSettingsType settings_type) { | 202 ContentSettingsType settings_type) { |
| 203 if (!content_blocked_[settings_type]) { | 203 if (!content_blocked_[settings_type]) { |
| 204 content_blocked_[settings_type] = true; | 204 content_blocked_[settings_type] = true; |
| 205 Send(new ChromeViewHostMsg_ContentBlocked(routing_id(), settings_type)); | 205 Send(new ChromeViewHostMsg_ContentBlocked(routing_id(), settings_type, |
| 206 base::string16())); | |
| 206 } | 207 } |
| 207 } | 208 } |
| 208 | 209 |
| 210 void ContentSettingsObserver::DidBlockContentType( | |
| 211 ContentSettingsType settings_type, | |
| 212 const base::string16& details) { | |
| 213 if (!content_blocked_[settings_type]) { | |
| 214 content_blocked_[settings_type] = true; | |
| 215 Send(new ChromeViewHostMsg_ContentBlocked(routing_id(), settings_type, | |
| 216 details)); | |
| 217 } | |
| 218 } | |
| 219 | |
| 209 bool ContentSettingsObserver::OnMessageReceived(const IPC::Message& message) { | 220 bool ContentSettingsObserver::OnMessageReceived(const IPC::Message& message) { |
| 210 bool handled = true; | 221 bool handled = true; |
| 211 IPC_BEGIN_MESSAGE_MAP(ContentSettingsObserver, message) | 222 IPC_BEGIN_MESSAGE_MAP(ContentSettingsObserver, message) |
| 212 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAsInterstitial, OnSetAsInterstitial) | 223 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAsInterstitial, OnSetAsInterstitial) |
| 213 IPC_MESSAGE_HANDLER(ChromeViewMsg_NPAPINotSupported, OnNPAPINotSupported) | 224 IPC_MESSAGE_HANDLER(ChromeViewMsg_NPAPINotSupported, OnNPAPINotSupported) |
| 214 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAllowDisplayingInsecureContent, | 225 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAllowDisplayingInsecureContent, |
| 215 OnSetAllowDisplayingInsecureContent) | 226 OnSetAllowDisplayingInsecureContent) |
| 216 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAllowRunningInsecureContent, | 227 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAllowRunningInsecureContent, |
| 217 OnSetAllowRunningInsecureContent) | 228 OnSetAllowRunningInsecureContent) |
| 218 IPC_MESSAGE_HANDLER(ChromeViewMsg_ReloadFrame, OnReloadFrame); | 229 IPC_MESSAGE_HANDLER(ChromeViewMsg_ReloadFrame, OnReloadFrame); |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 715 | 726 |
| 716 // If the scheme is file:, an empty file name indicates a directory listing, | 727 // If the scheme is file:, an empty file name indicates a directory listing, |
| 717 // which requires JavaScript to function properly. | 728 // which requires JavaScript to function properly. |
| 718 if (EqualsASCII(origin.protocol(), url::kFileScheme)) { | 729 if (EqualsASCII(origin.protocol(), url::kFileScheme)) { |
| 719 return document_url.SchemeIs(url::kFileScheme) && | 730 return document_url.SchemeIs(url::kFileScheme) && |
| 720 document_url.ExtractFileName().empty(); | 731 document_url.ExtractFileName().empty(); |
| 721 } | 732 } |
| 722 | 733 |
| 723 return false; | 734 return false; |
| 724 } | 735 } |
| OLD | NEW |