2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #include "browser_config.h"
18 #include "BrowserLogger.h"
21 #include <Elementary.h>
28 #include <ewk_chromium.h>
31 #include "Lifecycle.h"
32 #include "ServiceManager.h"
33 #include "BasicUI/AbstractMainWindow.h"
35 ///\note Odroid platform modification
37 const std::string DEFAULT_URL = "";
39 static bool app_create(void * /*app_data*/)
41 elm_config_accel_preference_set("opengl");
43 elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK);
45 elm_config_focus_highlight_enabled_set(EINA_TRUE);
47 /// \todo: clean casts, depends on ServiceManager
48 std::shared_ptr<tizen_browser::base_ui::AbstractMainWindow<Evas_Object>> mainUi =
49 std::dynamic_pointer_cast
51 tizen_browser::base_ui::AbstractMainWindow<Evas_Object>,
52 tizen_browser::core::AbstractService
54 (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.simpleui"));
60 static void app_terminate(void */*app_data*/)
62 std::shared_ptr<tizen_browser::base_ui::AbstractMainWindow<Evas_Object>> mainUi =
63 std::dynamic_pointer_cast
65 tizen_browser::base_ui::AbstractMainWindow<Evas_Object>,
66 tizen_browser::core::AbstractService
68 (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.simpleui"));
72 static void app_service(service_h service, void */*app_data*/){
73 /* to test this functionality please use aul_test command on target:
74 * $aul_test org.tizen.browser __APP_SVC_URI__ <http://full.url.com/>
76 BROWSER_LOGD("%s\n", __func__);
78 char *operation = NULL;
79 char *request_uri = NULL;
80 char *request_mime_type = NULL;
82 if (service_get_operation(service, &operation) != SERVICE_ERROR_NONE) {
83 BROWSER_LOGD("get service operation failed");
87 if (service_get_uri(service, &request_uri) != SERVICE_ERROR_NONE)
88 BROWSER_LOGD("get service uri failed");
90 if (service_get_mime(service, &request_mime_type) != SERVICE_ERROR_NONE)
91 BROWSER_LOGD("get service mime failed");
94 BROWSER_LOGD("operation = [%s], request_uri = [%s], request_mime_type = [%s]"
95 , operation, request_uri, request_mime_type);
97 std::string uri = request_uri != NULL ? std::string(request_uri) : DEFAULT_URL;
99 BROWSER_LOGD("[%s] uri=%s", __func__, uri.c_str());
101 free(request_mime_type);
104 std::shared_ptr<tizen_browser::base_ui::AbstractMainWindow<Evas_Object>> mainUi =
105 std::dynamic_pointer_cast
107 tizen_browser::base_ui::AbstractMainWindow<Evas_Object>,
108 tizen_browser::core::AbstractService
110 (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.simpleui"));
114 evas_object_show(mainUi->getMainWindow().get());
115 elm_win_activate(mainUi->getMainWindow().get());
118 static void app_pause(void *){
119 BROWSER_LOGD("%s", __PRETTY_FUNCTION__);
122 static void app_resume(void *){
123 BROWSER_LOGD("%s", __PRETTY_FUNCTION__);
126 int main(int argc, char* argv[])try
130 setenv("ELM_PROFILE", "tv", true);
132 //#if !defined(NDEBUG)
133 //Initialization of logger module
134 tizen_browser::logger::Logger::getInstance().init();
135 tizen_browser::logger::Logger::getInstance().setLogTag("browser");
138 BROWSER_LOGD("BROWSER IS SAYING HELLO");
139 BROWSER_LOGD("BROWSER TAG: %s",tizen_browser::logger::Logger::getInstance().getLogTag().c_str());
140 BROWSER_LOGD("BROWSER REGISTERED LOGGERS COUNT: %d",tizen_browser::logger::Logger::getInstance().getLoggersCount());
142 app_event_callback_s ops;
143 memset(&ops, 0x00, sizeof(app_event_callback_s));
145 ops.create = app_create;
146 ops.terminate = app_terminate;
147 ops.service = app_service;
149 ops.pause = app_pause;
150 ops.resume = app_resume;
152 app_efl_main(&argc, &argv, &ops, NULL);
157 } catch (std::exception & e)
159 std::cerr << "UNHANDLED EXCEPTION " << e.what() << std::endl;
162 std::cerr << "UNHANDLED EXCEPTION" << std::endl;
165 int main(int argc, char* argv[]) try
168 elm_init(argc, argv);
171 elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK);
173 elm_config_focus_highlight_enabled_set(EINA_TRUE);
176 tizen_browser::logger::Logger::getInstance().init();
177 tizen_browser::logger::Logger::getInstance().setLogTag("browser");
179 std::shared_ptr<tizen_browser::base_ui::AbstractMainWindow<Evas_Object>> mainUi =
180 std::dynamic_pointer_cast
182 tizen_browser::base_ui::AbstractMainWindow<Evas_Object>,
183 tizen_browser::core::AbstractService
185 (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.simpleui"));
188 evas_object_show(mainUi->getMainWindow().get());
189 mainUi->exec("http://enlightenment.org");
196 } catch (std::exception & e)
198 std::cerr << "UNHANDLED EXCEPTION " << e.what() << std::endl;
201 std::cerr << "UNHANDLED EXCEPTION" << std::endl;