%bcond_with wayland
Name: crosswalk
-Version: 7.35.136.0
+Version: 7.35.138.0
Release: 0
Summary: Crosswalk is an app runtime based on Chromium
License: (BSD-3-Clause and LGPL-2.1+)
MAJOR=7
MINOR=35
-BUILD=136
+BUILD=138
PATCH=0
import os
import subprocess
+
def GetJARFilename():
# Version of YUI Compressor.
version = "2.4.8"
for file_full_path in file_list:
if os.path.exists(file_full_path):
cmd_args = ["java", "-jar", GetJARFilename(), "--type=" + ext,
- file_full_path, "-o", file_full_path]
+ file_full_path, "-o", file_full_path]
subprocess.call(cmd_args)
from handle_permissions import HandlePermissions
from xml.dom import minidom
+
def VerifyAppName(value, mode='default'):
descrpt = 'The app'
sample = 'helloworld, hello_world, hello_world1'
regex = r'^([a-zA-Z](\w)*)+$'
- if len(value) >= 128 :
+ if len(value) >= 128:
print('To be safe, the length of package name or app name '
'should be less than 128.')
sys.exit(6)
for c in invalid_chars:
if mode == 'apkname' and c in value:
print("Illegal character: '%s' is replaced with '_'" % c)
- value = value.replace(c,'_')
+ value = value.replace(c, '_')
return value
-def GetFilesByExt(path, ext, sub_dir = True):
+def GetFilesByExt(path, ext, sub_dir=True):
if os.path.exists(path):
file_list = []
for name in os.listdir(path):
print ('Please make sure that the java file'
' of activity does exist.')
sys.exit(7)
- root_path = os.path.join(name, 'src', package.replace('.', os.path.sep))
+ root_path = os.path.join(name, 'src', package.replace('.', os.path.sep))
if not os.path.exists(root_path):
os.makedirs(root_path)
dest_activity = name + 'Activity.java'
def CustomizeJava(name, package, app_url, app_local_path,
enable_remote_debugging, display_as_fullscreen,
keep_screen_on):
- root_path = os.path.join(name, 'src', package.replace('.', os.path.sep))
+ root_path = os.path.join(name, 'src', package.replace('.', os.path.sep))
dest_activity = os.path.join(root_path, name + 'Activity.java')
ReplaceString(dest_activity, 'org.xwalk.app.template', package)
ReplaceString(dest_activity, 'AppTemplate', name)
ReplaceString(
dest_activity,
'super.onCreate(savedInstanceState);',
- 'super.onCreate(savedInstanceState);\n '+
+ 'super.onCreate(savedInstanceState);\n ' +
'getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);')
json_output = json.JSONDecoder().decode(src_file_content)
# Below 3 properties are used by runtime. See extension manager.
# And 'permissions' will be merged.
- if ((not 'name' in json_output) or (not 'class' in json_output)
- or (not 'jsapi' in json_output)):
+ if not ('name' in json_output and
+ 'class' in json_output and
+ 'jsapi' in json_output):
print ('Error: properties \'name\', \'class\' and \'jsapi\' in a json '
'file are mandatory.')
sys.exit(9)
def CustomizeIconByDict(name, app_root, icon_dict):
icon_name = None
- drawable_dict = {'ldpi':[1, 37], 'mdpi':[37, 72], 'hdpi':[72, 96],
- 'xhdpi':[96, 120], 'xxhdpi':[120, 144], 'xxxhdpi':[144, 168]}
+ drawable_dict = {'ldpi': [1, 37], 'mdpi': [37, 72], 'hdpi': [72, 96],
+ 'xhdpi': [96, 120], 'xxhdpi': [120, 144],
+ 'xxxhdpi': [144, 168]}
if not icon_dict:
return icon_name
print('The key of icon in the manifest file should be a number.')
if len(icon_dict) > 0:
- icon_list = sorted(icon_dict.iteritems(), key = lambda d:d[0])
+ icon_list = sorted(icon_dict.iteritems(), key=lambda d: d[0])
for kd, vd in drawable_dict.iteritems():
for item in icon_list:
if item[0] >= vd[0] and item[0] < vd[1]:
parser.add_option('--app-local-path', help=info)
parser.add_option('--enable-remote-debugging', action='store_true',
dest='enable_remote_debugging', default=False,
- help = 'Enable remote debugging.')
+ help='Enable remote debugging.')
parser.add_option('-f', '--fullscreen', action='store_true',
dest='fullscreen', default=False,
help='Make application fullscreen.')
72: 'icons/icon_72.png',
96: 'icons/icon_96.png',
48: 'icons/icon_48.png'}
- if options.name == None:
+ if options.name is None:
options.name = 'Example'
- if options.app_root == None:
+ if options.app_root is None:
options.app_root = os.path.join('test_data', 'manifest')
- if options.package == None:
+ if options.package is None:
options.package = 'org.xwalk.app.template'
- if options.orientation == None:
+ if options.orientation is None:
options.orientation = 'unspecified'
- if options.app_version == None:
+ if options.app_version is None:
options.app_version = '1.0.0'
icon = os.path.join('test_data', 'manifest', 'icons', 'icon_96.png')
CustomizeAll(options.app_versionCode, options.description, icon_dict,
options.permissions, options.app_url, options.app_root,
options.app_local_path, options.enable_remote_debugging,
- options.fullscreen, options.keep_screen_on, options.extensions,
- options.manifest, icon, options.package, options.name,
+ options.fullscreen, options.keep_screen_on,
+ options.extensions, options.manifest,
+ icon, options.package, options.name,
options.app_version, options.orientation,
options.xwalk_command_line, options.compressor)
except SystemExit as ec:
from manifest_json_parser import ManifestJsonParser
+
def CopyToPathWithName(root, name, final_path, rename):
if name == '':
return False
origin_path = os.path.join(root, name)
if not os.path.exists(origin_path):
- print ('Error: \'' + origin_path + '\' not found.' )
+ print('Error: \'' + origin_path + '\' not found.')
sys.exit(6)
if not os.path.exists(final_path):
os.makedirs(final_path)
if not has_image:
closest = ''
delta = sys.maxint
- for (k , v) in image_dict.items():
+ for(k, v) in image_dict.items():
items = k.split('x')
if len(items) == 2:
float_value = sys.maxint
for image_pair in image_list:
items = image_pair.strip().split(' ')
if len(items) >= 2:
- x = items[len(items)-1]
+ x = items[len(items) - 1]
image_item = items[0]
image_dict[x] = image_item
content = content.replace('<!-- Background Image -->', tmp, 1)
has_background = True
if has_background:
- background_file = file(background_path,'w')
+ background_file = file(background_path, 'w')
background_file.write(content)
background_file.close()
return has_background
# The global permission mapping table.
# TODO: update the permission mapping table for added permission.
permission_mapping_table = {
- 'contacts' : ['android.permission.READ_CONTACTS',
- 'android.permission.WRITE_CONTACTS'],
- 'geolocation' : ['android.permission.ACCESS_FINE_LOCATION'],
- 'messaging' : ['android.permission.READ_SMS',
- 'android.permission.READ_PHONE_STATE',
- 'android.permission.RECEIVE_SMS',
- 'android.permission.SEND_SMS',
- 'android.permission.WRITE_SMS'],
- 'devicecapabilities' : [],
- 'fullscreen' : [],
- 'presentation' : [],
- 'rawsockets' : [],
- 'screenorientation' : [],
- 'vibration' : ['android.permission.VIBRATE']
+ 'contacts': ['android.permission.READ_CONTACTS',
+ 'android.permission.WRITE_CONTACTS'],
+ 'geolocation': ['android.permission.ACCESS_FINE_LOCATION'],
+ 'messaging': ['android.permission.READ_SMS',
+ 'android.permission.READ_PHONE_STATE',
+ 'android.permission.RECEIVE_SMS',
+ 'android.permission.SEND_SMS',
+ 'android.permission.WRITE_SMS'],
+ 'devicecapabilities': [],
+ 'fullscreen': [],
+ 'presentation': [],
+ 'rawsockets': [],
+ 'screenorientation': [],
+ 'vibration': ['android.permission.VIBRATE']
}
from manifest_json_parser import HandlePermissionList
from manifest_json_parser import ManifestJsonParser
+
def CleanDir(path):
if os.path.exists(path):
shutil.rmtree(path)
sdk_root_path = os.path.dirname(os.path.dirname(android_path_array[0]))
try:
- sdk_jar_path = Find('android.jar', os.path.join(sdk_root_path, 'platforms'))
+ sdk_jar_path = Find('android.jar',
+ os.path.join(sdk_root_path, 'platforms'))
except Exception:
print('Your Android SDK may be ruined, please reinstall it.')
sys.exit(2)
'tools', 'lib', 'ant-tasks.jar')
if not os.path.exists(ant_tasks_jar_path):
ant_tasks_jar_path = os.path.join(sdk_root_path,
- 'tools', 'lib' ,'anttasks.jar')
+ 'tools', 'lib', 'anttasks.jar')
aapt_path = ''
for aapt_str in AddExeExtensions('aapt'):
def PrintPackageInfo(target_dir, app_name, app_version,
- arch = '', multi_arch = False):
+ arch='', multi_arch=False):
package_name_version = os.path.join(target_dir, app_name)
if app_version != '':
package_name_version += ('_' + app_version)
'Runtime built for %s was generated successfully, which can be '
'found at\n%s_%s.apk.'
% (app_name, arch, package_name_version, arch))
- if multi_arch == False:
+ if multi_arch is False:
if arch == 'x86':
print ('WARNING: This APK will only work on x86 based Android devices. '
'Consider building for ARM as well.')
sys.exit(13)
multi_arch = False
- if len(packaged_archs) >=2:
+ if len(packaged_archs) >= 2:
multi_arch = True
for arch in packaged_archs:
PrintPackageInfo(options.target_dir, name, app_version, arch,
info = ('The target architecture of the embedded runtime. Supported values '
'are \'x86\' and \'arm\'. Note, if undefined, APKs for all possible '
'architestures will be generated.')
- parser.add_option('--arch', help=info)
+ parser.add_option('--arch', choices=("x86", "arm"), help=info)
group = optparse.OptionGroup(parser, 'Application Source Options',
'This packaging tool supports 3 kinds of web application source: '
'1) XPK package; 2) manifest.json; 3) various command line options, '
'--description=YourApplicationDescription')
group.add_option('--description', help=info)
group.add_option('--enable-remote-debugging', action='store_true',
- dest='enable_remote_debugging', default=False,
- help = 'Enable remote debugging.')
+ dest='enable_remote_debugging', default=False,
+ help='Enable remote debugging.')
info = ('The list of external extension paths splitted by OS separators. '
'The separators are \':\' , \';\' and \':\' on Linux, Windows and '
'Mac OS respectively. For example, '
'--compressor=js: compress javascript.'
'--compressor=css: compress css.')
group.add_option('--compressor', dest='compressor', action='callback',
- callback=ParseParameterForCompressor, type='string', nargs=0,
- help=info)
+ callback=ParseParameterForCompressor, type='string',
+ nargs=0, help=info)
parser.add_option_group(group)
options, _ = parser.parse_args()
if len(argv) == 1:
VerifyAppName(options.name)
else:
parser.error('The APK name is required! Please use "--name" option.')
- if not ((options.app_url and not options.app_root
- and not options.app_local_path) or ((not options.app_url)
- and options.app_root and options.app_local_path)):
+ if not ((options.app_url and
+ not options.app_root and
+ not options.app_local_path) or
+ (not options.app_url and
+ options.app_root and
+ options.app_local_path)):
parser.error('The entry is required. If the entry is a remote url, '
'please use "--app-url" option; If the entry is local, '
'please use "--app-root" and '
except SystemExit as ec:
return ec.code
- if (options.app_root and options.app_local_path and not
- os.path.isfile(os.path.join(options.app_root, options.app_local_path))):
+ if (options.app_root and options.app_local_path and
+ not os.path.isfile(os.path.join(options.app_root,
+ options.app_local_path))):
print('Please make sure that the local path file of launching app '
'does exist.')
sys.exit(7)
import unittest
import warnings
+
def Clean(name, app_version):
if os.path.exists(name):
shutil.rmtree(name)
def GetResultWithOption(mode, manifest=None, name=None, package=None):
app_url = None
- if manifest != None:
+ if manifest is not None:
manifest = '--manifest=' + manifest
else:
app_url = '--app-url=http://www.intel.com'
- if name != None:
+ if name is not None:
name = '--name=' + name
- if package != None:
+ if package is not None:
package = '--package=' + package
cmd = ['python', 'make_apk.py',
'--app-version=1.0.0',
manifest_path = os.path.join('test_data', 'manifest',
'manifest_app_launch_local_path.json')
- cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path, self._mode]
+ cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
+ self._mode]
out = RunCommand(cmd)
- self.assertTrue(out.find('Please make sure that the local path file') != -1)
+ self.assertTrue(
+ out.find('Please make sure that the local path file') != -1)
self.assertFalse(os.path.exists('Example.apk'))
def testIconByOption(self):
self.checkApks('Example', '1.0.0')
def testKeystore(self):
- keystore_path = os.path.join('test_data', 'keystore', 'xwalk-test.keystore')
+ keystore_path = os.path.join('test_data', 'keystore',
+ 'xwalk-test.keystore')
cmd = ['python', 'make_apk.py', '--name=Example', '--app-version=1.0.0',
'--package=org.xwalk.example', '--app-url=http://www.intel.com',
'--keystore-path=%s' % keystore_path, '--keystore-alias=xwalk-test',
def testManifest(self):
manifest_path = os.path.join('test_data', 'manifest', 'manifest.json')
- cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path, self._mode]
+ cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
+ self._mode]
RunCommand(cmd)
self.addCleanup(Clean, 'Example', '1.0.0')
manifest = 'Example/AndroidManifest.xml'
def testManifestWithSpecificValue(self):
manifest_path = os.path.join('test_data', 'manifest',
'manifest_app_launch_local_path.json')
- cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path, self._mode]
+ cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
+ self._mode]
out = RunCommand(cmd)
self.addCleanup(Clean, 'Example', '1.0.0')
self.assertTrue(out.find('no app launch path') == -1)
self.assertTrue(os.path.exists(extensions_config_json))
with open(extensions_config_json, 'r') as content_file:
content = content_file.read()
- self.assertTrue(content.find('xwalk-extensions/myextension/myextension.js'))
+ self.assertTrue(
+ content.find('xwalk-extensions/myextension/myextension.js'))
self.assertTrue(content.find('com.example.extension.MyExtension'))
extension_js = 'Example/assets/xwalk-extensions/myextension/myextension.js'
self.assertTrue(os.path.exists(extension_js))
else:
self.assertFalse(os.path.isfile('Example_1.0.0._arm.apk'))
self.assertFalse(os.path.isfile('Example_1.0.0_x86.apk'))
+ Clean('Example', '1.0.0')
+ cmd = ['python', 'make_apk.py', '--name=Example', '--app-version=1.0.0',
+ '--package=org.xwalk.example', '--app-url=http://www.intel.com',
+ self._mode]
+ RunCommand(cmd)
+ if 'arm' in self.archs():
+ self.assertTrue(os.path.isfile('Example_1.0.0_arm.apk'))
+ self.checkApk('Example_1.0.0_arm.apk', 'arm')
+ else:
+ self.assertFalse(os.path.isfile('Example_1.0.0._arm.apk'))
+ if 'x86' in self.archs():
+ self.assertTrue(os.path.isfile('Example_1.0.0_x86.apk'))
+ self.checkApk('Example_1.0.0_x86.apk', 'x86')
+ else:
+ self.assertFalse(os.path.isfile('Example_1.0.0._x86.apk'))
+ Clean('Example', '1.0.0')
+ cmd = ['python', 'make_apk.py', '--name=Example', '--app-version=1.0.0',
+ '--package=org.xwalk.example', '--app-url=http://www.intel.com',
+ '--arch=undefined', self._mode]
+ out = RunCommand(cmd)
+ error_msg = 'invalid choice: \'undefined\''
+ self.assertTrue(out.find(error_msg) != -1)
def testVerbose(self):
cmd = ['python', 'make_apk.py', '--name=Example', '--app-version=1.0.0',
import re
import sys
+
def HandlePermissionList(permission_list):
"""This function is used to handle the permission list and return the string
of permissions.
class ManifestJsonParser(object):
- """ The class is used to parse json-format manifest file, recompose the fields
- and provide the field interfaces required by the packaging tool.
+ """ The class is used to parse json-format manifest file, recompose the
+ fields and provide the field interfaces required by the packaging tool.
Args:
input_path: the full path of the json-format manifest file.
if 'launch_path' in self.data_src:
app_url = self.data_src['launch_path']
elif ('app' in self.data_src and
- 'launch' in self.data_src['app'] and
- 'local_path' in self.data_src['app']['launch']):
+ 'launch' in self.data_src['app'] and
+ 'local_path' in self.data_src['app']['launch']):
app_url = self.data_src['app']['launch']['local_path']
else:
app_url = ''
print('launch_screen.landscape.image_border: %s' %
self.GetLaunchScreenImageBorder('landscape'))
-
def GetAppName(self):
"""Return the application name."""
return self.ret_dict['app_name']
XPK_MAGIC_HEAD = 'CrWk'
errorMessageMap = {
- EXIT_CODE_CRYPTO_NOT_FOUND: 'Python module Crypto('\
- 'https://www.dlitz.net/software/pycrypto/) is needed',
- EXIT_CODE_NO_XPK_FILE: 'Please specify XPK file by --file',
- EXIT_CODE_XPK_FILE_NOT_EXIST: 'The XPK file you specified does not exist',
- EXIT_CODE_MAGIC_FAILED: 'The file you specified is not in XPK format',
- EXIT_CODE_VERIFICATION_FAILED:
- 'Signature verification failed for the XPK file',
- EXIT_CODE_XPK_FILE_IO_ERROR: 'Error happened when reading the XPK file',
+ EXIT_CODE_CRYPTO_NOT_FOUND: 'Python module Crypto('\
+ 'https://www.dlitz.net/software/pycrypto/) is needed',
+ EXIT_CODE_NO_XPK_FILE: 'Please specify XPK file by --file',
+ EXIT_CODE_XPK_FILE_NOT_EXIST: 'The XPK file you specified does not exist',
+ EXIT_CODE_MAGIC_FAILED: 'The file you specified is not in XPK format',
+ EXIT_CODE_VERIFICATION_FAILED:
+ 'Signature verification failed for the XPK file',
+ EXIT_CODE_XPK_FILE_IO_ERROR: 'Error happened when reading the XPK file',
}
opts, _ = option_parser.parse_args()
- if opts.file == None:
+ if opts.file is None:
HandleError(EXIT_CODE_NO_XPK_FILE)
app_name = os.path.splitext(os.path.basename(opts.file))[0]
- if opts.out == None:
+ if opts.out is None:
opts.out = app_name
if os.path.isfile(opts.file):
GURL Application::GetStartURL(const LaunchParams& params,
LaunchEntryPoint* used) {
- if (params.entry_points & URLKey) {
- GURL url = GetURLFromURLKey();
+ if (params.entry_points & StartURLKey) {
+ GURL url = GetURLFromRelativePathKey(keys::kStartURLKey);
if (url.is_valid()) {
- *used = URLKey;
+ *used = StartURLKey;
return url;
}
}
}
if (params.entry_points & LaunchLocalPathKey) {
- GURL url = GetURLFromLocalPathKey();
+ GURL url = GetURLFromRelativePathKey(
+ GetLaunchLocalPathKey(application_data_->GetPackageType()));
if (url.is_valid()) {
*used = LaunchLocalPathKey;
return url;
}
}
+ if (params.entry_points & URLKey) {
+ GURL url = GetURLFromURLKey();
+ if (url.is_valid()) {
+ *used = URLKey;
+ return url;
+ }
+ }
+
LOG(WARNING) << "Failed to find a valid launch URL for the app.";
return GURL();
}
return ui::SHOW_STATE_DEFAULT;
}
-GURL Application::GetURLFromLocalPathKey() {
+GURL Application::GetURLFromURLKey() {
const Manifest* manifest = application_data_->GetManifest();
- std::string entry_page;
- std::string key(GetLaunchLocalPathKey(
- application_data_->GetPackageType()));
+ std::string url_string;
+ if (!manifest->GetString(keys::kURLKey, &url_string))
+ return GURL();
+
+ return GURL(url_string);
+}
+GURL Application::GetURLFromRelativePathKey(const std::string& key) {
+ const Manifest* manifest = application_data_->GetManifest();
+ std::string entry_page;
if (!manifest->GetString(key, &entry_page)
|| entry_page.empty()) {
if (application_data_->GetPackageType() == Manifest::TYPE_XPK)
return application_data_->GetResourceURL(entry_page);
}
-GURL Application::GetURLFromURLKey() {
- const Manifest* manifest = application_data_->GetManifest();
- std::string url_string;
- if (!manifest->GetString(keys::kURLKey, &url_string))
- return GURL();
-
- return GURL(url_string);
-}
-
void Application::Terminate(TerminationMode mode) {
termination_mode_used_ = mode;
if (IsTerminating()) {
// Manifest keys that can be used as application entry points.
enum LaunchEntryPoint {
- AppMainKey = 1 << 0, // app.main
- LaunchLocalPathKey = 1 << 1, // app.launch.local_path
- URLKey = 1 << 2, // url
- Default = AppMainKey | LaunchLocalPathKey | URLKey
+ StartURLKey = 1 << 0, // start_url
+ AppMainKey = 1 << 1, // app.main
+ LaunchLocalPathKey = 1 << 2, // app.launch.local_path
+ URLKey = 1 << 3, // url
+ Default = StartURLKey | AppMainKey | LaunchLocalPathKey
};
typedef unsigned LaunchEntryPoints;
ui::WindowShowState GetWindowShowState(const LaunchParams& params);
GURL GetURLFromAppMainKey();
- GURL GetURLFromLocalPathKey();
GURL GetURLFromURLKey();
+ GURL GetURLFromRelativePathKey(const std::string& key);
+
friend class FinishEventObserver;
void CloseMainDocument();
void NotifyTermination();
}
std::list<std::string> locales;
- if (application->GetPackageType() == Manifest::TYPE_WGT) {
+ if (application && application->GetPackageType() == Manifest::TYPE_WGT) {
GetUserAgentLocales(
xwalk::XWalkRunner::GetInstance()->GetLocale(), locales);
GetUserAgentLocales(application->GetManifest()->default_locale(), locales);
#if defined(OS_TIZEN)
#include "xwalk/application/browser/application_tizen.h"
-#include "xwalk/application/browser/installer/tizen/service_package_installer.h"
+#include "xwalk/application/browser/installer/tizen/package_installer.h"
#endif
namespace xwalk {
}
}
-#if defined(OS_TIZEN)
-bool InstallPackageOnTizen(ApplicationData* application_data,
- const base::FilePath& data_dir) {
- if (!XWalkRunner::GetInstance()->is_running_as_service()) {
- LOG(ERROR) << "Installation on Tizen is only possible in"
- << "service mode via 'xwalkctl' utility.";
- return false;
- }
-
- return InstallApplicationForTizen(application_data, data_dir);
-}
-
-bool UninstallPackageOnTizen(ApplicationData* application_data,
- const base::FilePath& data_dir) {
- if (!XWalkRunner::GetInstance()->is_running_as_service()) {
- LOG(ERROR) << "Uninstallation on Tizen is only possible in"
- << "service mode using 'xwalkctl' utility.";
- return false;
- }
-
- return UninstallApplicationForTizen(application_data, data_dir);
-}
-#endif // OS_TIZEN
-
bool CopyDirectoryContents(const base::FilePath& from,
const base::FilePath& to) {
base::FileEnumerator iter(from, false,
}
#if defined(OS_TIZEN)
- if (!InstallPackageOnTizen(application_data,
- runtime_context_->GetPath())) {
+ if (!PackageInstaller::InstallApplication(
+ application_data, runtime_context_->GetPath())) {
application_storage_->RemoveApplication(application_data->ID());
return false;
}
return false;
}
-#if defined(OS_TIZEN)
- if (!UninstallPackageOnTizen(old_application,
- runtime_context_->GetPath())) {
+ if (!application_storage_->UpdateApplication(new_application)) {
+ LOG(ERROR) << "Fail to update application, roll back to the old one.";
base::DeleteFile(app_dir, true);
base::Move(tmp_dir, app_dir);
return false;
}
-#endif
- if (!application_storage_->UpdateApplication(new_application)) {
- LOG(ERROR) << "An Error occurred when updating the application.";
+#if defined(OS_TIZEN)
+ if (!PackageInstaller::UpdateApplication(
+ new_application, runtime_context_->GetPath())) {
+ LOG(ERROR) << "Fail to update package on Tizen, roll back to the old one.";
base::DeleteFile(app_dir, true);
+ if (!application_storage_->UpdateApplication(old_application)) {
+ LOG(ERROR) << "Fail to revert old application info, "
+ << "remove the application as a last resort.";
+ application_storage_->RemoveApplication(old_application->ID());
+ return false;
+ }
base::Move(tmp_dir, app_dir);
-#if defined(OS_TIZEN)
- InstallPackageOnTizen(old_application,
- runtime_context_->GetPath());
-#endif
return false;
}
-#if defined(OS_TIZEN)
- if (!InstallPackageOnTizen(new_application,
- runtime_context_->GetPath()))
- return false;
#endif
+
base::DeleteFile(tmp_dir, true);
SaveSystemEventsInfo(new_application, this, event_manager_);
}
#if defined(OS_TIZEN)
- if (!UninstallPackageOnTizen(application,
- runtime_context_->GetPath()))
+ if (!PackageInstaller::UninstallApplication(
+ application, runtime_context_->GetPath()))
result = false;
#endif
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "xwalk/application/browser/installer/tizen/service_package_installer.h"
+#include "xwalk/application/browser/installer/tizen/package_installer.h"
#include <sys/types.h>
#include <pwd.h>
#include "xwalk/application/common/manifest_handlers/tizen_metadata_handler.h"
#include "xwalk/application/browser/application_storage.h"
#include "xwalk/application/browser/installer/tizen/packageinfo_constants.h"
+#include "xwalk/runtime/browser/xwalk_runner.h"
namespace info = xwalk::application_packageinfo_constants;
};
void WriteMetaDataElement(
- XmlWriter& writer,
+ XmlWriter& writer, // NOLINT
xwalk::application::TizenMetaDataInfo* info) {
if (!info)
return;
return true;
}
+bool CheckRunningMode() {
+ if (xwalk::XWalkRunner::GetInstance()->is_running_as_service())
+ return true;
+ LOG(ERROR) << "Package manipulation on Tizen is only possible in"
+ << "service mode using 'xwalkctl' utility.";
+ return false;
+}
+
} // namespace
namespace xwalk {
namespace application {
-bool InstallApplicationForTizen(
+bool PackageInstaller::InstallApplication(
ApplicationData* application, const base::FilePath& data_dir) {
+ if (!CheckRunningMode())
+ return false;
+
std::string package_id = application->ID();
std::string tizen_app_id = kAppIdPrefix + package_id;
base::FilePath app_dir =
return false;
}
- base::FilePath icon;
- if (icon_name.empty())
- icon = kDefaultIcon;
- else
- icon = app_dir.AppendASCII(icon_name);
+ base::FilePath icon =
+ icon_name.empty() ? kDefaultIcon : app_dir.AppendASCII(icon_name);
CommandLine cmdline(kPkgHelper);
cmdline.AppendSwitch("--install");
return true;
}
-bool UninstallApplicationForTizen(ApplicationData* application,
- const base::FilePath& data_dir) {
+bool PackageInstaller::UninstallApplication(
+ ApplicationData* application, const base::FilePath& data_dir) {
+ if (!CheckRunningMode())
+ return false;
+
std::string package_id = application->ID();
bool result = true;
return result;
}
+bool PackageInstaller::UpdateApplication(
+ ApplicationData* new_application, const base::FilePath& data_dir) {
+ if (!CheckRunningMode())
+ return false;
+
+ std::string package_id = new_application->ID();
+ std::string tizen_app_id = kAppIdPrefix + package_id;
+ base::FilePath app_dir =
+ data_dir.AppendASCII(info::kAppDir).AppendASCII(package_id);
+ base::FilePath new_xml_path = data_dir.AppendASCII(info::kAppDir).AppendASCII(
+ package_id + ".new" + std::string(info::kXmlExtension));
+
+ std::string icon_name;
+ if (!new_application->GetManifest()->GetString(info::kIconKey, &icon_name)) {
+ LOG(WARNING) << "'icon' not included in manifest";
+ }
+ // This will clean everything inside '<data dir>/<app id>' and the new XML.
+ FileDeleter app_dir_cleaner(app_dir, true);
+ FileDeleter new_xml_cleaner(new_xml_path, true);
+
+ if (!GeneratePkgInfoXml(new_application, icon_name, app_dir, new_xml_path)) {
+ LOG(ERROR) << "Could not create new XML metadata file '"
+ << new_xml_path.value() << "'.";
+ return false;
+ }
+
+ base::FilePath icon =
+ icon_name.empty() ? kDefaultIcon : app_dir.AppendASCII(icon_name);
+
+ CommandLine cmdline(kPkgHelper);
+ cmdline.AppendSwitch("--update");
+ cmdline.AppendArg(package_id);
+ cmdline.AppendArgPath(new_xml_path);
+ cmdline.AppendArgPath(icon);
+
+ int exit_code;
+ std::string output;
+
+ if (!base::GetAppOutputWithExitCode(cmdline, &output, &exit_code)) {
+ LOG(ERROR) << "Could not launch installer helper";
+ return false;
+ }
+
+ if (exit_code != 0) {
+ LOG(ERROR) << "Could not update application: "
+ << output << " (" << exit_code << ")";
+ return false;
+ }
+
+ base::FilePath old_xml_path = data_dir.AppendASCII(info::kAppDir).AppendASCII(
+ package_id + std::string(info::kXmlExtension));
+ base::Move(new_xml_path, old_xml_path);
+ app_dir_cleaner.Dismiss();
+ return true;
+}
+
} // namespace application
} // namespace xwalk
--- /dev/null
+// Copyright (c) 2014 Intel Corporation. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef XWALK_APPLICATION_BROWSER_INSTALLER_TIZEN_PACKAGE_INSTALLER_H_
+#define XWALK_APPLICATION_BROWSER_INSTALLER_TIZEN_PACKAGE_INSTALLER_H_
+
+#include <string>
+#include "base/files/file_path.h"
+
+namespace xwalk {
+namespace application {
+
+class ApplicationData;
+
+class PackageInstaller {
+ public:
+ static bool InstallApplication(ApplicationData* application,
+ const base::FilePath& data_dir);
+ static bool UninstallApplication(ApplicationData* application,
+ const base::FilePath& data_dir);
+ static bool UpdateApplication(ApplicationData* application,
+ const base::FilePath& data_dir);
+};
+
+} // namespace application
+} // namespace xwalk
+
+#endif // XWALK_APPLICATION_BROWSER_INSTALLER_TIZEN_PACKAGE_INSTALLER_H_
+++ /dev/null
-// Copyright (c) 2014 Intel Corporation. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef XWALK_APPLICATION_BROWSER_INSTALLER_TIZEN_SERVICE_PACKAGE_INSTALLER_H_
-#define XWALK_APPLICATION_BROWSER_INSTALLER_TIZEN_SERVICE_PACKAGE_INSTALLER_H_
-
-#include <string>
-#include "base/files/file_path.h"
-
-namespace xwalk {
-namespace application {
-
-class ApplicationData;
-
-bool InstallApplicationForTizen(ApplicationData* application,
- const base::FilePath& data_dir);
-
-bool UninstallApplicationForTizen(ApplicationData* application,
- const base::FilePath& data_dir);
-
-} // namespace application
-} // namespace xwalk
-
-#endif // XWALK_APPLICATION_BROWSER_INSTALLER_TIZEN_SERVICE_PACKAGE_INSTALLER_H_
adaptor_.RemoveManagedObject(GetInstalledPathForAppID(app_id));
}
+void InstalledApplicationsManager::OnApplicationUpdated(
+ const std::string& app_id) {
+ if (scoped_refptr<ApplicationData> app =
+ app_storage_->GetApplicationData(app_id))
+ OnApplicationNameChanged(app_id, app->Name());
+}
+
void InstalledApplicationsManager::OnApplicationNameChanged(
const std::string& app_id, const std::string& app_name) {
InstalledApplicationObject* object =
// ApplicationService::Observer implementation.
void virtual OnApplicationInstalled(const std::string& app_id) OVERRIDE;
void virtual OnApplicationUninstalled(const std::string& app_id) OVERRIDE;
+ void virtual OnApplicationUpdated(const std::string& app_id) OVERRIDE;
void virtual OnApplicationNameChanged(const std::string& app_id,
const std::string& app_name) OVERRIDE;
void RunningApplicationObject::OnGetExtensionProcessChannel(
dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender response_sender) {
- content::BrowserThread::PostTaskAndReplyWithResult(
+ content::BrowserThread::PostTask(
content::BrowserThread::FILE,
FROM_HERE,
- base::Bind(&RunningApplicationObject::CreateClientFileDescriptor,
- base::Unretained(this)),
base::Bind(&RunningApplicationObject::SendChannel,
base::Unretained(this),
method_call,
TerminateApplication(Application::Immediate);
}
-scoped_ptr<dbus::FileDescriptor>
-RunningApplicationObject::CreateClientFileDescriptor() {
- scoped_ptr<dbus::FileDescriptor> client_fd(
- new dbus::FileDescriptor(ep_bp_channel_.socket.fd));
- client_fd->CheckValidity();
- return client_fd.Pass();
-}
-
void RunningApplicationObject::SendChannel(
dbus::MethodCall* method_call,
- dbus::ExportedObject::ResponseSender response_sender,
- scoped_ptr<dbus::FileDescriptor> client_fd) {
+ dbus::ExportedObject::ResponseSender response_sender) {
scoped_ptr<dbus::Response> response =
dbus::Response::FromMethodCall(method_call);
- dbus::MessageWriter writer(response.get());
+ int fd = ep_bp_channel_.socket.fd;
+ if (fd == -1) { // EP was not yet created, return empty response.
+ response_sender.Run(response.Pass());
+ return;
+ }
+
+ dbus::MessageWriter writer(response.get());
writer.AppendString(ep_bp_channel_.name);
+
+ scoped_ptr<dbus::FileDescriptor> client_fd(new dbus::FileDescriptor(fd));
+ client_fd->CheckValidity();
+ CHECK(client_fd->is_valid());
writer.AppendFileDescriptor(*client_fd);
+
response_sender.Run(response.Pass());
}
void OnLauncherDisappeared();
- scoped_ptr<dbus::FileDescriptor> CreateClientFileDescriptor();
void SendChannel(dbus::MethodCall* method_call,
- dbus::ExportedObject::ResponseSender response_sender,
- scoped_ptr<dbus::FileDescriptor> client_fd);
+ dbus::ExportedObject::ResponseSender response_sender);
scoped_refptr<dbus::Bus> bus_;
std::string launcher_name_;
const char kManifestVersionKey[] = "manifest_version";
const char kNameKey[] = "name";
const char kPermissionsKey[] = "permissions";
+const char kStartURLKey[] = "start_url";
const char kURLKey[] = "url";
const char kVersionKey[] = "version";
const char kWebURLsKey[] = "app.urls";
extern const char kManifestVersionKey[];
extern const char kNameKey[];
extern const char kPermissionsKey[];
+ extern const char kStartURLKey[];
extern const char kURLKey[];
extern const char kVersionKey[];
extern const char kWebURLsKey[];
test_runner_->WaitForTestNotification();
EXPECT_EQ(test_runner_->GetTestsResult(), ApiTestRunner::PASS);
// The App1 has 2 pages: main doc page and "main.html" page.
- EXPECT_EQ(app1->runtimes().size(), 2);
- ASSERT_TRUE(app1->GetMainDocumentRuntime());
+ EXPECT_EQ(app1->runtimes().size(), 1);
EXPECT_EQ(service->active_applications().size(), currently_running_count + 1);
EXPECT_EQ(service->GetApplicationByID(app1->id()), app1);
EXPECT_EQ(test_runner_->GetTestsResult(), ApiTestRunner::PASS);
// The App2 also has 2 pages: main doc page and "main.html" page.
- EXPECT_EQ(app2->runtimes().size(), 2);
- ASSERT_TRUE(app2->GetMainDocumentRuntime());
+ EXPECT_EQ(app2->runtimes().size(), 1);
// Check that the apps have different IDs and RPH IDs.
EXPECT_NE(app1->id(), app2->id());
+++ /dev/null
-setTimeout(
- function(){
- window.open("main.html");
- }, 100);
"name": "dummy_app_1",
"manifest_version": 1,
"version": "1.0",
- "app": {
- "main": {
- "scripts": ["main.js"]
- }
- }
+ "start_url": "main.html"
}
+++ /dev/null
-setTimeout(
- function(){
- window.open("main.html");
- }, 100);
"name": "dummy_app_2",
"manifest_version": 1,
"version": "1.0",
- "app": {
- "main": {
- "scripts": ["main.js"]
- }
- }
+ "start_url": "main.html"
}
}
}
-static gboolean init_extension_process_channel(gpointer data) {
- GDBusProxy* app_proxy = static_cast<GDBusProxy*>(data);
+static gboolean init_extension_process_channel(GDBusProxy* app_proxy) {
if (ep_launcher->is_started())
return FALSE;
+
// Get the client socket file descriptor from fd_list. The reply will
// contains an index to the list.
GUnixFDList* fd_list;
GVariant* res = g_dbus_proxy_call_with_unix_fd_list_sync(
app_proxy, "GetEPChannel", NULL, G_DBUS_CALL_FLAGS_NONE,
-1, NULL, &fd_list, NULL, NULL);
+ if (!res || g_variant_n_children(res) != 2)
+ return FALSE;
+
const gchar* channel_id =
g_variant_get_string(g_variant_get_child_value(res, 0), NULL);
- if (!strlen(channel_id))
- return TRUE;
+ if (!channel_id || !strlen(channel_id))
+ return FALSE;
gint32 client_fd_idx =
g_variant_get_handle(g_variant_get_child_value(res, 1));
int client_fd = g_unix_fd_list_get(fd_list, client_fd_idx, NULL);
ep_launcher->Launch(channel_id, client_fd);
- return FALSE;
+ return TRUE;
}
static void on_app_signal(GDBusProxy* proxy,
}
#endif
- g_idle_add(init_extension_process_channel, app_proxy);
+ init_extension_process_channel(app_proxy);
g_main_loop_run(mainloop);
}
#include <glib.h>
#include <gio/gio.h>
+#include <locale.h>
#include "xwalk/application/tools/linux/dbus_connection.h"
#include "xwalk/application/tools/linux/xwalk_tizen_user.h"
}
int main(int argc, char* argv[]) {
+ setlocale(LC_ALL, "");
GError* error = NULL;
GOptionContext* context;
bool success;
#include "base/files/file_path.h"
#include "base/file_util.h"
-#include "xwalk/application/tools/tizen/xwalk_pkg_installer.h"
+#include "xwalk/application/tools/tizen/xwalk_package_installer_helper.h"
namespace {
fprintf(stdout, "Usage: \n"
"\t%s --install <appid> <xml> <icon>\n"
"\t%s --uninstall <appid>\n",
+ "\t%s --update <appid> <xml> <icon>\n",
program, program);
return 1;
}
return 1;;
}
- PkgInstaller installer(argv[2]);
+ PackageInstallerHelper helper(argv[2]);
if (!strcmp(argv[1], "--install")) {
if (argc != 5)
return usage(argv[0]);
- result = installer.InstallApplication(argv[3], argv[4]);
+ result = helper.InstallApplication(argv[3], argv[4]);
} else if (!strcmp(argv[1], "--uninstall")) {
if (argc != 3)
return usage(argv[0]);
- result = installer.UninstallApplication();
+ result = helper.UninstallApplication();
+ } else if (!strcmp(argv[1], "--update")) {
+ if (argc != 5)
+ return usage(argv[0]);
+
+ result = helper.UpdateApplication(argv[3], argv[4]);
} else {
return usage(argv[0]);
}
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "xwalk/application/tools/tizen/xwalk_pkg_installer.h"
+#include "xwalk/application/tools/tizen/xwalk_package_installer_helper.h"
#include <assert.h>
#include <stdio.h>
-#if defined(OS_TIZEN)
#include <pkgmgr/pkgmgr_parser.h>
-#endif
#undef LOG
#include <string>
// Value for uninstallation.
const char PKGMGR_START_UNINSTALL[] = "uninstall";
+// Value for update.
+const char PKGMGR_START_UPDATE[] = "update";
+
// Notification about end of installation with status.
const char PKGMGR_END_KEY[] = "end";
bool recursive_;
};
+const char* ToEndStatus(bool result) {
+ return result ? PKGMGR_END_SUCCESS : PKGMGR_END_FAILURE;
+}
+
} // namespace
-PkgInstaller::PkgInstaller(const std::string& appid)
+PackageInstallerHelper::PackageInstallerHelper(const std::string& appid)
: appid_(appid) {
if (appid_.empty())
fprintf(stdout, "Invalid app id is provided for pkg installer.\n");
-#if defined(OS_TIZEN)
handle_ = pkgmgr_installer_new();
if (!handle_)
fprintf(stdout, "Fail to get package manager installer handle.\n");
-#endif
}
-PkgInstaller::~PkgInstaller() {
-#if defined(OS_TIZEN)
+PackageInstallerHelper::~PackageInstallerHelper() {
if (handle_)
pkgmgr_installer_free(handle_);
-#endif
}
-bool PkgInstaller::InstallApplication(const std::string& xmlpath,
- const std::string& iconpath) {
+bool PackageInstallerHelper::InstallApplication(
+ const std::string& xmlpath,
+ const std::string& iconpath) {
+ SendSignal(PKGMGR_START_KEY, PKGMGR_START_INSTALL);
+ bool ret = InstallApplicationInternal(xmlpath, iconpath);
+ SendSignal(PKGMGR_END_KEY, ToEndStatus(ret));
+ return ret;
+}
+
+bool PackageInstallerHelper::UninstallApplication() {
+ SendSignal(PKGMGR_START_KEY, PKGMGR_START_UNINSTALL);
+ bool ret = UninstallApplicationInternal();
+ SendSignal(PKGMGR_END_KEY, ToEndStatus(ret));
+ return ret;
+}
+
+bool PackageInstallerHelper::UpdateApplication(
+ const std::string& xmlpath,
+ const std::string& iconpath) {
+ SendSignal(PKGMGR_START_KEY, PKGMGR_START_UPDATE);
+ bool ret = UninstallApplicationInternal();
+ if (ret)
+ ret = InstallApplicationInternal(xmlpath, iconpath);
+ SendSignal(PKGMGR_END_KEY, ToEndStatus(ret));
+ return ret;
+}
+
+bool PackageInstallerHelper::InstallApplicationInternal(
+ const std::string& xmlpath,
+ const std::string& iconpath) {
if (xmlpath.empty() || iconpath.empty()) {
fprintf(stdout, "Invalid xml path or icon path for installation\n");
}
return false;
}
-#if defined(OS_TIZEN)
- if (!ParseManifest(PkgInstaller::INSTALL, xmlpath)) {
- fprintf(stdout, "Couldn't install %s'\n", appid_.c_str());
+ if (pkgmgr_parser_parse_manifest_for_installation(xmlpath.c_str(), NULL)) {
+ fprintf(stdout, "Couldn't parse manifest XML '%s'\n", xmlpath.c_str());
return false;
}
-#endif
FileDeleter xml_cleaner(xml_dst, false);
icon_cleaner.Dismiss();
return true;
}
-bool PkgInstaller::UninstallApplication() {
+bool PackageInstallerHelper::UninstallApplicationInternal() {
bool result = true;
// FIXME(vcgomes): Add support for more icon types
base::FilePath xmlpath(kXmlDir);
xmlpath = xmlpath.Append(kServicePrefix + std::string(appid_) + ".xml");
-#if defined(OS_TIZEN)
- if (!ParseManifest(PkgInstaller::UNINSTALL, xmlpath.MaybeAsASCII())) {
- fprintf(stdout, "Couldn't uninstall %s'\n", appid_.c_str());
+ std::string xmlpath_str = xmlpath.MaybeAsASCII();
+ assert(!xmlpath_str.empty());
+ if (pkgmgr_parser_parse_manifest_for_uninstallation(
+ xmlpath_str.c_str(), NULL)) {
+ fprintf(stdout, "Couldn't parse manifest XML '%s'\n", xmlpath_str.c_str());
result = false;
}
-#endif
if (!base::DeleteFile(xmlpath, false)) {
- fprintf(stdout, "Couldn't delete '%s'\n", xmlpath.value().c_str());
+ fprintf(stdout, "Couldn't delete '%s'\n", xmlpath_str.c_str());
result = false;
}
return result;
}
-#if defined(OS_TIZEN)
-bool PkgInstaller::ParseManifest(PkgInstaller::RequestType type,
- const std::string& xmlpath) {
- std::string pkgmgr_cmd;
- PkgParser parser;
- switch (type) {
- case PkgInstaller::INSTALL:
- pkgmgr_cmd = PKGMGR_START_INSTALL;
- parser = pkgmgr_parser_parse_manifest_for_installation;
- break;
-
- case PkgInstaller::UNINSTALL:
- pkgmgr_cmd = PKGMGR_START_UNINSTALL;
- parser = pkgmgr_parser_parse_manifest_for_uninstallation;
- break;
-
- default:
- assert(false);
- fprintf(stdout, "Setting unknown command for package manager.");
- return false;
- }
-
- SendSignal(PKGMGR_START_KEY, pkgmgr_cmd);
-
- bool result = parser(xmlpath.c_str(), NULL);
-
- if (result) {
- fprintf(stdout, "Couldn't parse manifest XML '%s'\n", xmlpath.c_str());
- SendSignal(PKGMGR_END_KEY, PKGMGR_END_FAILURE);
- return false;
- } else {
- SendSignal(PKGMGR_END_KEY, PKGMGR_END_SUCCESS);
- }
-
- return true;
-}
-
-bool PkgInstaller::SendSignal(
+bool PackageInstallerHelper::SendSignal(
const std::string& key,
const std::string& value) {
if (!handle_) {
return true;
}
-#endif
--- /dev/null
+// Copyright (c) 2014 Intel Corporation. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef XWALK_APPLICATION_TOOLS_TIZEN_XWALK_PACKAGE_INSTALLER_HELPER_H_
+#define XWALK_APPLICATION_TOOLS_TIZEN_XWALK_PACKAGE_INSTALLER_HELPER_H_
+
+#include <pkgmgr_installer.h>
+
+#include <string>
+
+class PackageInstallerHelper {
+ public:
+ explicit PackageInstallerHelper(const std::string& appid);
+ ~PackageInstallerHelper();
+ bool InstallApplication(const std::string& xmlpath,
+ const std::string& iconpath);
+ bool UninstallApplication();
+ bool UpdateApplication(const std::string& xmlpath,
+ const std::string& iconpath);
+
+ private:
+ bool InstallApplicationInternal(const std::string& xmlpath,
+ const std::string& iconpath);
+ bool UninstallApplicationInternal();
+
+ bool SendSignal(const std::string& key, const std::string& value);
+
+ pkgmgr_installer* handle_;
+
+ std::string appid_;
+};
+
+#endif // XWALK_APPLICATION_TOOLS_TIZEN_XWALK_PACKAGE_INSTALLER_HELPER_H_
+++ /dev/null
-// Copyright (c) 2014 Intel Corporation. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef XWALK_APPLICATION_TOOLS_TIZEN_XWALK_PKG_INSTALLER_H_
-#define XWALK_APPLICATION_TOOLS_TIZEN_XWALK_PKG_INSTALLER_H_
-
-#if defined(OS_TIZEN)
-#include <pkgmgr_installer.h>
-#endif
-
-#include <string>
-
-class PkgInstaller {
- public:
- explicit PkgInstaller(const std::string& appid);
- ~PkgInstaller();
- bool InstallApplication(const std::string& xmlpath,
- const std::string& iconpath);
- bool UninstallApplication();
-
- private:
-#if defined(OS_TIZEN)
- enum RequestType {
- INSTALL,
- UNINSTALL
- };
- bool ParseManifest(RequestType type, const std::string& xmlpath);
- bool SendSignal(const std::string& key, const std::string& value);
-
- pkgmgr_installer* handle_;
-#endif
-
- std::string appid_;
-};
-
-#endif // XWALK_APPLICATION_TOOLS_TIZEN_XWALK_PKG_INSTALLER_H_
'target_name': 'xwalk-pkg-helper',
'type': 'executable',
'product_name': 'xwalk-pkg-helper',
- 'conditions': [
- ['tizen==1', {
- 'dependencies': [
- '../../../build/system.gyp:tizen',
- '../../../../base/base.gyp:base',
- ],
- }],
- ['OS=="linux"', {
- 'dependencies': [
- '../../../../base/base.gyp:base',
- ],
- }],
+ 'dependencies': [
+ '../../../build/system.gyp:tizen',
+ '../../../../base/base.gyp:base',
],
'include_dirs': [
'../../../..',
],
'sources': [
- 'xwalk_pkg_helper.cc',
- 'xwalk_pkg_installer.cc',
- 'xwalk_pkg_installer.h',
+ 'xwalk_package_helper.cc',
+ 'xwalk_package_installer_helper.cc',
+ 'xwalk_package_installer_helper.h',
],
},
],
'browser/application_tizen.h',
'browser/installer/tizen/packageinfo_constants.cc',
'browser/installer/tizen/packageinfo_constants.h',
- 'browser/installer/tizen/service_package_installer.cc',
- 'browser/installer/tizen/service_package_installer.h',
+ 'browser/installer/tizen/package_installer.cc',
+ 'browser/installer/tizen/package_installer.h',
'common/manifest_handlers/navigation_handler.cc',
'common/manifest_handlers/navigation_handler.h',
'common/manifest_handlers/tizen_application_handler.cc',
'dependencies': [
'application/tools/linux/xwalk_application_tools.gyp:xwalkctl',
'application/tools/linux/xwalk_application_tools.gyp:xwalk_launcher',
+ ],
+ }],
+ ['tizen == 1', {
+ 'dependencies': [
'application/tools/tizen/xwalk_tizen_helper.gyp:xwalk-pkg-helper',
],
}],
%bcond_with wayland
Name: crosswalk
-Version: 7.35.136.0
+Version: 7.35.138.0
Release: 0
Summary: Crosswalk is an app runtime based on Chromium
License: (BSD-3-Clause and LGPL-2.1+)
XWalkRenderViewHostExt* render_view_host_ext() {
return render_view_host_ext_.get();
- };
+ }
XWalkContentsClientBridge* GetContentsClientBridge() {
return contents_client_bridge_.get();
- };
+ }
void SetJsOnlineProperty(JNIEnv* env, jobject obj, jboolean network_up);
jboolean SetManifest(JNIEnv* env,
jobject delegate);
JavaObjectWeakGlobalRef java_ref_;
- scoped_ptr<content::WebContents> web_contents_;
+ // TODO(guangzhen): The WebContentsDelegate need to take ownership of
+ // WebContents as chrome content design. For xwalk, XWalkContent owns
+ // these two, we need to redesign XWalkContent in the future.
+ // Currently as a workaround, below declaration order makes sure
+ // the WebContents destructed before WebContentsDelegate.
scoped_ptr<XWalkWebContentsDelegate> web_contents_delegate_;
scoped_ptr<XWalkRenderViewHostExt> render_view_host_ext_;
scoped_ptr<XWalkContentsClientBridge> contents_client_bridge_;
+ scoped_ptr<content::WebContents> web_contents_;
// GURL is supplied by the content layer as requesting frame.
// Callback is supplied by the content layer, and is invoked with the result
--- /dev/null
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2014 Intel Corporation. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.xwalk.core.xwview.test;
+
+import android.test.suitebuilder.annotation.SmallTest;
+
+import org.chromium.base.test.util.Feature;
+
+/**
+ * Test suite for getTitle().
+ */
+public class GetTitleTest extends XWalkViewTestBase {
+ final String mTitle = "Crosswalk Sample Application";
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ setXWalkClient(new XWalkViewTestBase.TestXWalkClient());
+ }
+
+ @SmallTest
+ @Feature({"GetTitle"})
+ public void testGetTitle() throws Throwable {
+ final String url = "file:///android_asset/www/index.html";
+
+ loadUrlSync(url);
+ assertEquals(mTitle, getTitleOnUiThread());
+ }
+
+ @SmallTest
+ @Feature({"GetTitle"})
+ public void testGetTitleWithData() throws Throwable {
+ final String name = "index.html";
+ final String fileContent = getFileContent(name);
+
+ loadDataSync(name, fileContent, "text/html", false);
+ assertEquals(mTitle, getTitleOnUiThread());
+ }
+}
'../content/content.gyp:content_renderer',
'../content/content.gyp:content_utility',
'../content/content.gyp:content_worker',
- '../content/content_resources.gyp:content_resources',
'../ipc/ipc.gyp:ipc',
'../media/media.gyp:media',
'../net/net.gyp:net',
'<(SHARED_INTERMEDIATE_DIR)/xwalk/xwalk_application_resources.pak',
'<(SHARED_INTERMEDIATE_DIR)/xwalk/xwalk_extensions_resources.pak',
'<(SHARED_INTERMEDIATE_DIR)/xwalk/xwalk_sysapps_resources.pak',
- '<(SHARED_INTERMEDIATE_DIR)/content/content_resources.pak',
'<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
'<(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_en-US.pak',
'<(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_en-US.pak',
'*org/xwalk/*',
],
},
+ 'all_dependent_settings': {
+ 'variables': {
+ 'input_jars_paths': ['<(jar_final_path)'],
+ },
+ },
'actions': [
{
'action_name': 'jar_<(_target_name)',
'classes_dir': '<(PRODUCT_DIR)/<(_target_name)/classes',
'jar_name': '<(_target_name).jar',
'jar_final_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)',
- #TODO(wang16): figure out why the 'jar_final_path' defined in chromium_generated_java
- # not added into following all_dependent_settings setting chain.
- # BUG=https://crosswalk-project.org/jira/browse/XWALK-1575
- 'input_jars_paths': ['<(PRODUCT_DIR)/lib.java/chromium_generated_java.jar'],
- },
- 'all_dependent_settings': {
- 'variables': {
- 'input_jars_paths': ['<(jar_final_path)'],
- },
},
'actions': [
{