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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 const extensions::Extension* extension = GetExtension(origin); | 656 const extensions::Extension* extension = GetExtension(origin); |
657 return extension && extension->is_platform_app(); | 657 return extension && extension->is_platform_app(); |
658 #else | 658 #else |
659 return false; | 659 return false; |
660 #endif | 660 #endif |
661 } | 661 } |
662 | 662 |
663 #if defined(ENABLE_EXTENSIONS) | 663 #if defined(ENABLE_EXTENSIONS) |
664 const extensions::Extension* ContentSettingsObserver::GetExtension( | 664 const extensions::Extension* ContentSettingsObserver::GetExtension( |
665 const WebSecurityOrigin& origin) const { | 665 const WebSecurityOrigin& origin) const { |
666 if (!EqualsASCII(origin.protocol(), extensions::kExtensionScheme)) | 666 if (!base::EqualsASCII(origin.protocol(), extensions::kExtensionScheme)) |
667 return NULL; | 667 return NULL; |
668 | 668 |
669 const std::string extension_id = origin.host().utf8().data(); | 669 const std::string extension_id = origin.host().utf8().data(); |
670 if (!extension_dispatcher_->IsExtensionActive(extension_id)) | 670 if (!extension_dispatcher_->IsExtensionActive(extension_id)) |
671 return NULL; | 671 return NULL; |
672 | 672 |
673 return extension_dispatcher_->extensions()->GetByID(extension_id); | 673 return extension_dispatcher_->extensions()->GetByID(extension_id); |
674 } | 674 } |
675 #endif | 675 #endif |
676 | 676 |
(...skipping 13 matching lines...) Expand all Loading... |
690 | 690 |
691 bool ContentSettingsObserver::IsWhitelistedForContentSettings( | 691 bool ContentSettingsObserver::IsWhitelistedForContentSettings( |
692 const WebSecurityOrigin& origin, | 692 const WebSecurityOrigin& origin, |
693 const GURL& document_url) { | 693 const GURL& document_url) { |
694 if (document_url == GURL(content::kUnreachableWebDataURL)) | 694 if (document_url == GURL(content::kUnreachableWebDataURL)) |
695 return true; | 695 return true; |
696 | 696 |
697 if (origin.isUnique()) | 697 if (origin.isUnique()) |
698 return false; // Uninitialized document? | 698 return false; // Uninitialized document? |
699 | 699 |
700 if (EqualsASCII(origin.protocol(), content::kChromeUIScheme)) | 700 if (base::EqualsASCII(origin.protocol(), content::kChromeUIScheme)) |
701 return true; // Browser UI elements should still work. | 701 return true; // Browser UI elements should still work. |
702 | 702 |
703 if (EqualsASCII(origin.protocol(), content::kChromeDevToolsScheme)) | 703 if (base::EqualsASCII(origin.protocol(), content::kChromeDevToolsScheme)) |
704 return true; // DevTools UI elements should still work. | 704 return true; // DevTools UI elements should still work. |
705 | 705 |
706 #if defined(ENABLE_EXTENSIONS) | 706 #if defined(ENABLE_EXTENSIONS) |
707 if (EqualsASCII(origin.protocol(), extensions::kExtensionScheme)) | 707 if (base::EqualsASCII(origin.protocol(), extensions::kExtensionScheme)) |
708 return true; | 708 return true; |
709 #endif | 709 #endif |
710 | 710 |
711 // TODO(creis, fsamuel): Remove this once the concept of swapped out | 711 // TODO(creis, fsamuel): Remove this once the concept of swapped out |
712 // RenderFrames goes away. | 712 // RenderFrames goes away. |
713 if (document_url == GURL(content::kSwappedOutURL)) | 713 if (document_url == GURL(content::kSwappedOutURL)) |
714 return true; | 714 return true; |
715 | 715 |
716 // If the scheme is file:, an empty file name indicates a directory listing, | 716 // If the scheme is file:, an empty file name indicates a directory listing, |
717 // which requires JavaScript to function properly. | 717 // which requires JavaScript to function properly. |
718 if (EqualsASCII(origin.protocol(), url::kFileScheme)) { | 718 if (base::EqualsASCII(origin.protocol(), url::kFileScheme)) { |
719 return document_url.SchemeIs(url::kFileScheme) && | 719 return document_url.SchemeIs(url::kFileScheme) && |
720 document_url.ExtractFileName().empty(); | 720 document_url.ExtractFileName().empty(); |
721 } | 721 } |
722 | 722 |
723 return false; | 723 return false; |
724 } | 724 } |
OLD | NEW |