Index: chrome_frame/chrome_frame_delegate.cc |
=================================================================== |
--- chrome_frame/chrome_frame_delegate.cc (revision 68604) |
+++ chrome_frame/chrome_frame_delegate.cc (working copy) |
@@ -4,6 +4,10 @@ |
#include "chrome_frame/chrome_frame_delegate.h" |
+#include "base/utf_string_conversions.h" |
+#include "chrome/common/url_constants.h" |
+#include "chrome_frame/utils.h" |
+ |
bool ChromeFrameDelegateImpl::IsTabMessage(const IPC::Message& message, |
int* tab_handle) { |
bool is_tab_message = true; |
@@ -75,3 +79,44 @@ |
IPC_MESSAGE_HANDLER(AutomationMsg_CloseExternalTab, OnCloseTab) |
IPC_END_MESSAGE_MAP() |
} |
+ |
+ |
+// NavigationConstraintsImpl method definitions. |
+bool NavigationConstraintsImpl::AllowUnsafeUrls() { |
+ // No sanity checks if unsafe URLs are allowed |
+ return GetConfigBool(false, kAllowUnsafeURLs); |
+} |
+ |
+bool NavigationConstraintsImpl::IsSchemeAllowed(const GURL& url) { |
+ if (url.is_empty()) |
+ return false; |
+ |
+ if (!url.is_valid()) |
+ return false; |
+ |
+ if (url.SchemeIs(chrome::kHttpScheme) || |
+ url.SchemeIs(chrome::kHttpsScheme)) |
+ return true; |
+ |
+ // Additional checking for view-source. Allow only http and https |
+ // URLs in view source. |
+ if (url.SchemeIs(chrome::kViewSourceScheme)) { |
+ GURL sub_url(url.path()); |
+ if (sub_url.SchemeIs(chrome::kHttpScheme) || |
+ sub_url.SchemeIs(chrome::kHttpsScheme)) |
+ return true; |
+ } |
+ |
+ // Allow only about:blank or about:version |
+ if (url.SchemeIs(chrome::kAboutScheme)) { |
+ if (LowerCaseEqualsASCII(url.spec(), chrome::kAboutBlankURL) || |
+ LowerCaseEqualsASCII(url.spec(), chrome::kAboutVersionURL)) { |
+ return true; |
+ } |
+ } |
+ return false; |
+} |
+ |
+bool NavigationConstraintsImpl::IsZoneAllowed(const GURL& url) { |
+ return true; |
+} |