├── tools ├── gyp │ ├── .gitignore │ ├── pylib │ │ └── gyp │ │ │ ├── generator │ │ │ ├── __init__.py │ │ │ ├── msvs_test.py │ │ │ ├── ninja_test.py │ │ │ ├── gypsh.py │ │ │ ├── gypd.py │ │ │ └── dump_dependency_json.py │ │ │ ├── sun_tool.py │ │ │ ├── MSVSToolFile.py │ │ │ ├── common_test.py │ │ │ ├── xml_fix.py │ │ │ └── easy_xml_test.py │ ├── gyp.bat │ ├── AUTHORS │ ├── gyp │ └── LICENSE ├── dolint.sh ├── generate_api.py └── mergejs.py ├── common ├── CPPLINT.cfg ├── file_utils.h ├── locale_manager.h ├── app_db.h ├── string_utils.h ├── arraysize.h ├── app_db_sqlite.h ├── common.gyp ├── url.h ├── profiler.h ├── app_control.h ├── command_line.h ├── file_utils.cc ├── profiler.cc ├── string_utils.cc ├── logger.h └── resource_manager.h ├── CPPLINT.cfg ├── OWNERS ├── extensions ├── internal │ ├── widget │ │ ├── widget.json │ │ ├── widget_api.js │ │ └── widget_extension.cc │ └── splash_screen │ │ ├── splash_screen.json │ │ ├── splash_screen_api.js │ │ └── splash_screen_extension.cc ├── renderer │ ├── xwalk_v8tools_module.h │ ├── object_tools_module.h │ ├── xwalk_extension_renderer_controller.h │ ├── xwalk_extension_client.h │ ├── widget_module.h │ ├── xwalk_v8tools_module.cc │ └── xwalk_extension_module.h ├── common │ ├── constants.h │ ├── constants.cc │ ├── xwalk_extension_instance.h │ ├── xwalk_extension_manager.h │ ├── xwalk_extension_server.h │ ├── xwalk_extension_instance.cc │ └── xwalk_extension.h ├── public │ ├── XW_Extension_Runtime.h │ ├── XW_Extension_Permissions.h │ ├── XW_Extension_EntryPoints.h │ ├── XW_Extension_SyncMessage.h │ └── XW_Extension_Message_2.h └── extensions.gyp ├── runtime ├── resources │ ├── icons │ │ ├── tw_ic_popup_btn_check.png │ │ └── tw_ic_popup_btn_delete.png │ ├── resources.gyp │ └── locales │ │ ├── zh_CN.po │ │ ├── ko_KR.po │ │ ├── th.po │ │ ├── vi.po │ │ └── ar.po ├── browser │ ├── native_app_window.cc │ ├── vibration_manager.h │ ├── native_ime_window.cc │ ├── native_app_window.h │ ├── native_ime_window.h │ ├── native_watch_window.h │ ├── notification_window.h │ ├── preload_manager.h │ ├── native_watch_window.cc │ ├── notification_manager.h │ ├── ime_application.h │ ├── ime_application.cc │ ├── prelauncher.h │ ├── runtime.h │ ├── notification_window.cc │ ├── ime_runtime.h │ ├── ui_runtime.h │ ├── watch_runtime.h │ ├── popup_string.h │ ├── preload_manager.cc │ ├── vibration_manager.cc │ ├── splash_screen.h │ ├── popup_string.cc │ ├── runtime.cc │ ├── web_view.cc │ ├── native_window.h │ ├── popup.h │ ├── web_view_impl.h │ └── notification_manager.cc └── common │ ├── constants.cc │ └── constants.h ├── .gitignore ├── packaging ├── wrt.loader └── crosswalk-tizen.manifest ├── xwalk_tizen.gyp ├── wrt-upgrade ├── 720.wrt.upgrade.sh ├── wrt-upgrade.gyp ├── wrt-upgrade.h └── wrt-upgrade-info.h ├── loader ├── loader.gyp └── wrt_loader.cc ├── LICENSE.BSD └── README.md /tools/gyp/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /common/CPPLINT.cfg: -------------------------------------------------------------------------------- 1 | exclude_files=picojson\.h -------------------------------------------------------------------------------- /tools/gyp/pylib/gyp/generator/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CPPLINT.cfg: -------------------------------------------------------------------------------- 1 | set noparent 2 | filter=-build/header_guard 3 | linelength=80 -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | ws77.cho@samsung.com 2 | sngn.lee@samsung.com 3 | wy80.choi@samsung.com 4 | -------------------------------------------------------------------------------- /extensions/internal/widget/widget.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name":"Widget", 4 | "lib":"libwidget_plugin.so", 5 | "entry_points":["widget"] 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /runtime/resources/icons/tw_ic_popup_btn_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-tizen/HEAD/runtime/resources/icons/tw_ic_popup_btn_check.png -------------------------------------------------------------------------------- /runtime/resources/icons/tw_ic_popup_btn_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crosswalk-project/crosswalk-tizen/HEAD/runtime/resources/icons/tw_ic_popup_btn_delete.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | *.pyc 3 | *.o 4 | *.os 5 | *.exe 6 | *~ 7 | *.lo 8 | .libs 9 | .deps 10 | *.la 11 | CMakeFiles 12 | CMakeCache.txt 13 | cmake_build_tmp/ 14 | .cproject 15 | -------------------------------------------------------------------------------- /extensions/internal/splash_screen/splash_screen.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name":"SplashScreen", 4 | "lib":"libsplash_screen_plugin.so", 5 | "entry_points":["window.screen.show"] 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /packaging/wrt.loader: -------------------------------------------------------------------------------- 1 | [LOADER] 2 | NAME wrt-loader 3 | EXE /usr/bin/wrt-loader 4 | APP_TYPE webapp 5 | DETECTION_METHOD TIMEOUT|DEMAND 6 | TIMEOUT 5000 7 | -------------------------------------------------------------------------------- /tools/gyp/gyp.bat: -------------------------------------------------------------------------------- 1 | @rem Copyright (c) 2009 Google Inc. All rights reserved. 2 | @rem Use of this source code is governed by a BSD-style license that can be 3 | @rem found in the LICENSE file. 4 | 5 | @python "%~dp0/gyp" %* 6 | -------------------------------------------------------------------------------- /tools/gyp/AUTHORS: -------------------------------------------------------------------------------- 1 | # Names should be added to this file like so: 2 | # Name or Organization 3 | 4 | Google Inc. 5 | Bloomberg Finance L.P. 6 | 7 | Steven Knight 8 | Ryan Norton 9 | -------------------------------------------------------------------------------- /packaging/crosswalk-tizen.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /tools/dolint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "############################# CPP LINT ##################################" 4 | 5 | files=`find $1 -name "*.c" -or -name "*.cc" -or -name "*.h"` 6 | 7 | ret=0 8 | python $(dirname $0)/cpplint.py $files 9 | if [ $? -ne 0 ]; then 10 | ret=1 11 | fi 12 | 13 | echo "############################# LINT DONE ##################################" 14 | 15 | exit $ret 16 | 17 | -------------------------------------------------------------------------------- /xwalk_tizen.gyp: -------------------------------------------------------------------------------- 1 | { 2 | 'targets': [ 3 | { 4 | 'target_name': 'xwalk_tizen_all_targets', 5 | 'type': 'none', 6 | 'dependencies': [ 7 | 'common/common.gyp:*', 8 | 'extensions/extensions.gyp:*', 9 | 'runtime/runtime.gyp:*', 10 | 'loader/loader.gyp:*', 11 | 'wrt-upgrade/wrt-upgrade.gyp:*', 12 | ], 13 | }, # end of target 'xwalk_tizen' 14 | ], # end of targets 15 | } 16 | -------------------------------------------------------------------------------- /wrt-upgrade/720.wrt.upgrade.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PATH=/bin:/usr/bin:/sbin:/usr/sbin 3 | 4 | #excute upgrade application 5 | /usr/bin/wrt-upgrade 6 | 7 | #remove unuse databases 8 | rm /opt/dbspace/.wrt.db 9 | rm /opt/dbspace/.wrt.db-journal 10 | 11 | rm -r /opt/share/widget 12 | 13 | rm /opt/usr/dbspace/.wrt_custom_handler.db 14 | rm /opt/usr/dbspace/.wrt_custom_handler.db-journal 15 | rm /opt/usr/dbspace/.wrt_i18n.db 16 | rm /opt/usr/dbspace/.wrt_i18n.db-journal 17 | -------------------------------------------------------------------------------- /loader/loader.gyp: -------------------------------------------------------------------------------- 1 | { 2 | 'includes':[ 3 | '../build/common.gypi', 4 | ], 5 | 'targets': [ 6 | { 7 | 'target_name': 'wrt-loader', 8 | 'type': 'executable', 9 | 'sources': [ 10 | 'wrt_loader.cc', 11 | ], 12 | 'variables': { 13 | 'packages': [ 14 | 'dlog', 15 | ], 16 | }, 17 | 'libraries' : [ 18 | '-ldl', 19 | ], 20 | }, # end of target 'wrt-loader' 21 | ], 22 | } 23 | -------------------------------------------------------------------------------- /tools/gyp/gyp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Copyright (c) 2009 Google Inc. All rights reserved. 4 | # Use of this source code is governed by a BSD-style license that can be 5 | # found in the LICENSE file. 6 | 7 | import sys 8 | 9 | # TODO(mark): sys.path manipulation is some temporary testing stuff. 10 | try: 11 | import gyp 12 | except ImportError, e: 13 | import os.path 14 | sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), 'pylib')) 15 | import gyp 16 | 17 | if __name__ == '__main__': 18 | sys.exit(gyp.main(sys.argv[1:])) 19 | -------------------------------------------------------------------------------- /tools/generate_api.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Copyright (c) 2013 Intel Corporation. All rights reserved. 4 | # Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved. 5 | # Use of this source code is governed by a BSD-style license that can be 6 | # found in the LICENSE file. 7 | 8 | import os 9 | import sys 10 | import subprocess 11 | 12 | TEMPLATE = """\ 13 | extern const char %s[]; 14 | const char %s[] = { %s, 0 }; 15 | """ 16 | 17 | js_code = sys.argv[1] 18 | cmd = "python " + os.path.dirname(__file__) + "/mergejs.py -f" + js_code 19 | lines = subprocess.check_output(cmd, shell=True) 20 | c_code = ', '.join(str(ord(c)) for c in lines) 21 | 22 | symbol_name = sys.argv[2] 23 | output = open(sys.argv[3], "w") 24 | output.write(TEMPLATE % (symbol_name, symbol_name, c_code)) 25 | output.close() 26 | -------------------------------------------------------------------------------- /wrt-upgrade/wrt-upgrade.gyp: -------------------------------------------------------------------------------- 1 | { 2 | 'includes': [ 3 | '../build/common.gypi', 4 | ], 5 | 'targets': [ 6 | { 7 | 'target_name': 'wrt-upgrade', 8 | 'type': 'executable', 9 | 'dependencies': [ 10 | '../common/common.gyp:xwalk_tizen_common', 11 | ], 12 | 'sources': [ 13 | 'wrt-upgrade.cc', 14 | 'wrt-upgrade-info.cc', 15 | ], 16 | 'variables': { 17 | 'packages': [ 18 | 'sqlite3', 19 | 'dlog', 20 | ], 21 | }, 22 | 'libraries' : [ 23 | '-ldl', 24 | ], 25 | 'copies': [ 26 | { 27 | 'destination': '<(SHARED_INTERMEDIATE_DIR)', 28 | 'files': [ 29 | '720.wrt.upgrade.sh' 30 | ], 31 | }, 32 | ], 33 | }, # end of target 'wrt-upgrade' 34 | ], # end of targets 35 | } 36 | -------------------------------------------------------------------------------- /extensions/internal/splash_screen/splash_screen_api.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | var sendRuntimeMessage = extension.sendRuntimeMessage || function() { 18 | console.error('Runtime did not implement extension.sendRuntimeMessage!'); 19 | }; 20 | window.screen.show = function() { 21 | sendRuntimeMessage('tizen://hide_splash_screen'); 22 | }; 23 | -------------------------------------------------------------------------------- /extensions/renderer/xwalk_v8tools_module.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Intel Corporation. All rights reserved. 2 | // Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | 6 | #ifndef XWALK_EXTENSIONS_RENDERER_XWALK_V8TOOLS_MODULE_H_ 7 | #define XWALK_EXTENSIONS_RENDERER_XWALK_V8TOOLS_MODULE_H_ 8 | 9 | #include "extensions/renderer/xwalk_module_system.h" 10 | 11 | namespace extensions { 12 | 13 | // This module provides extra JS functions that help writing JS API code for 14 | // extensions, for example: allowing setting a read-only property of an object. 15 | class XWalkV8ToolsModule : public XWalkNativeModule { 16 | public: 17 | XWalkV8ToolsModule(); 18 | ~XWalkV8ToolsModule() override; 19 | 20 | private: 21 | v8::Handle NewInstance() override; 22 | 23 | v8::Persistent object_template_; 24 | }; 25 | 26 | } // namespace extensions 27 | 28 | #endif // XWALK_EXTENSIONS_RENDERER_XWALK_V8TOOLS_MODULE_H_ 29 | -------------------------------------------------------------------------------- /wrt-upgrade/wrt-upgrade.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Intel Corporation. All rights reserved. 2 | // Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | 6 | #ifndef WRT_UPGRADE_H 7 | #define WRT_UPGRADE_H 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "wrt-upgrade/wrt-upgrade-info.h" 14 | 15 | namespace upgrade { 16 | class WrtUpgrade{ 17 | public: 18 | WrtUpgrade(); 19 | ~WrtUpgrade(); 20 | void Run(); 21 | private: 22 | void ParseWrtDatabse(); 23 | void ParseSecurityOriginDatabase(); 24 | void ParseCertificatenDatabase(); 25 | void CreateMigrationFile(); 26 | void RemoveDatabases(); 27 | bool RemoveFile(const std::string& path); 28 | void RedirectSymlink(); 29 | std::string CreateJsonObject(std::string appid); 30 | std::vector application_list_; 31 | std::map application_map_; 32 | }; 33 | } // namespace upgrade 34 | #endif // WRT_UPGRADE_H 35 | -------------------------------------------------------------------------------- /runtime/browser/native_app_window.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include "runtime/browser/native_app_window.h" 18 | 19 | #include 20 | 21 | namespace runtime { 22 | 23 | NativeAppWindow::NativeAppWindow() { 24 | } 25 | 26 | NativeAppWindow::~NativeAppWindow() { 27 | } 28 | 29 | Evas_Object* NativeAppWindow::CreateWindowInternal() { 30 | elm_config_accel_preference_set("opengl"); 31 | return elm_win_add(NULL, "xwalk-window", ELM_WIN_BASIC); 32 | } 33 | 34 | 35 | } // namespace runtime 36 | -------------------------------------------------------------------------------- /runtime/browser/vibration_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_RUNTIME_BROWSER_VIBRATION_MANAGER_H_ 18 | #define XWALK_RUNTIME_BROWSER_VIBRATION_MANAGER_H_ 19 | 20 | namespace runtime { 21 | namespace platform { 22 | class VibrationManager { 23 | public: 24 | static VibrationManager* GetInstance(); 25 | virtual void Start(int ms) = 0; 26 | virtual void Stop() = 0; 27 | }; 28 | } // namespace platform 29 | } // namespace runtime 30 | 31 | #endif // XWALK_RUNTIME_BROWSER_VIBRATION_MANAGER_H_ 32 | -------------------------------------------------------------------------------- /tools/gyp/pylib/gyp/generator/msvs_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2012 Google Inc. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | """ Unit tests for the msvs.py file. """ 7 | 8 | import gyp.generator.msvs as msvs 9 | import unittest 10 | import StringIO 11 | 12 | 13 | class TestSequenceFunctions(unittest.TestCase): 14 | 15 | def setUp(self): 16 | self.stderr = StringIO.StringIO() 17 | 18 | def test_GetLibraries(self): 19 | self.assertEqual( 20 | msvs._GetLibraries({}), 21 | []) 22 | self.assertEqual( 23 | msvs._GetLibraries({'libraries': []}), 24 | []) 25 | self.assertEqual( 26 | msvs._GetLibraries({'other':'foo', 'libraries': ['a.lib']}), 27 | ['a.lib']) 28 | self.assertEqual( 29 | msvs._GetLibraries({'libraries': ['-la']}), 30 | ['a.lib']) 31 | self.assertEqual( 32 | msvs._GetLibraries({'libraries': ['a.lib', 'b.lib', 'c.lib', '-lb.lib', 33 | '-lb.lib', 'd.lib', 'a.lib']}), 34 | ['c.lib', 'b.lib', 'd.lib', 'a.lib']) 35 | 36 | if __name__ == '__main__': 37 | unittest.main() 38 | -------------------------------------------------------------------------------- /runtime/browser/native_ime_window.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include "runtime/browser/native_ime_window.h" 18 | #include "common/logger.h" 19 | 20 | #include 21 | #include 22 | 23 | namespace runtime { 24 | 25 | NativeImeWindow::NativeImeWindow() { 26 | } 27 | 28 | NativeImeWindow::~NativeImeWindow() { 29 | } 30 | 31 | Evas_Object* NativeImeWindow::CreateWindowInternal() { 32 | elm_config_accel_preference_set("opengl"); 33 | return ime_get_main_window(); 34 | } 35 | 36 | 37 | } // namespace runtime 38 | -------------------------------------------------------------------------------- /runtime/browser/native_app_window.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_RUNTIME_BROWSER_NATIVE_APP_WINDOW_H_ 18 | #define XWALK_RUNTIME_BROWSER_NATIVE_APP_WINDOW_H_ 19 | 20 | #include "runtime/browser/native_window.h" 21 | 22 | namespace runtime { 23 | 24 | class NativeAppWindow: public NativeWindow { 25 | public: 26 | NativeAppWindow(); 27 | virtual ~NativeAppWindow(); 28 | protected: 29 | Evas_Object* CreateWindowInternal(); // override 30 | }; 31 | 32 | } // namespace runtime 33 | 34 | #endif // XWALK_RUNTIME_BROWSER_NATIVE_APP_WINDOW_H_ 35 | -------------------------------------------------------------------------------- /runtime/browser/native_ime_window.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_RUNTIME_BROWSER_NATIVE_IME_WINDOW_H_ 18 | #define XWALK_RUNTIME_BROWSER_NATIVE_IME_WINDOW_H_ 19 | 20 | #include "runtime/browser/native_window.h" 21 | 22 | namespace runtime { 23 | 24 | class NativeImeWindow: public NativeWindow { 25 | public: 26 | NativeImeWindow(); 27 | virtual ~NativeImeWindow(); 28 | protected: 29 | Evas_Object* CreateWindowInternal(); // override 30 | }; 31 | 32 | } // namespace runtime 33 | 34 | #endif // XWALK_RUNTIME_BROWSER_NATIVE_IME_WINDOW_H_ 35 | -------------------------------------------------------------------------------- /runtime/browser/native_watch_window.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_RUNTIME_BROWSER_NATIVE_WATCH_WINDOW_H_ 18 | #define XWALK_RUNTIME_BROWSER_NATIVE_WATCH_WINDOW_H_ 19 | 20 | #include "runtime/browser/native_window.h" 21 | 22 | namespace runtime { 23 | 24 | class NativeWatchWindow: public NativeWindow { 25 | public: 26 | NativeWatchWindow(); 27 | virtual ~NativeWatchWindow(); 28 | protected: 29 | Evas_Object* CreateWindowInternal(); // override 30 | }; 31 | 32 | } // namespace runtime 33 | 34 | #endif // XWALK_RUNTIME_BROWSER_NATIVE_WATCH_WINDOW_H_ 35 | -------------------------------------------------------------------------------- /extensions/common/constants.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_EXTENSIONS_COMMON_CONSTANTS_H_ 18 | #define XWALK_EXTENSIONS_COMMON_CONSTANTS_H_ 19 | 20 | namespace extensions { 21 | 22 | extern const char kMethodGetExtensions[]; 23 | extern const char kMethodCreateInstance[]; 24 | extern const char kMethodDestroyInstance[]; 25 | extern const char kMethodSendSyncMessage[]; 26 | extern const char kMethodPostMessage[]; 27 | extern const char kMethodGetAPIScript[]; 28 | extern const char kMethodPostMessageToJS[]; 29 | 30 | } // namespace extensions 31 | 32 | #endif // XWALK_EXTENSIONS_COMMON_CONSTANTS_H_ 33 | -------------------------------------------------------------------------------- /runtime/common/constants.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include "runtime/common/constants.h" 18 | 19 | namespace runtime { 20 | 21 | const char kRuntimeExecName[] = "xwalk_runtime"; 22 | 23 | const char kAppDBRuntimeSection[] = "Runtime"; 24 | const char kAppDBRuntimeAppID[] = "app_id"; 25 | const char kAppDBRuntimeName[] = "runtime_name"; 26 | const char kAppDBRuntimeBundle[] = "encoded_bundle"; 27 | const char kAppDBRuntimeBackgroundSupport[] = "background_support"; 28 | 29 | const char kTextLocalePath[] = "/usr/share/locale"; 30 | const char kTextDomainRuntime[] = "xwalk"; 31 | 32 | } // namespace runtime 33 | -------------------------------------------------------------------------------- /common/file_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_COMMON_FILE_UTILS_H_ 18 | #define XWALK_COMMON_FILE_UTILS_H_ 19 | 20 | #include 21 | 22 | namespace common { 23 | namespace utils { 24 | 25 | bool Exists(const std::string& path); 26 | 27 | std::string BaseName(const std::string& path); 28 | 29 | std::string DirName(const std::string& path); 30 | 31 | std::string SchemeName(const std::string& uri); 32 | 33 | std::string ExtName(const std::string& path); 34 | 35 | std::string GetUserRuntimeDir(); 36 | 37 | } // namespace utils 38 | } // namespace common 39 | 40 | #endif // XWALK_COMMON_FILE_UTILS_H_ 41 | -------------------------------------------------------------------------------- /extensions/common/constants.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include "extensions/common/constants.h" 18 | 19 | namespace extensions { 20 | 21 | const char kMethodGetExtensions[] = "xwalk://GetExtensions"; 22 | const char kMethodCreateInstance[] = "xwalk://CreateInstance"; 23 | const char kMethodDestroyInstance[] = "xwalk://DestroyInstance"; 24 | const char kMethodSendSyncMessage[] = "xwalk://SendSyncMessage"; 25 | const char kMethodPostMessage[] = "xwalk://PostMessage"; 26 | const char kMethodGetAPIScript[] = "xwalk://GetAPIScript"; 27 | const char kMethodPostMessageToJS[] = "xwalk://PostMessageToJS"; 28 | 29 | 30 | } // namespace extensions 31 | -------------------------------------------------------------------------------- /runtime/common/constants.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_RUNTIME_COMMON_CONSTANTS_H_ 18 | #define XWALK_RUNTIME_COMMON_CONSTANTS_H_ 19 | 20 | namespace runtime { 21 | 22 | extern const char kRuntimeExecName[]; 23 | 24 | extern const char kAppDBRuntimeSection[]; 25 | extern const char kAppDBRuntimeAppID[]; 26 | extern const char kAppDBRuntimeName[]; 27 | extern const char kAppDBRuntimeBundle[]; 28 | extern const char kAppDBRuntimeBackgroundSupport[]; 29 | 30 | extern const char kTextLocalePath[]; 31 | extern const char kTextDomainRuntime[]; 32 | 33 | } // namespace runtime 34 | 35 | #endif // XWALK_RUNTIME_COMMON_CONSTANTS_H_ 36 | -------------------------------------------------------------------------------- /runtime/browser/notification_window.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_RUNTIME_BROWSER_NOTIFICATION_WINDOW_H_ 18 | #define XWALK_RUNTIME_BROWSER_NOTIFICATION_WINDOW_H_ 19 | 20 | #include 21 | 22 | namespace runtime { 23 | 24 | class NotificationWindow : public NativeWindow { 25 | public: 26 | NotificationWindow(); 27 | virtual ~NotificationWindow() = default; 28 | 29 | Evas_Object* CreateWindowInternal() override; 30 | 31 | private: 32 | static void SetAlwaysOnTop(Evas_Object* window, bool enable); 33 | }; 34 | 35 | } // namespace runtime 36 | 37 | #endif // XWALK_RUNTIME_BROWSER_NOTIFICATION_WINDOW_H_ 38 | -------------------------------------------------------------------------------- /extensions/renderer/object_tools_module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_EXTENSIONS_RENDERER_OBJECT_TOOLS_MODULE_H_ 18 | #define XWALK_EXTENSIONS_RENDERER_OBJECT_TOOLS_MODULE_H_ 19 | 20 | #include "extensions/renderer/xwalk_module_system.h" 21 | 22 | namespace extensions { 23 | 24 | class ObjectToolsModule : public XWalkNativeModule { 25 | public: 26 | ObjectToolsModule(); 27 | ~ObjectToolsModule() override; 28 | 29 | private: 30 | v8::Handle NewInstance() override; 31 | v8::Persistent create_function_; 32 | }; 33 | 34 | } // namespace extensions 35 | 36 | #endif // XWALK_EXTENSIONS_RENDERER_OBJECT_TOOLS_MODULE_H_ 37 | -------------------------------------------------------------------------------- /runtime/browser/preload_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | 18 | 19 | #ifndef XWALK_RUNTIME_BROWSER_PRELOAD_MANAGER_H_ 20 | #define XWALK_RUNTIME_BROWSER_PRELOAD_MANAGER_H_ 21 | 22 | #include 23 | 24 | namespace runtime { 25 | class NativeWindow; 26 | class PreloadManager { 27 | public: 28 | static PreloadManager* GetInstance(); 29 | void CreateCacheComponet(); 30 | NativeWindow* GetCachedNativeWindow(); 31 | void ReleaseCachedNativeWindow(); 32 | 33 | private: 34 | PreloadManager(); 35 | std::unique_ptr cached_window_; 36 | }; 37 | 38 | } // namespace runtime 39 | 40 | #endif // XWALK_RUNTIME_BROWSER_PRELOAD_MANAGER_H_ 41 | -------------------------------------------------------------------------------- /runtime/browser/native_watch_window.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include "runtime/browser/native_watch_window.h" 18 | #include "common/logger.h" 19 | 20 | #include 21 | #include 22 | 23 | namespace runtime { 24 | 25 | NativeWatchWindow::NativeWatchWindow() { 26 | } 27 | 28 | NativeWatchWindow::~NativeWatchWindow() { 29 | } 30 | 31 | Evas_Object* NativeWatchWindow::CreateWindowInternal() { 32 | Evas_Object* window = NULL; 33 | elm_config_accel_preference_set("opengl"); 34 | watch_app_get_elm_win(&window); 35 | elm_win_alpha_set(window, EINA_TRUE); 36 | evas_object_render_op_set(window, EVAS_RENDER_COPY); 37 | return window; 38 | } 39 | 40 | 41 | } // namespace runtime 42 | -------------------------------------------------------------------------------- /runtime/browser/notification_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | 18 | #ifndef XWALK_RUNTIME_BROWSER_NOTIFICATION_MANAGER_H_ 19 | #define XWALK_RUNTIME_BROWSER_NOTIFICATION_MANAGER_H_ 20 | 21 | #include 22 | #include 23 | 24 | namespace runtime { 25 | class NotificationManager { 26 | public: 27 | static NotificationManager* GetInstance(); 28 | bool Show(uint64_t tag, 29 | const std::string& title, 30 | const std::string& body, 31 | const std::string& icon_path); 32 | bool Hide(uint64_t tag); 33 | private: 34 | NotificationManager(); 35 | std::map keymapper_; 36 | }; 37 | } // namespace runtime 38 | 39 | #endif // XWALK_RUNTIME_BROWSER_NOTIFICATION_MANAGER_H_ 40 | -------------------------------------------------------------------------------- /loader/wrt_loader.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | #include 17 | #include 18 | 19 | // loader file must have "User" execute label, because launchpad daemon runs 20 | // with "System::Privileged" label. 21 | int main(int argc, char* argv[]) { 22 | void* handle = dlopen("/usr/bin/xwalk_runtime", RTLD_NOW); 23 | if (!handle) { 24 | dlog_print(DLOG_DEBUG, "XWALK", "Error loading xwalk_runtime"); 25 | return false; 26 | } 27 | 28 | typedef int (*MAIN_FUNC)(int argc, char* argv[]); 29 | 30 | MAIN_FUNC real_main = reinterpret_cast(dlsym(handle, "main")); 31 | if (!real_main) { 32 | dlog_print(DLOG_DEBUG, "XWALK", "Error loading real_main"); 33 | return false; 34 | } 35 | 36 | int ret = real_main(argc, argv); 37 | dlclose(handle); 38 | 39 | return ret; 40 | } 41 | -------------------------------------------------------------------------------- /runtime/browser/ime_application.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_RUNTIME_BROWSER_IME_APPLICATION_H_ 18 | #define XWALK_RUNTIME_BROWSER_IME_APPLICATION_H_ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include "runtime/browser/web_view.h" 26 | #include "runtime/browser/native_window.h" 27 | #include "runtime/browser/web_application.h" 28 | 29 | namespace runtime { 30 | 31 | class ImeApplication : public WebApplication { 32 | public: 33 | ImeApplication( 34 | NativeWindow* window, common::ApplicationData* app_data); 35 | virtual ~ImeApplication(); 36 | protected: 37 | virtual void OnLoadFinished(WebView* view); // override 38 | }; 39 | 40 | } // namespace runtime 41 | 42 | #endif // XWALK_RUNTIME_BROWSER_IME_APPLICATION_H_ 43 | -------------------------------------------------------------------------------- /extensions/public/XW_Extension_Runtime.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_RUNTIME_H_ 6 | #define XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_RUNTIME_H_ 7 | 8 | // NOTE: This file and interfaces marked as internal are not considered stable 9 | // and can be modified in incompatible ways between Crosswalk versions. 10 | 11 | #ifndef XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_H_ 12 | #error "You should include XW_Extension.h before this file" 13 | #endif 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #define XW_INTERNAL_RUNTIME_INTERFACE_1 \ 20 | "XW_Internal_RuntimeInterface_1" 21 | #define XW_INTERNAL_RUNTIME_INTERFACE \ 22 | XW_INTERNAL_RUNTIME_INTERFACE_1 23 | 24 | // 25 | // XW_INTERNAL_RUNTIME_INTERFACE: allow extensions to gather information 26 | // from the runtime. 27 | // 28 | 29 | struct XW_Internal_RuntimeInterface_1 { 30 | void (*GetRuntimeVariableString)(XW_Extension extension, 31 | const char* key, 32 | char* value, 33 | unsigned int value_len); 34 | }; 35 | 36 | typedef struct XW_Internal_RuntimeInterface_1 37 | XW_Internal_RuntimeInterface; 38 | 39 | #ifdef __cplusplus 40 | } // extern "C" 41 | #endif 42 | 43 | #endif // XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_RUNTIME_H_ 44 | 45 | -------------------------------------------------------------------------------- /extensions/public/XW_Extension_Permissions.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_PERMISSIONS_H_ 6 | #define XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_PERMISSIONS_H_ 7 | 8 | // NOTE: This file and interfaces marked as internal are not considered stable 9 | // and can be modified in incompatible ways between Crosswalk versions. 10 | 11 | #ifndef XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_H_ 12 | #error "You should include XW_Extension.h before this file" 13 | #endif 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #define XW_INTERNAL_PERMISSIONS_INTERFACE_1 \ 20 | "XW_Internal_PermissionsInterface_1" 21 | #define XW_INTERNAL_PERMISSIONS_INTERFACE \ 22 | XW_INTERNAL_PERMISSIONS_INTERFACE_1 23 | 24 | // 25 | // XW_INTERNAL_PERMISSIONS_INTERFACE: provides a way for extensions 26 | // check if they have the proper permissions for certain APIs. 27 | // 28 | 29 | struct XW_Internal_PermissionsInterface_1 { 30 | int (*CheckAPIAccessControl)(XW_Extension extension, const char* api_name); 31 | int (*RegisterPermissions)(XW_Extension extension, const char* perm_table); 32 | }; 33 | 34 | typedef struct XW_Internal_PermissionsInterface_1 35 | XW_Internal_PermissionsInterface; 36 | 37 | #ifdef __cplusplus 38 | } // extern "C" 39 | #endif 40 | 41 | #endif // XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_PERMISSIONS_H_ 42 | -------------------------------------------------------------------------------- /extensions/renderer/xwalk_extension_renderer_controller.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Intel Corporation. All rights reserved. 2 | // Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | 6 | #ifndef XWALK_EXTENSIONS_RENDERER_XWALK_EXTENSION_RENDERER_CONTROLLER_H_ 7 | #define XWALK_EXTENSIONS_RENDERER_XWALK_EXTENSION_RENDERER_CONTROLLER_H_ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | namespace extensions { 17 | 18 | class XWalkExtensionClient; 19 | 20 | class XWalkExtensionRendererController { 21 | public: 22 | static XWalkExtensionRendererController& GetInstance(); 23 | static int plugin_session_count; 24 | 25 | void DidCreateScriptContext(v8::Handle context); 26 | void WillReleaseScriptContext(v8::Handle context); 27 | 28 | void OnReceivedIPCMessage(const Ewk_IPC_Wrt_Message_Data* data); 29 | 30 | void InitializeExtensionClient(); 31 | void LoadUserExtensions(const std::string app_path); 32 | 33 | bool exit_requested; 34 | 35 | private: 36 | XWalkExtensionRendererController(); 37 | virtual ~XWalkExtensionRendererController(); 38 | 39 | private: 40 | std::unique_ptr extensions_client_; 41 | }; 42 | 43 | } // namespace extensions 44 | 45 | #endif // XWALK_EXTENSIONS_RENDERER_XWALK_EXTENSION_RENDERER_CONTROLLER_H_ 46 | -------------------------------------------------------------------------------- /extensions/common/xwalk_extension_instance.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Intel Corporation. All rights reserved. 2 | // Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | 6 | #ifndef XWALK_EXTENSIONS_XWALK_EXTENSION_INSTANCE_H_ 7 | #define XWALK_EXTENSIONS_XWALK_EXTENSION_INSTANCE_H_ 8 | 9 | #include 10 | #include 11 | 12 | #include "extensions/public/XW_Extension.h" 13 | 14 | namespace extensions { 15 | 16 | class XWalkExtension; 17 | 18 | class XWalkExtensionInstance { 19 | public: 20 | typedef std::function MessageCallback; 21 | 22 | XWalkExtensionInstance(XWalkExtension* extension, XW_Instance xw_instance); 23 | virtual ~XWalkExtensionInstance(); 24 | 25 | void HandleMessage(const std::string& msg); 26 | void HandleSyncMessage(const std::string& msg); 27 | 28 | void SetPostMessageCallback(MessageCallback callback); 29 | void SetSendSyncReplyCallback(MessageCallback callback); 30 | 31 | private: 32 | friend class XWalkExtensionAdapter; 33 | 34 | void PostMessageToJS(const std::string& msg); 35 | void SyncReplyToJS(const std::string& reply); 36 | 37 | XWalkExtension* extension_; 38 | XW_Instance xw_instance_; 39 | void* instance_data_; 40 | 41 | MessageCallback post_message_callback_; 42 | MessageCallback send_sync_reply_callback_; 43 | }; 44 | 45 | } // namespace extensions 46 | 47 | #endif // XWALK_EXTENSIONS_XWALK_EXTENSION_INSTANCE_H_ 48 | -------------------------------------------------------------------------------- /extensions/common/xwalk_extension_manager.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef XWALK_EXTENSIONS_XWALK_EXTENSION_MANAGER_H_ 6 | #define XWALK_EXTENSIONS_XWALK_EXTENSION_MANAGER_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "extensions/common/xwalk_extension.h" 13 | 14 | namespace extensions { 15 | 16 | class XWalkExtensionManager : public XWalkExtension::XWalkExtensionDelegate { 17 | public: 18 | typedef std::set StringSet; 19 | typedef std::map ExtensionMap; 20 | 21 | XWalkExtensionManager(); 22 | virtual ~XWalkExtensionManager(); 23 | 24 | ExtensionMap extensions() const { return extensions_; } 25 | 26 | void LoadExtensions(bool meta_only = true); 27 | void LoadUserExtensions(const std::string app_path); 28 | void PreloadExtensions(); 29 | 30 | void UnloadExtensions(); 31 | 32 | private: 33 | // override 34 | void GetRuntimeVariable(const char* key, char* value, size_t value_len); 35 | 36 | bool RegisterSymbols(XWalkExtension* extension); 37 | void RegisterExtension(XWalkExtension* extension); 38 | void RegisterExtensionsByMeta(const std::string& meta_path, 39 | StringSet* files); 40 | 41 | StringSet extension_symbols_; 42 | ExtensionMap extensions_; 43 | }; 44 | 45 | } // namespace extensions 46 | 47 | #endif // XWALK_EXTENSIONS_XWALK_EXTENSION_MANAGER_H_ 48 | -------------------------------------------------------------------------------- /common/locale_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_COMMON_LOCALE_MANAGER_H_ 18 | #define XWALK_COMMON_LOCALE_MANAGER_H_ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace common { 25 | 26 | class LocaleManager { 27 | public: 28 | typedef std::map StringMap; 29 | 30 | LocaleManager(); 31 | virtual ~LocaleManager(); 32 | void SetDefaultLocale(const std::string& locale); 33 | void EnableAutoUpdate(bool enable); 34 | void UpdateSystemLocale(); 35 | const std::list& system_locales() const 36 | { return system_locales_; } 37 | 38 | std::string GetLocalizedString(const StringMap& strmap); 39 | 40 | private: 41 | std::string default_locale_; 42 | std::list system_locales_; 43 | }; 44 | 45 | } // namespace common 46 | 47 | #endif // XWALK_COMMON_LOCALE_MANAGER_H_ 48 | -------------------------------------------------------------------------------- /tools/gyp/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 Google Inc. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /runtime/browser/ime_application.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include 18 | 19 | #include "common/application_data.h" 20 | #include "common/logger.h" 21 | #include "runtime/browser/native_window.h" 22 | #include "runtime/browser/web_view.h" 23 | #include "runtime/browser/ime_application.h" 24 | 25 | namespace runtime { 26 | 27 | ImeApplication::ImeApplication( 28 | NativeWindow* window, common::ApplicationData* app_data) 29 | : WebApplication(window, app_data) { 30 | } 31 | 32 | ImeApplication::~ImeApplication() { 33 | } 34 | 35 | // override 36 | void ImeApplication::OnLoadFinished(WebView* view) { 37 | this->WebApplication::OnLoadFinished(view); 38 | 39 | LOGGER(DEBUG) << "LoadFinished"; 40 | const char* kImeActivateFunctionCallScript = 41 | "(function(){WebHelperClient.impl.activate();})()"; 42 | view->EvalJavascript(kImeActivateFunctionCallScript); 43 | } 44 | 45 | } // namespace runtime 46 | -------------------------------------------------------------------------------- /LICENSE.BSD: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Samsung Electronics Co, Ltd. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Samsung Electronics nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /runtime/browser/prelauncher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | namespace runtime { 24 | 25 | class PreLauncher { 26 | public: 27 | using Preload = std::function; 28 | using DidStart = std::function; 29 | using RealMain = std::function; 30 | static int Prelaunch(int argc, char* argv[], Preload, DidStart, RealMain); 31 | 32 | PreLauncher(); 33 | ~PreLauncher(); 34 | 35 | private: 36 | void StartMainLoop(); 37 | void StopMainLoop(); 38 | 39 | void Watch(int fd, std::function readable); 40 | void Unwatch(int fd); 41 | 42 | Preload preload_; 43 | DidStart didstart_; 44 | RealMain realmain_; 45 | 46 | std::map > handlers_; 47 | std::map fd_map_; 48 | }; 49 | 50 | } // namespace runtime 51 | -------------------------------------------------------------------------------- /common/app_db.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_COMMON_APP_DB_H_ 18 | #define XWALK_COMMON_APP_DB_H_ 19 | 20 | #include 21 | #include 22 | 23 | namespace common { 24 | 25 | class AppDB { 26 | public: 27 | static AppDB* GetInstance(); 28 | virtual bool HasKey(const std::string& section, 29 | const std::string& key) const = 0; 30 | virtual std::string Get(const std::string& section, 31 | const std::string& key) const = 0; 32 | virtual void Set(const std::string& section, 33 | const std::string& key, 34 | const std::string& value) = 0; 35 | virtual void GetKeys(const std::string& section, 36 | std::list* keys) const = 0; 37 | virtual void Remove(const std::string& section, 38 | const std::string& key) = 0; 39 | }; 40 | } // namespace common 41 | 42 | #endif // XWALK_COMMON_APP_DB_H_ 43 | -------------------------------------------------------------------------------- /runtime/browser/runtime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_RUNTIME_BROWSER_RUNTIME_H_ 18 | #define XWALK_RUNTIME_BROWSER_RUNTIME_H_ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "common/application_data.h" 25 | #include "runtime/browser/web_application.h" 26 | 27 | namespace runtime { 28 | 29 | class Runtime { 30 | public: 31 | virtual ~Runtime() = 0; 32 | virtual void Terminate() = 0; 33 | 34 | virtual int Exec(int argc, char* argv[]) = 0; 35 | 36 | static std::unique_ptr MakeRuntime( 37 | common::ApplicationData* app_data); 38 | 39 | protected: 40 | void ProcessClosingPage(WebApplication* application); 41 | 42 | private: 43 | static Eina_Bool ClosePageInExtendedMainLoop(void* user_data); 44 | struct Timer 45 | { 46 | WebApplication* application; 47 | Ecore_Timer* timer; 48 | }; 49 | }; 50 | 51 | } // namespace runtime 52 | 53 | #endif // XWALK_RUNTIME_BROWSER_RUNTIME_H_ 54 | -------------------------------------------------------------------------------- /common/string_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_COMMON_STRING_UTILS_H_ 18 | #define XWALK_COMMON_STRING_UTILS_H_ 19 | 20 | #include 21 | #include 22 | 23 | namespace common { 24 | namespace utils { 25 | 26 | std::string GenerateUUID(); 27 | bool StartsWith(const std::string& str, const std::string& sub); 28 | bool EndsWith(const std::string& str, const std::string& sub); 29 | std::string ReplaceAll(const std::string& replace, 30 | const std::string& from, const std::string& to); 31 | std::string GetCurrentMilliSeconds(); 32 | bool SplitString(const std::string &str, 33 | std::string *part_1, std::string *part_2, const char delim); 34 | std::string UrlEncode(const std::string& url); 35 | std::string UrlDecode(const std::string& url); 36 | std::string Base64Encode(const unsigned char* data, size_t len); 37 | 38 | } // namespace utils 39 | } // namespace common 40 | 41 | #endif // XWALK_COMMON_STRING_UTILS_H_ 42 | -------------------------------------------------------------------------------- /runtime/browser/notification_window.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | namespace runtime { 22 | 23 | 24 | NotificationWindow::NotificationWindow() { 25 | window_type_ = NativeWindow::Type::NOTIFICATION; 26 | } 27 | 28 | Evas_Object* NotificationWindow::CreateWindowInternal() { 29 | elm_config_accel_preference_set("opengl"); 30 | Evas_Object* window = elm_win_add(NULL, "xwalk-window", ELM_WIN_NOTIFICATION); 31 | efl_util_set_notification_window_level(window, 32 | EFL_UTIL_NOTIFICATION_LEVEL_3); 33 | SetAlwaysOnTop(window, true); 34 | return window; 35 | } 36 | 37 | void NotificationWindow::SetAlwaysOnTop(Evas_Object* window, bool enable) { 38 | if (enable) 39 | elm_win_aux_hint_add(window, "wm.policy.win.above.lock", "1"); 40 | else 41 | elm_win_aux_hint_add(window, "wm.policy.win.above.lock", "0"); 42 | } 43 | 44 | 45 | } // namespace runtime 46 | -------------------------------------------------------------------------------- /tools/gyp/pylib/gyp/sun_tool.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2011 Google Inc. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | """These functions are executed via gyp-sun-tool when using the Makefile 7 | generator.""" 8 | 9 | import fcntl 10 | import os 11 | import struct 12 | import subprocess 13 | import sys 14 | 15 | 16 | def main(args): 17 | executor = SunTool() 18 | executor.Dispatch(args) 19 | 20 | 21 | class SunTool(object): 22 | """This class performs all the SunOS tooling steps. The methods can either be 23 | executed directly, or dispatched from an argument list.""" 24 | 25 | def Dispatch(self, args): 26 | """Dispatches a string command to a method.""" 27 | if len(args) < 1: 28 | raise Exception("Not enough arguments") 29 | 30 | method = "Exec%s" % self._CommandifyName(args[0]) 31 | getattr(self, method)(*args[1:]) 32 | 33 | def _CommandifyName(self, name_string): 34 | """Transforms a tool name like copy-info-plist to CopyInfoPlist""" 35 | return name_string.title().replace('-', '') 36 | 37 | def ExecFlock(self, lockfile, *cmd_list): 38 | """Emulates the most basic behavior of Linux's flock(1).""" 39 | # Rely on exception handling to report errors. 40 | # Note that the stock python on SunOS has a bug 41 | # where fcntl.flock(fd, LOCK_EX) always fails 42 | # with EBADF, that's why we use this F_SETLK 43 | # hack instead. 44 | fd = os.open(lockfile, os.O_WRONLY|os.O_NOCTTY|os.O_CREAT, 0666) 45 | op = struct.pack('hhllhhl', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0) 46 | fcntl.fcntl(fd, fcntl.F_SETLK, op) 47 | return subprocess.call(cmd_list) 48 | 49 | 50 | if __name__ == '__main__': 51 | sys.exit(main(sys.argv[1:])) 52 | -------------------------------------------------------------------------------- /runtime/browser/ime_runtime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_RUNTIME_BROWSER_IME_RUNTIME_H_ 18 | #define XWALK_RUNTIME_BROWSER_IME_RUNTIME_H_ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "common/application_data.h" 25 | #include "runtime/browser/runtime.h" 26 | #include "runtime/browser/native_window.h" 27 | #include "runtime/browser/ime_application.h" 28 | 29 | namespace runtime { 30 | 31 | class ImeRuntime : public Runtime { 32 | public: 33 | ImeRuntime(common::ApplicationData* app_data); 34 | virtual ~ImeRuntime(); 35 | 36 | virtual int Exec(int argc, char* argv[]); 37 | 38 | protected: 39 | virtual void OnCreate(); 40 | virtual void OnTerminate(); 41 | virtual void OnShow(int context_id, ime_context_h context); 42 | virtual void OnHide(int context_id); 43 | virtual void OnAppControl(); 44 | 45 | virtual void Terminate(); 46 | private: 47 | WebApplication* application_; 48 | NativeWindow* native_window_; 49 | common::ApplicationData* app_data_; 50 | }; 51 | 52 | } // namespace runtime 53 | 54 | #endif // XWALK_RUNTIME_BROWSER_IME_RUNTIME_H_ 55 | -------------------------------------------------------------------------------- /common/arraysize.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_COMMON_ARRAYSIZE_H_ 18 | #define XWALK_COMMON_ARRAYSIZE_H_ 19 | 20 | // The ARRAYSIZE(arr) macro returns the # of elements in an array arr. 21 | // The expression is a compile-time constant, and therefore can be 22 | // used in defining new arrays, for example. If you use arraysize on 23 | // a pointer by mistake, you will get a compile-time error. 24 | // 25 | // One caveat is that ARRAYSIZE() doesn't accept any array of an 26 | // anonymous type or a type defined inside a function. In these rare 27 | // cases, you have to use the unsafe ARRAYSIZE_UNSAFE() macro below. This is 28 | // due to a limitation in C++'s template system. The limitation might 29 | // eventually be removed, but it hasn't happened yet. 30 | 31 | // This template function declaration is used in defining arraysize. 32 | // Note that the function doesn't need an implementation, as we only 33 | // use its type. 34 | template 35 | char (&ArraySizeHelper(T (&array)[N]))[N]; 36 | 37 | #define ARRAYSIZE(array) (sizeof(ArraySizeHelper(array))) 38 | 39 | #endif // XWALK_COMMON_ARRAYSIZE_H_ 40 | 41 | -------------------------------------------------------------------------------- /extensions/public/XW_Extension_EntryPoints.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_ENTRYPOINTS_H_ 6 | #define XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_ENTRYPOINTS_H_ 7 | 8 | // NOTE: This file and interfaces marked as internal are not considered stable 9 | // and can be modified in incompatible ways between Crosswalk versions. 10 | 11 | #ifndef XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_H_ 12 | #error "You should include XW_Extension.h before this file" 13 | #endif 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #define XW_INTERNAL_ENTRY_POINTS_INTERFACE_1 \ 20 | "XW_Internal_EntryPointsInterface_1" 21 | #define XW_INTERNAL_ENTRY_POINTS_INTERFACE \ 22 | XW_INTERNAL_ENTRY_POINTS_INTERFACE_1 23 | 24 | // 25 | // XW_INTERNAL_ENTRY_POINTS_INTERFACE: provides a way for extensions to add 26 | // more information about its implementation. For now, allow extensions to 27 | // specify more objects that the access should cause the extension to be 28 | // loaded. 29 | // 30 | 31 | struct XW_Internal_EntryPointsInterface_1 { 32 | // Register extra entry points for this extension. An "extra" entry points 33 | // are objects outside the implicit namespace for which the extension should 34 | // be loaded when they are touched. 35 | // 36 | // This function should be called only during XW_Initialize(). 37 | void (*SetExtraJSEntryPoints)(XW_Extension extension, 38 | const char** entry_points); 39 | }; 40 | 41 | typedef struct XW_Internal_EntryPointsInterface_1 42 | XW_Internal_EntryPointsInterface; 43 | 44 | #ifdef __cplusplus 45 | } // extern "C" 46 | #endif 47 | 48 | #endif // XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_ENTRYPOINTS_H_ 49 | 50 | -------------------------------------------------------------------------------- /extensions/public/XW_Extension_SyncMessage.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_SYNCMESSAGE_H_ 6 | #define XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_SYNCMESSAGE_H_ 7 | 8 | // NOTE: This file and interfaces marked as internal are not considered stable 9 | // and can be modified in incompatible ways between Crosswalk versions. 10 | 11 | #ifndef XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_H_ 12 | #error "You should include XW_Extension.h before this file" 13 | #endif 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | // 20 | // XW_INTERNAL_SYNC_MESSAGING_INTERFACE: allow JavaScript code to send a 21 | // synchronous message to extension code and block until response is 22 | // available. The response is made available by calling the SetSyncReply 23 | // function, that can be done from outside the context of the SyncMessage 24 | // handler. 25 | // 26 | 27 | #define XW_INTERNAL_SYNC_MESSAGING_INTERFACE_1 \ 28 | "XW_InternalSyncMessagingInterface_1" 29 | #define XW_INTERNAL_SYNC_MESSAGING_INTERFACE \ 30 | XW_INTERNAL_SYNC_MESSAGING_INTERFACE_1 31 | 32 | typedef void (*XW_HandleSyncMessageCallback)(XW_Instance instance, 33 | const char* message); 34 | 35 | struct XW_Internal_SyncMessagingInterface_1 { 36 | void (*Register)(XW_Extension extension, 37 | XW_HandleSyncMessageCallback handle_sync_message); 38 | void (*SetSyncReply)(XW_Instance instance, const char* reply); 39 | }; 40 | 41 | typedef struct XW_Internal_SyncMessagingInterface_1 42 | XW_Internal_SyncMessagingInterface; 43 | 44 | #ifdef __cplusplus 45 | } // extern "C" 46 | #endif 47 | 48 | #endif // XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_SYNCMESSAGE_H_ 49 | -------------------------------------------------------------------------------- /tools/gyp/pylib/gyp/generator/ninja_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Copyright (c) 2012 Google Inc. All rights reserved. 4 | # Use of this source code is governed by a BSD-style license that can be 5 | # found in the LICENSE file. 6 | 7 | """ Unit tests for the ninja.py file. """ 8 | 9 | import gyp.generator.ninja as ninja 10 | import unittest 11 | import StringIO 12 | import sys 13 | import TestCommon 14 | 15 | 16 | class TestPrefixesAndSuffixes(unittest.TestCase): 17 | if sys.platform in ('win32', 'cygwin'): 18 | def test_BinaryNamesWindows(self): 19 | writer = ninja.NinjaWriter('foo', 'wee', '.', '.', 'ninja.build', 'win') 20 | spec = { 'target_name': 'wee' } 21 | self.assertTrue(writer.ComputeOutputFileName(spec, 'executable'). 22 | endswith('.exe')) 23 | self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). 24 | endswith('.dll')) 25 | self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). 26 | endswith('.lib')) 27 | 28 | if sys.platform == 'linux2': 29 | def test_BinaryNamesLinux(self): 30 | writer = ninja.NinjaWriter('foo', 'wee', '.', '.', 'ninja.build', 'linux') 31 | spec = { 'target_name': 'wee' } 32 | self.assertTrue('.' not in writer.ComputeOutputFileName(spec, 33 | 'executable')) 34 | self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). 35 | startswith('lib')) 36 | self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). 37 | startswith('lib')) 38 | self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). 39 | endswith('.so')) 40 | self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). 41 | endswith('.a')) 42 | 43 | if __name__ == '__main__': 44 | unittest.main() 45 | -------------------------------------------------------------------------------- /common/app_db_sqlite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_COMMON_APP_DB_SQLITE_H_ 18 | #define XWALK_COMMON_APP_DB_SQLITE_H_ 19 | 20 | #include 21 | #include 22 | 23 | #include "common/app_db.h" 24 | 25 | class sqlite3; 26 | 27 | namespace common { 28 | class SqliteDB : public AppDB { 29 | public: 30 | explicit SqliteDB(const std::string& app_data_path = std::string()); 31 | ~SqliteDB(); 32 | virtual bool HasKey(const std::string& section, 33 | const std::string& key) const; 34 | virtual std::string Get(const std::string& section, 35 | const std::string& key) const; 36 | virtual void Set(const std::string& section, 37 | const std::string& key, 38 | const std::string& value); 39 | virtual void GetKeys(const std::string& section, 40 | std::list* keys) const; 41 | virtual void Remove(const std::string& section, 42 | const std::string& key); 43 | 44 | private: 45 | void Initialize(); 46 | void MigrationAppdb(); 47 | std::string app_data_path_; 48 | sqlite3* sqldb_; 49 | }; 50 | 51 | } // namespace common 52 | 53 | #endif // XWALK_COMMON_APP_DB_SQLITE_H_ 54 | -------------------------------------------------------------------------------- /tools/gyp/pylib/gyp/generator/gypsh.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2011 Google Inc. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | """gypsh output module 6 | 7 | gypsh is a GYP shell. It's not really a generator per se. All it does is 8 | fire up an interactive Python session with a few local variables set to the 9 | variables passed to the generator. Like gypd, it's intended as a debugging 10 | aid, to facilitate the exploration of .gyp structures after being processed 11 | by the input module. 12 | 13 | The expected usage is "gyp -f gypsh -D OS=desired_os". 14 | """ 15 | 16 | 17 | import code 18 | import sys 19 | 20 | 21 | # All of this stuff about generator variables was lovingly ripped from gypd.py. 22 | # That module has a much better description of what's going on and why. 23 | _generator_identity_variables = [ 24 | 'EXECUTABLE_PREFIX', 25 | 'EXECUTABLE_SUFFIX', 26 | 'INTERMEDIATE_DIR', 27 | 'PRODUCT_DIR', 28 | 'RULE_INPUT_ROOT', 29 | 'RULE_INPUT_DIRNAME', 30 | 'RULE_INPUT_EXT', 31 | 'RULE_INPUT_NAME', 32 | 'RULE_INPUT_PATH', 33 | 'SHARED_INTERMEDIATE_DIR', 34 | ] 35 | 36 | generator_default_variables = { 37 | } 38 | 39 | for v in _generator_identity_variables: 40 | generator_default_variables[v] = '<(%s)' % v 41 | 42 | 43 | def GenerateOutput(target_list, target_dicts, data, params): 44 | locals = { 45 | 'target_list': target_list, 46 | 'target_dicts': target_dicts, 47 | 'data': data, 48 | } 49 | 50 | # Use a banner that looks like the stock Python one and like what 51 | # code.interact uses by default, but tack on something to indicate what 52 | # locals are available, and identify gypsh. 53 | banner='Python %s on %s\nlocals.keys() = %s\ngypsh' % \ 54 | (sys.version, sys.platform, repr(sorted(locals.keys()))) 55 | 56 | code.interact(banner, local=locals) 57 | -------------------------------------------------------------------------------- /extensions/common/xwalk_extension_server.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef XWALK_EXTENSIONS_XWALK_EXTENSION_SERVER_H_ 6 | #define XWALK_EXTENSIONS_XWALK_EXTENSION_SERVER_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | #include "extensions/common/xwalk_extension_manager.h" 16 | #include "extensions/common/xwalk_extension_instance.h" 17 | 18 | namespace extensions { 19 | 20 | class XWalkExtensionServer { 21 | public: 22 | static XWalkExtensionServer* GetInstance(); 23 | 24 | void SetupIPC(Ewk_Context* ewk_context); 25 | void Preload(); 26 | Json::Value GetExtensions(); 27 | std::string GetAPIScript(const std::string& extension_name); 28 | std::string CreateInstance(const std::string& extension_name); 29 | 30 | void HandleIPCMessage(Ewk_IPC_Wrt_Message_Data* data); 31 | 32 | void Shutdown(); 33 | void LoadUserExtensions(const std::string app_path); 34 | 35 | private: 36 | XWalkExtensionServer(); 37 | virtual ~XWalkExtensionServer(); 38 | 39 | void HandleGetExtensions(Ewk_IPC_Wrt_Message_Data* data); 40 | void HandleCreateInstance(Ewk_IPC_Wrt_Message_Data* data); 41 | void HandleDestroyInstance(Ewk_IPC_Wrt_Message_Data* data); 42 | void HandlePostMessageToNative(Ewk_IPC_Wrt_Message_Data* data); 43 | void HandleSendSyncMessageToNative(Ewk_IPC_Wrt_Message_Data* data); 44 | void HandleGetAPIScript(Ewk_IPC_Wrt_Message_Data* data); 45 | 46 | typedef std::map InstanceMap; 47 | 48 | Ewk_Context* ewk_context_; 49 | 50 | XWalkExtensionManager manager_; 51 | 52 | InstanceMap instances_; 53 | }; 54 | 55 | } // namespace extensions 56 | 57 | #endif // XWALK_EXTENSIONS_XWALK_EXTENSION_SERVER_H_ 58 | -------------------------------------------------------------------------------- /runtime/browser/ui_runtime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_RUNTIME_BROWSER_UI_RUNTIME_H_ 18 | #define XWALK_RUNTIME_BROWSER_UI_RUNTIME_H_ 19 | 20 | #include 21 | #include 22 | 23 | #include "common/application_data.h" 24 | #include "runtime/browser/runtime.h" 25 | #include "runtime/browser/native_window.h" 26 | #include "runtime/browser/web_application.h" 27 | 28 | class Ewk_Context; 29 | 30 | namespace runtime { 31 | 32 | class UiRuntime : public Runtime { 33 | public: 34 | UiRuntime(common::ApplicationData* app_data); 35 | virtual ~UiRuntime(); 36 | 37 | virtual int Exec(int argc, char* argv[]); 38 | 39 | protected: 40 | virtual bool OnCreate(); 41 | virtual void OnTerminate(); 42 | virtual void OnPause(); 43 | virtual void OnResume(); 44 | virtual void OnAppControl(app_control_h app_control); 45 | virtual void OnLanguageChanged(const std::string& language); 46 | virtual void OnLowMemory(); 47 | virtual void Terminate(); 48 | 49 | private: 50 | void ResetWebApplication(NativeWindow::Type windowType); 51 | 52 | std::unique_ptr native_window_; 53 | std::unique_ptr application_; 54 | Ewk_Context* context_; 55 | common::ApplicationData* app_data_; 56 | }; 57 | 58 | } // namespace runtime 59 | 60 | #endif // XWALK_RUNTIME_BROWSER_UI_RUNTIME_H_ 61 | -------------------------------------------------------------------------------- /runtime/browser/watch_runtime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_RUNTIME_BROWSER_WATCH_RUNTIME_H_ 18 | #define XWALK_RUNTIME_BROWSER_WATCH_RUNTIME_H_ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "common/application_data.h" 25 | #include "runtime/browser/runtime.h" 26 | #include "runtime/browser/native_window.h" 27 | 28 | namespace runtime { 29 | 30 | class WatchRuntime : public Runtime { 31 | public: 32 | WatchRuntime(common::ApplicationData* app_data); 33 | virtual ~WatchRuntime(); 34 | 35 | virtual int Exec(int argc, char* argv[]); 36 | 37 | protected: 38 | virtual bool OnCreate(); 39 | virtual void OnTerminate(); 40 | virtual void OnPause(); 41 | virtual void OnResume(); 42 | virtual void OnAppControl(app_control_h app_control); 43 | virtual void OnLanguageChanged(const std::string& language); 44 | virtual void OnLowMemory(); 45 | virtual void OnTimeTick(watch_time_h watch_time); 46 | virtual void OnAmbientTick(watch_time_h watch_time); 47 | virtual void OnAmbientChanged(bool ambient_mode); 48 | 49 | virtual void Terminate(); 50 | private: 51 | WebApplication* application_; 52 | NativeWindow* native_window_; 53 | common::ApplicationData* app_data_; 54 | }; 55 | 56 | } // namespace runtime 57 | 58 | #endif // XWALK_RUNTIME_BROWSER_WATCH_RUNTIME_H_ 59 | -------------------------------------------------------------------------------- /tools/gyp/pylib/gyp/MSVSToolFile.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 Google Inc. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | """Visual Studio project reader/writer.""" 6 | 7 | import gyp.common 8 | import gyp.easy_xml as easy_xml 9 | 10 | 11 | class Writer(object): 12 | """Visual Studio XML tool file writer.""" 13 | 14 | def __init__(self, tool_file_path, name): 15 | """Initializes the tool file. 16 | 17 | Args: 18 | tool_file_path: Path to the tool file. 19 | name: Name of the tool file. 20 | """ 21 | self.tool_file_path = tool_file_path 22 | self.name = name 23 | self.rules_section = ['Rules'] 24 | 25 | def AddCustomBuildRule(self, name, cmd, description, 26 | additional_dependencies, 27 | outputs, extensions): 28 | """Adds a rule to the tool file. 29 | 30 | Args: 31 | name: Name of the rule. 32 | description: Description of the rule. 33 | cmd: Command line of the rule. 34 | additional_dependencies: other files which may trigger the rule. 35 | outputs: outputs of the rule. 36 | extensions: extensions handled by the rule. 37 | """ 38 | rule = ['CustomBuildRule', 39 | {'Name': name, 40 | 'ExecutionDescription': description, 41 | 'CommandLine': cmd, 42 | 'Outputs': ';'.join(outputs), 43 | 'FileExtensions': ';'.join(extensions), 44 | 'AdditionalDependencies': 45 | ';'.join(additional_dependencies) 46 | }] 47 | self.rules_section.append(rule) 48 | 49 | def WriteIfChanged(self): 50 | """Writes the tool file.""" 51 | content = ['VisualStudioToolFile', 52 | {'Version': '8.00', 53 | 'Name': self.name 54 | }, 55 | self.rules_section 56 | ] 57 | easy_xml.WriteXmlIfChanged(content, self.tool_file_path, 58 | encoding="Windows-1252") 59 | -------------------------------------------------------------------------------- /runtime/browser/popup_string.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | 18 | #ifndef XWALK_RUNTIME_BROWSER_POPUP_STRING_H_ 19 | #define XWALK_RUNTIME_BROWSER_POPUP_STRING_H_ 20 | 21 | #include 22 | 23 | namespace runtime { 24 | 25 | namespace popup_string { 26 | 27 | extern const char kPopupTitleAuthRequest[]; 28 | extern const char kPopupTitleCert[]; 29 | extern const char kPopupTitleGeoLocation[]; 30 | extern const char kPopupTitleUserMedia[]; 31 | extern const char kPopupTitleWebNotification[]; 32 | extern const char kPopupTitleWebStorage[]; 33 | 34 | extern const char kPopupBodyAuthRequest[]; 35 | extern const char kPopupBodyCert[]; 36 | extern const char kPopupBodyGeoLocation[]; 37 | extern const char kPopupBodyUserMedia[]; 38 | extern const char kPopupBodyWebNotification[]; 39 | extern const char kPopupBodyWebStorage[]; 40 | 41 | extern const char kPopupCheckRememberPreference[]; 42 | 43 | extern const char kPopupLabelAuthusername[]; 44 | extern const char kPopupLabelPassword[]; 45 | 46 | extern const char kPopupButtonOk[]; 47 | extern const char kPopupButtonLogin[]; 48 | extern const char kPopupButtonCancel[]; 49 | extern const char kPopupButtonAllow[]; 50 | extern const char kPopupButtonDeny[]; 51 | 52 | std::string GetText(const std::string& msg_id); 53 | 54 | } // namespace popup_string 55 | 56 | } // namespace runtime 57 | 58 | #endif // XWALK_RUNTIME_BROWSER_POPUP_STRING_H_ 59 | -------------------------------------------------------------------------------- /common/common.gyp: -------------------------------------------------------------------------------- 1 | { 2 | 'includes':[ 3 | '../build/common.gypi', 4 | ], 5 | 'targets': [ 6 | { 7 | 'target_name': 'xwalk_tizen_common', 8 | 'type': 'shared_library', 9 | 'sources': [ 10 | 'command_line.h', 11 | 'command_line.cc', 12 | 'file_utils.h', 13 | 'file_utils.cc', 14 | 'string_utils.h', 15 | 'string_utils.cc', 16 | 'logger.h', 17 | 'picojson.h', 18 | 'profiler.h', 19 | 'profiler.cc', 20 | 'url.h', 21 | 'url.cc', 22 | 'app_control.h', 23 | 'app_control.cc', 24 | 'app_db.h', 25 | 'app_db.cc', 26 | 'app_db_sqlite.h', 27 | 'application_data.h', 28 | 'application_data.cc', 29 | 'locale_manager.h', 30 | 'locale_manager.cc', 31 | 'resource_manager.h', 32 | 'resource_manager.cc', 33 | ], 34 | 'cflags': [ 35 | '-fvisibility=default', 36 | ], 37 | 'variables': { 38 | 'packages': [ 39 | 'appsvc', 40 | 'aul', 41 | 'capi-appfw-application', 42 | 'capi-appfw-app-manager', 43 | 'capi-appfw-package-manager', 44 | 'capi-system-system-settings', 45 | 'cynara-client', 46 | 'dlog', 47 | 'uuid', 48 | 'libwebappenc', 49 | 'manifest-parser', 50 | 'wgt-manifest-handlers', 51 | 'pkgmgr-info', 52 | 'glib-2.0', 53 | 'ttrace', 54 | ], 55 | }, 56 | 'conditions': [ 57 | ['tizen_feature_web_ime_support == 1', { 58 | 'defines': ['IME_FEATURE_SUPPORT'], 59 | }], 60 | ['tizen_feature_watch_face_support == 1', { 61 | 'defines': ['WATCH_FACE_FEATURE_SUPPORT'], 62 | }], 63 | ], 64 | 'direct_dependent_settings': { 65 | 'libraries': [ 66 | '-lxwalk_tizen_common', 67 | ], 68 | 'variables': { 69 | 'packages': [ 70 | 'dlog', 71 | ], 72 | }, 73 | }, 74 | }, 75 | ], 76 | } 77 | -------------------------------------------------------------------------------- /runtime/browser/preload_manager.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include "runtime/browser/preload_manager.h" 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include "common/logger.h" 25 | #include "runtime/browser/native_app_window.h" 26 | #include "extensions/common/xwalk_extension_server.h" 27 | 28 | #ifndef INJECTED_BUNDLE_PATH 29 | #error INJECTED_BUNDLE_PATH is not set. 30 | #endif 31 | 32 | namespace runtime { 33 | 34 | PreloadManager* PreloadManager::GetInstance() { 35 | static PreloadManager instance; 36 | return &instance; 37 | } 38 | 39 | PreloadManager::PreloadManager() { 40 | } 41 | 42 | void PreloadManager::CreateCacheComponet() { 43 | // Load extensions in the preload step 44 | auto extension_server = extensions::XWalkExtensionServer::GetInstance(); 45 | extension_server->Preload(); 46 | 47 | // It was not used. just to fork zygote process 48 | auto context = 49 | ewk_context_new_with_injected_bundle_path(INJECTED_BUNDLE_PATH); 50 | context = context; // To prevent build warning 51 | cached_window_.reset(new NativeAppWindow()); 52 | cached_window_->Initialize(); 53 | } 54 | 55 | NativeWindow* PreloadManager::GetCachedNativeWindow() { 56 | return cached_window_ ? cached_window_.release() : nullptr; 57 | } 58 | 59 | void PreloadManager::ReleaseCachedNativeWindow() { 60 | cached_window_.reset(nullptr); 61 | } 62 | 63 | } // namespace runtime 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This project is archived. Please contact Tizen Forum (https://developer.tizen.org/forums/web-application-development/active) instead. 2 | 3 | 4 | ## Introduction 5 | Crosswalk Project for Tizen is a sub-project of [Crosswalk](https://crosswalk-project.org), it aims to provide a web runtime for Tizen 3.0 and later. 6 | 7 | It is an open source project forked from [Crosswalk](https://crosswalk-project.org) by the Samsung Electronics. 8 | 9 | * [Enlightenment](https://www.enlightenment.org) 10 | 11 | Crosswalk Project for Tizen uses EWK API of [Chromium-EFL](https://review.tizen.org/git/?p=platform/framework/web/chromium-efl.git;a=shortlog;h=refs/heads/tizen). 12 | The EWK API provides abstract API layer of web engine for using [EFL](https://www.enlightenment.org) graphics system in Tizen. 13 | 14 | * Crosswalk Extension Framework 15 | 16 | Extension enhance the capabilities of the Crosswalk Project, enabling applications to make full use of platform features via native code. 17 | The [Device APIs for Tizen](https://review.tizen.org/git/?p=platform/core/api/webapi-plugins.git;a=shortlog;h=refs/heads/tizen) are written under the Crosswalk Extension Framework. 18 | 19 | ## System Requirement 20 | Presently, the following Mobile and TV profiles are supported on Tizen 3.0: 21 | 22 | * Mobile 23 | * Device: Samsung Galaxy Note 4 24 | * Binary: https://download.tizen.org/snapshots/tizen/mobile/latest/images 25 | 26 | * TV 27 | * Device: Odroid XU3 28 | * Binary: https://download.tizen.org/snapshots/tizen/tv/latest/images 29 | 30 | ## Quick Start Guide 31 | Refer to the [Quick Start Guide](https://github.com/crosswalk-project/crosswalk-tizen/wiki/Quick-Start-Guide) page to build crosswalk-tizen project. 32 | 33 | ## Community 34 | 35 | * Follow the [crosswalk-help](https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help) mailing list to ask questions 36 | 37 | * Follow the [crosswalk-dev](https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev) mailing list for development updates 38 | 39 | ## License 40 | 41 | Crosswalk Project for Tizen is available under the Apache-2.0 and the BSD licenses, see our `LICENSE` and `LICENSE.BSD` files. 42 | 43 | -------------------------------------------------------------------------------- /common/url.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_COMMON_URL_H_ 18 | #define XWALK_COMMON_URL_H_ 19 | 20 | #include 21 | 22 | namespace common { 23 | 24 | class URLImpl; 25 | 26 | /* 27 | * This class parses a given url based on its scheme type. 28 | * The parsed data is stored in different variables depending on the scheme 29 | * type. 30 | * The following shows the variables which are used for each scheme type: 31 | * http:// https:// ssh:// ftp:// 32 | * => url_, scheme_, domain_, port_, path_ 33 | * app:// 34 | * => url_, scheme_, domain_, path_ 35 | * file:// 36 | * => url_, scheme_, path_ 37 | * No Scheme Type 38 | * => domain_, path_ 39 | * 40 | * If the url does not have specific data, an empty string will be stored 41 | * in the corresponding variables.(RFC 1738) 42 | * 43 | * ex) http://user:password@www.tizen.org:8080/market/Item?12345 44 | * url_ = http://user:password@www.tizen.org:8080/market/Item?12345 45 | * scheme_ = http 46 | * user_ = user 47 | * password_ = password 48 | * domain_ = www.tizen.org 49 | * port_ = 8080 50 | * path_ = /market/Item?12345 51 | */ 52 | class URL { 53 | public: 54 | explicit URL(const std::string& url); 55 | ~URL(); 56 | 57 | std::string url() const; 58 | std::string scheme() const; 59 | std::string domain() const; 60 | int port() const; 61 | std::string path() const; 62 | 63 | private: 64 | URLImpl* impl_; 65 | }; 66 | 67 | } // namespace common 68 | 69 | #endif // XWALK_COMMON_URL_H_ 70 | -------------------------------------------------------------------------------- /common/profiler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_COMMON_PROFILER_H_ 18 | #define XWALK_COMMON_PROFILER_H_ 19 | 20 | #include 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace common { 27 | 28 | #define PROFILE_START() PrintProfileLog(__FUNCTION__, "START"); 29 | #define PROFILE_END() PrintProfileLog(__FUNCTION__, "END"); 30 | #define PROFILE(x) PrintProfileLog(__FUNCTION__, x); 31 | 32 | void PrintProfileLog(const char* func, const char* tag); 33 | 34 | class ScopeProfile { 35 | public: 36 | explicit ScopeProfile(const char* step, const bool isStep); 37 | ~ScopeProfile(); 38 | void Reset(); 39 | void End(); 40 | private: 41 | std::string step_; 42 | struct timespec start_; 43 | bool expired_; 44 | bool isStep_; 45 | }; 46 | 47 | class StepProfile { 48 | public: 49 | static StepProfile* GetInstance(); 50 | void Start(const char* step); 51 | void End(const char* step); 52 | private: 53 | StepProfile(); 54 | ~StepProfile(); 55 | typedef std::map > ProfileMapT; 57 | ProfileMapT map_; 58 | }; 59 | 60 | } // namespace common 61 | 62 | #define SCOPE_PROFILE() \ 63 | common::ScopeProfile __profile(__PRETTY_FUNCTION__, false); 64 | 65 | #define STEP_PROFILE_START(x) \ 66 | common::StepProfile::GetInstance()->Start(x) 67 | 68 | #define STEP_PROFILE_END(x) \ 69 | common::StepProfile::GetInstance()->End(x) 70 | 71 | 72 | #endif // XWALK_COMMON_PROFILER_H_ 73 | -------------------------------------------------------------------------------- /runtime/browser/vibration_manager.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include "runtime/browser/vibration_manager.h" 18 | 19 | #include 20 | 21 | #include "common/logger.h" 22 | 23 | namespace runtime { 24 | namespace platform { 25 | 26 | class VibrationImpl : public VibrationManager { 27 | public: 28 | VibrationImpl(); 29 | virtual ~VibrationImpl(); 30 | virtual void Start(int ms); 31 | virtual void Stop(); 32 | private: 33 | bool Initialize(); 34 | // haptic_devce_h was declared as int 35 | haptic_device_h handle_; 36 | }; 37 | 38 | 39 | VibrationImpl::VibrationImpl() 40 | : handle_(0) { 41 | } 42 | 43 | VibrationImpl::~VibrationImpl() { 44 | if (handle_ != 0) { 45 | haptic_close(handle_); 46 | handle_ = 0; 47 | } 48 | } 49 | 50 | bool VibrationImpl::Initialize() { 51 | if (handle_ != 0) 52 | return true; 53 | 54 | int ret = haptic_open(HAPTIC_DEVICE_0, &handle_); 55 | if (ret != HAPTIC_ERROR_NONE) { 56 | LOGGER(ERROR) << "Fail to open haptic device"; 57 | handle_ = 0; 58 | return false; 59 | } 60 | return true; 61 | } 62 | 63 | void VibrationImpl::Start(int ms) { 64 | if (Initialize()) { 65 | haptic_vibrate_monotone(handle_, ms, NULL); 66 | } 67 | } 68 | 69 | void VibrationImpl::Stop() { 70 | if (Initialize()) { 71 | haptic_stop_all_effects(handle_); 72 | } 73 | } 74 | 75 | VibrationManager* VibrationManager::GetInstance() { 76 | static VibrationImpl instance; 77 | return &instance; 78 | } 79 | 80 | 81 | } // namespace platform 82 | } // namespace runtime 83 | -------------------------------------------------------------------------------- /extensions/common/xwalk_extension_instance.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Intel Corporation. All rights reserved. 2 | // Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | 6 | #include "extensions/common/xwalk_extension_instance.h" 7 | 8 | #include "extensions/common/xwalk_extension_adapter.h" 9 | #include "extensions/public/XW_Extension_SyncMessage.h" 10 | 11 | namespace extensions { 12 | 13 | XWalkExtensionInstance::XWalkExtensionInstance( 14 | XWalkExtension* extension, XW_Instance xw_instance) 15 | : extension_(extension), 16 | xw_instance_(xw_instance), 17 | instance_data_(NULL) { 18 | XWalkExtensionAdapter::GetInstance()->RegisterInstance(this); 19 | XW_CreatedInstanceCallback callback = extension_->created_instance_callback_; 20 | if (callback) 21 | callback(xw_instance_); 22 | } 23 | 24 | XWalkExtensionInstance::~XWalkExtensionInstance() { 25 | XW_DestroyedInstanceCallback callback = 26 | extension_->destroyed_instance_callback_; 27 | if (callback) 28 | callback(xw_instance_); 29 | XWalkExtensionAdapter::GetInstance()->UnregisterInstance(this); 30 | } 31 | 32 | void XWalkExtensionInstance::HandleMessage(const std::string& msg) { 33 | XW_HandleMessageCallback callback = extension_->handle_msg_callback_; 34 | if (callback) 35 | callback(xw_instance_, msg.c_str()); 36 | } 37 | 38 | void XWalkExtensionInstance::HandleSyncMessage(const std::string& msg) { 39 | XW_HandleSyncMessageCallback callback = extension_->handle_sync_msg_callback_; 40 | if (callback) { 41 | callback(xw_instance_, msg.c_str()); 42 | } 43 | } 44 | 45 | void XWalkExtensionInstance::SetPostMessageCallback( 46 | MessageCallback callback) { 47 | post_message_callback_ = callback; 48 | } 49 | 50 | void XWalkExtensionInstance::SetSendSyncReplyCallback( 51 | MessageCallback callback) { 52 | send_sync_reply_callback_ = callback; 53 | } 54 | 55 | void XWalkExtensionInstance::PostMessageToJS(const std::string& msg) { 56 | post_message_callback_(msg); 57 | } 58 | 59 | void XWalkExtensionInstance::SyncReplyToJS(const std::string& reply) { 60 | send_sync_reply_callback_(reply); 61 | } 62 | 63 | } // namespace extensions 64 | -------------------------------------------------------------------------------- /tools/gyp/pylib/gyp/common_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Copyright (c) 2012 Google Inc. All rights reserved. 4 | # Use of this source code is governed by a BSD-style license that can be 5 | # found in the LICENSE file. 6 | 7 | """Unit tests for the common.py file.""" 8 | 9 | import gyp.common 10 | import unittest 11 | import sys 12 | 13 | 14 | class TestTopologicallySorted(unittest.TestCase): 15 | def test_Valid(self): 16 | """Test that sorting works on a valid graph with one possible order.""" 17 | graph = { 18 | 'a': ['b', 'c'], 19 | 'b': [], 20 | 'c': ['d'], 21 | 'd': ['b'], 22 | } 23 | def GetEdge(node): 24 | return tuple(graph[node]) 25 | self.assertEqual( 26 | gyp.common.TopologicallySorted(graph.keys(), GetEdge), 27 | ['a', 'c', 'd', 'b']) 28 | 29 | def test_Cycle(self): 30 | """Test that an exception is thrown on a cyclic graph.""" 31 | graph = { 32 | 'a': ['b'], 33 | 'b': ['c'], 34 | 'c': ['d'], 35 | 'd': ['a'], 36 | } 37 | def GetEdge(node): 38 | return tuple(graph[node]) 39 | self.assertRaises( 40 | gyp.common.CycleError, gyp.common.TopologicallySorted, 41 | graph.keys(), GetEdge) 42 | 43 | 44 | class TestGetFlavor(unittest.TestCase): 45 | """Test that gyp.common.GetFlavor works as intended""" 46 | original_platform = '' 47 | 48 | def setUp(self): 49 | self.original_platform = sys.platform 50 | 51 | def tearDown(self): 52 | sys.platform = self.original_platform 53 | 54 | def assertFlavor(self, expected, argument, param): 55 | sys.platform = argument 56 | self.assertEqual(expected, gyp.common.GetFlavor(param)) 57 | 58 | def test_platform_default(self): 59 | self.assertFlavor('freebsd', 'freebsd9' , {}) 60 | self.assertFlavor('freebsd', 'freebsd10', {}) 61 | self.assertFlavor('openbsd', 'openbsd5' , {}) 62 | self.assertFlavor('solaris', 'sunos5' , {}); 63 | self.assertFlavor('solaris', 'sunos' , {}); 64 | self.assertFlavor('linux' , 'linux2' , {}); 65 | self.assertFlavor('linux' , 'linux3' , {}); 66 | 67 | def test_param(self): 68 | self.assertFlavor('foobar', 'linux2' , {'flavor': 'foobar'}) 69 | 70 | 71 | if __name__ == '__main__': 72 | unittest.main() 73 | -------------------------------------------------------------------------------- /runtime/browser/splash_screen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_RUNTIME_BROWSER_SPLASH_SCREEN_H_ 18 | #define XWALK_RUNTIME_BROWSER_SPLASH_SCREEN_H_ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | #include "runtime/browser/native_window.h" 29 | #include "wgt_manifest_handlers/launch_screen_handler.h" 30 | 31 | namespace runtime { 32 | 33 | class SplashScreen { 34 | public: 35 | typedef std::pair SplashScreenBound; 36 | enum class HideReason { RENDERED, LOADFINISHED, CUSTOM }; 37 | 38 | SplashScreen(NativeWindow* window, 39 | std::shared_ptr ss_info, 40 | const std::string& app_path); 41 | void HideSplashScreen(HideReason reason); 42 | 43 | private: 44 | std::pair GetDimensions(); 45 | void SetBackground(const wgt::parse::LaunchScreenData& splash_data, 46 | Evas_Object* parent, const SplashScreenBound& bound, 47 | const std::string& app_path); 48 | 49 | void SetImage(const wgt::parse::LaunchScreenData& splash_data, 50 | Evas_Object* parent, const SplashScreenBound& bound, 51 | const std::string& app_path); 52 | 53 | std::shared_ptr ss_info_; 54 | NativeWindow* window_; 55 | Evas_Object* image_; 56 | Evas_Object* background_; 57 | Evas_Object* background_image_; 58 | bool is_active_; 59 | }; 60 | } // namespace runtime 61 | #endif // XWALK_RUNTIME_BROWSER_SPLASH_SCREEN_H_ 62 | -------------------------------------------------------------------------------- /common/app_control.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_COMMON_APP_CONTROL_H_ 18 | #define XWALK_COMMON_APP_CONTROL_H_ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace common { 28 | 29 | class AppControl { 30 | public: 31 | static std::unique_ptr MakeAppcontrolFromURL( 32 | const std::string& url); 33 | explicit AppControl(app_control_h app_control); 34 | AppControl(); 35 | ~AppControl(); 36 | // disable copy 37 | AppControl(const AppControl& src) = delete; 38 | AppControl& operator=(const AppControl&) = delete; 39 | 40 | std::string operation() const; 41 | void set_operation(const std::string& operation); 42 | std::string mime() const; 43 | void set_mime(const std::string& mime); 44 | std::string uri() const; 45 | void set_uri(const std::string& uri); 46 | std::string category() const; 47 | void set_category(const std::string& category); 48 | std::string data(const std::string& key) const; 49 | std::vector data_array(const std::string& key) const; 50 | std::string encoded_bundle(); 51 | 52 | bool IsDataArray(const std::string& key); 53 | bool AddData(const std::string& key, const std::string& value); 54 | bool AddDataArray(const std::string& key, 55 | const std::vector& value_array); 56 | bool Reply(const std::map>& data); 57 | bool LaunchRequest(); 58 | 59 | private: 60 | app_control_h app_control_; 61 | bundle* app_control_bundle_; 62 | }; 63 | 64 | } // namespace common 65 | 66 | #endif // XWALK_COMMON_APP_CONTROL_H_ 67 | -------------------------------------------------------------------------------- /runtime/resources/resources.gyp: -------------------------------------------------------------------------------- 1 | { 2 | 'targets': [ 3 | { 4 | 'target_name': 'xwalk_runtime_resources', 5 | 'type': 'none', 6 | 'rules': [ 7 | { 8 | 'rule_name': 'xwalk_po2mo', 9 | 'extension': 'po', 10 | 'outputs': [ 11 | '<(SHARED_INTERMEDIATE_DIR)/locales/<(RULE_INPUT_ROOT)/LC_MESSAGES/xwalk.mo', 12 | ], 13 | 'action': [ 14 | 'msgfmt', 15 | '-o', 16 | '<@(_outputs)', 17 | '<(RULE_INPUT_PATH)', 18 | ], 19 | 'message': 'Generating mo file from <(RULE_INPUT_PATH)', 20 | }, 21 | { 22 | 'rule_name': 'xwalk_edc2edj', 23 | 'extension': 'edc', 24 | 'outputs': [ 25 | '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).edj', 26 | ], 27 | 'action': [ 28 | 'edje_cc', 29 | '<(RULE_INPUT_PATH)', 30 | '<@(_outputs)', 31 | ], 32 | 'message': 'Generating edj file from <(RULE_INPUT_PATH)', 33 | } 34 | ], 35 | 'sources': [ 36 | 'xwalk_tizen.edc', 37 | 'locales/ar.po', 38 | 'locales/as.po', 39 | 'locales/bn_BD.po', 40 | 'locales/bn.po', 41 | 'locales/en_PH.po', 42 | 'locales/en.po', 43 | 'locales/en_US.po', 44 | 'locales/es_US.po', 45 | 'locales/fa.po', 46 | 'locales/fr.po', 47 | 'locales/gu.po', 48 | 'locales/hi.po', 49 | 'locales/id.po', 50 | 'locales/km.po', 51 | 'locales/kn.po', 52 | 'locales/ko_KR.po', 53 | 'locales/lo.po', 54 | 'locales/ml.po', 55 | 'locales/mr.po', 56 | 'locales/ms.po', 57 | 'locales/my_ZG.po', 58 | 'locales/ne.po', 59 | 'locales/or.po', 60 | 'locales/pa.po', 61 | 'locales/pt_BR.po', 62 | 'locales/pt_PT.po', 63 | 'locales/ru_RU.po', 64 | 'locales/si.po', 65 | 'locales/ta.po', 66 | 'locales/te.po', 67 | 'locales/th.po', 68 | 'locales/tl.po', 69 | 'locales/tr_TR.po', 70 | 'locales/ur.po', 71 | 'locales/vi.po', 72 | 'locales/zh_CN.po', 73 | 'icons/tw_ic_popup_btn_check.png', 74 | 'icons/tw_ic_popup_btn_delete.png', 75 | ], 76 | }, # end of target 'xwalk_runtime_resources_locales' 77 | ], 78 | } 79 | -------------------------------------------------------------------------------- /common/command_line.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_COMMON_COMMAND_LINE_H_ 18 | #define XWALK_COMMON_COMMAND_LINE_H_ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace common { 25 | 26 | class CommandLine { 27 | public: 28 | // CommandLine only uses long options 29 | typedef std::map OptionMap; 30 | // Arguments which except for option strings 31 | typedef std::vector Arguments; 32 | 33 | static void Init(int argc, char* argv[]); 34 | static CommandLine* ForCurrentProcess(); 35 | static void Reset(); 36 | 37 | // Test if options_ has 'option_name' 38 | bool HasOptionName(const std::string& option_name); 39 | // Get the option's value 40 | std::string GetOptionValue(const std::string& option_name); 41 | // Get command string include options and arguments 42 | std::string GetCommandString(); 43 | 44 | std::string GetAppIdFromCommandLine(const std::string& program); 45 | 46 | std::string program() const { return program_; } 47 | const OptionMap& options() const { return options_; } 48 | const Arguments& arguments() const { return arguments_; } 49 | char** argv() const { return argv_; } 50 | int argc() const { return argc_; } 51 | 52 | private: 53 | CommandLine(int argc, char* argv[]); 54 | virtual ~CommandLine(); 55 | 56 | void AppendOption(const char* value); 57 | 58 | // The singleton CommandLine instance of current process 59 | static CommandLine* current_process_commandline_; 60 | 61 | std::string program_; 62 | OptionMap options_; 63 | Arguments arguments_; 64 | int argc_; 65 | char** argv_; 66 | }; 67 | 68 | } // namespace common 69 | 70 | #endif // XWALK_COMMON_COMMAND_LINE_H_ 71 | -------------------------------------------------------------------------------- /common/file_utils.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include "common/file_utils.h" 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | namespace common { 28 | namespace utils { 29 | 30 | bool Exists(const std::string& path) { 31 | return (access(path.c_str(), F_OK) != -1); 32 | } 33 | 34 | std::string BaseName(const std::string& path) { 35 | char* p = basename(const_cast(path.c_str())); 36 | return std::string(p); 37 | } 38 | 39 | std::string DirName(const std::string& path) { 40 | char* p = dirname(const_cast(path.c_str())); 41 | return std::string(p); 42 | } 43 | 44 | std::string SchemeName(const std::string& uri) { 45 | size_t pos = uri.find(":"); 46 | if (pos != std::string::npos && pos < uri.length()) { 47 | return std::string(uri.substr(0, pos)); 48 | } else { 49 | return uri; 50 | } 51 | } 52 | 53 | std::string ExtName(const std::string& path) { 54 | size_t last_dot = path.find_last_of("."); 55 | if (last_dot != 0 && last_dot != std::string::npos) { 56 | std::string ext = path.substr(last_dot); 57 | size_t end_of_ext = ext.find_first_of("?#"); 58 | if (end_of_ext != std::string::npos) 59 | ext = ext.substr(0, end_of_ext); 60 | std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower); 61 | return ext; 62 | } else { 63 | return std::string(); 64 | } 65 | } 66 | 67 | std::string GetUserRuntimeDir() { 68 | uid_t uid = getuid(); 69 | std::stringstream ss; 70 | ss << "/run/user/" << uid; 71 | std::string path = ss.str(); 72 | if (!Exists(path)) { 73 | path = "/tmp"; 74 | } 75 | return path; 76 | } 77 | 78 | } // namespace utils 79 | } // namespace common 80 | -------------------------------------------------------------------------------- /tools/gyp/pylib/gyp/xml_fix.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2011 Google Inc. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | """Applies a fix to CR LF TAB handling in xml.dom. 6 | 7 | Fixes this: http://code.google.com/p/chromium/issues/detail?id=76293 8 | Working around this: http://bugs.python.org/issue5752 9 | TODO(bradnelson): Consider dropping this when we drop XP support. 10 | """ 11 | 12 | 13 | import xml.dom.minidom 14 | 15 | 16 | def _Replacement_write_data(writer, data, is_attrib=False): 17 | """Writes datachars to writer.""" 18 | data = data.replace("&", "&").replace("<", "<") 19 | data = data.replace("\"", """).replace(">", ">") 20 | if is_attrib: 21 | data = data.replace( 22 | "\r", " ").replace( 23 | "\n", " ").replace( 24 | "\t", " ") 25 | writer.write(data) 26 | 27 | 28 | def _Replacement_writexml(self, writer, indent="", addindent="", newl=""): 29 | # indent = current indentation 30 | # addindent = indentation to add to higher levels 31 | # newl = newline string 32 | writer.write(indent+"<" + self.tagName) 33 | 34 | attrs = self._get_attributes() 35 | a_names = attrs.keys() 36 | a_names.sort() 37 | 38 | for a_name in a_names: 39 | writer.write(" %s=\"" % a_name) 40 | _Replacement_write_data(writer, attrs[a_name].value, is_attrib=True) 41 | writer.write("\"") 42 | if self.childNodes: 43 | writer.write(">%s" % newl) 44 | for node in self.childNodes: 45 | node.writexml(writer, indent + addindent, addindent, newl) 46 | writer.write("%s%s" % (indent, self.tagName, newl)) 47 | else: 48 | writer.write("/>%s" % newl) 49 | 50 | 51 | class XmlFix(object): 52 | """Object to manage temporary patching of xml.dom.minidom.""" 53 | 54 | def __init__(self): 55 | # Preserve current xml.dom.minidom functions. 56 | self.write_data = xml.dom.minidom._write_data 57 | self.writexml = xml.dom.minidom.Element.writexml 58 | # Inject replacement versions of a function and a method. 59 | xml.dom.minidom._write_data = _Replacement_write_data 60 | xml.dom.minidom.Element.writexml = _Replacement_writexml 61 | 62 | def Cleanup(self): 63 | if self.write_data: 64 | xml.dom.minidom._write_data = self.write_data 65 | xml.dom.minidom.Element.writexml = self.writexml 66 | self.write_data = None 67 | 68 | def __del__(self): 69 | self.Cleanup() 70 | -------------------------------------------------------------------------------- /extensions/renderer/xwalk_extension_client.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Intel Corporation. All rights reserved. 2 | // Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | 6 | #ifndef XWALK_EXTENSIONS_RENDERER_XWALK_EXTENSION_CLIENT_H_ 7 | #define XWALK_EXTENSIONS_RENDERER_XWALK_EXTENSION_CLIENT_H_ 8 | 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include "extensions/renderer/xwalk_module_system.h" 17 | 18 | namespace extensions { 19 | 20 | class XWalkExtensionClient { 21 | public: 22 | struct InstanceHandler { 23 | virtual void HandleMessageFromNative(const std::string& msg) = 0; 24 | protected: 25 | ~InstanceHandler() {} 26 | }; 27 | 28 | XWalkExtensionClient(); 29 | virtual ~XWalkExtensionClient(); 30 | 31 | void Initialize(); 32 | 33 | std::string CreateInstance(v8::Handle context, 34 | const std::string& extension_name, 35 | InstanceHandler* handler); 36 | void DestroyInstance(v8::Handle context, 37 | const std::string& instance_id); 38 | 39 | void PostMessageToNative(v8::Handle context, 40 | const std::string& instance_id, 41 | const std::string& msg); 42 | std::string SendSyncMessageToNative(v8::Handle context, 43 | const std::string& instance_id, 44 | const std::string& msg); 45 | 46 | std::string GetAPIScript(v8::Handle context, 47 | const std::string& extension_name); 48 | 49 | void OnReceivedIPCMessage(const std::string& instance_id, 50 | const std::string& msg); 51 | void LoadUserExtensions(const std::string app_path); 52 | 53 | struct ExtensionCodePoints { 54 | std::string api; 55 | std::vector entry_points; 56 | }; 57 | 58 | typedef std::map ExtensionAPIMap; 59 | 60 | const ExtensionAPIMap& extension_apis() const { return extension_apis_; } 61 | 62 | private: 63 | ExtensionAPIMap extension_apis_; 64 | 65 | typedef std::map HandlerMap; 66 | HandlerMap handlers_; 67 | }; 68 | 69 | } // namespace extensions 70 | 71 | #endif // XWALK_EXTENSIONS_RENDERER_XWALK_EXTENSION_CLIENT_H_ 72 | -------------------------------------------------------------------------------- /extensions/renderer/widget_module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_EXTENSIONS_RENDERER_WIDGET_MODULE_H_ 18 | #define XWALK_EXTENSIONS_RENDERER_WIDGET_MODULE_H_ 19 | 20 | #include 21 | #include 22 | 23 | #include "common/application_data.h" 24 | #include "common/locale_manager.h" 25 | #include "extensions/renderer/xwalk_module_system.h" 26 | 27 | namespace extensions { 28 | 29 | // This module provides widget object 30 | class WidgetModule : public XWalkNativeModule { 31 | public: 32 | WidgetModule(); 33 | ~WidgetModule() override; 34 | 35 | private: 36 | v8::Handle NewInstance() override; 37 | v8::Persistent preference_object_template_; 38 | }; 39 | 40 | class WidgetPreferenceDB { 41 | public: 42 | static WidgetPreferenceDB* GetInstance(); 43 | void Initialize(const common::ApplicationData* appdata, 44 | common::LocaleManager* locale_manager); 45 | void InitializeDB(); 46 | int Length(); 47 | bool Key(int idx, std::string* key); 48 | bool GetItem(const std::string& key, std::string* value); 49 | bool SetItem(const std::string& key, const std::string& value); 50 | bool RemoveItem(const std::string& key); 51 | bool HasItem(const std::string& key); 52 | void Clear(); 53 | void GetKeys(std::list* keys); 54 | 55 | std::string author(); 56 | std::string description(); 57 | std::string name(); 58 | std::string shortName(); 59 | std::string version(); 60 | std::string id(); 61 | std::string authorEmail(); 62 | std::string authorHref(); 63 | unsigned int height(); 64 | unsigned int width(); 65 | 66 | private: 67 | WidgetPreferenceDB(); 68 | virtual ~WidgetPreferenceDB(); 69 | const common::ApplicationData* appdata_; 70 | common::LocaleManager* locale_manager_; 71 | }; 72 | 73 | } // namespace extensions 74 | 75 | #endif // XWALK_EXTENSIONS_RENDERER_WIDGET_MODULE_H_ 76 | -------------------------------------------------------------------------------- /extensions/common/xwalk_extension.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Intel Corporation. All rights reserved. 2 | // Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | 6 | #ifndef XWALK_EXTENSIONS_XWALK_EXTENSION_H_ 7 | #define XWALK_EXTENSIONS_XWALK_EXTENSION_H_ 8 | 9 | #include 10 | #include 11 | 12 | #include "extensions/common/xwalk_extension_instance.h" 13 | #include "extensions/public/XW_Extension.h" 14 | #include "extensions/public/XW_Extension_SyncMessage.h" 15 | #include "extensions/public/XW_Extension_Message_2.h" 16 | 17 | namespace extensions { 18 | 19 | class XWalkExtensionAdapter; 20 | class XWalkExtensionInstance; 21 | 22 | class XWalkExtension { 23 | public: 24 | typedef std::vector StringVector; 25 | 26 | class XWalkExtensionDelegate { 27 | public: 28 | virtual void GetRuntimeVariable(const char* key, char* value, 29 | size_t value_len) = 0; 30 | }; 31 | 32 | XWalkExtension(const std::string& path, XWalkExtensionDelegate* delegate); 33 | XWalkExtension(const std::string& path, 34 | const std::string& name, 35 | const StringVector& entry_points, 36 | XWalkExtensionDelegate* delegate); 37 | virtual ~XWalkExtension(); 38 | 39 | bool Initialize(); 40 | XWalkExtensionInstance* CreateInstance(); 41 | std::string GetJavascriptCode(); 42 | 43 | std::string name() const { return name_; } 44 | 45 | const StringVector& entry_points() const { 46 | return entry_points_; 47 | } 48 | 49 | bool lazy_loading() const { 50 | return lazy_loading_; 51 | } 52 | 53 | private: 54 | friend class XWalkExtensionAdapter; 55 | friend class XWalkExtensionInstance; 56 | 57 | void GetRuntimeVariable(const char* key, char* value, size_t value_len); 58 | int CheckAPIAccessControl(const char* api_name); 59 | int RegisterPermissions(const char* perm_table); 60 | 61 | bool initialized_; 62 | std::string library_path_; 63 | XW_Extension xw_extension_; 64 | 65 | std::string name_; 66 | std::string javascript_api_; 67 | StringVector entry_points_; 68 | bool lazy_loading_; 69 | 70 | XWalkExtensionDelegate* delegate_; 71 | 72 | XW_CreatedInstanceCallback created_instance_callback_; 73 | XW_DestroyedInstanceCallback destroyed_instance_callback_; 74 | XW_ShutdownCallback shutdown_callback_; 75 | XW_HandleMessageCallback handle_msg_callback_; 76 | XW_HandleSyncMessageCallback handle_sync_msg_callback_; 77 | XW_HandleBinaryMessageCallback handle_binary_msg_callback_; 78 | }; 79 | 80 | } // namespace extensions 81 | 82 | #endif // XWALK_EXTENSIONS_XWALK_EXTENSION_H_ 83 | -------------------------------------------------------------------------------- /runtime/browser/popup_string.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include "runtime/browser/popup_string.h" 18 | 19 | #include 20 | 21 | #include "runtime/common/constants.h" 22 | 23 | namespace runtime { 24 | 25 | namespace popup_string { 26 | 27 | 28 | const char kPopupTitleAuthRequest[] = "IDS_SA_BODY_USER_AUTHENTICATION"; 29 | const char kPopupTitleCert[] = "IDS_BR_HEADER_CERTIFICATE_INFO"; 30 | const char kPopupTitleGeoLocation[] = "IDS_WRT_OPT_ACCESS_USER_LOCATION"; 31 | const char kPopupTitleUserMedia[] = "IDS_WRT_OPT_USE_USER_MEDIA"; 32 | const char kPopupTitleWebNotification[] = 33 | "IDS_BR_HEADER_WEB_NOTIFICATION"; 34 | const char kPopupTitleWebStorage[] = "IDS_WRT_OPT_USE_STORE_WEB_DATA"; 35 | 36 | const char kPopupBodyAuthRequest[] = 37 | "IDS_BR_BODY_DESTINATIONS_AUTHENTICATION_REQUIRED"; 38 | const char kPopupBodyCert[] = 39 | "IDS_BR_BODY_SECURITY_CERTIFICATE_PROBLEM_MSG"; 40 | const char kPopupBodyGeoLocation[] = 41 | "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_ACCESS_YOUR_LOCATION_INFORMATION"; 42 | const char kPopupBodyUserMedia[] = 43 | "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_USE_YOUR_CAMERA"; 44 | const char kPopupBodyWebNotification[] = 45 | "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_DISPLAY_NOTIFICATIONS"; 46 | const char kPopupBodyWebStorage[] = 47 | "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_SAVE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE"; 48 | 49 | const char kPopupCheckRememberPreference[] = 50 | "IDS_BR_BODY_REMEMBER_PREFERENCE"; 51 | 52 | const char kPopupLabelAuthusername[] = "IDS_BR_BODY_AUTHUSERNAME"; 53 | const char kPopupLabelPassword[] = "IDS_BR_BODY_AUTHPASSWORD"; 54 | 55 | const char kPopupButtonOk[] = "IDS_BR_SK_OK"; 56 | const char kPopupButtonLogin[] = "IDS_BR_BODY_LOGIN"; 57 | const char kPopupButtonCancel[] = "IDS_BR_SK_CANCEL"; 58 | const char kPopupButtonAllow[] = "IDS_BR_OPT_ALLOW"; 59 | const char kPopupButtonDeny[] = "IDS_COM_BODY_DENY"; 60 | 61 | std::string GetText(const std::string& msg_id) { 62 | return dgettext(kTextDomainRuntime, msg_id.c_str()); 63 | } 64 | 65 | } // namespace popup_string 66 | 67 | } // namespace runtime 68 | -------------------------------------------------------------------------------- /extensions/public/XW_Extension_Message_2.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_MESSAGE_2_H_ 6 | #define XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_MESSAGE_2_H_ 7 | 8 | #ifndef XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_H_ 9 | #error "You should include XW_Extension.h before this file" 10 | #endif 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | #define XW_MESSAGING_INTERFACE_2 "XW_MessagingInterface_2" 17 | 18 | typedef void (*XW_HandleBinaryMessageCallback)(XW_Instance instance, 19 | const char* message, 20 | const size_t size); 21 | 22 | struct XW_MessagingInterface_2 { 23 | // Register a callback to be called when the JavaScript code associated 24 | // with the extension posts a message. Note that the callback will be called 25 | // with the XW_Instance that posted the message as well as the message 26 | // contents. 27 | void (*Register)(XW_Extension extension, 28 | XW_HandleMessageCallback handle_message); 29 | 30 | // Post a message to the web content associated with the instance. To 31 | // receive this message the extension's JavaScript code should set a 32 | // listener using extension.setMessageListener() function. 33 | // 34 | // This function is thread-safe and can be called until the instance is 35 | // destroyed. 36 | void (*PostMessage)(XW_Instance instance, const char* message); 37 | 38 | // Register a callback to be called when the JavaScript code associated 39 | // with the extension posts a binary message (ArrayBuffer object). 40 | // Note that the callback will be called with the XW_Instance that posted 41 | // the message as well as the message contents. 42 | void (*RegisterBinaryMesssageCallback)( 43 | XW_Extension extension, 44 | XW_HandleBinaryMessageCallback handle_message); 45 | 46 | // Post a binary message to the web content associated with the instance. To 47 | // receive this message the extension's JavaScript code should set a 48 | // listener using extension.setMessageListener() function. 49 | // The JavaScript message listener function would receive the binary message 50 | // in an ArrayBuffer object. 51 | // 52 | // This function is thread-safe and can be called until the instance is 53 | // destroyed. 54 | void (*PostBinaryMessage)(XW_Instance instance, 55 | const char* message, size_t size); 56 | }; 57 | 58 | typedef struct XW_MessagingInterface_2 XW_MessagingInterface2; 59 | 60 | #ifdef __cplusplus 61 | } // extern "C" 62 | #endif 63 | 64 | #endif // XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_MESSAGE_2_H_ 65 | -------------------------------------------------------------------------------- /extensions/internal/widget/widget_api.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | var dispatchStorageEvent = function(key, oldValue, newValue) { 18 | var evt = document.createEvent("CustomEvent"); 19 | evt.initCustomEvent("storage", true, true, null); 20 | evt.key = key; 21 | evt.oldValue = oldValue; 22 | evt.newValue = newValue; 23 | evt.storageArea = window.widget.preference; 24 | document.dispatchEvent(evt); 25 | for (var i=0; i < window.frames.length; i++) { 26 | window.frames[i].document.dispatchEvent(evt); 27 | } 28 | }; 29 | 30 | var widget_info_ = requireNative('WidgetModule'); 31 | var preference_ = widget_info_['preference']; 32 | preference_.__onChanged_WRT__ = dispatchStorageEvent; 33 | 34 | function Widget() { 35 | Object.defineProperties(this, { 36 | "author": { 37 | value: widget_info_[ 38 | "author"], 39 | writable: false 40 | }, 41 | "description": { 42 | value: widget_info_["description"], 43 | writable: false 44 | }, 45 | "name": { 46 | value: widget_info_["name"], 47 | writable: false 48 | }, 49 | "shortName": { 50 | value: widget_info_["shortName"], 51 | writable: false 52 | }, 53 | "version": { 54 | value: widget_info_["version"], 55 | writable: false 56 | }, 57 | "id": { 58 | value: widget_info_["id"], 59 | writable: false 60 | }, 61 | "authorEmail": { 62 | value: widget_info_["authorEmail"], 63 | writable: false 64 | }, 65 | "authorHref": { 66 | value: widget_info_["authorHref"], 67 | writable: false 68 | }, 69 | "height": { 70 | get: function() { 71 | return window && window.innerHeight || 0; 72 | }, 73 | configurable: false 74 | }, 75 | "width": { 76 | get: function() { 77 | return window && window.innerWidth || 0; 78 | }, 79 | configurable: false 80 | }, 81 | "preferences": { 82 | value: preference_, 83 | writable: false 84 | } 85 | }); 86 | }; 87 | 88 | Widget.prototype.toString = function() { 89 | return "[object Widget]"; 90 | }; 91 | 92 | window.widget = new Widget(); 93 | exports = Widget; 94 | -------------------------------------------------------------------------------- /runtime/browser/runtime.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | #include "common/application_data.h" 22 | #include "common/command_line.h" 23 | #include "common/logger.h" 24 | #include "runtime/common/constants.h" 25 | #include "runtime/browser/runtime.h" 26 | #include "runtime/browser/ui_runtime.h" 27 | #ifdef IME_FEATURE_SUPPORT 28 | #include "runtime/browser/ime_runtime.h" 29 | #endif // IME_FEATURE_SUPPORT 30 | #ifdef WATCH_FACE_FEATURE_SUPPORT 31 | #include "runtime/browser/watch_runtime.h" 32 | #endif // WATCH_FACE_FEATURE_SUPPORT 33 | 34 | #define MAIN_LOOP_INTERVAL 1 35 | 36 | namespace runtime { 37 | 38 | Runtime::~Runtime() { 39 | } 40 | 41 | std::unique_ptr Runtime::MakeRuntime( 42 | common::ApplicationData* app_data) { 43 | if (app_data->app_type() == common::ApplicationData::UI) { 44 | return std::unique_ptr(new UiRuntime(app_data)); 45 | } 46 | #ifdef IME_FEATURE_SUPPORT 47 | else if (app_data->app_type() == common::ApplicationData::IME) { 48 | return std::unique_ptr(new ImeRuntime(app_data)); 49 | } 50 | #endif // IME_FEATURE_SUPPORT 51 | #ifdef WATCH_FACE_FEATURE_SUPPORT 52 | else if (app_data->app_type() == common::ApplicationData::WATCH) { 53 | return std::unique_ptr(new WatchRuntime(app_data)); 54 | } 55 | #endif // WATCH_FACE_FEATURE_SUPPORT 56 | else { 57 | return std::unique_ptr(new UiRuntime(app_data)); 58 | } 59 | } 60 | 61 | // static 62 | Eina_Bool Runtime::ClosePageInExtendedMainLoop(void* user_data) 63 | { 64 | LOGGER(DEBUG); 65 | struct Timer* main_loop = static_cast(user_data); 66 | main_loop->application->ClosePage(); 67 | return ECORE_CALLBACK_CANCEL; 68 | } 69 | 70 | void Runtime::ProcessClosingPage(WebApplication* application) { 71 | LOGGER(DEBUG); 72 | if (application) { 73 | struct Timer main_loop; 74 | main_loop.application = application; 75 | main_loop.timer = ecore_timer_add(MAIN_LOOP_INTERVAL, ClosePageInExtendedMainLoop, &main_loop); 76 | LOGGER(DEBUG) << "Defer termination of main loop"; 77 | ecore_main_loop_begin(); 78 | ecore_timer_del(main_loop.timer); 79 | } 80 | } 81 | 82 | } // namespace runtime 83 | -------------------------------------------------------------------------------- /tools/mergejs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved. 4 | 5 | import fileinput 6 | import sys 7 | import getopt 8 | import glob 9 | import os 10 | 11 | class Utils: 12 | reqfiles = [] 13 | searchfile = '*_api.js' 14 | startwith = "//= require('" 15 | endwith = "')" 16 | code = "" 17 | 18 | @classmethod 19 | def get_require(self, s): 20 | try: 21 | start = s.index(self.startwith) + len(self.startwith) 22 | end = s.index(self.endwith, start) 23 | filename = s[start:end] 24 | self.reqfiles.append(filename) 25 | except ValueError: 26 | return "" 27 | 28 | @classmethod 29 | def find_require(self): 30 | p = os.path.join('./', self.searchfile) 31 | filenames = glob.glob(self.searchfile) 32 | for fname in filenames: 33 | with open(fname, 'r') as myfile: 34 | for line in myfile: 35 | self.get_require(line) 36 | 37 | @classmethod 38 | def print_lines(self, filename): 39 | with open(filename, 'r') as file: 40 | for line in file: 41 | self.code += line 42 | 43 | @classmethod 44 | def merge_js_files(self, path): 45 | self.find_require() 46 | if len(self.reqfiles) == 0: 47 | s = os.path.join('./', self.searchfile) 48 | sfiles = glob.glob(s) 49 | for fname in sfiles: 50 | self.print_lines(fname) 51 | else: 52 | js = '*.js' 53 | p = os.path.join(path, js) 54 | filenames = glob.glob(p) 55 | for fname in self.reqfiles: 56 | fname = path + '/' + fname 57 | if fname in filenames: 58 | self.print_lines(fname) 59 | 60 | @classmethod 61 | def main(self, argv): 62 | path = 'js' 63 | try: 64 | opts, args = getopt.getopt(argv,"hf:p:",["file=", "path="]) 65 | except getopt.GetoptError: 66 | print __file__ + ' -h' 67 | sys.exit() 68 | if len(argv) > 0: 69 | for opt, arg in opts: 70 | if opt in ("-h"): 71 | print 'Help:' 72 | print '' 73 | print __file__ + '-f -p ' 74 | print '' 75 | print ' \t \t\t ' 76 | print '-f \t --file \t Name of the file where script searching for require files:' 77 | print '\t \t \t ' + self.startwith + 'file_name.js' + self.endwith 78 | print '-p \t --path \t Path to "' + path + '" directory' 79 | print '' 80 | sys.exit() 81 | elif opt in ("-f", "--file"): 82 | self.searchfile = arg 83 | elif opt in ("-p", "--path"): 84 | path = arg 85 | self.merge_js_files(path) 86 | print self.code 87 | 88 | if Utils.__module__ == "__main__": 89 | Utils.main(sys.argv[1:]) 90 | -------------------------------------------------------------------------------- /runtime/browser/web_view.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include "runtime/browser/web_view.h" 18 | 19 | #include 20 | #include 21 | 22 | #include "runtime/browser/native_window.h" 23 | #include "runtime/browser/web_view_impl.h" 24 | 25 | namespace runtime { 26 | 27 | WebView::WebView(NativeWindow* window, Ewk_Context* context) 28 | : impl_(new WebViewImpl(this, window, context)) { 29 | } 30 | 31 | WebView::~WebView() { 32 | delete impl_; 33 | } 34 | 35 | void WebView::ReplyToJavascriptDialog() { 36 | impl_->ReplyToJavascriptDialog(); 37 | } 38 | 39 | void WebView::LoadUrl(const std::string& url, const std::string& mime) { 40 | impl_->LoadUrl(url, mime); 41 | } 42 | 43 | std::string WebView::GetUrl() { 44 | return impl_->GetUrl(); 45 | } 46 | 47 | void WebView::Suspend() { 48 | impl_->Suspend(); 49 | } 50 | 51 | void WebView::Resume() { 52 | impl_->Resume(); 53 | } 54 | 55 | void WebView::Reload() { 56 | impl_->Reload(); 57 | } 58 | 59 | bool WebView::Backward() { 60 | return impl_->Backward(); 61 | } 62 | 63 | void WebView::SetVisibility(bool show) { 64 | impl_->SetVisibility(show); 65 | } 66 | 67 | bool WebView::EvalJavascript(const std::string& script) { 68 | return impl_->EvalJavascript(script); 69 | } 70 | 71 | void WebView::SetEventListener(EventListener* listener) { 72 | impl_->SetEventListener(listener); 73 | } 74 | 75 | Evas_Object* WebView::evas_object() const { 76 | return impl_->evas_object(); 77 | } 78 | 79 | void WebView::SetAppInfo(const std::string& app_name, 80 | const std::string& version) { 81 | impl_->SetAppInfo(app_name, version); 82 | } 83 | 84 | bool WebView::SetUserAgent(const std::string& user_agent) { 85 | return impl_->SetUserAgent(user_agent.c_str()); 86 | } 87 | 88 | void WebView::SetCSPRule(const std::string& rule, bool report_only) { 89 | impl_->SetCSPRule(rule, report_only); 90 | } 91 | 92 | void WebView::SetDefaultEncoding(const std::string& encoding) { 93 | impl_->SetDefaultEncoding(encoding); 94 | } 95 | 96 | void WebView::SetLongPolling(unsigned long longpolling) { 97 | impl_->SetLongPolling(longpolling); 98 | } 99 | 100 | #ifdef PROFILE_WEARABLE 101 | void WebView::SetBGColor(int r, int g, int b, int a) { 102 | impl_->SetBGColor(r, g, b, a); 103 | } 104 | #endif // PROFILE_WEARABLE 105 | 106 | } // namespace runtime 107 | -------------------------------------------------------------------------------- /runtime/browser/native_window.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_RUNTIME_BROWSER_NATIVE_WINDOW_H_ 18 | #define XWALK_RUNTIME_BROWSER_NATIVE_WINDOW_H_ 19 | 20 | #include 21 | 22 | #include 23 | #include 24 | 25 | namespace runtime { 26 | 27 | class NativeWindow { 28 | public: 29 | enum class ScreenOrientation { 30 | PORTRAIT_PRIMARY = 0, 31 | PORTRAIT_SECONDARY = 1, 32 | LANDSCAPE_PRIMARY = 2, 33 | LANDSCAPE_SECONDARY = 3, 34 | NATURAL = 4, 35 | ANY = 5 36 | }; 37 | enum class Type { 38 | NORMAL = 0, 39 | NOTIFICATION = 1 40 | }; 41 | typedef std::function RotationHandler; 42 | NativeWindow(); 43 | virtual ~NativeWindow(); 44 | 45 | void Initialize(); 46 | 47 | bool initialized() const { return initialized_; } 48 | Evas_Object* evas_object() const; 49 | void SetContent(Evas_Object* content); 50 | void SetRotationLock(int degree); 51 | void SetRotationLock(ScreenOrientation orientation); 52 | void SetAutoRotation(); 53 | void SetCurrentViewModeFullScreen(bool mode); 54 | int AddRotationHandler(RotationHandler handler); 55 | void RemoveRotationHandler(int id); 56 | int rotation() const { return rotation_; } 57 | ScreenOrientation orientation() const; 58 | void Show(); 59 | void Active(); 60 | void InActive(); 61 | void FullScreen(bool enable); 62 | ScreenOrientation natural_orientation() const { return natural_orientation_;} 63 | Type type() const { return window_type_;} 64 | #ifdef MANUAL_ROTATE_FEATURE_SUPPORT 65 | void EnableManualRotation(bool enable); 66 | void ManualRotationDone(); 67 | #endif // MANUAL_ROTATE_FEATURE_SUPPORT 68 | 69 | protected: 70 | virtual Evas_Object* CreateWindowInternal() = 0; 71 | Evas_Object* window_; 72 | Type window_type_; 73 | 74 | private: 75 | static void DidDeleteRequested(void* data, Evas_Object* obj, 76 | void* event_info); 77 | static void DidProfileChanged(void* data, Evas_Object* obj, void* event_info); 78 | void DidRotation(int degree); 79 | void DidFocusChanged(bool got); 80 | 81 | bool initialized_; 82 | bool currentViewModeFullScreen_; 83 | Evas_Object* focus_; 84 | Evas_Object* content_; 85 | int rotation_; 86 | int handler_id_; 87 | ScreenOrientation natural_orientation_; 88 | std::map handler_table_; 89 | }; 90 | 91 | } // namespace runtime 92 | 93 | 94 | #endif // XWALK_RUNTIME_BROWSER_NATIVE_WINDOW_H_ 95 | -------------------------------------------------------------------------------- /runtime/resources/locales/zh_CN.po: -------------------------------------------------------------------------------- 1 | msgid "IDS_BR_OPT_ALLOW" 2 | msgstr "允许" 3 | 4 | msgid "IDS_BR_POP_STARTING_DOWNLOAD_ING" 5 | msgstr "正在开始下载..." 6 | 7 | msgid "IDS_BR_BODY_SECURITY_CERTIFICATE_PROBLEM_MSG" 8 | msgstr "此站点的安全证书存在问题。" 9 | 10 | msgid "IDS_BR_SK_CANCEL" 11 | msgstr "取消" 12 | 13 | msgid "IDS_BR_SK_DELETE" 14 | msgstr "删除" 15 | 16 | msgid "IDS_BR_BODY_RESET_TO_DEFAULT" 17 | msgstr "重置为默认值" 18 | 19 | msgid "IDS_BR_BODY_WEBSITE_SETTINGS" 20 | msgstr "网站设置" 21 | 22 | msgid "IDS_BR_BODY_AUTHUSERNAME" 23 | msgstr "用户名" 24 | 25 | msgid "IDS_BR_BODY_DESTINATIONS_AUTHENTICATION_REQUIRED" 26 | msgstr "需要认证" 27 | 28 | msgid "IDS_BR_BODY_AUTHPASSWORD" 29 | msgstr "密码" 30 | 31 | msgid "IDS_BR_BODY_PASSWORD" 32 | msgstr "密码" 33 | 34 | msgid "IDS_BR_HEADER_WEB_NOTIFICATION" 35 | msgstr "网络通知" 36 | 37 | msgid "IDS_BR_BODY_ALLOW_SITES_TO_REQUEST_ACCESS_TO_YOUR_LOCATION" 38 | msgstr "允许网站请求访问您的位置" 39 | 40 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE" 41 | msgstr "%1$s (%2$s) 正在尝试在您的设备上存储大量数据用于离线使用。" 42 | 43 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_STORE_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE" 44 | msgstr "%1$s (%2$s) 正在请求许可在您的设备上存储数据用于离线使用。" 45 | 46 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_ACCESS_YOUR_LOCATION" 47 | msgstr "%1$s (%2$s) 正在请求许可访问您的位置。" 48 | 49 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_SHOW_NOTIFICATIONS" 50 | msgstr "%1$s (%2$s) 正在请求许可显示通知。" 51 | 52 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_USE_YOUR_CAMERA" 53 | msgstr "%1$s (%2$s) 正在请求许可使用您的相机。" 54 | 55 | msgid "IDS_BR_BODY_FULL_SCREEN" 56 | msgstr "全屏显示" 57 | 58 | msgid "IDS_BR_SK_OK" 59 | msgstr "确定" 60 | 61 | msgid "IDS_BR_MBODY_LOCATION_ACCESS" 62 | msgstr "位置访问" 63 | 64 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_DISPLAY_NOTIFICATIONS" 65 | msgstr "请允许此站点显示通知。" 66 | 67 | msgid "IDS_BR_BODY_EMPTY" 68 | msgstr "空白" 69 | 70 | msgid "IDS_BR_HEADER_AUTO_REFRESH" 71 | msgstr "自动刷新" 72 | 73 | msgid "IDS_WRT_OPT_ACCESS_USER_LOCATION" 74 | msgstr "访问用户位置" 75 | 76 | msgid "IDS_WRT_OPT_USE_STORE_WEB_DATA" 77 | msgstr "使用/存储网络数据" 78 | 79 | msgid "IDS_WRT_OPT_USE_USER_MEDIA" 80 | msgstr "使用用户媒体" 81 | 82 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_ACCESS_YOUR_LOCATION_INFORMATION" 83 | msgstr "请允许此站点访问您的位置数据。" 84 | 85 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_SAVE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE" 86 | msgstr "请允许此站点保存您设备上的大量数据。" 87 | 88 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_CHANGE_THE_DISPLAY_TO_FULL_SCREEN" 89 | msgstr "请允许此站点更改为全屏显示。" 90 | 91 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_USE_THE_MEDIA_FILES_STORED_ON_YOUR_DEVICE" 92 | msgstr "请允许此站点使用储存在您设备上的媒体文件。" 93 | 94 | msgid "IDS_ST_POP_CLEAR_DEFAULT_APP_SETTINGS_BY_GOING_TO_SETTINGS_GENERAL_MANAGE_APPLICATIONS_ALL" 95 | msgstr "通过进入设定 > 一般 > 管理应用程序 > 全部清除默认应用程序设置。" 96 | 97 | msgid "IDS_COM_BODY_DENY" 98 | msgstr "拒绝" 99 | 100 | msgid "IDS_SA_BODY_USER_AUTHENTICATION" 101 | msgstr "用户验证" 102 | 103 | msgid "IDS_BR_BODY_REMEMBER_PREFERENCE" 104 | msgstr "记住首选项。" 105 | 106 | msgid "IDS_BR_HEADER_CERTIFICATE_INFO" 107 | msgstr "证书信息" 108 | 109 | msgid "IDS_BR_BODY_LOGIN" 110 | msgstr "登录" 111 | 112 | -------------------------------------------------------------------------------- /runtime/browser/popup.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | 18 | #ifndef XWALK_RUNTIME_BROWSER_POPUP_H_ 19 | #define XWALK_RUNTIME_BROWSER_POPUP_H_ 20 | 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace runtime { 30 | 31 | class NativeWindow; 32 | 33 | class Popup { 34 | public: 35 | enum class ButtonType { 36 | OkButton, 37 | OkCancelButton, 38 | LoginCancelButton, 39 | AllowDenyButton 40 | }; 41 | 42 | enum class EntryType { 43 | Edit, 44 | PwEdit 45 | }; 46 | 47 | static Popup* CreatePopup(NativeWindow* window); 48 | static void ForceCloseAllPopup(); 49 | 50 | // button 51 | void SetButtonType(ButtonType type); 52 | bool IsPositiveButton(Evas_Object* button); 53 | bool GetButtonResult() const; // yes/allow/ok: true, the others: false 54 | 55 | void SetFirstEntry(const std::string& str_id, EntryType type); 56 | void SetSecondEntry(const std::string& str_id, EntryType type); 57 | std::string GetFirstEntryResult() const; 58 | std::string GetSecondEntryResult() const; 59 | 60 | // check box 61 | void SetCheckBox(const std::string& str_id = std::string()); 62 | bool GetCheckBoxResult() const; 63 | 64 | // etc. 65 | void SetTitle(const std::string& str_id); 66 | void SetBody(const std::string& str_id); 67 | void SetResultHandler(std::function 68 | handler, void* user_data); 69 | 70 | // Popup's actions 71 | void Show(); 72 | void Hide(); 73 | void Result(bool is_positive); 74 | 75 | // getter 76 | Evas_Object* popup() { return popup_; } 77 | 78 | private: 79 | Popup(Evas_Object* popup, Evas_Object* layout, Evas_Object* box); 80 | ~Popup(); 81 | 82 | Evas_Object* popup_; 83 | Evas_Object* layout_; 84 | Evas_Object* box_; 85 | Evas_Object* button1_; 86 | Evas_Object* button2_; 87 | Evas_Object* entry1_; 88 | Evas_Object* entry2_; 89 | Evas_Object* check_box_; 90 | 91 | std::function handler_; 92 | void* user_data_; 93 | 94 | bool enable_button_; 95 | bool result_button_; 96 | bool enable_entry_; 97 | std::string result_entry1_; 98 | std::string result_entry2_; 99 | bool enable_check_box_; 100 | bool result_check_box_; 101 | static std::set opened_popups_; 102 | }; 103 | 104 | } // namespace runtime 105 | 106 | #endif // XWALK_RUNTIME_BROWSER_POPUP_H_ 107 | -------------------------------------------------------------------------------- /extensions/extensions.gyp: -------------------------------------------------------------------------------- 1 | { 2 | 'includes':[ 3 | '../build/common.gypi', 4 | ], 5 | 'targets': [ 6 | { 7 | 'target_name': 'xwalk_extension_shared', 8 | 'type': 'shared_library', 9 | 'dependencies': [ 10 | '../common/common.gyp:xwalk_tizen_common', 11 | ], 12 | 'sources': [ 13 | 'common/constants.h', 14 | 'common/constants.cc', 15 | 'common/xwalk_extension.h', 16 | 'common/xwalk_extension.cc', 17 | 'common/xwalk_extension_instance.h', 18 | 'common/xwalk_extension_instance.cc', 19 | 'common/xwalk_extension_adapter.h', 20 | 'common/xwalk_extension_adapter.cc', 21 | 'common/xwalk_extension_manager.h', 22 | 'common/xwalk_extension_manager.cc', 23 | 'common/xwalk_extension_server.h', 24 | 'common/xwalk_extension_server.cc', 25 | 'renderer/xwalk_extension_client.h', 26 | 'renderer/xwalk_extension_client.cc', 27 | 'renderer/xwalk_extension_module.h', 28 | 'renderer/xwalk_extension_module.cc', 29 | 'renderer/xwalk_extension_renderer_controller.h', 30 | 'renderer/xwalk_extension_renderer_controller.cc', 31 | 'renderer/xwalk_module_system.h', 32 | 'renderer/xwalk_module_system.cc', 33 | 'renderer/xwalk_v8tools_module.h', 34 | 'renderer/xwalk_v8tools_module.cc', 35 | 'renderer/widget_module.h', 36 | 'renderer/widget_module.cc', 37 | 'renderer/object_tools_module.h', 38 | 'renderer/object_tools_module.cc', 39 | 'renderer/runtime_ipc_client.h', 40 | 'renderer/runtime_ipc_client.cc', 41 | ], 42 | 'cflags': [ 43 | '-fvisibility=default', 44 | ], 45 | 'variables': { 46 | 'packages': [ 47 | 'chromium-efl', 48 | 'elementary', 49 | ], 50 | }, 51 | 'direct_dependent_settings': { 52 | 'libraries': [ 53 | '-lxwalk_extension_shared', 54 | ], 55 | 'variables': { 56 | 'packages': [ 57 | 'jsoncpp', 58 | ], 59 | }, 60 | }, 61 | }, # end of target 'xwalk_extension_static' 62 | { 63 | 'target_name': 'widget_plugin', 64 | 'type': 'shared_library', 65 | 'dependencies': [ 66 | '../common/common.gyp:xwalk_tizen_common', 67 | ], 68 | 'sources': [ 69 | 'internal/widget/widget_api.js', 70 | 'internal/widget/widget_extension.cc', 71 | ], 72 | 'copies': [ 73 | { 74 | 'destination': '<(SHARED_INTERMEDIATE_DIR)', 75 | 'files': [ 76 | 'internal/widget/widget.json' 77 | ], 78 | }, 79 | ], 80 | }, # end of target 'widget_plugin' 81 | { 82 | 'target_name': 'splash_screen_plugin', 83 | 'type': 'shared_library', 84 | 'dependencies': [ 85 | '../common/common.gyp:xwalk_tizen_common', 86 | ], 87 | 'sources': [ 88 | 'internal/splash_screen/splash_screen_api.js', 89 | 'internal/splash_screen/splash_screen_extension.cc', 90 | ], 91 | 'copies': [ 92 | { 93 | 'destination': '<(SHARED_INTERMEDIATE_DIR)', 94 | 'files': [ 95 | 'internal/splash_screen/splash_screen.json' 96 | ], 97 | }, 98 | ], 99 | }, # end of target 'splash_screen_plugin' 100 | ], # end of targets 101 | } 102 | -------------------------------------------------------------------------------- /runtime/resources/locales/ko_KR.po: -------------------------------------------------------------------------------- 1 | msgid "IDS_BR_OPT_ALLOW" 2 | msgstr "허용" 3 | 4 | msgid "IDS_BR_POP_STARTING_DOWNLOAD_ING" 5 | msgstr "다운로드를 시작하는 중..." 6 | 7 | msgid "IDS_BR_BODY_SECURITY_CERTIFICATE_PROBLEM_MSG" 8 | msgstr "이 사이트의 보안 인증서에 문제가 있습니다" 9 | 10 | msgid "IDS_BR_SK_CANCEL" 11 | msgstr "취소" 12 | 13 | msgid "IDS_BR_SK_DELETE" 14 | msgstr "삭제" 15 | 16 | msgid "IDS_BR_BODY_RESET_TO_DEFAULT" 17 | msgstr "기본 설정으로 초기화" 18 | 19 | msgid "IDS_BR_BODY_WEBSITE_SETTINGS" 20 | msgstr "웹사이트 설정" 21 | 22 | msgid "IDS_BR_BODY_AUTHUSERNAME" 23 | msgstr "사용자 이름" 24 | 25 | msgid "IDS_BR_BODY_DESTINATIONS_AUTHENTICATION_REQUIRED" 26 | msgstr "인증이 필요합니다." 27 | 28 | msgid "IDS_BR_BODY_AUTHPASSWORD" 29 | msgstr "비밀번호" 30 | 31 | msgid "IDS_BR_BODY_PASSWORD" 32 | msgstr "비밀번호" 33 | 34 | msgid "IDS_BR_HEADER_WEB_NOTIFICATION" 35 | msgstr "웹 알림" 36 | 37 | msgid "IDS_BR_BODY_ALLOW_SITES_TO_REQUEST_ACCESS_TO_YOUR_LOCATION" 38 | msgstr "웹사이트에서 내 위치정보 수집을 요청할 수 있도록 허용합니다." 39 | 40 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE" 41 | msgstr "%1$s(%2$s)에서 오프라인에서 사용할 수 있도록 용량이 큰 데이터를 내 디바이스에 저장하려고 합니다." 42 | 43 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_STORE_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE" 44 | msgstr "%1$s(%2$s)에서 오프라인에서 사용할 수 있도록 디바이스에 데이터를 저장할 수 있는 권한을 요청합니다." 45 | 46 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_ACCESS_YOUR_LOCATION" 47 | msgstr "%1$s(%2$s)에서 내 위치정보 접근 권한을 요청합니다." 48 | 49 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_SHOW_NOTIFICATIONS" 50 | msgstr "%1$s(%2$s)에서 알림 표시 권한을 요청합니다." 51 | 52 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_USE_YOUR_CAMERA" 53 | msgstr "%1$s(%2$s)에서 카메라 사용 권한을 요청합니다." 54 | 55 | msgid "IDS_BR_BODY_FULL_SCREEN" 56 | msgstr "전체 화면" 57 | 58 | msgid "IDS_BR_SK_OK" 59 | msgstr "확인" 60 | 61 | msgid "IDS_BR_MBODY_LOCATION_ACCESS" 62 | msgstr "위치정보 사용" 63 | 64 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_DISPLAY_NOTIFICATIONS" 65 | msgstr "이 사이트가 알림을 표시할 수 있도록 허용합니다." 66 | 67 | msgid "IDS_BR_BODY_EMPTY" 68 | msgstr "비어 있음" 69 | 70 | msgid "IDS_BR_HEADER_AUTO_REFRESH" 71 | msgstr "자동 새로고침" 72 | 73 | msgid "IDS_WRT_OPT_ACCESS_USER_LOCATION" 74 | msgstr "사용자 위치정보 접근" 75 | 76 | msgid "IDS_WRT_OPT_USE_STORE_WEB_DATA" 77 | msgstr "웹 데이터 사용 및 저장" 78 | 79 | msgid "IDS_WRT_OPT_USE_USER_MEDIA" 80 | msgstr "사용자 미디어 사용" 81 | 82 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_ACCESS_YOUR_LOCATION_INFORMATION" 83 | msgstr "이 사이트에서 내 위치정보에 접근할 수 있도록 허용합니다." 84 | 85 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_SAVE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE" 86 | msgstr "이 사이트가 디바이스에 용량이 큰 데이터를 저장할 수 있도록 허용합니다." 87 | 88 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_CHANGE_THE_DISPLAY_TO_FULL_SCREEN" 89 | msgstr "이 사이트에서 화면을 전체 화면으로 변경할 수 있도록 허용합니다." 90 | 91 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_USE_THE_MEDIA_FILES_STORED_ON_YOUR_DEVICE" 92 | msgstr "이 사이트가 디바이스에 저장된 멀티미디어 파일을 사용할 수 있도록 허용합니다." 93 | 94 | msgid "IDS_ST_POP_CLEAR_DEFAULT_APP_SETTINGS_BY_GOING_TO_SETTINGS_GENERAL_MANAGE_APPLICATIONS_ALL" 95 | msgstr "[설정] > [일반] > [애플리케이션 관리] > [전체]에서 기본 애플리케이션 설정을 삭제하세요." 96 | 97 | msgid "IDS_COM_BODY_DENY" 98 | msgstr "거부" 99 | 100 | msgid "IDS_SA_BODY_USER_AUTHENTICATION" 101 | msgstr "사용자 인증" 102 | 103 | msgid "IDS_BR_BODY_REMEMBER_PREFERENCE" 104 | msgstr "설정을 기억합니다." 105 | 106 | msgid "IDS_BR_HEADER_CERTIFICATE_INFO" 107 | msgstr "인증서 정보" 108 | 109 | msgid "IDS_BR_BODY_LOGIN" 110 | msgstr "로그인" 111 | 112 | -------------------------------------------------------------------------------- /extensions/renderer/xwalk_v8tools_module.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Intel Corporation. All rights reserved. 2 | // Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | 6 | #include "extensions/renderer/xwalk_v8tools_module.h" 7 | 8 | #include 9 | 10 | #include "common/logger.h" 11 | 12 | namespace extensions { 13 | 14 | namespace { 15 | 16 | void ForceSetPropertyCallback( 17 | const v8::FunctionCallbackInfo& info) { 18 | if (info.Length() != 3 || !info[0]->IsObject() || !info[1]->IsString()) { 19 | return; 20 | } 21 | info[0].As()->ForceSet(info[1], info[2]); 22 | } 23 | 24 | void LifecycleTrackerCleanup( 25 | const v8::WeakCallbackData >& data) { 27 | v8::Isolate* isolate = data.GetIsolate(); 28 | v8::HandleScope handle_scope(isolate); 29 | 30 | v8::Local tracker = data.GetValue(); 31 | v8::Handle function = 32 | tracker->Get(v8::String::NewFromUtf8(isolate, "destructor")); 33 | 34 | if (function.IsEmpty() || !function->IsFunction()) { 35 | LOGGER(WARN) << "Destructor function not set for LifecycleTracker."; 36 | data.GetParameter()->Reset(); 37 | delete data.GetParameter(); 38 | return; 39 | } 40 | 41 | v8::Handle context = v8::Context::New(isolate); 42 | 43 | v8::TryCatch try_catch; 44 | v8::Handle::Cast(function)->Call(context->Global(), 0, NULL); 45 | if (try_catch.HasCaught()) 46 | LOGGER(WARN) << "Exception when running LifecycleTracker destructor"; 47 | 48 | data.GetParameter()->Reset(); 49 | delete data.GetParameter(); 50 | } 51 | 52 | void LifecycleTracker(const v8::FunctionCallbackInfo& info) { 53 | v8::Isolate* isolate = v8::Isolate::GetCurrent(); 54 | v8::HandleScope handle_scope(isolate); 55 | 56 | v8::Persistent* tracker = 57 | new v8::Persistent(isolate, v8::Object::New(isolate)); 58 | tracker->SetWeak(tracker, &LifecycleTrackerCleanup); 59 | 60 | info.GetReturnValue().Set(*tracker); 61 | } 62 | 63 | } // namespace 64 | 65 | XWalkV8ToolsModule::XWalkV8ToolsModule() { 66 | v8::Isolate* isolate = v8::Isolate::GetCurrent(); 67 | v8::HandleScope handle_scope(isolate); 68 | v8::Handle object_template = v8::ObjectTemplate::New(); 69 | 70 | // TODO(cmarcelo): Use Template::Set() function that takes isolate, once we 71 | // update the Chromium (and V8) version. 72 | object_template->Set(v8::String::NewFromUtf8(isolate, "forceSetProperty"), 73 | v8::FunctionTemplate::New( 74 | isolate, ForceSetPropertyCallback)); 75 | object_template->Set(v8::String::NewFromUtf8(isolate, "lifecycleTracker"), 76 | v8::FunctionTemplate::New(isolate, LifecycleTracker)); 77 | 78 | object_template_.Reset(isolate, object_template); 79 | } 80 | 81 | XWalkV8ToolsModule::~XWalkV8ToolsModule() { 82 | object_template_.Reset(); 83 | } 84 | 85 | v8::Handle XWalkV8ToolsModule::NewInstance() { 86 | v8::Isolate* isolate = v8::Isolate::GetCurrent(); 87 | v8::EscapableHandleScope handle_scope(isolate); 88 | v8::Handle object_template = 89 | v8::Local::New(isolate, object_template_); 90 | return handle_scope.Escape(object_template->NewInstance()); 91 | } 92 | 93 | } // namespace extensions 94 | -------------------------------------------------------------------------------- /wrt-upgrade/wrt-upgrade-info.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Intel Corporation. All rights reserved. 2 | // Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | 6 | #ifndef WRT_UPGRADE_INFO_H 7 | #define WRT_UPGRADE_INFO_H 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace upgrade { 14 | class PreferenceInfo{ 15 | public: 16 | PreferenceInfo(std::string key, std::string value); 17 | std::string getSection() {return m_section_;} 18 | std::string getKey() {return m_key_;} 19 | std::string getValue() {return m_value_;} 20 | private: 21 | std::string m_section_; 22 | std::string m_key_; 23 | std::string m_value_; 24 | }; 25 | 26 | class SecurityOriginInfo{ 27 | public: 28 | SecurityOriginInfo( 29 | int feature, 30 | std::string scheme, 31 | std::string host, 32 | int port, 33 | int result); 34 | std::string getSection() {return m_section_;} 35 | std::string getKey() {return m_key_;} 36 | std::string getValue() {return m_value_;} 37 | private: 38 | std::string translateKey( 39 | int feature, 40 | std::string scheme, 41 | std::string host, 42 | int port); 43 | std::string translateValue(int result); 44 | std::string m_section_; 45 | std::string m_key_; 46 | std::string m_value_; 47 | }; 48 | 49 | class CertificateInfo{ 50 | public: 51 | CertificateInfo( 52 | std::string pem, 53 | int result); 54 | std::string getSection() {return m_section_;} 55 | std::string getKey() {return m_key_;} 56 | std::string getValue() {return m_value_;} 57 | private: 58 | std::string translateKey(std::string pem); 59 | std::string translateValue(int result); 60 | std::string m_section_; 61 | std::string m_key_; 62 | std::string m_value_; 63 | }; 64 | 65 | class WrtUpgradeInfo{ 66 | public: 67 | WrtUpgradeInfo() {} 68 | explicit WrtUpgradeInfo(std::string appid); 69 | 70 | std::string getAppid() { return app_id_; } 71 | std::string getPkgid() { return pkg_id_; } 72 | std::string getAppDir() { return app_dir_; } 73 | std::string getSecurityOriginDB(); 74 | std::string getCertificateDB(); 75 | 76 | void addPreferenceInfo(PreferenceInfo preference); 77 | void addSecurityOriginInfo(SecurityOriginInfo security_origin); 78 | void addCertificateInfo(CertificateInfo certificate); 79 | 80 | PreferenceInfo getPreferenceInfo(int idx) 81 | {return preference_info_list_[idx];} 82 | SecurityOriginInfo getSecurityOriginInfo(int idx) 83 | {return security_origin_info_list_[idx];} 84 | CertificateInfo getCertificateInfo(int idx) 85 | {return certificate_info_list[idx];} 86 | 87 | int getPreferenceInfoSize() 88 | {return static_cast(preference_info_list_.size());} 89 | int getSecurityOriginInfoSize() 90 | {return static_cast(security_origin_info_list_.size());} 91 | int getCertificateInfoSize() 92 | {return static_cast(certificate_info_list.size());} 93 | 94 | private: 95 | std::string pkg_id_; 96 | std::string app_id_; 97 | std::string app_dir_; 98 | std::vector preference_info_list_; 99 | std::vector security_origin_info_list_; 100 | std::vector certificate_info_list; 101 | }; 102 | } // namespace upgrade 103 | #endif // WRT_UPGRADE_INFO_H 104 | -------------------------------------------------------------------------------- /common/profiler.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include "common/profiler.h" 18 | 19 | #include 20 | #include 21 | 22 | #include "common/logger.h" 23 | #include "common/string_utils.h" 24 | 25 | namespace common { 26 | 27 | namespace { 28 | 29 | void PrintProfileTime(const char* step, const struct timespec& start) { 30 | struct timespec end; 31 | clock_gettime(CLOCK_REALTIME, &end); 32 | int64_t diff_in_milli = (end.tv_sec - start.tv_sec) * 1000 33 | + round((end.tv_nsec - start.tv_nsec) * 0.000001); 34 | std::ostringstream ss; 35 | ss << "END (" << diff_in_milli << "ms)"; 36 | PrintProfileLog(step, ss.str().c_str()); 37 | } 38 | 39 | } // namespace 40 | 41 | void PrintProfileLog(const char* func, const char* tag) { 42 | LOGGER_RAW(DLOG_DEBUG, LOGGER_TAG) 43 | << "[PROF] [" << utils::GetCurrentMilliSeconds() << "] " 44 | << func << ":" << tag; 45 | } 46 | 47 | ScopeProfile::ScopeProfile(const char* step, const bool isStep) 48 | : step_(step), expired_(false), isStep_(isStep) { 49 | clock_gettime(CLOCK_REALTIME, &start_); 50 | 51 | if (!isStep) { 52 | // Remove return type and parameter info from __PRETTY_FUNCTION__ 53 | int se = step_.find_first_of('('); 54 | int ss = step_.find_last_of(' ', se) + 1; 55 | if (ss < se) { 56 | step_ = step_.substr(ss, se - ss); 57 | } 58 | } 59 | 60 | PrintProfileLog(step_.c_str(), "START"); 61 | 62 | if(isStep_) 63 | traceAsyncBegin(TTRACE_TAG_WEB, 0, "%s%s", "XWALK:", step_.c_str()); 64 | else 65 | traceBegin(TTRACE_TAG_WEB,"%s%s", "XWALK:", step_.c_str()); 66 | } 67 | 68 | ScopeProfile::~ScopeProfile() { 69 | if (!expired_) { 70 | PrintProfileTime(step_.c_str(), start_); 71 | 72 | if(isStep_) 73 | traceAsyncEnd(TTRACE_TAG_WEB, 0, "%s%s", "XWALK:", step_.c_str()); 74 | else 75 | traceEnd(TTRACE_TAG_WEB); 76 | } 77 | } 78 | 79 | void ScopeProfile::Reset() { 80 | clock_gettime(CLOCK_REALTIME, &start_); 81 | PrintProfileLog(step_.c_str(), "START-updated"); 82 | 83 | if(isStep_) 84 | traceAsyncEnd(TTRACE_TAG_WEB, 0, "%s%s", "XWALK:", step_.c_str()); 85 | else 86 | traceEnd(TTRACE_TAG_WEB); 87 | } 88 | 89 | void ScopeProfile::End() { 90 | expired_ = true; 91 | PrintProfileTime(step_.c_str(), start_); 92 | } 93 | 94 | StepProfile* StepProfile::GetInstance() { 95 | static StepProfile instance; 96 | return &instance; 97 | } 98 | 99 | StepProfile::StepProfile() { 100 | } 101 | 102 | StepProfile::~StepProfile() { 103 | } 104 | 105 | void StepProfile::Start(const char* step) { 106 | map_[step].reset(new ScopeProfile(step, true)); 107 | } 108 | 109 | void StepProfile::End(const char* step) { 110 | map_[step].reset(); 111 | } 112 | 113 | } // namespace common 114 | -------------------------------------------------------------------------------- /extensions/renderer/xwalk_extension_module.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Copyright (c) 2013 Intel Corporation. All rights reserved. 3 | // Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. 4 | // Use of this source code is governed by a BSD-style license that can be 5 | // found in the LICENSE file. 6 | 7 | #ifndef XWALK_EXTENSIONS_RENDERER_XWALK_EXTENSION_MODULE_H_ 8 | #define XWALK_EXTENSIONS_RENDERER_XWALK_EXTENSION_MODULE_H_ 9 | 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | #include "extensions/renderer/xwalk_extension_client.h" 16 | 17 | namespace extensions { 18 | 19 | class XWalkModuleSystem; 20 | 21 | // Responsible for running the JS code of a Extension. This includes 22 | // creating and exposing an 'extension' object for the execution context of 23 | // the extension JS code. 24 | // 25 | // We'll create one XWalkExtensionModule per extension/frame pair, so 26 | // there'll be a set of different modules per v8::Context. 27 | class XWalkExtensionModule : public XWalkExtensionClient::InstanceHandler { 28 | public: 29 | XWalkExtensionModule(XWalkExtensionClient* client, 30 | XWalkModuleSystem* module_system, 31 | const std::string& extension_name, 32 | const std::string& extension_code); 33 | virtual ~XWalkExtensionModule(); 34 | 35 | // TODO(cmarcelo): Make this return a v8::Handle, and 36 | // let the module system set it to the appropriated object. 37 | void LoadExtensionCode(v8::Handle context, 38 | v8::Handle require_native); 39 | 40 | std::string extension_name() const { return extension_name_; } 41 | 42 | private: 43 | // ExtensionClient::InstanceHandler implementation. 44 | virtual void HandleMessageFromNative(const std::string& msg); 45 | 46 | // Callbacks for JS functions available in 'extension' object. 47 | static void PostMessageCallback( 48 | const v8::FunctionCallbackInfo& info); 49 | static void SendSyncMessageCallback( 50 | const v8::FunctionCallbackInfo& info); 51 | static void SetMessageListenerCallback( 52 | const v8::FunctionCallbackInfo& info); 53 | static void SendRuntimeMessageCallback( 54 | const v8::FunctionCallbackInfo& info); 55 | static void SendRuntimeSyncMessageCallback( 56 | const v8::FunctionCallbackInfo& info); 57 | static void SendRuntimeAsyncMessageCallback( 58 | const v8::FunctionCallbackInfo& info); 59 | 60 | static XWalkExtensionModule* GetExtensionModule( 61 | const v8::FunctionCallbackInfo& info); 62 | 63 | // Template for the 'extension' object exposed to the extension JS code. 64 | v8::Persistent object_template_; 65 | 66 | // This JS object contains a pointer back to the ExtensionModule, it is 67 | // set as data for the function callbacks. 68 | v8::Persistent function_data_; 69 | 70 | // Function to be called when the extension sends a message to its JS code. 71 | // This value is registered by using 'extension.setMessageListener()'. 72 | v8::Persistent message_listener_; 73 | 74 | std::string extension_name_; 75 | std::string extension_code_; 76 | 77 | XWalkExtensionClient* client_; 78 | XWalkModuleSystem* module_system_; 79 | std::string instance_id_; 80 | }; 81 | 82 | } // namespace extensions 83 | 84 | #endif // XWALK_EXTENSIONS_RENDERER_XWALK_EXTENSION_MODULE_H_ 85 | -------------------------------------------------------------------------------- /common/string_utils.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include "common/string_utils.h" 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | namespace common { 32 | namespace utils { 33 | 34 | std::string GenerateUUID() { 35 | char tmp[37]; 36 | uuid_t uuid; 37 | uuid_generate(uuid); 38 | uuid_unparse(uuid, tmp); 39 | return std::string(tmp); 40 | } 41 | 42 | bool StartsWith(const std::string& str, const std::string& sub) { 43 | if (sub.size() > str.size()) return false; 44 | return std::equal(sub.begin(), sub.end(), str.begin()); 45 | } 46 | 47 | bool EndsWith(const std::string& str, const std::string& sub) { 48 | if (sub.size() > str.size()) return false; 49 | return std::equal(sub.rbegin(), sub.rend(), str.rbegin()); 50 | } 51 | 52 | std::string ReplaceAll(const std::string& replace, 53 | const std::string& from, const std::string& to) { 54 | std::string str = replace; 55 | size_t pos = str.find(from); 56 | while (pos != std::string::npos) { 57 | str.replace(pos, from.length(), to); 58 | pos = str.find(from, pos+to.length()); 59 | } 60 | return str; 61 | } 62 | 63 | std::string GetCurrentMilliSeconds() { 64 | std::ostringstream ss; 65 | struct timespec spec; 66 | clock_gettime(CLOCK_REALTIME, &spec); 67 | ss << (spec.tv_sec%10000) << "." << 68 | std::setw(3) << std::setfill('0') << (round(spec.tv_nsec / 1.0e6)); 69 | return ss.str(); 70 | } 71 | 72 | bool SplitString(const std::string &str, 73 | std::string *part_1, std::string *part_2, const char delim) { 74 | if (part_1 == nullptr || part_2 == nullptr) 75 | return false; 76 | 77 | size_t pos = str.find(delim); 78 | if (pos == std::string::npos) 79 | return false; 80 | 81 | *part_1 = str.substr(0, pos); 82 | *part_2 = str.substr(pos+1); 83 | return true; 84 | } 85 | 86 | std::string UrlDecode(const std::string& url) { 87 | std::unique_ptr decoded_str { 88 | g_uri_unescape_string(url.c_str(), NULL), std::free }; 89 | return decoded_str.get() != nullptr ? std::string(decoded_str.get()) : url; 90 | } 91 | 92 | std::string UrlEncode(const std::string& url) { 93 | std::unique_ptr encoded_str { 94 | g_uri_escape_string(url.c_str(), NULL, TRUE), std::free }; 95 | return encoded_str.get() != nullptr ? std::string(encoded_str.get()) : url; 96 | } 97 | 98 | std::string Base64Encode(const unsigned char* data, size_t len) { 99 | gchar* encoded = g_base64_encode(data, len); 100 | std::unique_ptr encoded_ptr {encoded, g_free}; 101 | return std::string(encoded); 102 | } 103 | 104 | } // namespace utils 105 | } // namespace common 106 | -------------------------------------------------------------------------------- /common/logger.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_COMMON_LOGGER_H_ 18 | #define XWALK_COMMON_LOGGER_H_ 19 | 20 | #include 21 | #include 22 | 23 | #undef LOGGER_TAG 24 | #define LOGGER_TAG "XWALK" 25 | 26 | #define _LOGGER_LOG(prio, fmt, args...) \ 27 | LOG_(LOG_ID_MAIN, prio, LOGGER_TAG, fmt, ##args) 28 | 29 | #define _LOGGER_SLOG(prio, fmt, args...) \ 30 | SECURE_LOG_(LOG_ID_MAIN, prio, LOGGER_TAG, fmt, ##args) 31 | 32 | #define LoggerD(fmt, args...) _LOGGER_LOG(DLOG_DEBUG, fmt, ##args) 33 | #define LoggerI(fmt, args...) _LOGGER_LOG(DLOG_INFO, fmt, ##args) 34 | #define LoggerW(fmt, args...) _LOGGER_LOG(DLOG_WARN, fmt, ##args) 35 | #define LoggerE(fmt, args...) _LOGGER_LOG(DLOG_ERROR, fmt, ##args) 36 | 37 | #define SLoggerD(fmt, args...) _LOGGER_SLOG(DLOG_DEBUG, fmt, ##args) 38 | #define SLoggerI(fmt, args...) _LOGGER_SLOG(DLOG_INFO, fmt, ##args) 39 | #define SLoggerW(fmt, args...) _LOGGER_SLOG(DLOG_WARN, fmt, ##args) 40 | #define SLoggerE(fmt, args...) _LOGGER_SLOG(DLOG_ERROR, fmt, ##args) 41 | 42 | namespace common { 43 | namespace utils { 44 | 45 | class LogMessageVodify { 46 | public: 47 | LogMessageVodify() {} 48 | void operator&(const std::ostream&) const {} 49 | }; 50 | 51 | class LogMessage { 52 | public: 53 | LogMessage(int severity, const char* tag, 54 | const char* file, const char* func, const int line) 55 | : severity_(severity), tag_(tag), file_(file), func_(func), line_(line) {} 56 | LogMessage(int severity, const char* tag) 57 | : severity_(severity), tag_(tag), file_(NULL), func_(NULL), line_(0) {} 58 | ~LogMessage() { 59 | if (file_) { 60 | __dlog_print(LOG_ID_MAIN, severity_, tag_, 61 | "%s: %s(%d) > %s", 62 | file_, func_, line_, stream_.str().c_str()); 63 | } else { 64 | __dlog_print(LOG_ID_MAIN, severity_, tag_, "%s", stream_.str().c_str()); 65 | } 66 | } 67 | std::ostream& stream() { return stream_; } 68 | private: 69 | const int severity_; 70 | const char* tag_; 71 | const char* file_; 72 | const char* func_; 73 | const int line_; 74 | std::ostringstream stream_; 75 | }; 76 | 77 | } // namespace utils 78 | } // namespace common 79 | 80 | #ifndef __MODULE__ 81 | #define __MODULE__ \ 82 | (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) 83 | #endif 84 | 85 | #define LOGGER(severity) \ 86 | common::utils::LogMessageVodify() & \ 87 | common::utils::LogMessage(DLOG_ ## severity, LOGGER_TAG, \ 88 | __MODULE__, __FUNCTION__, __LINE__).stream() 89 | 90 | #define LOGGER_RAW(level, tag) \ 91 | common::utils::LogMessageVodify() & \ 92 | common::utils::LogMessage(level, tag).stream() 93 | 94 | 95 | #endif // XWALK_COMMON_LOGGER_H_ 96 | -------------------------------------------------------------------------------- /tools/gyp/pylib/gyp/generator/gypd.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2011 Google Inc. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | """gypd output module 6 | 7 | This module produces gyp input as its output. Output files are given the 8 | .gypd extension to avoid overwriting the .gyp files that they are generated 9 | from. Internal references to .gyp files (such as those found in 10 | "dependencies" sections) are not adjusted to point to .gypd files instead; 11 | unlike other paths, which are relative to the .gyp or .gypd file, such paths 12 | are relative to the directory from which gyp was run to create the .gypd file. 13 | 14 | This generator module is intended to be a sample and a debugging aid, hence 15 | the "d" for "debug" in .gypd. It is useful to inspect the results of the 16 | various merges, expansions, and conditional evaluations performed by gyp 17 | and to see a representation of what would be fed to a generator module. 18 | 19 | It's not advisable to rename .gypd files produced by this module to .gyp, 20 | because they will have all merges, expansions, and evaluations already 21 | performed and the relevant constructs not present in the output; paths to 22 | dependencies may be wrong; and various sections that do not belong in .gyp 23 | files such as such as "included_files" and "*_excluded" will be present. 24 | Output will also be stripped of comments. This is not intended to be a 25 | general-purpose gyp pretty-printer; for that, you probably just want to 26 | run "pprint.pprint(eval(open('source.gyp').read()))", which will still strip 27 | comments but won't do all of the other things done to this module's output. 28 | 29 | The specific formatting of the output generated by this module is subject 30 | to change. 31 | """ 32 | 33 | 34 | import gyp.common 35 | import errno 36 | import os 37 | import pprint 38 | 39 | 40 | # These variables should just be spit back out as variable references. 41 | _generator_identity_variables = [ 42 | 'EXECUTABLE_PREFIX', 43 | 'EXECUTABLE_SUFFIX', 44 | 'INTERMEDIATE_DIR', 45 | 'PRODUCT_DIR', 46 | 'RULE_INPUT_ROOT', 47 | 'RULE_INPUT_DIRNAME', 48 | 'RULE_INPUT_EXT', 49 | 'RULE_INPUT_NAME', 50 | 'RULE_INPUT_PATH', 51 | 'SHARED_INTERMEDIATE_DIR', 52 | ] 53 | 54 | # gypd doesn't define a default value for OS like many other generator 55 | # modules. Specify "-D OS=whatever" on the command line to provide a value. 56 | generator_default_variables = { 57 | } 58 | 59 | # gypd supports multiple toolsets 60 | generator_supports_multiple_toolsets = True 61 | 62 | # TODO(mark): This always uses <, which isn't right. The input module should 63 | # notify the generator to tell it which phase it is operating in, and this 64 | # module should use < for the early phase and then switch to > for the late 65 | # phase. Bonus points for carrying @ back into the output too. 66 | for v in _generator_identity_variables: 67 | generator_default_variables[v] = '<(%s)' % v 68 | 69 | 70 | def GenerateOutput(target_list, target_dicts, data, params): 71 | output_files = {} 72 | for qualified_target in target_list: 73 | [input_file, target] = \ 74 | gyp.common.ParseQualifiedTarget(qualified_target)[0:2] 75 | 76 | if input_file[-4:] != '.gyp': 77 | continue 78 | input_file_stem = input_file[:-4] 79 | output_file = input_file_stem + params['options'].suffix + '.gypd' 80 | 81 | if not output_file in output_files: 82 | output_files[output_file] = input_file 83 | 84 | for output_file, input_file in output_files.iteritems(): 85 | output = open(output_file, 'w') 86 | pprint.pprint(data[input_file], output) 87 | output.close() 88 | -------------------------------------------------------------------------------- /extensions/internal/widget/widget_extension.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #include "extensions/public/XW_Extension.h" 23 | #include "extensions/public/XW_Extension_EntryPoints.h" 24 | #include "extensions/public/XW_Extension_Permissions.h" 25 | #include "extensions/public/XW_Extension_Runtime.h" 26 | #include "extensions/public/XW_Extension_SyncMessage.h" 27 | 28 | #include "common/application_data.h" 29 | #include "common/locale_manager.h" 30 | #include "common/logger.h" 31 | #include "common/string_utils.h" 32 | 33 | XW_Extension g_xw_extension = 0; 34 | const XW_CoreInterface* g_core = NULL; 35 | const XW_MessagingInterface* g_messaging = NULL; 36 | const XW_Internal_SyncMessagingInterface* g_sync_messaging = NULL; 37 | const XW_Internal_EntryPointsInterface* g_entry_points = NULL; 38 | const XW_Internal_RuntimeInterface* g_runtime = NULL; 39 | 40 | extern const char kSource_widget_api[]; 41 | 42 | extern "C" int32_t XW_Initialize(XW_Extension extension, 43 | XW_GetInterface get_interface) { 44 | g_xw_extension = extension; 45 | g_core = reinterpret_cast( 46 | get_interface(XW_CORE_INTERFACE)); 47 | if (!g_core) { 48 | LOGGER(ERROR) 49 | << "Can't initialize extension: error getting Core interface."; 50 | return XW_ERROR; 51 | } 52 | 53 | g_messaging = reinterpret_cast( 54 | get_interface(XW_MESSAGING_INTERFACE)); 55 | if (!g_messaging) { 56 | LOGGER(ERROR) 57 | << "Can't initialize extension: error getting Messaging interface."; 58 | return XW_ERROR; 59 | } 60 | 61 | g_sync_messaging = 62 | reinterpret_cast( 63 | get_interface(XW_INTERNAL_SYNC_MESSAGING_INTERFACE)); 64 | if (!g_sync_messaging) { 65 | LOGGER(ERROR) 66 | << "Can't initialize extension: " 67 | << "error getting SyncMessaging interface."; 68 | return XW_ERROR; 69 | } 70 | 71 | g_entry_points = reinterpret_cast( 72 | get_interface(XW_INTERNAL_ENTRY_POINTS_INTERFACE)); 73 | if (!g_entry_points) { 74 | LOGGER(ERROR) 75 | << "NOTE: Entry points interface not available in this version " 76 | << "of Crosswalk, ignoring entry point data for extensions.\n"; 77 | return XW_ERROR; 78 | } 79 | 80 | g_runtime = reinterpret_cast( 81 | get_interface(XW_INTERNAL_RUNTIME_INTERFACE)); 82 | if (!g_runtime) { 83 | LOGGER(ERROR) 84 | << "NOTE: runtime interface not available in this version " 85 | << "of Crosswalk, ignoring runtime variables for extensions.\n"; 86 | return XW_ERROR; 87 | } 88 | 89 | g_core->SetExtensionName(g_xw_extension, "Widget"); 90 | const char* entry_points[] = {"widget", NULL}; 91 | g_entry_points->SetExtraJSEntryPoints(g_xw_extension, entry_points); 92 | g_core->SetJavaScriptAPI(g_xw_extension, kSource_widget_api); 93 | 94 | return XW_OK; 95 | } 96 | -------------------------------------------------------------------------------- /tools/gyp/pylib/gyp/easy_xml_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Copyright (c) 2011 Google Inc. All rights reserved. 4 | # Use of this source code is governed by a BSD-style license that can be 5 | # found in the LICENSE file. 6 | 7 | """ Unit tests for the easy_xml.py file. """ 8 | 9 | import gyp.easy_xml as easy_xml 10 | import unittest 11 | import StringIO 12 | 13 | 14 | class TestSequenceFunctions(unittest.TestCase): 15 | 16 | def setUp(self): 17 | self.stderr = StringIO.StringIO() 18 | 19 | def test_EasyXml_simple(self): 20 | self.assertEqual( 21 | easy_xml.XmlToString(['test']), 22 | '') 23 | 24 | self.assertEqual( 25 | easy_xml.XmlToString(['test'], encoding='Windows-1252'), 26 | '') 27 | 28 | def test_EasyXml_simple_with_attributes(self): 29 | self.assertEqual( 30 | easy_xml.XmlToString(['test2', {'a': 'value1', 'b': 'value2'}]), 31 | '') 32 | 33 | def test_EasyXml_escaping(self): 34 | original = '\'"\r&\nfoo' 35 | converted = '<test>\'" & foo' 36 | converted_apos = converted.replace("'", ''') 37 | self.assertEqual( 38 | easy_xml.XmlToString(['test3', {'a': original}, original]), 39 | '%s' % 40 | (converted, converted_apos)) 41 | 42 | def test_EasyXml_pretty(self): 43 | self.assertEqual( 44 | easy_xml.XmlToString( 45 | ['test3', 46 | ['GrandParent', 47 | ['Parent1', 48 | ['Child'] 49 | ], 50 | ['Parent2'] 51 | ] 52 | ], 53 | pretty=True), 54 | '\n' 55 | '\n' 56 | ' \n' 57 | ' \n' 58 | ' \n' 59 | ' \n' 60 | ' \n' 61 | ' \n' 62 | '\n') 63 | 64 | 65 | def test_EasyXml_complex(self): 66 | # We want to create: 67 | target = ( 68 | '' 69 | '' 70 | '' 71 | '{D2250C20-3A94-4FB9-AF73-11BC5B73884B}' 72 | 'Win32Proj' 73 | 'automated_ui_tests' 74 | '' 75 | '' 76 | '' 79 | 'Application' 80 | 'Unicode' 81 | '' 82 | '') 83 | 84 | xml = easy_xml.XmlToString( 85 | ['Project', 86 | ['PropertyGroup', {'Label': 'Globals'}, 87 | ['ProjectGuid', '{D2250C20-3A94-4FB9-AF73-11BC5B73884B}'], 88 | ['Keyword', 'Win32Proj'], 89 | ['RootNamespace', 'automated_ui_tests'] 90 | ], 91 | ['Import', {'Project': '$(VCTargetsPath)\\Microsoft.Cpp.props'}], 92 | ['PropertyGroup', 93 | {'Condition': "'$(Configuration)|$(Platform)'=='Debug|Win32'", 94 | 'Label': 'Configuration'}, 95 | ['ConfigurationType', 'Application'], 96 | ['CharacterSet', 'Unicode'] 97 | ] 98 | ]) 99 | self.assertEqual(xml, target) 100 | 101 | 102 | if __name__ == '__main__': 103 | unittest.main() 104 | -------------------------------------------------------------------------------- /extensions/internal/splash_screen/splash_screen_extension.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #include "extensions/public/XW_Extension.h" 23 | #include "extensions/public/XW_Extension_EntryPoints.h" 24 | #include "extensions/public/XW_Extension_Permissions.h" 25 | #include "extensions/public/XW_Extension_Runtime.h" 26 | #include "extensions/public/XW_Extension_SyncMessage.h" 27 | 28 | #include "common/application_data.h" 29 | #include "common/locale_manager.h" 30 | #include "common/logger.h" 31 | #include "common/string_utils.h" 32 | 33 | XW_Extension g_xw_extension = 0; 34 | const XW_CoreInterface* g_core = NULL; 35 | const XW_MessagingInterface* g_messaging = NULL; 36 | const XW_Internal_SyncMessagingInterface* g_sync_messaging = NULL; 37 | const XW_Internal_EntryPointsInterface* g_entry_points = NULL; 38 | const XW_Internal_RuntimeInterface* g_runtime = NULL; 39 | 40 | extern const char kSource_splash_screen_api[]; 41 | 42 | extern "C" int32_t XW_Initialize(XW_Extension extension, 43 | XW_GetInterface get_interface) { 44 | g_xw_extension = extension; 45 | g_core = reinterpret_cast( 46 | get_interface(XW_CORE_INTERFACE)); 47 | if (!g_core) { 48 | LOGGER(ERROR) 49 | << "Can't initialize extension: error getting Core interface."; 50 | return XW_ERROR; 51 | } 52 | 53 | g_messaging = reinterpret_cast( 54 | get_interface(XW_MESSAGING_INTERFACE)); 55 | if (!g_messaging) { 56 | LOGGER(ERROR) 57 | << "Can't initialize extension: error getting Messaging interface."; 58 | return XW_ERROR; 59 | } 60 | 61 | g_sync_messaging = 62 | reinterpret_cast( 63 | get_interface(XW_INTERNAL_SYNC_MESSAGING_INTERFACE)); 64 | if (!g_sync_messaging) { 65 | LOGGER(ERROR) 66 | << "Can't initialize extension: " 67 | << "error getting SyncMessaging interface."; 68 | return XW_ERROR; 69 | } 70 | 71 | g_entry_points = reinterpret_cast( 72 | get_interface(XW_INTERNAL_ENTRY_POINTS_INTERFACE)); 73 | if (!g_entry_points) { 74 | LOGGER(ERROR) 75 | << "NOTE: Entry points interface not available in this version " 76 | << "of Crosswalk, ignoring entry point data for extensions.\n"; 77 | return XW_ERROR; 78 | } 79 | 80 | g_runtime = reinterpret_cast( 81 | get_interface(XW_INTERNAL_RUNTIME_INTERFACE)); 82 | if (!g_runtime) { 83 | LOGGER(ERROR) 84 | << "NOTE: runtime interface not available in this version " 85 | << "of Crosswalk, ignoring runtime variables for extensions.\n"; 86 | return XW_ERROR; 87 | } 88 | 89 | g_core->SetExtensionName(g_xw_extension, "SplashScreen"); 90 | const char* entry_points[] = {"window.screen.show", NULL}; 91 | g_entry_points->SetExtraJSEntryPoints(g_xw_extension, entry_points); 92 | g_core->SetJavaScriptAPI(g_xw_extension, kSource_splash_screen_api); 93 | 94 | return XW_OK; 95 | } 96 | -------------------------------------------------------------------------------- /tools/gyp/pylib/gyp/generator/dump_dependency_json.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 Google Inc. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | import collections 6 | import os 7 | import gyp 8 | import gyp.common 9 | import gyp.msvs_emulation 10 | import json 11 | import sys 12 | 13 | generator_supports_multiple_toolsets = True 14 | 15 | generator_wants_static_library_dependencies_adjusted = False 16 | 17 | generator_default_variables = { 18 | } 19 | for dirname in ['INTERMEDIATE_DIR', 'SHARED_INTERMEDIATE_DIR', 'PRODUCT_DIR', 20 | 'LIB_DIR', 'SHARED_LIB_DIR']: 21 | # Some gyp steps fail if these are empty(!). 22 | generator_default_variables[dirname] = 'dir' 23 | for unused in ['RULE_INPUT_PATH', 'RULE_INPUT_ROOT', 'RULE_INPUT_NAME', 24 | 'RULE_INPUT_DIRNAME', 'RULE_INPUT_EXT', 25 | 'EXECUTABLE_PREFIX', 'EXECUTABLE_SUFFIX', 26 | 'STATIC_LIB_PREFIX', 'STATIC_LIB_SUFFIX', 27 | 'SHARED_LIB_PREFIX', 'SHARED_LIB_SUFFIX', 28 | 'CONFIGURATION_NAME']: 29 | generator_default_variables[unused] = '' 30 | 31 | 32 | def CalculateVariables(default_variables, params): 33 | generator_flags = params.get('generator_flags', {}) 34 | for key, val in generator_flags.items(): 35 | default_variables.setdefault(key, val) 36 | default_variables.setdefault('OS', gyp.common.GetFlavor(params)) 37 | 38 | flavor = gyp.common.GetFlavor(params) 39 | if flavor =='win': 40 | # Copy additional generator configuration data from VS, which is shared 41 | # by the Windows Ninja generator. 42 | import gyp.generator.msvs as msvs_generator 43 | generator_additional_non_configuration_keys = getattr(msvs_generator, 44 | 'generator_additional_non_configuration_keys', []) 45 | generator_additional_path_sections = getattr(msvs_generator, 46 | 'generator_additional_path_sections', []) 47 | 48 | # Set a variable so conditions can be based on msvs_version. 49 | msvs_version = gyp.msvs_emulation.GetVSVersion(generator_flags) 50 | default_variables['MSVS_VERSION'] = msvs_version.ShortName() 51 | 52 | # To determine processor word size on Windows, in addition to checking 53 | # PROCESSOR_ARCHITECTURE (which reflects the word size of the current 54 | # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which 55 | # contains the actual word size of the system when running thru WOW64). 56 | if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or 57 | '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')): 58 | default_variables['MSVS_OS_BITS'] = 64 59 | else: 60 | default_variables['MSVS_OS_BITS'] = 32 61 | 62 | 63 | def CalculateGeneratorInputInfo(params): 64 | """Calculate the generator specific info that gets fed to input (called by 65 | gyp).""" 66 | generator_flags = params.get('generator_flags', {}) 67 | if generator_flags.get('adjust_static_libraries', False): 68 | global generator_wants_static_library_dependencies_adjusted 69 | generator_wants_static_library_dependencies_adjusted = True 70 | 71 | 72 | def GenerateOutput(target_list, target_dicts, data, params): 73 | # Map of target -> list of targets it depends on. 74 | edges = {} 75 | 76 | # Queue of targets to visit. 77 | targets_to_visit = target_list[:] 78 | 79 | while len(targets_to_visit) > 0: 80 | target = targets_to_visit.pop() 81 | if target in edges: 82 | continue 83 | edges[target] = [] 84 | 85 | for dep in target_dicts[target].get('dependencies', []): 86 | edges[target].append(dep) 87 | targets_to_visit.append(dep) 88 | 89 | filename = 'dump.json' 90 | f = open(filename, 'w') 91 | json.dump(edges, f) 92 | f.close() 93 | print 'Wrote json to %s.' % filename 94 | -------------------------------------------------------------------------------- /runtime/browser/web_view_impl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_RUNTIME_BROWSER_WEB_VIEW_IMPL_H_ 18 | #define XWALK_RUNTIME_BROWSER_WEB_VIEW_IMPL_H_ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | #include "common/url.h" 29 | #include "runtime/browser/web_view.h" 30 | 31 | namespace runtime { 32 | 33 | class NativeWindow; 34 | class WebViewImpl { 35 | public: 36 | WebViewImpl(WebView* view, NativeWindow* window, Ewk_Context* context); 37 | virtual ~WebViewImpl(); 38 | 39 | void ReplyToJavascriptDialog(); 40 | void LoadUrl(const std::string& url, const std::string& mime = std::string()); 41 | std::string GetUrl(); 42 | 43 | void Suspend(); 44 | void Resume(); 45 | void Reload(); 46 | bool Backward(); 47 | void SetVisibility(bool show); 48 | bool EvalJavascript(const std::string& script); 49 | void SetAppInfo(const std::string& app_name, const std::string& version); 50 | bool SetUserAgent(const std::string& user_agent); 51 | void SetCSPRule(const std::string& rule, bool report_only); 52 | void SetDefaultEncoding(const std::string& encoding); 53 | void SetLongPolling(unsigned long longpolling); 54 | #ifdef PROFILE_WEARABLE 55 | void SetBGColor(int r, int g, int b, int a); 56 | #endif 57 | 58 | void SetEventListener(WebView::EventListener* listener); 59 | Evas_Object* evas_object() const; 60 | 61 | private: 62 | void OnKeyEvent(Eext_Callback_Type key_type); 63 | void OnRotation(int degree); 64 | void Initialize(); 65 | void Deinitialize(); 66 | 67 | void InitKeyCallback(); 68 | void InitLoaderCallback(); 69 | void InitPolicyDecideCallback(); 70 | void InitQuotaExceededCallback(); 71 | void InitIPCMessageCallback(); 72 | void InitConsoleMessageCallback(); 73 | void InitCustomContextMenuCallback(); 74 | void InitRotationCallback(); 75 | void InitWindowCreateCallback(); 76 | void InitFullscreenCallback(); 77 | void InitNotificationPermissionCallback(); 78 | void InitGeolocationPermissionCallback(); 79 | void InitAuthenticationCallback(); 80 | void InitCertificateAllowCallback(); 81 | void InitPopupWaitCallback(); 82 | void InitUsermediaCallback(); 83 | void InitEditorClientImeCallback(); 84 | #ifdef ROTARY_EVENT_FEATURE_SUPPORT 85 | void InitRotaryEventCallback(); 86 | #endif // ROTARY_EVENT_FEATURE_SUPPORT 87 | 88 | std::function mime_set_cb_; 89 | 90 | NativeWindow* window_; 91 | Ewk_Context* context_; 92 | Evas_Object* ewk_view_; 93 | WebView::EventListener* listener_; 94 | int rotation_handler_id_; 95 | WebView* view_; 96 | std::map smart_callbacks_; 97 | bool fullscreen_; 98 | Evas_Smart* evas_smart_class_; 99 | Ewk_View_Smart_Class ewk_smart_class_; 100 | bool internal_popup_opened_; 101 | size_t ime_width_; 102 | size_t ime_height_; 103 | }; 104 | } // namespace runtime 105 | 106 | #endif // XWALK_RUNTIME_BROWSER_WEB_VIEW_IMPL_H_ 107 | -------------------------------------------------------------------------------- /runtime/resources/locales/th.po: -------------------------------------------------------------------------------- 1 | msgid "IDS_BR_OPT_ALLOW" 2 | msgstr "อนุญาต" 3 | 4 | msgid "IDS_BR_POP_STARTING_DOWNLOAD_ING" 5 | msgstr "กำลัง​เริ่ม​ดาวน์​โหลด..." 6 | 7 | msgid "IDS_BR_BODY_SECURITY_CERTIFICATE_PROBLEM_MSG" 8 | msgstr "มี​ปัญหา​การ​รับรอง​ความ​ปลอดภัย​สำ​หรับ​ไซ​ต์​นี้" 9 | 10 | msgid "IDS_BR_SK_CANCEL" 11 | msgstr "ยกเลิก" 12 | 13 | msgid "IDS_BR_SK_DELETE" 14 | msgstr "ลบ" 15 | 16 | msgid "IDS_BR_BODY_RESET_TO_DEFAULT" 17 | msgstr "รี​เซ็ท​เป็น​ค่า​พื้น​ฐาน" 18 | 19 | msgid "IDS_BR_BODY_WEBSITE_SETTINGS" 20 | msgstr "การ​ตั้ง​ค่า​เว็บ​ไซ​ต์" 21 | 22 | msgid "IDS_BR_BODY_AUTHUSERNAME" 23 | msgstr "ชื่อ​ผู้​ใช้" 24 | 25 | msgid "IDS_BR_BODY_DESTINATIONS_AUTHENTICATION_REQUIRED" 26 | msgstr "ต้อง​การ​การ​รับรอง" 27 | 28 | msgid "IDS_BR_BODY_AUTHPASSWORD" 29 | msgstr "รหัสผ่าน" 30 | 31 | msgid "IDS_BR_BODY_PASSWORD" 32 | msgstr "รหัสผ่าน" 33 | 34 | msgid "IDS_BR_HEADER_WEB_NOTIFICATION" 35 | msgstr "การแจ้งเตือนเว็บ" 36 | 37 | msgid "IDS_BR_BODY_ALLOW_SITES_TO_REQUEST_ACCESS_TO_YOUR_LOCATION" 38 | msgstr "อนุญาตให้ไซต์ขอการเข้าถึง ตำแหน่งของคุณ" 39 | 40 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE" 41 | msgstr "%1$s (%2$s) กำลังพยายามจัดเก็บข้อมูลจำนวนมาก ลงในอุปกรณ์ของคุณสำหรับใช้งานแบบออฟไลน์" 42 | 43 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_STORE_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE" 44 | msgstr "%1$s (%2$s) กำลังขออนุญาตให้จัดเก็บข้อมูล ลงบนอุปกรณ์ของคุณ สำหรับใช้งานแบบออฟไลน์" 45 | 46 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_ACCESS_YOUR_LOCATION" 47 | msgstr "%1$s (%2$s) กำลังขออนุญาต เพื่อเข้าถึงตำแหน่งของคุณ" 48 | 49 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_SHOW_NOTIFICATIONS" 50 | msgstr "%1$s (%2$s) กำลังขออนุญาตให้แสดง การแจ้งเตือน" 51 | 52 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_USE_YOUR_CAMERA" 53 | msgstr "%1$s (%2$s) กำลังขออนุญาต เพื่อใช้กล้องของคุณ" 54 | 55 | msgid "IDS_BR_BODY_FULL_SCREEN" 56 | msgstr "เต็ม​หน้า​จอ" 57 | 58 | msgid "IDS_BR_SK_OK" 59 | msgstr "ตกลง" 60 | 61 | msgid "IDS_BR_MBODY_LOCATION_ACCESS" 62 | msgstr "การ​เข้า​ถึง​ตำแหน่ง" 63 | 64 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_DISPLAY_NOTIFICATIONS" 65 | msgstr "อนุญาตให้ไซต์นี้แสดงการแจ้งเตือนได้" 66 | 67 | msgid "IDS_BR_BODY_EMPTY" 68 | msgstr "ว่าง" 69 | 70 | msgid "IDS_BR_HEADER_AUTO_REFRESH" 71 | msgstr "รีเฟรชอัตโนมัติ" 72 | 73 | msgid "IDS_WRT_OPT_ACCESS_USER_LOCATION" 74 | msgstr "เข้าถึงตำแหน่งของผู้ใช้" 75 | 76 | msgid "IDS_WRT_OPT_USE_STORE_WEB_DATA" 77 | msgstr "ใช้/เก็บข้อมูลเว็บ" 78 | 79 | msgid "IDS_WRT_OPT_USE_USER_MEDIA" 80 | msgstr "ใช้มีเดียผู้ใช้" 81 | 82 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_ACCESS_YOUR_LOCATION_INFORMATION" 83 | msgstr "อนุญาตให้ไซต์นี้เข้าถึง ข้อมูลตำแหน่งของคุณได้" 84 | 85 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_SAVE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE" 86 | msgstr "อนุญาตให้ไซต์นี้บันทึกข้อมูลจำนวนมาก บนอุปกรณ์ของคุณได้" 87 | 88 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_CHANGE_THE_DISPLAY_TO_FULL_SCREEN" 89 | msgstr "อนุญาตให้ไซต์นี้เปลี่ยนข้อมูล ที่แสดงเป็นเต็มหน้าจอได้" 90 | 91 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_USE_THE_MEDIA_FILES_STORED_ON_YOUR_DEVICE" 92 | msgstr "อนุญาตให้ไซต์นี้ใช้ไฟล์มีเดีย ที่เก็บอยู่บนอุปกรณ์ของคุณได้" 93 | 94 | msgid "IDS_ST_POP_CLEAR_DEFAULT_APP_SETTINGS_BY_GOING_TO_SETTINGS_GENERAL_MANAGE_APPLICATIONS_ALL" 95 | msgstr "ล้างการตั้งค่าแอพพื้น​ฐาน​โดยไปที่ การตั้งค่า > ทั่วไป > จัดการแอพพลิเคชั่น > ทั้งหมด" 96 | 97 | msgid "IDS_COM_BODY_DENY" 98 | msgstr "ปฏิเสธ" 99 | 100 | msgid "IDS_SA_BODY_USER_AUTHENTICATION" 101 | msgstr "การ​รับรอง​ผู้​ใช้" 102 | 103 | msgid "IDS_BR_BODY_REMEMBER_PREFERENCE" 104 | msgstr "จดจำค่าที่เตรียมไว้" 105 | 106 | msgid "IDS_BR_HEADER_CERTIFICATE_INFO" 107 | msgstr "ข้อมูล​ใบ​รับรอง​การ​ใช้​งาน" 108 | 109 | msgid "IDS_BR_BODY_LOGIN" 110 | msgstr "Login" 111 | 112 | -------------------------------------------------------------------------------- /common/resource_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #ifndef XWALK_COMMON_RESOURCE_MANAGER_H_ 18 | #define XWALK_COMMON_RESOURCE_MANAGER_H_ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace wgt { 25 | namespace parse { 26 | class AppControlInfo; 27 | } // namespace parse 28 | } // namespace wgt 29 | 30 | namespace common { 31 | 32 | class ApplicationData; 33 | class LocaleManager; 34 | class AppControl; 35 | 36 | class ResourceManager { 37 | public: 38 | class Resource { 39 | public: 40 | explicit Resource(const std::string& uri); 41 | Resource(const std::string& uri, bool should_reset); 42 | Resource(const std::string& uri, const std::string& mime, 43 | const std::string& encoding); 44 | Resource(const Resource& res); 45 | ~Resource() {} 46 | 47 | Resource& operator=(const Resource& res); 48 | bool operator==(const Resource& res); 49 | 50 | void set_uri(const std::string& uri) { uri_ = uri; } 51 | void set_mime(const std::string& mime) { mime_ = mime; } 52 | void set_should_reset(bool should_reset) { should_reset_ = should_reset; } 53 | void set_encoding(const std::string& encoding) { encoding_ = encoding; } 54 | 55 | std::string uri() const { return uri_; } 56 | std::string mime() const { return mime_; } 57 | bool should_reset() const { return should_reset_; } 58 | std::string encoding() const { return encoding_; } 59 | 60 | private: 61 | std::string uri_; 62 | std::string mime_; 63 | bool should_reset_; 64 | std::string encoding_; 65 | }; 66 | 67 | ResourceManager(ApplicationData* application_data, 68 | LocaleManager* locale_manager); 69 | ~ResourceManager() {} 70 | 71 | // input : file:///..... , app://[appid]/.... 72 | // output : /[system path]/.../locales/.../ 73 | std::string GetLocalizedPath(const std::string& origin); 74 | std::unique_ptr GetStartResource(const AppControl* app_control); 75 | bool AllowNavigation(const std::string& url); 76 | bool AllowedResource(const std::string& url); 77 | 78 | bool IsEncrypted(const std::string& url); 79 | std::string DecryptResource(const std::string& path); 80 | 81 | void set_base_resource_path(const std::string& base_path); 82 | 83 | private: 84 | std::unique_ptr GetMatchedResource( 85 | const wgt::parse::AppControlInfo&); 86 | std::unique_ptr GetDefaultResource(); 87 | 88 | // for localization 89 | bool Exists(const std::string& path); 90 | bool CheckWARP(const std::string& url); 91 | bool CheckAllowNavigation(const std::string& url); 92 | std::string RemoveLocalePath(const std::string& path); 93 | 94 | std::string resource_base_path_; 95 | std::string appid_; 96 | std::map file_existed_cache_; 97 | std::map locale_cache_; 98 | std::map warp_cache_; 99 | 100 | ApplicationData* application_data_; 101 | LocaleManager* locale_manager_; 102 | int security_model_version_; 103 | }; 104 | 105 | } // namespace common 106 | 107 | #endif // XWALK_COMMON_RESOURCE_MANAGER_H_ 108 | -------------------------------------------------------------------------------- /runtime/browser/notification_manager.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 3 | * 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 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 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. 15 | */ 16 | 17 | #include "runtime/browser/notification_manager.h" 18 | 19 | #include 20 | #include 21 | 22 | #include 23 | 24 | #include "common/logger.h" 25 | 26 | namespace runtime { 27 | 28 | NotificationManager* NotificationManager::GetInstance() { 29 | static NotificationManager instance; 30 | return &instance; 31 | } 32 | 33 | NotificationManager::NotificationManager() { 34 | } 35 | 36 | bool NotificationManager::Show(uint64_t tag, 37 | const std::string& title, 38 | const std::string& body, 39 | const std::string& icon_path) { 40 | auto found = keymapper_.find(tag); 41 | if (found != keymapper_.end()) { 42 | Hide(tag); 43 | } 44 | 45 | notification_h noti_h = NULL; 46 | int ret = NOTIFICATION_ERROR_NONE; 47 | noti_h = notification_new( 48 | NOTIFICATION_TYPE_NOTI, 49 | NOTIFICATION_GROUP_ID_DEFAULT, 50 | NOTIFICATION_PRIV_ID_NONE); 51 | if (noti_h == NULL) { 52 | LOGGER(ERROR) << "Can't create notification handle"; 53 | return false; 54 | } 55 | 56 | std::unique_ptr::type, 57 | decltype(notification_free)*> 58 | auto_release {noti_h, notification_free}; 59 | 60 | // set notification title 61 | ret = notification_set_text( 62 | noti_h, 63 | NOTIFICATION_TEXT_TYPE_TITLE, 64 | title.c_str(), 65 | NULL, 66 | NOTIFICATION_VARIABLE_TYPE_NONE); 67 | if (ret != NOTIFICATION_ERROR_NONE) { 68 | LOGGER(ERROR) << "Can't set title"; 69 | return false; 70 | } 71 | 72 | // set notification content 73 | ret = notification_set_text( 74 | noti_h, 75 | NOTIFICATION_TEXT_TYPE_CONTENT, 76 | body.c_str(), 77 | NULL, 78 | NOTIFICATION_VARIABLE_TYPE_NONE); 79 | if (ret != NOTIFICATION_ERROR_NONE) { 80 | LOGGER(ERROR) << "Can't set content"; 81 | return false; 82 | } 83 | 84 | if (!icon_path.empty()) { 85 | ret = notification_set_image( 86 | noti_h, 87 | NOTIFICATION_IMAGE_TYPE_ICON, 88 | icon_path.c_str()); 89 | if (ret != NOTIFICATION_ERROR_NONE) { 90 | LOGGER(ERROR) << "Can't set icon"; 91 | return false; 92 | } 93 | } 94 | 95 | // insert notification 96 | int platform_key = NOTIFICATION_PRIV_ID_NONE; 97 | ret = notification_insert(noti_h, &platform_key); 98 | if (ret != NOTIFICATION_ERROR_NONE) { 99 | LOGGER(ERROR) << "Can't insert notification"; 100 | return false; 101 | } 102 | keymapper_[tag] = platform_key; 103 | return true; 104 | } 105 | 106 | bool NotificationManager::Hide(uint64_t tag) { 107 | auto found = keymapper_.find(tag); 108 | if (found == keymapper_.end()) { 109 | LOGGER(ERROR) << "Can't find notification"; 110 | return false; 111 | } 112 | notification_delete_by_priv_id(NULL, 113 | NOTIFICATION_TYPE_NOTI, 114 | found->second); 115 | keymapper_.erase(found); 116 | return true; 117 | } 118 | 119 | } // namespace runtime 120 | -------------------------------------------------------------------------------- /runtime/resources/locales/vi.po: -------------------------------------------------------------------------------- 1 | msgid "IDS_BR_OPT_ALLOW" 2 | msgstr "Cho phép" 3 | 4 | msgid "IDS_BR_POP_STARTING_DOWNLOAD_ING" 5 | msgstr "Đang bắt đầu tải về..." 6 | 7 | msgid "IDS_BR_BODY_SECURITY_CERTIFICATE_PROBLEM_MSG" 8 | msgstr "Có vấn đề về chứng chỉ bảo mật cho site này." 9 | 10 | msgid "IDS_BR_SK_CANCEL" 11 | msgstr "Thoát" 12 | 13 | msgid "IDS_BR_SK_DELETE" 14 | msgstr "Xóa" 15 | 16 | msgid "IDS_BR_BODY_RESET_TO_DEFAULT" 17 | msgstr "Đặt lại về mặc định" 18 | 19 | msgid "IDS_BR_BODY_WEBSITE_SETTINGS" 20 | msgstr "Cài đặt website" 21 | 22 | msgid "IDS_BR_BODY_AUTHUSERNAME" 23 | msgstr "Tên người dùng" 24 | 25 | msgid "IDS_BR_BODY_DESTINATIONS_AUTHENTICATION_REQUIRED" 26 | msgstr "Yêu cầu xác thực." 27 | 28 | msgid "IDS_BR_BODY_AUTHPASSWORD" 29 | msgstr "Mật mã" 30 | 31 | msgid "IDS_BR_BODY_PASSWORD" 32 | msgstr "Mật mã" 33 | 34 | msgid "IDS_BR_HEADER_WEB_NOTIFICATION" 35 | msgstr "Thông báo web" 36 | 37 | msgid "IDS_BR_BODY_ALLOW_SITES_TO_REQUEST_ACCESS_TO_YOUR_LOCATION" 38 | msgstr "Cho phép site yêu cầu truy nhập vị trí của bạn." 39 | 40 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE" 41 | msgstr "%1$s (%2$s) đang cố gắng lưu trữ một lượng lớn dữ liệu vào thiết bị để sử dụng offline." 42 | 43 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_STORE_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE" 44 | msgstr "%1$s (%2$s) đang yêu cầu lưu trữ dữ liệu trên thiết bị của bạn để dùng offline." 45 | 46 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_ACCESS_YOUR_LOCATION" 47 | msgstr "%1$s (%2$s) đang yêu cầu quyền truy cập vị trí của bạn." 48 | 49 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_SHOW_NOTIFICATIONS" 50 | msgstr "%1$s (%2$s) đang yêu cầu quyền hiển thị thông báo." 51 | 52 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_USE_YOUR_CAMERA" 53 | msgstr "%1$s (%2$s) đang yêu cầu quyền sử dụng máy ảnh của bạn." 54 | 55 | msgid "IDS_BR_BODY_FULL_SCREEN" 56 | msgstr "Toàn màn hình" 57 | 58 | msgid "IDS_BR_SK_OK" 59 | msgstr "OK" 60 | 61 | msgid "IDS_BR_MBODY_LOCATION_ACCESS" 62 | msgstr "Truy cập vị trí" 63 | 64 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_DISPLAY_NOTIFICATIONS" 65 | msgstr "Cho phép trang này hiển thị thông báo." 66 | 67 | msgid "IDS_BR_BODY_EMPTY" 68 | msgstr "Trống" 69 | 70 | msgid "IDS_BR_HEADER_AUTO_REFRESH" 71 | msgstr "Tự động làm mới" 72 | 73 | msgid "IDS_WRT_OPT_ACCESS_USER_LOCATION" 74 | msgstr "Truy cập vị trí người dùng" 75 | 76 | msgid "IDS_WRT_OPT_USE_STORE_WEB_DATA" 77 | msgstr "Sử dụng/lưu trữ dữ liệu web" 78 | 79 | msgid "IDS_WRT_OPT_USE_USER_MEDIA" 80 | msgstr "Sử dụng media của người dùng" 81 | 82 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_ACCESS_YOUR_LOCATION_INFORMATION" 83 | msgstr "Cho phép trang này truy cập thông tin vị trí của bạn." 84 | 85 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_SAVE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE" 86 | msgstr "Cho phép trang này lưu số lượng lớn dữ liệu trên thiết bị." 87 | 88 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_CHANGE_THE_DISPLAY_TO_FULL_SCREEN" 89 | msgstr "Cho phép trang này chuyển sang hiển thị toàn màn hình." 90 | 91 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_USE_THE_MEDIA_FILES_STORED_ON_YOUR_DEVICE" 92 | msgstr "Cho phép trang này sử dụng file media lưu trên thiết bị." 93 | 94 | msgid "IDS_ST_POP_CLEAR_DEFAULT_APP_SETTINGS_BY_GOING_TO_SETTINGS_GENERAL_MANAGE_APPLICATIONS_ALL" 95 | msgstr "Xóa cài đặt ứng dụng mặc định bằng cách vào Cài đặt > Cài đặt chung > Quản lý ứng dụng > Tất cả." 96 | 97 | msgid "IDS_COM_BODY_DENY" 98 | msgstr "Từ chối" 99 | 100 | msgid "IDS_SA_BODY_USER_AUTHENTICATION" 101 | msgstr "Xác thực người dùng" 102 | 103 | msgid "IDS_BR_BODY_REMEMBER_PREFERENCE" 104 | msgstr "Nhớ Cài đặt sở thích." 105 | 106 | msgid "IDS_BR_HEADER_CERTIFICATE_INFO" 107 | msgstr "Thông tin chứng nhận" 108 | 109 | msgid "IDS_BR_BODY_LOGIN" 110 | msgstr "Đăng nhập" 111 | 112 | -------------------------------------------------------------------------------- /runtime/resources/locales/ar.po: -------------------------------------------------------------------------------- 1 | msgid "IDS_BR_OPT_ALLOW" 2 | msgstr "السماح" 3 | 4 | msgid "IDS_BR_POP_STARTING_DOWNLOAD_ING" 5 | msgstr "جاري بدء التنزيل..." 6 | 7 | msgid "IDS_BR_BODY_SECURITY_CERTIFICATE_PROBLEM_MSG" 8 | msgstr "توجد مشاكل في شهادة الأمان الخاصة بهذا الموقع." 9 | 10 | msgid "IDS_BR_SK_CANCEL" 11 | msgstr "إلغاء" 12 | 13 | msgid "IDS_BR_SK_DELETE" 14 | msgstr "مسح" 15 | 16 | msgid "IDS_BR_BODY_RESET_TO_DEFAULT" 17 | msgstr "إعادة الضبط إلى الافتراضي" 18 | 19 | msgid "IDS_BR_BODY_WEBSITE_SETTINGS" 20 | msgstr "إعدادات موقع الويب" 21 | 22 | msgid "IDS_BR_BODY_AUTHUSERNAME" 23 | msgstr "اسم المستخدم" 24 | 25 | msgid "IDS_BR_BODY_DESTINATIONS_AUTHENTICATION_REQUIRED" 26 | msgstr "مطلوب التوثيق." 27 | 28 | msgid "IDS_BR_BODY_AUTHPASSWORD" 29 | msgstr "كلمة المرور" 30 | 31 | msgid "IDS_BR_BODY_PASSWORD" 32 | msgstr "كلمة المرور" 33 | 34 | msgid "IDS_BR_HEADER_WEB_NOTIFICATION" 35 | msgstr "إخطار الويب" 36 | 37 | msgid "IDS_BR_BODY_ALLOW_SITES_TO_REQUEST_ACCESS_TO_YOUR_LOCATION" 38 | msgstr "السماح للمواقع بطلب الوصول إلى موقعك." 39 | 40 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE" 41 | msgstr "توجد محاولة من %1$s (%2$s) لتخزين كمية كبيرة من البيانات على جهازك للاستخدام عند عدم الاتصال بالإنترنت" 42 | 43 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_STORE_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE" 44 | msgstr "يوجد طلب من ‎%1$s (%2$s)‎ للحصول على إذن من أجل تخزين بيانات على جهازك للاستخدام عند عدم الاتصال بالإنترنت" 45 | 46 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_ACCESS_YOUR_LOCATION" 47 | msgstr "يوجد طلب من %1$s (%2$s) للحصول على إذن من أجل الوصول إلى موقعك" 48 | 49 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_SHOW_NOTIFICATIONS" 50 | msgstr "يوجد طلب من %1$s (%2$s) للحصول على إذن من أجل عرض الإخطارات" 51 | 52 | msgid "IDS_BR_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_USE_YOUR_CAMERA" 53 | msgstr "يوجد طلب من %1$s (%2$s) للحصول على إذن من أجل استخدام الكاميرا" 54 | 55 | msgid "IDS_BR_BODY_FULL_SCREEN" 56 | msgstr "الشاشة كاملة" 57 | 58 | msgid "IDS_BR_SK_OK" 59 | msgstr "موافق" 60 | 61 | msgid "IDS_BR_MBODY_LOCATION_ACCESS" 62 | msgstr "الوصول للموقع" 63 | 64 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_DISPLAY_NOTIFICATIONS" 65 | msgstr "يسمح لهذا الموقع بعرض الإخطارات." 66 | 67 | msgid "IDS_BR_BODY_EMPTY" 68 | msgstr "خالي" 69 | 70 | msgid "IDS_BR_HEADER_AUTO_REFRESH" 71 | msgstr "تحديث تلقائي" 72 | 73 | msgid "IDS_WRT_OPT_ACCESS_USER_LOCATION" 74 | msgstr "الوصول لموقع المستخدم" 75 | 76 | msgid "IDS_WRT_OPT_USE_STORE_WEB_DATA" 77 | msgstr "إستخدام/حفظ بيانات الويب" 78 | 79 | msgid "IDS_WRT_OPT_USE_USER_MEDIA" 80 | msgstr "إستخدام وسائط المستخدم" 81 | 82 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_ACCESS_YOUR_LOCATION_INFORMATION" 83 | msgstr "يسمح لهذا الموقع بالوصول إلى معلومات موقعك." 84 | 85 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_SAVE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE" 86 | msgstr "يسمح لهذا الموقع بحفظ مجموعة كبيرة من البيانات على جهازك." 87 | 88 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_CHANGE_THE_DISPLAY_TO_FULL_SCREEN" 89 | msgstr "يسمح لهذا الموقع بتغيير العرض إلى ملء الشاشة." 90 | 91 | msgid "IDS_WRT_BODY_ALLOWS_THIS_SITE_TO_USE_THE_MEDIA_FILES_STORED_ON_YOUR_DEVICE" 92 | msgstr "يسمح لهذا الموقع باستخدام ملفات الوسائط المخزنة على الجهاز." 93 | 94 | msgid "IDS_ST_POP_CLEAR_DEFAULT_APP_SETTINGS_BY_GOING_TO_SETTINGS_GENERAL_MANAGE_APPLICATIONS_ALL" 95 | msgstr "إلغاء تحديد إعدادات التطبيق الافتراضية من خلال الانتقال إلى الضبط > عام > إدارة التطبيقات > الكل." 96 | 97 | msgid "IDS_COM_BODY_DENY" 98 | msgstr "رفض" 99 | 100 | msgid "IDS_SA_BODY_USER_AUTHENTICATION" 101 | msgstr "مصادقة المستخدم" 102 | 103 | msgid "IDS_BR_BODY_REMEMBER_PREFERENCE" 104 | msgstr "تذكر الأفضلية." 105 | 106 | msgid "IDS_BR_HEADER_CERTIFICATE_INFO" 107 | msgstr "معلومات الشهادة" 108 | 109 | msgid "IDS_BR_BODY_LOGIN" 110 | msgstr "تسجيل الدخول" 111 | 112 | --------------------------------------------------------------------------------