#include "wrt/src/base/file_utils.h"
#include "wrt/src/base/string_utils.h"
-#if BUILDFLAG(IS_TIZEN_TV)
-#include "tizen_src/chromium_impl/tizen/vconf_handle.h"
-#include "wrt/src/common/application_data.h"
-#endif
-
namespace wrt {
namespace {
}
bool NativeAppControl::SendLaunchRequest() {
-#if BUILDFLAG(IS_TIZEN_TV)
- auto& app_data = ApplicationData::GetInstance();
- std::string vconfValue = "AppID:" + app_data.app_id() + ", URL is blocked.";
- LOG(ERROR) << "key: rtc/memory/WebApp/LaunchFail value: " << vconfValue;
- VconfHandle("rtc/memory/WebApp/LaunchFail").Set(vconfValue, true);
- return true;
-#else
return (app_control_send_launch_request(app_control_, nullptr, nullptr) ==
APP_CONTROL_ERROR_NONE);
-#endif
}
bool NativeAppControl::Reply(
return appname;
}
-static bool ProcessWellKnownScheme(const std::string& url) {
- if (utils::StartsWith(url, "file:") ||
- utils::StartsWith(url, "app:") ||
- utils::StartsWith(url, "data:") ||
- utils::StartsWith(url, "http:") ||
- utils::StartsWith(url, "https:") ||
- utils::StartsWith(url, "widget:") ||
- utils::StartsWith(url, "about:") ||
- utils::StartsWith(url, "blob:") ||
- utils::StartsWith(url, "appcontrol:") ||
- utils::StartsWith(url, "chrome-extension:")) {
- return false;
- }
-
- auto request(NativeAppControl::MakeAppcontrolFromURL(url));
- if (!request || !request->SendLaunchRequest())
- LOG(ERROR) << "Fail to send appcontrol request: " << url;
- // Should return true, to stop the WebEngine progress step about this URL
- return true;
+bool IsWellKnownScheme(const std::string& url) {
+ return utils::StartsWith(url, "file:") ||
+ utils::StartsWith(url, "app:") ||
+ utils::StartsWith(url, "data:") ||
+ utils::StartsWith(url, "http:") ||
+ utils::StartsWith(url, "https:") ||
+ utils::StartsWith(url, "widget:") ||
+ utils::StartsWith(url, "about:") ||
+ utils::StartsWith(url, "blob:") ||
+ utils::StartsWith(url, "appcontrol:") ||
+ utils::StartsWith(url, "chrome-extension:");
}
std::vector<std::string> ParseTizenVersion(const std::string& tizen_string) {
return true;
#endif
- // scheme handling
- // except(file , http, https, app, chrome-extension) 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))
+ if (IsWellKnownScheme(url) && resource_manager_->AllowNavigation(url))
return true;
+ // send launch request for blocked URL to guarrenty backward-compatibility.
LOG(ERROR) << "URL is blocked. send launch request for URL : " << url;
+ if (runtime_delegate_ && runtime_delegate_->BlockNavigation(url))
+ return false;
+
auto request(NativeAppControl::MakeAppcontrolFromURL(url));
if (!request || !request->SendLaunchRequest())
LOG(ERROR) << "Fail to send appcontrol request: " << url;
+
return false;
}