Location permission issue 59/157559/2 accepted/tizen_4.0_unified tizen_4.0 accepted/tizen/4.0/unified/20180312.060509 submit/tizen_4.0/20180308.094920
authorcookie <cookie@samsung.com>
Wed, 25 Oct 2017 05:48:03 +0000 (05:48 +0000)
committercookie <cookie@samsung.com>
Wed, 25 Oct 2017 06:02:58 +0000 (06:02 +0000)
Change-Id: Ica8bbb13f65abccb6e69446fd1715c0828902148
Signed-off-by: cookie <cookie@samsung.com>
CMakeLists.txt
manifest.xml.in.mb
packaging/org.tizen.browser.spec
services/WebEngineService/WebView.cpp
services/WebEngineService/WebView.h

index 962cd5f490986286d29b2f56b5149c8f6a1176c0..d23096f44030bbf9acf27050c2791f1e73ad4fd0 100755 (executable)
@@ -83,6 +83,7 @@ if(TIZEN_BUILD)
         libssl
         shortcut
         libsoup-2.4
+       capi-privacy-privilege-manager
     )
 
    if (${PROFILE} MATCHES "mobile")
@@ -97,7 +98,7 @@ if(TIZEN_BUILD)
         shortcut
         push
         capi-network-connection
-       appcore-common
+        appcore-common
     )
     endif (${PROFILE} MATCHES "mobile")
 
index 7649155be7067c426e792288d8adbce5be90b14c..40acacd4e46cbba6d5d24f5d358fe69e4b0ac901 100755 (executable)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns="http://tizen.org/ns/packages" package="@PACKAGE_NAME@" api-version="3.0" version="@VERSION@" install-location="internal-only">
+<manifest xmlns="http://tizen.org/ns/packages" package="@PACKAGE_NAME@" api-version="4.0" version="@VERSION@" install-location="internal-only">
     <label>Internet</label>
     <icon>org.tizen.browser.png</icon>
     <description>Web Browser Application</description>
         <privilege>http://tizen.org/privilege/network.get</privilege>
         <privilege>http://tizen.org/privilege/internet</privilege>
         <privilege>http://tizen.org/privilege/appdir.shareddata</privilege>
+        <privilege>http://tizen.org/privilege/location</privilege>
      </privileges>
 </manifest>
index 4cdb6539354e1cafba800134b17f2f9e81213fb9..933aa8c214ff8414e12e5ba1fadf9c88c4bd716d 100755 (executable)
@@ -2,7 +2,7 @@
 
 Name:       org.tizen.browser-profile_mobile
 Summary:    Tizen Open Browser
-Version:    4.0.6
+Version:    4.0.8
 Release:    0
 Provides:   org.tizen.browser = %{version}-%{release}
 Conflicts:  org.tizen.browser-profile_common
@@ -73,6 +73,7 @@ BuildRequires:        pkgconfig(dlog)
 %endif
 
 BuildRequires:  pkgconfig(libtzplatform-config)
+BuildRequires:  pkgconfig(capi-privacy-privilege-manager)
 
 %define _appdir %{TZ_SYS_RO_APP}/%{alias}
 %define _bindir %{_appdir}/bin
index 43f92b281b983fe91a1eef59856cd5b399e49828..bc88ee65d0142a90bd3bdc1400545266ec77037e 100755 (executable)
@@ -167,6 +167,8 @@ void WebView::init(bool desktopMode, TabOrigin origin)
     m_downloadControl = new DownloadControl();
     orientationChanged();
 
+    request_application_permission("http://tizen.org/privilege/location");
+
     BROWSER_LOGD("[%s:%d] Check permissions", __PRETTY_FUNCTION__, __LINE__);
     auto permissions = *getPermissionsMap();
     Eina_List* permList = nullptr;
@@ -1581,6 +1583,47 @@ void WebView::__policy_navigation_decide_cb(void *data, Evas_Object * /*obj*/, v
     ewk_policy_decision_use(policy_decision);
 }
 
+void WebView::__app_request_response_cb(ppm_call_cause_e cause, ppm_request_result_e result, const char* privilege, void*  /*user_data*/) {
+    BROWSER_LOGD("[%s:%d]", __PRETTY_FUNCTION__, __LINE__);
+  if (cause == PRIVACY_PRIVILEGE_MANAGER_CALL_CAUSE_ERROR) {
+    BROWSER_LOGD("ppm_request_permission failed");
+    return;
+  }
+
+  switch (result) {
+    case PRIVACY_PRIVILEGE_MANAGER_REQUEST_RESULT_ALLOW_FOREVER:
+      BROWSER_LOGD("response_cb %s privilege was allowed forever", privilege);
+      break;
+    case PRIVACY_PRIVILEGE_MANAGER_REQUEST_RESULT_DENY_FOREVER:
+      BROWSER_LOGD("response_cb %s privilege was denied forever", privilege);
+      break;
+    case PRIVACY_PRIVILEGE_MANAGER_REQUEST_RESULT_DENY_ONCE:
+      BROWSER_LOGD("response_cb %s privilege was denied", privilege);
+      break;
+  }
+}
+
+void WebView:: request_application_permission(const char* privilege) {
+    BROWSER_LOGD("[%s:%d]", __PRETTY_FUNCTION__, __LINE__);
+    ppm_check_result_e result;
+    int ret = ppm_check_permission(privilege, &result);
+    if (ret != PRIVACY_PRIVILEGE_MANAGER_ERROR_NONE) {
+        BROWSER_LOGD("ppm_check_permission failed");
+        return;
+    }
+
+  switch (result) {
+    case PRIVACY_PRIVILEGE_MANAGER_CHECK_RESULT_ALLOW:
+      BROWSER_LOGD("request_application()%s privilege was allowed", privilege);
+      break;
+    case PRIVACY_PRIVILEGE_MANAGER_CHECK_RESULT_DENY:
+      BROWSER_LOGD("request_application()%s privilege was denied", privilege);
+      break;
+    case PRIVACY_PRIVILEGE_MANAGER_CHECK_RESULT_ASK:
+      ppm_request_permission(privilege, __app_request_response_cb, NULL);
+      break;
+  }
+}
 } /* namespace webengine_service */
 } /* end of basic_webengine */
 } /* end of tizen_browser */
index f1d967816d4cb65d1c3839c5704026b51a2fbafc..9c2f29006205c957a729815b61fde0f9abcc8f15 100755 (executable)
@@ -36,6 +36,7 @@
 #include <app.h>
 #include "AbstractRotatable.h"
 #include <libsoup/soup.h>
+#include <privacy-privilege-manager/privacy_privilege_manager.h>
 
 enum context_menu_type {
     TEXT_ONLY = 0,
@@ -367,6 +368,8 @@ private:
     static void __setCertificatePem(void * data, Evas_Object * obj, void * event_info);
 
     static void scriptLinkSearchCallback(Evas_Object *o, const char *value, void *data);
+    static void request_application_permission(const char* privilege);
+    static void __app_request_response_cb(ppm_call_cause_e cause, ppm_request_result_e result, const char* privilege, void* /*user_data*/);
 
     // downloads
     static void __policy_response_decide_cb(void *data, Evas_Object *obj, void *event_info);