[EFL] Add url bar to EWebLauncher and MiniBrowser/Efl.
authorryuan.choi@samsung.com <ryuan.choi@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2012 13:04:48 +0000 (13:04 +0000)
committerryuan.choi@samsung.com <ryuan.choi@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2012 13:04:48 +0000 (13:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=63966

Reviewed by Kenneth Rohde Christiansen.

EWebLauncher and MiniBrowser/Efl did not have functionality that users
navigates the site which they want.
This patch adds the urlbar and functionality to load url which users want.

* CMakeLists.txt:
Added to share urlbar theme for both EWebLauncher and MiniBrowser/Efl.
* EWebLauncher/CMakeLists.txt:
Added urlbar.c and dependency of urlbar theme.
In addition, changed macro name to THEME_DIR to share the code easily.
* EWebLauncher/ControlTheme/CMakeLists.txt: Added for urlbar theme.
* EWebLauncher/ControlTheme/entry.edc: Implemented urlbar theme.
* EWebLauncher/main.c:
Implemented to use the urlbar.
In addition, remove unnecessary border of webview to control webview and urlbar easily.
(_ELauncher):
(on_url_changed):
(browserCreate):
(closeWindow):
(findThemePath):
* EWebLauncher/url_bar.c: Implemented functionality of the urlbar.
(_url_bar_url_get_with_protocol):
(on_urlbar_key_down):
(on_urlbar_mouse_down):
(on_urlbar_focus_out):
(url_bar_add):
(url_bar_del):
(url_bar_url_set):
* EWebLauncher/url_bar.h: Added.
* MiniBrowser/efl/CMakeLists.txt:
* MiniBrowser/efl/main.c: Implemented to use the urlbar.
(_MiniBrowser):
(on_url_changed):
(browserCreate):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126419 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/CMakeLists.txt
Tools/ChangeLog
Tools/EWebLauncher/CMakeLists.txt
Tools/EWebLauncher/ControlTheme/CMakeLists.txt [new file with mode: 0644]
Tools/EWebLauncher/ControlTheme/entry.edc [new file with mode: 0644]
Tools/EWebLauncher/main.c
Tools/EWebLauncher/url_bar.c [new file with mode: 0644]
Tools/EWebLauncher/url_bar.h [new file with mode: 0644]
Tools/MiniBrowser/efl/CMakeLists.txt
Tools/MiniBrowser/efl/main.c

index aed7144..1a6a69b 100644 (file)
@@ -3,6 +3,8 @@ IF (ENABLE_WEBKIT2)
 ENDIF ()
 
 IF ("${PORT}" STREQUAL "Efl")
 ENDIF ()
 
 IF ("${PORT}" STREQUAL "Efl")
+    ADD_SUBDIRECTORY(EWebLauncher/ControlTheme)
+
     IF (ENABLE_WEBKIT)
         ADD_SUBDIRECTORY(DumpRenderTree/efl)
         ADD_SUBDIRECTORY(EWebLauncher)
     IF (ENABLE_WEBKIT)
         ADD_SUBDIRECTORY(DumpRenderTree/efl)
         ADD_SUBDIRECTORY(EWebLauncher)
index cc26708..348316e 100644 (file)
@@ -1,3 +1,44 @@
+2012-08-23  Ryuan Choi  <ryuan.choi@samsung.com>
+
+        [EFL] Add url bar to EWebLauncher and MiniBrowser/Efl.
+        https://bugs.webkit.org/show_bug.cgi?id=63966
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        EWebLauncher and MiniBrowser/Efl did not have functionality that users
+        navigates the site which they want.
+        This patch adds the urlbar and functionality to load url which users want.
+
+        * CMakeLists.txt:
+        Added to share urlbar theme for both EWebLauncher and MiniBrowser/Efl.
+        * EWebLauncher/CMakeLists.txt:
+        Added urlbar.c and dependency of urlbar theme.
+        In addition, changed macro name to THEME_DIR to share the code easily.
+        * EWebLauncher/ControlTheme/CMakeLists.txt: Added for urlbar theme.
+        * EWebLauncher/ControlTheme/entry.edc: Implemented urlbar theme.
+        * EWebLauncher/main.c:
+        Implemented to use the urlbar.
+        In addition, remove unnecessary border of webview to control webview and urlbar easily.
+        (_ELauncher):
+        (on_url_changed):
+        (browserCreate):
+        (closeWindow):
+        (findThemePath):
+        * EWebLauncher/url_bar.c: Implemented functionality of the urlbar.
+        (_url_bar_url_get_with_protocol):
+        (on_urlbar_key_down):
+        (on_urlbar_mouse_down):
+        (on_urlbar_focus_out):
+        (url_bar_add):
+        (url_bar_del):
+        (url_bar_url_set):
+        * EWebLauncher/url_bar.h: Added.
+        * MiniBrowser/efl/CMakeLists.txt:
+        * MiniBrowser/efl/main.c: Implemented to use the urlbar.
+        (_MiniBrowser):
+        (on_url_changed):
+        (browserCreate):
+
 2012-08-23  Balazs Kelemen  <kbalazs@webkit.org>
 
         [nrwt, WTR] Remove workaround for timeout handing from r126062
 2012-08-23  Balazs Kelemen  <kbalazs@webkit.org>
 
         [nrwt, WTR] Remove workaround for timeout handing from r126062
index 3c489a4..bd879ad 100644 (file)
@@ -1,4 +1,5 @@
 SET(EWebLauncher_SOURCES
 SET(EWebLauncher_SOURCES
+    ${TOOLS_DIR}/EWebLauncher/url_bar.c
     ${TOOLS_DIR}/EWebLauncher/main.c
 )
 
     ${TOOLS_DIR}/EWebLauncher/main.c
 )
 
@@ -35,10 +36,12 @@ SET(EWebLauncher_LINK_FLAGS
     ${EVAS_LDFLAGS}
 )
 
     ${EVAS_LDFLAGS}
 )
 
-ADD_DEFINITIONS(-DDATA_DIR=\"${THEME_BINARY_DIR}\")
+ADD_DEFINITIONS(-DTHEME_DIR=\"${THEME_BINARY_DIR}\")
 
 INCLUDE_DIRECTORIES(${EWebLauncher_INCLUDE_DIRECTORIES})
 ADD_EXECUTABLE(EWebLauncher ${EWebLauncher_SOURCES})
 TARGET_LINK_LIBRARIES(EWebLauncher ${EWebLauncher_LIBRARIES})
 ADD_TARGET_PROPERTIES(EWebLauncher LINK_FLAGS "${EWebLauncher_LINK_FLAGS}")
 SET_TARGET_PROPERTIES(EWebLauncher PROPERTIES FOLDER "Tools")
 
 INCLUDE_DIRECTORIES(${EWebLauncher_INCLUDE_DIRECTORIES})
 ADD_EXECUTABLE(EWebLauncher ${EWebLauncher_SOURCES})
 TARGET_LINK_LIBRARIES(EWebLauncher ${EWebLauncher_LIBRARIES})
 ADD_TARGET_PROPERTIES(EWebLauncher LINK_FLAGS "${EWebLauncher_LINK_FLAGS}")
 SET_TARGET_PROPERTIES(EWebLauncher PROPERTIES FOLDER "Tools")
+
+ADD_DEPENDENCIES(EWebLauncher ControlTheme)
diff --git a/Tools/EWebLauncher/ControlTheme/CMakeLists.txt b/Tools/EWebLauncher/ControlTheme/CMakeLists.txt
new file mode 100644 (file)
index 0000000..68aa8cf
--- /dev/null
@@ -0,0 +1,8 @@
+SET(ControlTheme_DIR "${TOOLS_DIR}/EWebLauncher/ControlTheme")
+
+ADD_CUSTOM_TARGET(ControlTheme ALL
+    COMMAND ${EDJE_CC_EXECUTABLE} -v ${ControlTheme_DIR}/entry.edc ${THEME_BINARY_DIR}/entry.edj
+    DEPENDS
+        ${ControlTheme_DIR}/entry.edc
+    VERBATIM
+)
diff --git a/Tools/EWebLauncher/ControlTheme/entry.edc b/Tools/EWebLauncher/ControlTheme/entry.edc
new file mode 100644 (file)
index 0000000..7a1a5f7
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+collections {
+   group {
+      name: "control/entry/base/default";
+      styles {
+         style {
+            name: "entry_textblock_style";
+            base: "font=Roman font_size=14 color=#000000 wrap=mixed";
+         }
+      }
+      parts {
+         part {
+            name: "url.text";
+            type: TEXTBLOCK;
+            mouse_events: 1;
+            scale: 1;
+            entry_mode: EDITABLE;
+            multiline: 0;
+            source: "control/entry/selection/default"; // selection under
+            source4: "control/entry/cursor/default"; // cursor over
+            description {
+               state: "default" 0.0;
+               fixed: 1 0;
+               text {
+                  style: "entry_textblock_style";
+                  min: 0 1;
+               }
+            }
+         }
+      }
+      programs {
+         program {
+            name: "focus";
+            signal: "load";
+            source: "";
+            action: FOCUS_SET;
+            target: "url.text";
+         }
+      }
+   }
+
+   group {
+      name: "control/entry/cursor/default";
+      parts {
+         part {
+            name: "clip";
+            type: RECT;
+            mouse_events: 0;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               rel1.offset: -10 0;
+               rel2.offset: 9 9;
+               visible: 0;
+            }
+            description {
+               state: "focused" 0.0;
+               inherit: "default" 0.0;
+               visible: 1;
+            }
+         }
+         part {
+            name: "cursor";
+            type: RECT;
+            mouse_events: 0;
+            scale: 1;
+            clip_to: "clip";
+            description {
+               state: "default" 0.0;
+               min: 1 0;
+               fixed: 1 0;
+               align: 0.5 0.5;
+               visible: 1;
+               rel1 {
+                  relative: 0.0  0.0;
+                  offset: 0 2;
+               }
+               rel2 {
+                  relative: 0.0  1.0;
+                  offset: 0 -2;
+               }
+               color: 0 0 0 255; // cursor color
+            }
+         }
+      }
+      programs {
+         program {
+            name: "focused";
+            signal: "entry,action,focus";
+            source: "entry";
+            action: STATE_SET "focused" 0.0;
+            target: "clip";
+         }
+         program {
+            name: "unfocused";
+            signal: "entry,action,unfocus";
+            source: "entry";
+            action: STATE_SET "default" 0.0;
+            target: "clip";
+         }
+      }
+   }
+
+   group {
+      name: "control/entry/selection/default";
+      parts {
+         part {
+            name: "bg";
+            type: RECT;
+            scale: 1;
+            mouse_events: 0;
+            description {
+               state: "default" 0.0;
+               color: 138 183 223 128;
+            }
+         }
+      }
+   }
+}
index 4089d6e..06703cf 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "EWebKit.h"
 
 
 #include "EWebKit.h"
 
-#include <ctype.h>
+#include "url_bar.h"
 #include <Ecore.h>
 #include <Ecore_Evas.h>
 #include <Ecore_File.h>
 #include <Ecore.h>
 #include <Ecore_Evas.h>
 #include <Ecore_File.h>
@@ -38,6 +38,7 @@
 #include <Ecore_X.h>
 #include <Edje.h>
 #include <Evas.h>
 #include <Ecore_X.h>
 #include <Edje.h>
 #include <Evas.h>
+#include <ctype.h>
 #include <inttypes.h>
 #include <limits.h>
 #include <stdio.h>
 #include <inttypes.h>
 #include <limits.h>
 #include <stdio.h>
@@ -143,6 +144,7 @@ typedef struct _ELauncher {
     Evas *evas;
     Evas_Object *bg;
     Evas_Object *browser;
     Evas *evas;
     Evas_Object *bg;
     Evas_Object *browser;
+    Url_Bar *url_bar;
     const char *theme;
     const char *userAgent;
     const char *backingStore;
     const char *theme;
     const char *userAgent;
     const char *backingStore;
@@ -402,6 +404,13 @@ on_inputmethod_changed(void* user_data, Evas_Object* webview, void* event_info)
 }
 
 static void
 }
 
 static void
+on_url_changed(void* user_data, Evas_Object* webview, void* event_info)
+{
+    ELauncher *app = (ELauncher *)user_data;
+    url_bar_url_set(app->url_bar, ewk_view_uri_get(app->browser));
+}
+
+static void
 on_mouse_down(void* data, Evas* e, Evas_Object* webview, void* event_info)
 {
     Evas_Event_Mouse_Down *ev = (Evas_Event_Mouse_Down*) event_info;
 on_mouse_down(void* data, Evas* e, Evas_Object* webview, void* event_info)
 {
     Evas_Event_Mouse_Down *ev = (Evas_Event_Mouse_Down*) event_info;
@@ -695,6 +704,7 @@ browserCreate(const char *url, const char *theme, const char *userAgent, Eina_Re
     evas_object_smart_callback_add(app->browser, "menubar,visible,get", on_menubar_visible_get, app);
     evas_object_smart_callback_add(app->browser, "tooltip,text,set", on_tooltip_text_set, app);
     evas_object_smart_callback_add(app->browser, "inputmethod,changed", on_inputmethod_changed, app);
     evas_object_smart_callback_add(app->browser, "menubar,visible,get", on_menubar_visible_get, app);
     evas_object_smart_callback_add(app->browser, "tooltip,text,set", on_tooltip_text_set, app);
     evas_object_smart_callback_add(app->browser, "inputmethod,changed", on_inputmethod_changed, app);
+    evas_object_smart_callback_add(app->browser, "uri,changed", on_url_changed, app);
 
 /*     ewk_callback_resize_requested_add(app->browser, on_resize_requested, app->ee); */
 
 
 /*     ewk_callback_resize_requested_add(app->browser, on_resize_requested, app->ee); */
 
@@ -704,8 +714,10 @@ browserCreate(const char *url, const char *theme, const char *userAgent, Eina_Re
     evas_object_event_callback_add(app->browser, EVAS_CALLBACK_FOCUS_OUT, on_focus_out, app);
     evas_object_event_callback_add(app->browser, EVAS_CALLBACK_DEL, on_browser_del, app);
 
     evas_object_event_callback_add(app->browser, EVAS_CALLBACK_FOCUS_OUT, on_focus_out, app);
     evas_object_event_callback_add(app->browser, EVAS_CALLBACK_DEL, on_browser_del, app);
 
-    evas_object_move(app->browser, 10, 10);
-    evas_object_resize(app->browser, geometry.w - 20, geometry.h - 20);
+    app->url_bar = url_bar_add(app->browser, DEFAULT_WIDTH);
+
+    evas_object_move(app->browser, 0, URL_BAR_HEIGHT);
+    evas_object_resize(app->browser, geometry.w, geometry.h - URL_BAR_HEIGHT);
 
     if (url && (url[0] != '\0'))
         ewk_view_uri_set(app->browser, url);
 
     if (url && (url[0] != '\0'))
         ewk_view_uri_set(app->browser, url);
@@ -739,6 +751,7 @@ closeWindow(Ecore_Evas *ee)
             break;
     }
     windows = eina_list_remove(windows, app);
             break;
     }
     windows = eina_list_remove(windows, app);
+    url_bar_del(((ELauncher *)app)->url_bar);
     browserDestroy(ee);
     free(app);
 }
     browserDestroy(ee);
     free(app);
 }
@@ -760,12 +773,12 @@ main_signal_exit(void *data, int ev_type, void *ev)
 static char *
 findThemePath(const char *theme)
 {
 static char *
 findThemePath(const char *theme)
 {
-    const char *defaultTheme = DATA_DIR"/default.edj";
+    const char *default_theme = THEME_DIR"/default.edj";
     char *rpath;
     struct stat st;
 
     if (!theme)
     char *rpath;
     struct stat st;
 
     if (!theme)
-        theme = defaultTheme;
+        theme = default_theme;
 
     rpath = ecore_file_realpath(theme);
     if (!strlen(rpath) || stat(rpath, &st)) {
 
     rpath = ecore_file_realpath(theme);
     if (!strlen(rpath) || stat(rpath, &st)) {
diff --git a/Tools/EWebLauncher/url_bar.c b/Tools/EWebLauncher/url_bar.c
new file mode 100644 (file)
index 0000000..4ec6b1b
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "url_bar.h"
+
+#include <Edje.h>
+#include <Ecore_File.h>
+
+#define PADDING_SIZE 5
+
+static const char *
+_url_bar_url_get_with_protocol(Url_Bar *urlBar)
+{
+    const char *url = edje_object_part_text_get(urlBar->entry, "url.text");
+    if (ecore_file_exists(url))
+        return eina_stringshare_printf("file://%s", url);
+
+    if (!strstr(url, "://"))
+        return eina_stringshare_printf("http://%s", url);
+    return eina_stringshare_add(url);
+}
+
+static void
+on_urlbar_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+    Evas_Event_Key_Down *ev = event_info;
+    Url_Bar *urlBar = (Url_Bar *)data;
+
+    if (!ev->key || strcmp(ev->key, "Return"))
+        return;
+
+    const char *url = _url_bar_url_get_with_protocol(urlBar);
+    if (url) {
+        ewk_view_uri_set(urlBar->webView, url);
+        eina_stringshare_del(url);
+    }
+    evas_object_focus_set(urlBar->webView, EINA_TRUE);
+}
+
+static void
+on_urlbar_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+    Evas_Event_Mouse_Down *ev = event_info;
+    Url_Bar *urlBar = (Url_Bar *)data;
+
+    if (ev->button == 1) {
+        evas_object_focus_set(urlBar->entry, EINA_TRUE);
+        edje_object_signal_emit(urlBar->entry, "entry,action,focus", "entry");
+    }
+}
+
+static void
+on_urlbar_focus_out(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+    Url_Bar *urlBar = (Url_Bar *)data;
+
+    edje_object_signal_emit(urlBar->entry, "entry,action,unfocus", "entry");
+}
+
+Url_Bar *
+url_bar_add(Evas_Object *webView, int width)
+{
+    Evas *evas;
+    Url_Bar *url_bar;
+    if (!webView)
+        return NULL;
+    evas = evas_object_evas_get(webView);
+
+    url_bar = (Url_Bar *)malloc(sizeof(Url_Bar));
+    url_bar->webView = webView;
+
+    url_bar->area = evas_object_rectangle_add(evas);
+    evas_object_name_set(url_bar->area, "url_barArea");
+    evas_object_color_set(url_bar->area, 255, 255, 255, 255);
+    evas_object_move(url_bar->area, 0, 0);
+    evas_object_resize(url_bar->area, width, URL_BAR_HEIGHT);
+    evas_object_show(url_bar->area);
+
+    url_bar->entry = edje_object_add(evas);
+    Eina_Bool ret = edje_object_file_set(url_bar->entry, THEME_DIR"/entry.edj", "control/entry/base/default");
+    if (!ret) {
+        evas_object_del(url_bar->area);
+
+        free(url_bar);
+        return NULL;
+    }
+
+    edje_object_part_text_set(url_bar->entry, "url.text", "");
+    evas_object_move(url_bar->entry, PADDING_SIZE, PADDING_SIZE);
+    evas_object_resize(url_bar->entry, width - PADDING_SIZE * 2, URL_BAR_HEIGHT - PADDING_SIZE * 2);
+    evas_object_show(url_bar->entry);
+    evas_object_event_callback_add(url_bar->entry, EVAS_CALLBACK_MOUSE_DOWN, on_urlbar_mouse_down, url_bar);
+    evas_object_event_callback_add(url_bar->entry, EVAS_CALLBACK_KEY_DOWN, on_urlbar_key_down, url_bar);
+    evas_object_event_callback_add(url_bar->entry, EVAS_CALLBACK_FOCUS_OUT, on_urlbar_focus_out, url_bar);
+
+    return url_bar;
+}
+
+void
+url_bar_del(Url_Bar *urlBar)
+{
+    if (!urlBar)
+        return;
+
+    evas_object_event_callback_del(urlBar->entry, EVAS_CALLBACK_KEY_DOWN, on_urlbar_key_down);
+    evas_object_event_callback_del(urlBar->entry, EVAS_CALLBACK_MOUSE_DOWN, on_urlbar_mouse_down);
+    evas_object_event_callback_del(urlBar->entry, EVAS_CALLBACK_FOCUS_OUT, on_urlbar_focus_out);
+
+    evas_object_del(urlBar->area);
+    evas_object_del(urlBar->entry);
+    free(urlBar);
+}
+
+void
+url_bar_url_set(Url_Bar *urlBar, const char *url)
+{
+    if (!urlBar || !url)
+        return;
+
+    edje_object_part_text_set(urlBar->entry, "url.text", url);
+}
diff --git a/Tools/EWebLauncher/url_bar.h b/Tools/EWebLauncher/url_bar.h
new file mode 100644 (file)
index 0000000..472576f
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef url_bar_h
+#define url_bar_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <Evas.h>
+
+#define URL_BAR_HEIGHT 30
+
+typedef struct _Url_Bar {
+    Evas_Object *webView;
+    Evas_Object *area;
+    Evas_Object *entry;
+} Url_Bar;
+
+Url_Bar *url_bar_add(Evas_Object* webview, int width);
+void url_bar_del(Url_Bar *urlBar);
+void url_bar_url_set(Url_Bar *urlBar, const char *url);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // url_bar_h
index 753c449..79ab3e5 100644 (file)
@@ -1,6 +1,7 @@
 SET(MiniBrowser_DIR "${TOOLS_DIR}/MiniBrowser/efl")
 
 SET(MiniBrowser_SOURCES
 SET(MiniBrowser_DIR "${TOOLS_DIR}/MiniBrowser/efl")
 
 SET(MiniBrowser_SOURCES
+    ${TOOLS_DIR}/EWebLauncher/url_bar.c
     ${MiniBrowser_DIR}/main.c
 )
 
     ${MiniBrowser_DIR}/main.c
 )
 
@@ -10,6 +11,7 @@ SET(MiniBrowser_INCLUDE_DIRECTORIES
     ${EDJE_INCLUDE_DIRS}
     ${EFLDEPS_INCLUDE_DIRS}
     ${EVAS_INCLUDE_DIRS}
     ${EDJE_INCLUDE_DIRS}
     ${EFLDEPS_INCLUDE_DIRS}
     ${EVAS_INCLUDE_DIRS}
+    ${TOOLS_DIR}/EWebLauncher
     ${WEBKIT2_DIR}/UIProcess/API/efl
     ${WEBKIT2_DIR}
     ${CMAKE_SOURCE_DIR}/Source
     ${WEBKIT2_DIR}/UIProcess/API/efl
     ${WEBKIT2_DIR}
     ${CMAKE_SOURCE_DIR}/Source
@@ -54,3 +56,5 @@ ADD_EXECUTABLE(MiniBrowser ${MiniBrowser_SOURCES})
 TARGET_LINK_LIBRARIES(MiniBrowser ${MiniBrowser_LIBRARIES})
 ADD_TARGET_PROPERTIES(MiniBrowser LINK_FLAGS "${MiniBrowser_LINK_FLAGS}")
 SET_TARGET_PROPERTIES(MiniBrowser PROPERTIES FOLDER "Tools")
 TARGET_LINK_LIBRARIES(MiniBrowser ${MiniBrowser_LIBRARIES})
 ADD_TARGET_PROPERTIES(MiniBrowser LINK_FLAGS "${MiniBrowser_LINK_FLAGS}")
 SET_TARGET_PROPERTIES(MiniBrowser PROPERTIES FOLDER "Tools")
+
+ADD_DEPENDENCIES(MiniBrowser ThemeControl)
index 02630f1..1cbf784 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include "EWebKit2.h"
  */
 
 #include "EWebKit2.h"
+#include "url_bar.h"
 #include <Ecore.h>
 #include <Ecore_Evas.h>
 #include <Eina.h>
 #include <Ecore.h>
 #include <Ecore_Evas.h>
 #include <Eina.h>
@@ -41,6 +42,7 @@ typedef struct _MiniBrowser {
     Evas *evas;
     Evas_Object *bg;
     Evas_Object *browser;
     Evas *evas;
     Evas_Object *bg;
     Evas_Object *browser;
+    Url_Bar *url_bar;
 } MiniBrowser;
 
 static const Ecore_Getopt options = {
 } MiniBrowser;
 
 static const Ecore_Getopt options = {
@@ -155,6 +157,13 @@ on_title_changed(void *user_data, Evas_Object *webview, void *event_info)
 }
 
 static void
 }
 
 static void
+on_url_changed(void *user_data, Evas_Object *webview, void *event_info)
+{
+    MiniBrowser *app = (MiniBrowser *)user_data;
+    url_bar_url_set(app->url_bar, ewk_view_uri_get(app->browser));
+}
+
+static void
 on_progress(void *user_data, Evas_Object *webview, void *event_info)
 {
     MiniBrowser *app = (MiniBrowser *)user_data;
 on_progress(void *user_data, Evas_Object *webview, void *event_info)
 {
     MiniBrowser *app = (MiniBrowser *)user_data;
@@ -224,14 +233,18 @@ static MiniBrowser *browserCreate(const char *url, const char *engine)
     evas_object_smart_callback_add(app->browser, "load,error", on_error, app);
     evas_object_smart_callback_add(app->browser, "load,progress", on_progress, app);
     evas_object_smart_callback_add(app->browser, "title,changed", on_title_changed, app);
     evas_object_smart_callback_add(app->browser, "load,error", on_error, app);
     evas_object_smart_callback_add(app->browser, "load,progress", on_progress, app);
     evas_object_smart_callback_add(app->browser, "title,changed", on_title_changed, app);
+    evas_object_smart_callback_add(app->browser, "uri,changed", on_url_changed, app);
 
     evas_object_event_callback_add(app->browser, EVAS_CALLBACK_KEY_DOWN, on_key_down, app);
 
     evas_object_size_hint_weight_set(app->browser, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
     evas_object_event_callback_add(app->browser, EVAS_CALLBACK_KEY_DOWN, on_key_down, app);
 
     evas_object_size_hint_weight_set(app->browser, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_resize(app->browser, DEFAULT_WIDTH, DEFAULT_HEIGHT);
+    evas_object_move(app->browser, 0, URL_BAR_HEIGHT);
+    evas_object_resize(app->browser, DEFAULT_WIDTH, DEFAULT_HEIGHT - URL_BAR_HEIGHT);
     evas_object_show(app->browser);
     evas_object_focus_set(app->browser, EINA_TRUE);
 
     evas_object_show(app->browser);
     evas_object_focus_set(app->browser, EINA_TRUE);
 
+    app->url_bar = url_bar_add(app->browser, DEFAULT_WIDTH);
+
     ewk_view_uri_set(app->browser, url);
 
     return app;
     ewk_view_uri_set(app->browser, url);
 
     return app;