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 "components/content_settings/content/common/content_settings_messages.h
" | 9 #include "components/content_settings/content/common/content_settings_messages.h
" |
10 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 290 |
291 bool ContentSettingsObserver::allowImage(bool enabled_per_settings, | 291 bool ContentSettingsObserver::allowImage(bool enabled_per_settings, |
292 const WebURL& image_url) { | 292 const WebURL& image_url) { |
293 bool allow = enabled_per_settings; | 293 bool allow = enabled_per_settings; |
294 if (enabled_per_settings) { | 294 if (enabled_per_settings) { |
295 if (is_interstitial_page_) | 295 if (is_interstitial_page_) |
296 return true; | 296 return true; |
297 | 297 |
298 if (IsWhitelistedForContentSettings()) | 298 if (IsWhitelistedForContentSettings()) |
299 return true; | 299 return true; |
300 | 300 #if !defined(OS_ANDROID) |
301 if (content_setting_rules_) { | 301 if (content_setting_rules_) { |
302 GURL secondary_url(image_url); | 302 GURL secondary_url(image_url); |
303 allow = | 303 allow = |
304 GetContentSettingFromRules(content_setting_rules_->image_rules, | 304 GetContentSettingFromRules(content_setting_rules_->image_rules, |
305 render_frame()->GetWebFrame(), | 305 render_frame()->GetWebFrame(), |
306 secondary_url) != CONTENT_SETTING_BLOCK; | 306 secondary_url) != CONTENT_SETTING_BLOCK; |
307 } | 307 } |
| 308 #endif |
308 } | 309 } |
309 if (!allow) | 310 if (!allow) |
310 DidBlockContentType(CONTENT_SETTINGS_TYPE_IMAGES); | 311 DidBlockContentType(CONTENT_SETTINGS_TYPE_IMAGES); |
311 return allow; | 312 return allow; |
312 } | 313 } |
313 | 314 |
314 bool ContentSettingsObserver::allowIndexedDB(const WebString& name, | 315 bool ContentSettingsObserver::allowIndexedDB(const WebString& name, |
315 const WebSecurityOrigin& origin) { | 316 const WebSecurityOrigin& origin) { |
316 WebFrame* frame = render_frame()->GetWebFrame(); | 317 WebFrame* frame = render_frame()->GetWebFrame(); |
317 if (frame->getSecurityOrigin().isUnique() || | 318 if (frame->getSecurityOrigin().isUnique() || |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 | 624 |
624 // If the scheme is file:, an empty file name indicates a directory listing, | 625 // If the scheme is file:, an empty file name indicates a directory listing, |
625 // which requires JavaScript to function properly. | 626 // which requires JavaScript to function properly. |
626 if (base::EqualsASCII(protocol, url::kFileScheme)) { | 627 if (base::EqualsASCII(protocol, url::kFileScheme)) { |
627 return document_url.SchemeIs(url::kFileScheme) && | 628 return document_url.SchemeIs(url::kFileScheme) && |
628 document_url.ExtractFileName().empty(); | 629 document_url.ExtractFileName().empty(); |
629 } | 630 } |
630 | 631 |
631 return false; | 632 return false; |
632 } | 633 } |
OLD | NEW |