bool* no_javascript_access) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ if (!atom::Browser::Get()->ShouldAllowNavigation(target_url.spec()))
+ return false;
+
if (IsRendererSandboxed(render_process_id)) {
*no_javascript_access = false;
return true;
return false;
}
+bool AtomBrowserClient::ShouldAllowOpenURL(content::SiteInstance* site_instance, const GURL& url) {
+ return atom::Browser::Get()->ShouldAllowNavigation(url.spec());
+}
+
void AtomBrowserClient::GetAdditionalAllowedSchemesForFileSystem(
std::vector<std::string>* additional_schemes) {
auto schemes_list = api::GetStandardSchemes();
#include "atom/common/api/api_messages.h"
#include "base/logging.h"
+#include "common/string_utils.h"
#include "tizen/browser/tizen_browser_parts.h"
namespace tizen {
const char* kDefaultCSPRule =
"default-src *; script-src 'self'; style-src 'self'; object-src 'none';";
+static bool ProcessWellKnownScheme(const std::string& url) {
+ if (common::utils::StartsWith(url, "file:") ||
+ common::utils::StartsWith(url, "app:") ||
+ common::utils::StartsWith(url, "data:") ||
+ common::utils::StartsWith(url, "http:") ||
+ common::utils::StartsWith(url, "https:") ||
+ common::utils::StartsWith(url, "widget:") ||
+ common::utils::StartsWith(url, "about:") ||
+ common::utils::StartsWith(url, "blob:")) {
+ return false;
+ }
+
+ std::unique_ptr<common::AppControl> request(
+ common::AppControl::MakeAppcontrolFromURL(url));
+ if (request.get() == NULL || !request->LaunchRequest()) {
+ LOG(ERROR) << "Fail to send appcontrol request: " << url;
+ }
+
+ // Should return true, to stop the WebEngine progress step about this URL
+ return true;
+}
+
} // namespace
TizenBrowserParts::TizenBrowserParts()
rvh->Send(new WrtViewMsg_ResumeScheduledTasks(rvh->GetRoutingID()));
}
+bool TizenBrowserParts::ShouldAllowNavigation(const std::string &url) {
+ // scheme handling
+ // except(file , http, https, app) pass to appcontrol and return false
+ if (ProcessWellKnownScheme(url)) {
+ return false;
+ }
+
+ // send launch request for blocked URL to guarrenty backward-compatibility.
+ if (resource_manager_->AllowNavigation(url)) {
+ return true;
+ } else {
+ LOG(ERROR) << "URL is blocked. send launch request for URL : " << url;
+ std::unique_ptr<common::AppControl> request(
+ common::AppControl::MakeAppcontrolFromURL(url));
+ if (request.get() == NULL || !request->LaunchRequest()) {
+ LOG(ERROR) << "Fail to send appcontrol request: " << url;
+ }
+ return false;
+ }
}
+
+} // namespace tizen