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 "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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 frame->top()->securityOrigin().isUnique()) | 342 frame->top()->securityOrigin().isUnique()) |
| 343 return false; | 343 return false; |
| 344 | 344 |
| 345 bool result = false; | 345 bool result = false; |
| 346 Send(new ChromeViewHostMsg_AllowIndexedDB( | 346 Send(new ChromeViewHostMsg_AllowIndexedDB( |
| 347 routing_id(), GURL(frame->securityOrigin().toString()), | 347 routing_id(), GURL(frame->securityOrigin().toString()), |
| 348 GURL(frame->top()->securityOrigin().toString()), name, &result)); | 348 GURL(frame->top()->securityOrigin().toString()), name, &result)); |
| 349 return result; | 349 return result; |
| 350 } | 350 } |
| 351 | 351 |
| 352 bool ContentSettingsObserver::allowMediaAutoplay(bool hidden) { | |
| 353 if (!content_setting_rules_) | |
| 354 return true; | |
| 355 | |
| 356 WebFrame* frame = render_frame()->GetWebFrame(); | |
| 357 const ContentSetting setting = GetContentSettingFromRules( | |
| 358 content_setting_rules_->media_autoplay_rules, frame, | |
| 359 GURL(frame->document().securityOrigin().toString())); | |
| 360 | |
| 361 return setting == CONTENT_SETTING_ALLOW || | |
| 362 (setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT && !hidden); | |
|
philipj_slow
2015/10/23 12:17:30
Oh... so "important content" actually means anythi
DaleCurtis
2015/10/23 19:21:27
Currently and as planned yes. There are discussion
| |
| 363 } | |
| 364 | |
| 352 bool ContentSettingsObserver::allowPlugins(bool enabled_per_settings) { | 365 bool ContentSettingsObserver::allowPlugins(bool enabled_per_settings) { |
| 353 return enabled_per_settings; | 366 return enabled_per_settings; |
| 354 } | 367 } |
| 355 | 368 |
| 356 bool ContentSettingsObserver::allowScript(bool enabled_per_settings) { | 369 bool ContentSettingsObserver::allowScript(bool enabled_per_settings) { |
| 357 if (!enabled_per_settings) | 370 if (!enabled_per_settings) |
| 358 return false; | 371 return false; |
| 359 if (is_interstitial_page_) | 372 if (is_interstitial_page_) |
| 360 return true; | 373 return true; |
| 361 | 374 |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 724 | 737 |
| 725 // If the scheme is file:, an empty file name indicates a directory listing, | 738 // If the scheme is file:, an empty file name indicates a directory listing, |
| 726 // which requires JavaScript to function properly. | 739 // which requires JavaScript to function properly. |
| 727 if (base::EqualsASCII(protocol, url::kFileScheme)) { | 740 if (base::EqualsASCII(protocol, url::kFileScheme)) { |
| 728 return document_url.SchemeIs(url::kFileScheme) && | 741 return document_url.SchemeIs(url::kFileScheme) && |
| 729 document_url.ExtractFileName().empty(); | 742 document_url.ExtractFileName().empty(); |
| 730 } | 743 } |
| 731 | 744 |
| 732 return false; | 745 return false; |
| 733 } | 746 } |
| OLD | NEW |