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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 bool ContentSettingsObserver::allowWriteToClipboard(bool default_value) { | 423 bool ContentSettingsObserver::allowWriteToClipboard(bool default_value) { |
424 bool allowed = false; | 424 bool allowed = false; |
425 #if defined(ENABLE_EXTENSIONS) | 425 #if defined(ENABLE_EXTENSIONS) |
426 WebFrame* frame = render_frame()->GetWebFrame(); | 426 WebFrame* frame = render_frame()->GetWebFrame(); |
427 Send(new ChromeViewHostMsg_CanTriggerClipboardWrite( | 427 Send(new ChromeViewHostMsg_CanTriggerClipboardWrite( |
428 GURL(frame->document().securityOrigin().toString()), &allowed)); | 428 GURL(frame->document().securityOrigin().toString()), &allowed)); |
429 #endif | 429 #endif |
430 return allowed; | 430 return allowed; |
431 } | 431 } |
432 | 432 |
433 bool ContentSettingsObserver::allowWebComponents(bool default_value) { | |
434 if (default_value) | |
435 return true; | |
436 | |
437 WebFrame* frame = render_frame()->GetWebFrame(); | |
438 WebSecurityOrigin origin = frame->document().securityOrigin(); | |
439 if (EqualsASCII(origin.protocol(), content::kChromeUIScheme)) | |
440 return true; | |
441 | |
442 if (const extensions::Extension* extension = GetExtension(origin)) { | |
443 if (extension->permissions_data()->HasAPIPermission( | |
444 APIPermission::kExperimental)) | |
445 return true; | |
446 } | |
447 | |
448 return false; | |
449 } | |
450 | |
451 bool ContentSettingsObserver::allowMutationEvents(bool default_value) { | 433 bool ContentSettingsObserver::allowMutationEvents(bool default_value) { |
452 WebFrame* frame = render_frame()->GetWebFrame(); | 434 WebFrame* frame = render_frame()->GetWebFrame(); |
453 WebSecurityOrigin origin = frame->document().securityOrigin(); | 435 WebSecurityOrigin origin = frame->document().securityOrigin(); |
454 const extensions::Extension* extension = GetExtension(origin); | 436 const extensions::Extension* extension = GetExtension(origin); |
455 if (extension && extension->is_platform_app()) | 437 if (extension && extension->is_platform_app()) |
456 return false; | 438 return false; |
457 return default_value; | 439 return default_value; |
458 } | 440 } |
459 | 441 |
460 bool ContentSettingsObserver::allowPushState() { | 442 bool ContentSettingsObserver::allowPushState() { |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 | 690 |
709 // If the scheme is file:, an empty file name indicates a directory listing, | 691 // If the scheme is file:, an empty file name indicates a directory listing, |
710 // which requires JavaScript to function properly. | 692 // which requires JavaScript to function properly. |
711 if (EqualsASCII(origin.protocol(), url::kFileScheme)) { | 693 if (EqualsASCII(origin.protocol(), url::kFileScheme)) { |
712 return document_url.SchemeIs(url::kFileScheme) && | 694 return document_url.SchemeIs(url::kFileScheme) && |
713 document_url.ExtractFileName().empty(); | 695 document_url.ExtractFileName().empty(); |
714 } | 696 } |
715 | 697 |
716 return false; | 698 return false; |
717 } | 699 } |
OLD | NEW |