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

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

Issue 27635002: Content settings for <audio> and <video>. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test fix. Created 6 years, 5 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 "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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 return false; 323 return false;
324 324
325 bool result = false; 325 bool result = false;
326 Send(new ChromeViewHostMsg_AllowIndexedDB( 326 Send(new ChromeViewHostMsg_AllowIndexedDB(
327 routing_id(), GURL(frame->document().securityOrigin().toString()), 327 routing_id(), GURL(frame->document().securityOrigin().toString()),
328 GURL(frame->top()->document().securityOrigin().toString()), 328 GURL(frame->top()->document().securityOrigin().toString()),
329 name, &result)); 329 name, &result));
330 return result; 330 return result;
331 } 331 }
332 332
333 bool ContentSettingsObserver::allowMedia(const WebURL& media_url) {
334 if (is_interstitial_page_)
335 return true;
336
337 WebFrame* frame = render_frame()->GetWebFrame();
338 if (IsWhitelistedForContentSettings(frame))
339 return true;
340
341 bool allow = true;
342 if (content_setting_rules_) {
343 GURL secondary_url(media_url);
344 allow = GetContentSettingFromRules(
345 content_setting_rules_->media_rules,
346 frame, secondary_url) != CONTENT_SETTING_BLOCK;
347 if (!allow)
348 DidBlockContentType(CONTENT_SETTINGS_TYPE_MEDIA);
349 }
350 return allow;
351 }
352
333 bool ContentSettingsObserver::allowPlugins(bool enabled_per_settings) { 353 bool ContentSettingsObserver::allowPlugins(bool enabled_per_settings) {
334 return enabled_per_settings; 354 return enabled_per_settings;
335 } 355 }
336 356
337 bool ContentSettingsObserver::allowScript(bool enabled_per_settings) { 357 bool ContentSettingsObserver::allowScript(bool enabled_per_settings) {
338 if (!enabled_per_settings) 358 if (!enabled_per_settings)
339 return false; 359 return false;
340 if (is_interstitial_page_) 360 if (is_interstitial_page_)
341 return true; 361 return true;
342 362
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 724
705 // If the scheme is file:, an empty file name indicates a directory listing, 725 // If the scheme is file:, an empty file name indicates a directory listing,
706 // which requires JavaScript to function properly. 726 // which requires JavaScript to function properly.
707 if (EqualsASCII(origin.protocol(), url::kFileScheme)) { 727 if (EqualsASCII(origin.protocol(), url::kFileScheme)) {
708 return document_url.SchemeIs(url::kFileScheme) && 728 return document_url.SchemeIs(url::kFileScheme) &&
709 document_url.ExtractFileName().empty(); 729 document_url.ExtractFileName().empty();
710 } 730 }
711 731
712 return false; 732 return false;
713 } 733 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698