Implement the APP_CONTROL_OPERATION_SEARCH 26/89126/2
authorHyeKyoung Hwang <cookie@samsung.com>
Thu, 22 Sep 2016 09:20:49 +0000 (18:20 +0900)
committerHye Kyoung Hwang <cookie@samsung.com>
Fri, 23 Sep 2016 00:36:33 +0000 (17:36 -0700)
[ Issue ] http://suprem.sec.samsung.net/jira/browse/TSAM-6853
[ Problem ] There is no implement the APP_CONTROL_OPERATION_SEARCH
[ Solution ] Implement the APP_CONTROL_OPERATION_SEARCH

Change-Id: Ia3499dfc489f68385abb242656339fae9173f33f
Signed-off-by: HyeKyoung Hwang <cookie@samsung.com>
core/main.cpp
manifest.xml.in.mb

index 8aae1ff..39463cb 100755 (executable)
@@ -118,6 +118,7 @@ static void app_control(app_control_h app_control, void* app_data){
     char *request_uri = NULL;
     char *request_mime_type = NULL;
     char *request_caller = NULL;
+    char *search_keyword = NULL;
 
     if (app_control_get_operation(app_control, &operation) != APP_CONTROL_ERROR_NONE) {
         BROWSER_LOGD("get app_control operation failed");
@@ -139,13 +140,31 @@ static void app_control(app_control_h app_control, void* app_data){
     std::string uri = request_uri != NULL ? std::string(request_uri) : DEFAULT_URL;
     std::string caller = request_caller != NULL ? std::string(request_caller) : DEFAULT_CALLER;
 
-    if((operation && !strcmp(operation, "http://tizen.org/appcontrol/operation/view")) && (request_uri != NULL)) {
+    if((operation && !strcmp(operation, APP_CONTROL_OPERATION_VIEW)) && (request_uri != NULL)) {
         if (request_uri) {
             if (!strncmp(request_uri, "/opt/", strlen("/opt/"))) {
                 uri = std::string("file://") + uri;
             }
         }
     }
+    if (app_control_get_extra_data(app_control, "search", &search_keyword) == APP_CONTROL_ERROR_NONE) {
+        BROWSER_LOGD("search keyword launching");
+
+        if (search_keyword) {
+            uri=std::string(search_keyword);
+            free(search_keyword);
+        }
+    }
+
+    if ((operation && !strcmp(operation, APP_CONTROL_OPERATION_SEARCH )) &&
+        ((app_control_get_extra_data(app_control, "http://tizen.org/appcontrol/data/keyword", &search_keyword) == APP_CONTROL_ERROR_NONE) ||
+        (app_control_get_extra_data(app_control, APP_CONTROL_DATA_TEXT, &search_keyword) == APP_CONTROL_ERROR_NONE))) { 
+        BROWSER_LOGD("APP_CONTROL_OPERATION_SEARCH");
+        if (search_keyword) {
+            uri=std::string(search_keyword);
+            free(search_keyword);
+        }
+    }
 
     BROWSER_LOGD("[%s] uri=%s", __func__, uri.c_str());
     free(request_uri);
index 67aab46..b27b4f0 100755 (executable)
             <operation name="http://tizen.org/appcontrol/operation/view" />
             <mime name="application/xml" />
         </app-control>
+        <app-control>
+            <operation name="http://tizen.org/appcontrol/operation/search" />
+        </app-control>
     </ui-application>
     <privileges>
         <privilege>http://tizen.org/privilege/bookmark.admin</privilege>