Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: chrome/renderer/content_settings_observer.cc

Issue 1906533002: Add 'autoplay' content settings and expose it to Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 SendInsecureContentSignal(INSECURE_CONTENT_RUN_SWF); 479 SendInsecureContentSignal(INSECURE_CONTENT_RUN_SWF);
480 480
481 if (!allow_running_insecure_content_ && !allowed_per_settings) { 481 if (!allow_running_insecure_content_ && !allowed_per_settings) {
482 DidBlockContentType(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, origin.host()); 482 DidBlockContentType(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, origin.host());
483 return false; 483 return false;
484 } 484 }
485 485
486 return true; 486 return true;
487 } 487 }
488 488
489 bool ContentSettingsObserver::allowAutoplay(bool default_value) {
490 if (!content_setting_rules_)
491 return default_value;
492
493 WebFrame* frame = render_frame()->GetWebFrame();
494 return GetContentSettingFromRules(
495 content_setting_rules_->autoplay_rules, frame,
496 blink::WebStringToGURL(
497 frame->document().getSecurityOrigin().toString())) ==
raymes 2016/04/21 04:01:56 Resolving content settings this way isn't great be
Bernhard Bauer 2016/04/21 08:20:44 Hm... it might be possible to make sure that the l
498 CONTENT_SETTING_ALLOW;
499 }
500
489 void ContentSettingsObserver::didUseKeygen() { 501 void ContentSettingsObserver::didUseKeygen() {
490 WebFrame* frame = render_frame()->GetWebFrame(); 502 WebFrame* frame = render_frame()->GetWebFrame();
491 Send(new ChromeViewHostMsg_DidUseKeygen( 503 Send(new ChromeViewHostMsg_DidUseKeygen(
492 routing_id(), 504 routing_id(),
493 blink::WebStringToGURL(frame->getSecurityOrigin().toString()))); 505 blink::WebStringToGURL(frame->getSecurityOrigin().toString())));
494 } 506 }
495 507
496 void ContentSettingsObserver::didNotAllowPlugins() { 508 void ContentSettingsObserver::didNotAllowPlugins() {
497 DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS); 509 DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS);
498 } 510 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 623
612 // If the scheme is file:, an empty file name indicates a directory listing, 624 // If the scheme is file:, an empty file name indicates a directory listing,
613 // which requires JavaScript to function properly. 625 // which requires JavaScript to function properly.
614 if (base::EqualsASCII(protocol, url::kFileScheme)) { 626 if (base::EqualsASCII(protocol, url::kFileScheme)) {
615 return document_url.SchemeIs(url::kFileScheme) && 627 return document_url.SchemeIs(url::kFileScheme) &&
616 document_url.ExtractFileName().empty(); 628 document_url.ExtractFileName().empty();
617 } 629 }
618 630
619 return false; 631 return false;
620 } 632 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698