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 // MERGE_ME not sure which should be chosen
42 // elm_config_accel_preference_set("opengl");
43 elm_config_accel_preference_set("3d");
45 elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK);
47 elm_config_focus_highlight_enabled_set(EINA_TRUE);
49 /// \todo: clean casts, depends on ServiceManager
50 std::shared_ptr<tizen_browser::base_ui::AbstractMainWindow<Evas_Object>> mainUi =
51 std::dynamic_pointer_cast
53 tizen_browser::base_ui::AbstractMainWindow<Evas_Object>,
54 tizen_browser::core::AbstractService
56 (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.simpleui"));
62 static void app_terminate(void */*app_data*/)
64 BROWSER_LOGD("%s\n", __func__);
65 std::shared_ptr<tizen_browser::base_ui::AbstractMainWindow<Evas_Object>> mainUi =
66 std::dynamic_pointer_cast
68 tizen_browser::base_ui::AbstractMainWindow<Evas_Object>,
69 tizen_browser::core::AbstractService
71 (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.simpleui"));
75 static void app_service(service_h service, void */*app_data*/){
76 /* to test this functionality please use aul_test command on target:
77 * $aul_test org.tizen.browser __APP_SVC_URI__ <http://full.url.com/>
79 BROWSER_LOGD("%s\n", __func__);
81 char *operation = NULL;
82 char *request_uri = NULL;
83 char *request_mime_type = NULL;
85 if (service_get_operation(service, &operation) != SERVICE_ERROR_NONE) {
86 BROWSER_LOGD("get service operation failed");
90 if (service_get_uri(service, &request_uri) != SERVICE_ERROR_NONE)
91 BROWSER_LOGD("get service uri failed");
93 if (service_get_mime(service, &request_mime_type) != SERVICE_ERROR_NONE)
94 BROWSER_LOGD("get service mime failed");
97 BROWSER_LOGD("operation = [%s], request_uri = [%s], request_mime_type = [%s]"
98 , operation, request_uri, request_mime_type);
100 std::string uri = request_uri != NULL ? std::string(request_uri) : DEFAULT_URL;
102 BROWSER_LOGD("[%s] uri=%s", __func__, uri.c_str());
104 free(request_mime_type);
107 std::shared_ptr<tizen_browser::base_ui::AbstractMainWindow<Evas_Object>> mainUi =
108 std::dynamic_pointer_cast
110 tizen_browser::base_ui::AbstractMainWindow<Evas_Object>,
111 tizen_browser::core::AbstractService
113 (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.simpleui"));
117 evas_object_show(mainUi->getMainWindow().get());
118 elm_win_activate(mainUi->getMainWindow().get());
121 static void app_pause(void *){
122 BROWSER_LOGD("%s", __PRETTY_FUNCTION__);
125 static void app_resume(void *){
126 BROWSER_LOGD("%s", __PRETTY_FUNCTION__);
129 int main(int argc, char* argv[])try
133 setenv("ELM_PROFILE", "tv", true);
135 //#if !defined(NDEBUG)
136 //Initialization of logger module
137 tizen_browser::logger::Logger::getInstance().init();
138 tizen_browser::logger::Logger::getInstance().setLogTag("browser");
141 BROWSER_LOGD("BROWSER IS SAYING HELLO");
142 BROWSER_LOGD("BROWSER TAG: %s",tizen_browser::logger::Logger::getInstance().getLogTag().c_str());
143 BROWSER_LOGD("BROWSER REGISTERED LOGGERS COUNT: %d",tizen_browser::logger::Logger::getInstance().getLoggersCount());
145 app_event_callback_s ops;
146 memset(&ops, 0x00, sizeof(app_event_callback_s));
148 ops.create = app_create;
149 ops.terminate = app_terminate;
150 ops.service = app_service;
152 ops.pause = app_pause;
153 ops.resume = app_resume;
155 app_efl_main(&argc, &argv, &ops, NULL);
160 } catch (std::exception & e)
162 std::cerr << "UNHANDLED EXCEPTION " << e.what() << std::endl;
165 std::cerr << "UNHANDLED EXCEPTION" << std::endl;
168 int main(int argc, char* argv[]) try
171 elm_init(argc, argv);
174 elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK);
176 elm_config_focus_highlight_enabled_set(EINA_TRUE);
179 tizen_browser::logger::Logger::getInstance().init();
180 tizen_browser::logger::Logger::getInstance().setLogTag("browser");
182 std::shared_ptr<tizen_browser::base_ui::AbstractMainWindow<Evas_Object>> mainUi =
183 std::dynamic_pointer_cast
185 tizen_browser::base_ui::AbstractMainWindow<Evas_Object>,
186 tizen_browser::core::AbstractService
188 (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.simpleui"));
191 evas_object_show(mainUi->getMainWindow().get());
192 mainUi->exec("http://enlightenment.org");
199 } catch (std::exception & e)
201 std::cerr << "UNHANDLED EXCEPTION " << e.what() << std::endl;
204 std::cerr << "UNHANDLED EXCEPTION" << std::endl;