#include <common/view_logic_user_agent_support.h>
#include <common/view_logic_vibration_support.h>
#include <view_logic_scheme_support.h>
-#include <view_logic_filesystem_support.h>
#include <view_logic_geolocation_support_webkit2.h>
#include <view_logic_usermedia_support.h>
#include <view_logic_web_notification_support.h>
{ "database,quota,exceeded",
&ViewLogic::databaseUsagePermissionRequestCallback },
- { "filesystem,permission,request",
- &ViewLogic::fileSystemPermissionRequestCallback },
{ "fullscreen,enterfullscreen", &ViewLogic::enterFullscreenCallback },
{ "fullscreen,exitfullscreen", &ViewLogic::exitFullscreenCallback },
// IME Callback
return;
}
-void ViewLogic::fileSystemPermissionRequestCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* eventInfo)
-{
- LogDebug("fileSystemPermissionRequestCallback called");
- Assert(data);
- ViewLogic* This = static_cast<ViewLogic*>(data);
-
- if (This->m_securityOriginSupport->isNeedPermissionCheck(
- SecurityOriginDB::FEATURE_FILE_SYSTEM_ACCESS)
- == WrtDB::SETTINGS_TYPE_OFF)
- {
- Ewk_Context_File_System_Permission* fileSystemPermission =
- static_cast<Ewk_Context_File_System_Permission*>(eventInfo);
- ewk_context_file_system_permission_allow_set(fileSystemPermission,
- EINA_FALSE);
- return;
- }
-
- Assert(eventInfo);
- ViewModule::FileSystemSupport::fileSystemPermissionRequest(
- This->m_window,
- This->m_securityOriginSupport->getSecurityOriginDAO(),
- eventInfo);
-}
-
void ViewLogic::certificateConfirmRequestCallback(
void* data,
Evas_Object* /*obj*/,
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file view_logic_filesystem_support.cpp
- * @author Jihoon Chung (jihoon.chung@samsung.com)
- */
-
-#include "view_logic_filesystem_support.h"
-
-#include <string>
-#include <dpl/log/log.h>
-#include <dpl/assert.h>
-#include <wrt-commons/security-origin-dao/security_origin_dao_types.h>
-#include <wrt-commons/security-origin-dao/security_origin_dao.h>
-#include <EWebKit2.h>
-#include <common/view_logic_security_origin_support.h>
-#include <Elementary.h>
-
-namespace ViewModule {
-using namespace SecurityOriginDB;
-using namespace ViewModule::SecurityOriginSupportUtil;
-
-namespace {
-const char* const FILESYSTEM_USE_ASK_TITLE = "Use FileSystem?";
-const char* const FILESYSTEM_USE_ASK_BODY_PREFIX = "Do you want to allow ";
-const char* const FILESYSTEM_USE_ASK_BODY_POSTFIX =
- " to use persistent filesystem?";
-const char* const FILESYSTEM_USE_ASK_CHECK = "Don't ask again";
-
-// function declare
-void askUserForFileSystemPermission(
- Evas_Object* window,
- PermissionData* data);
-static void popupCallback(void* data, Evas_Object* obj, void* eventInfo);
-
-void askUserForFileSystemPermission(Evas_Object* window, PermissionData* data)
-{
- LogDebug("askUserForFileSystemPermission called");
- std::string body =
- FILESYSTEM_USE_ASK_BODY_PREFIX +
- DPL::ToUTF8String(data->m_originData.origin.host) +
- FILESYSTEM_USE_ASK_BODY_POSTFIX;
- Evas_Object* popup = createPopup(window,
- body.c_str(),
- FILESYSTEM_USE_ASK_CHECK,
- popupCallback,
- data);
- if (popup == NULL) {
- LogError("Fail to create popup object");
- delete data;
- return;
- } else {
- evas_object_show(popup);
- }
-}
-
-void popupCallback(void* data, Evas_Object* obj, void* /*eventInfo*/)
-{
- LogDebug("popupCallback");
- Assert(data);
- PermissionData* permData = static_cast<PermissionData*>(data);
- Ewk_Context_File_System_Permission* fileSystemPermission =
- static_cast<Ewk_Context_File_System_Permission*>(permData->m_data);
-
- Evas_Object* popup = getPopup(obj);
- Result result = getResult(obj);
-
- if (result != RESULT_UNKNOWN) {
- permData->m_originDao->setSecurityOriginData(permData->m_originData,
- result);
- }
- Eina_Bool ret =
- (result == RESULT_ALLOW_ALWAYS || result == RESULT_ALLOW_ONCE) ?
- EINA_TRUE : EINA_FALSE;
- ewk_context_file_system_permission_allow_set(fileSystemPermission,
- ret);
- delete permData;
- evas_object_hide(popup);
- evas_object_del(popup);
-}
-} // namespace
-
-void FileSystemSupport::fileSystemPermissionRequest(
- Evas_Object* window,
- SecurityOriginDAO* securityOriginDAO,
- void* data)
-{
- LogDebug("fileSystemPermissionRequest called");
- Assert(securityOriginDAO);
- Assert(data);
- Ewk_Context_File_System_Permission* fileSystemPermission =
- static_cast<Ewk_Context_File_System_Permission*>(data);
- Ewk_Security_Origin* ewkOrigin =
- ewk_context_file_system_permission_origin_get(
- fileSystemPermission);
- Assert(ewkOrigin);
-
- SecurityOriginData securityOriginData(
- FEATURE_FILE_SYSTEM_ACCESS,
- Origin(
- DPL::FromUTF8String(ewk_security_origin_protocol_get(ewkOrigin)),
- DPL::FromUTF8String(ewk_security_origin_host_get(ewkOrigin)),
- ewk_security_origin_port_get(ewkOrigin)));
-
- // check cache database
- Result result = securityOriginDAO->getResult(securityOriginData);
- if (RESULT_ALLOW_ONCE == result || RESULT_ALLOW_ALWAYS == result) {
- LogDebug("permit");
- ewk_context_file_system_permission_allow_set(fileSystemPermission,
- EINA_TRUE);
- return;
- } else if (RESULT_DENY_ONCE == result || RESULT_DENY_ALWAYS == result) {
- LogDebug("deny");
- ewk_context_file_system_permission_allow_set(fileSystemPermission,
- EINA_FALSE);
- return;
- }
-
- // ask to user
- PermissionData* permissionData =
- new PermissionData(securityOriginDAO,
- securityOriginData,
- fileSystemPermission);
- askUserForFileSystemPermission(window, permissionData);
- return;
-}
-} // namespace ViewModule
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file view_logic_filesystem_support.h
- * @author Jihoon Chung (jihoon.chung@samsung.com)
- */
-
-#ifndef VIEW_LOGIC_FILESYSTEM_SUPPORT_H_
-#define VIEW_LOGIC_FILESYSTEM_SUPPORT_H_
-
-#include <memory.h>
-#include <Elementary.h>
-
-namespace SecurityOriginDB {
-class SecurityOriginDAO;
-}
-
-namespace ViewModule {
-namespace FileSystemSupport {
-void fileSystemPermissionRequest(
- Evas_Object* window,
- SecurityOriginDB::SecurityOriginDAO* securityOriginDAO,
- void* data);
-} // namespace FileSystemSupport
-} // namespace ViewModule
-
-#endif // VIEW_LOGIC_FILESYSTEM_SUPPORT_H_