%define _binary_payload w3.gzdio
Name: crosswalk
-Version: 11.40.271.0
+Version: 11.40.277.0
Release: 0
Summary: Chromium-based app runtime
License: (BSD-3-Clause and LGPL-2.1+)
# does not expect -Wall to be passed to the compiler (see webrtc issue 3307).
export CXXFLAGS=`echo $CXXFLAGS | sed s,-Wall,,g`
+# Do not use -finline-functions: it breaks the build because it causes -Wall to
+# warn about some conditions that cannot really be reached (ie. variables that
+# may be used uninitialized while in fact thay cannot be uninitialized). See
+# TC-2299.
+export CXXFLAGS=`echo $CXXFLAGS | sed s,-finline-functions,,g`
+
# For ffmpeg on ia32. The original CFLAGS set by the gyp and config files in
# src/third_party/ffmpeg already pass -O2 -fomit-frame-pointer, but Tizen's
# CFLAGS end up appending -fno-omit-frame-pointer. See http://crbug.com/37246
-LASTCHANGE=e36755cc26d8a8fcb4f4c3cca52c242297326917
+LASTCHANGE=5557d5159b3ed591f53887db1de564d2c07725b9
PulseAudioOutputStream* data =
static_cast<PulseAudioOutputStream*>(user_data);
pa_proplist* proplist = pa_proplist_new();
- pa_proplist_sets(proplist, "resource.set.appid", data->app_id().c_str());
+ pa_proplist_sets(proplist, "resource.set.name", data->app_id().c_str());
pa_proplist_sets(proplist, PA_PROP_MEDIA_ROLE, data->app_class().c_str());
*stream = pa_stream_new_with_proplist(*context, "Playback",
&sample_specifications,
// underlying platform windowing system (i.e. X11/Win/OSX).
class PlatformWindow {
public:
- enum PlatformWindowType {
- PLATFORM_WINDOW_UNKNOWN,
- PLATFORM_WINDOW_TYPE_TOOLTIP,
- PLATFORM_WINDOW_TYPE_POPUP,
- PLATFORM_WINDOW_TYPE_MENU,
- PLATFORM_WINDOW_TYPE_BUBBLE,
- PLATFORM_WINDOW_TYPE_WINDOW,
- PLATFORM_WINDOW_TYPE_WINDOW_FRAMELESS
- };
+ enum PlatformWindowType {
+ PLATFORM_WINDOW_UNKNOWN,
+ PLATFORM_WINDOW_TYPE_TOOLTIP,
+ PLATFORM_WINDOW_TYPE_POPUP,
+ PLATFORM_WINDOW_TYPE_MENU,
+ PLATFORM_WINDOW_TYPE_BUBBLE,
+ PLATFORM_WINDOW_TYPE_WINDOW,
+ PLATFORM_WINDOW_TYPE_WINDOW_FRAMELESS
+ };
virtual ~PlatformWindow() {}
--- /dev/null
+# Contributing to Crosswalk
+
+Thanks a lot for contributing to Crosswalk, you rock!
+
+This page lists some guidelines for the contribution process to help you send
+an awesome patch that gets reviewed and merged quickly.
+[Crosswalk's website](https://crosswalk-project.org/contribute/) also has a
+whole section dedicated to this, be sure to check it out.
+
+## License
+
+Crosswalk is licensed under the
+[3-clause BSD license](http://opensource.org/licenses/BSD-3-Clause). When you
+submit a patch, you agree to license your contribution to Intel under this
+license.
+
+## Submitting pull requests
+
+* If it applies, add the platform your change affects in both the commit
+ message and the pull request title. For example, _"[Android] Update target
+ SDK to android-21"_ or _"[Tizen] Add unit test for metadata element
+ handler"_.
+
+* If you know them, be sure to mention the people you would like to review your
+ patch in a comment. You can check the `OWNERS` files in the tree to know the
+ best people to look at your changes.
+
+* Do not use your `master` branch in your pull request. This means you will not
+ be able to send multiple pull requests at the same time without changing all
+ of them at once, and they will also be changed when you update your branch to
+ track Crosswalk's latest changes. Instead, use a separate branch for each
+ pull request.
+
+* If someone asks you to make a change to your pull request, **DO NOT** close
+ it and open a new one. Instead, make the changes to your branch, amending and
+ rebasing when necessary, and then use `git push -f` to push the changes to
+ the same branch you have used in your existing pull request.
+
+## Commit messages
+
+* Use the present tense ("Add feature" not "Added feature").
+
+* Use the imperative mood ("Move cursor to..." not "Moves cursor to...").
+
+* Limit the first line to 72 characters or less.
+
+* If your pull request fixes an open issue in
+ [our bug tracker](https://crosswalk-project.org/jira), please reference it in
+ your commit message as well as your pull request message, like this:
+ ```
+ Fix something.
+
+ Yadda, yadda, yadda.
+
+ BUG=XWALK-123456
+ ```
+ This way, the issue will be updated when the pull request is sent and, once
+ it is merged, the issue will be closed automatically.
+ If you simply want the issue to be updated but do **not** want it to be
+ closed, use a different construct in your message, like _"Related to:
+ XWALK-123"_.
+
+## Coding style
+
+* C++: We follow
+ [Chromium's coding style](http://dev.chromium.org/developers/coding-style),
+ which basically mean's
+ [Google's](https://google-styleguide.googlecode.com/svn/trunk/cppguide.html).
+ Please take some time to get familiar with it, particularly with the amount
+ of space used for indentation and the position of asterisks and braces. If in
+ doubt, check the rest of the code around what you are changing.
+
+* Java: We also follow
+ [Chromium's guidelines](http://www.chromium.org/developers/coding-style/java),
+ which are very similar to
+ [Android's style guide](http://source.android.com/source/code-style.html), so
+ there should not be any big surprises.
+
+* Python: Just like
+ [Chromium's](http://dev.chromium.org/developers/coding-style), our Python
+ code mostly follows [PEP-8](https://www.python.org/dev/peps/pep-0008/), the
+ exceptions being the amount of space used for indentation (2 instead of 4)
+ and the use of `MixedCase` functions and methods instead of
+ `lower_case_ones`.
# Edit these when rolling DEPS.xwalk.
# -----------------------------------
-chromium_crosswalk_rev = 'e36755cc26d8a8fcb4f4c3cca52c242297326917'
+chromium_crosswalk_rev = '5557d5159b3ed591f53887db1de564d2c07725b9'
v8_crosswalk_rev = '11bb7b400ff9e0179ecf6fe358b9d9452d297234'
ozone_wayland_rev = '597c8dfffd6058589db481c9d3beb1120eaf2b6b'
MAJOR=11
MINOR=40
-BUILD=271
+BUILD=277
PATCH=0
</activity>
</application>
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
+ <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA"/>
</activity>
</application>
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
+ <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA"/>
</activity>
</application>
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
+ <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</activity>
</application>
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
+ <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
options.arch = 'arm'
else:
options.arch = arch
- print "options.arch:", options.arch
+ print("options.arch:", options.arch)
Execution(options, name)
packaged_archs.append(options.arch)
else:
content::RenderProcessHost* rph =
content::RenderProcessHost::FromID(application->GetRenderProcessHostID());
+ CHECK(rph);
content::StoragePartition* partition = rph->GetStoragePartition();
+ CHECK(partition);
base::FilePath path = partition->GetPath().Append(
FILE_PATH_LITERAL("WidgetStorage"));
widget_storage_.reset(new AppWidgetStorage(application_, path));
--- /dev/null
+// Copyright (c) 2013 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.
+
+#include "xwalk/application/tools/linux/dbus_connection.h"
+
+GDBusConnection* get_session_bus_connection(GError** error) {
+#if defined(OS_TIZEN_MOBILE)
+ // In Tizen the session bus is created in /run/user/app/dbus/user_bus_socket
+ // but this information isn't set in DBUS_SESSION_BUS_ADDRESS, neither when
+ // logging via 'sdb shell' and changing user to 'app', nor when an application
+ // is launched.
+ return g_dbus_connection_new_for_address_sync(
+ "unix:path=/run/user/app/dbus/user_bus_socket",
+ GDBusConnectionFlags(G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT
+ | G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION),
+ NULL, NULL, error);
+#else
+ return g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, error);
+#endif
+}
--- /dev/null
+// Copyright (c) 2013 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_LINUX_DBUS_CONNECTION_H_
+#define XWALK_APPLICATION_TOOLS_LINUX_DBUS_CONNECTION_H_
+
+#include <gio/gio.h>
+
+GDBusConnection* get_session_bus_connection(GError** error);
+
+#endif // XWALK_APPLICATION_TOOLS_LINUX_DBUS_CONNECTION_H_
+++ /dev/null
-// Copyright (c) 2013 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.
-
-#include "xwalk/application/tools/linux/dbus_object_manager.h"
-
-#include "base/message_loop/message_loop.h"
-
-namespace {
-
-const char kServiceName[] = "org.crosswalkproject.Runtime1";
-const char kRunningManagerIface[] = "org.crosswalkproject.Running.Manager1";
-const char kRunningAppIface[] = "org.crosswalkproject.Running.Application1";
-const char kRunningManagerDBusPath[] = "/running1";
-const char kEPChannelCreatedSignalName[] = "EPChannelCreated";
-
-struct Properties : public dbus::PropertySet {
- dbus::Property<std::string> app_id;
-
- Properties(dbus::ObjectProxy* object_proxy,
- const std::string& interface_name,
- PropertyChangedCallback property_changed_callback)
- : PropertySet(object_proxy, interface_name, property_changed_callback) {
- RegisterProperty("AppID", &app_id);
- }
-};
-
-} // namespace
-
-DBusObjectManager::DBusObjectManager(dbus::Bus* bus,
- base::MessageLoop* main_loop)
- : bus_(bus),
- main_loop_(main_loop),
- weak_ptr_factory_(this) {
- ConnectToApplicationManager();
-}
-
-bool DBusObjectManager::Launch(const std::string& appid_or_url,
- int launcher_pid, bool fullscreen, bool remote_debugging) {
- if (!running_proxy_)
- return false;
- dbus::MethodCall method_call(
- kRunningManagerIface, "Launch");
- dbus::MessageWriter writer(&method_call);
- writer.AppendString(appid_or_url);
- writer.AppendUint32(launcher_pid);
- writer.AppendBool(fullscreen);
- writer.AppendBool(remote_debugging);
- scoped_ptr<dbus::Response> response(
- running_proxy_->CallMethodAndBlock(&method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT));
- if (!response.get())
- return false;
- if (!response->GetErrorName().empty()) {
- LOG(ERROR) << "Error during call to 'Launch': "
- << response->GetErrorName();
- return false;
- }
-
- dbus::MessageReader reader(response.get());
- dbus::ObjectPath running_application_path;
- if (!reader.PopObjectPath(&running_application_path)) {
- LOG(WARNING) << "Failed to create app proxy.";
- } else {
- app_proxy_ = bus_->GetObjectProxy(kServiceName, running_application_path);
- if (app_proxy_)
- ConnectToApplicationSignal(kEPChannelCreatedSignalName);
- }
- return true;
-}
-
-std::pair<std::string, int> DBusObjectManager::GetEPChannel() const {
- std::pair<std::string, int> fd;
- if (!app_proxy_) {
- fd.second = -1;
- return fd;
- }
- dbus::MethodCall method_call(kRunningAppIface, "GetEPChannel");
- scoped_ptr<dbus::Response> response = app_proxy_->CallMethodAndBlock(
- &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT);
- const std::string& error = response->GetErrorName();
- if (!error.empty()) {
- LOG(ERROR) << "Error during call to 'GetEPChannel': "
- << error;
- fd.second = -1;
- return fd;
- }
- dbus::MessageReader reader(response.release());
- dbus::FileDescriptor extension_process_fd_;
- if (!reader.PopString(&fd.first) ||
- !reader.PopFileDescriptor(&extension_process_fd_)) {
- LOG(ERROR) << "Couldn't get EP Channel";
- fd.second = -1;
- return fd;
- }
- extension_process_fd_.CheckValidity();
- fd.second = extension_process_fd_.TakeValue();
- return fd;
-}
-
-bool DBusObjectManager::Suspend() {
- if (!app_proxy_)
- return false;
- dbus::MethodCall method_call(kRunningAppIface, "Suspend");
- scoped_ptr<dbus::Response> response = app_proxy_->CallMethodAndBlock(
- &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT);
- if (!response->GetErrorName().empty()) {
- LOG(ERROR) << "Error during call to 'Suspend': "
- << response->GetErrorName();
- return false;
- }
- return true;
-}
-
-bool DBusObjectManager::Resume() {
- if (!app_proxy_)
- return false;
- dbus::MethodCall method_call(kRunningAppIface, "Resume");
- scoped_ptr<dbus::Response> response = app_proxy_->CallMethodAndBlock(
- &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT);
- if (!response->GetErrorName().empty()) {
- LOG(ERROR) << "Error during call to 'Resume': "
- << response->GetErrorName();
- return false;
- }
- return true;
-}
-
-void DBusObjectManager::OnOwnershipCallback(const std::string& service_name,
- bool success) {
- LOG(WARNING) << "Couldn't get ownership of D-Bus service name: "
- << service_name << ".";
-}
-
-void DBusObjectManager::ConnectToApplicationManager() {
- running_apps_manager_ = bus_->GetObjectManager(kServiceName,
- dbus::ObjectPath(kRunningManagerDBusPath));
- running_apps_manager_->RegisterInterface(kRunningAppIface, this);
- running_proxy_ = bus_->GetObjectProxy(kServiceName,
- dbus::ObjectPath(kRunningManagerDBusPath));
-}
-
-void DBusObjectManager::ObjectAdded(const dbus::ObjectPath& object_path,
- const std::string& interface_name) {
-}
-
-void DBusObjectManager::ObjectRemoved(const dbus::ObjectPath& object_path,
- const std::string& interface_name) {
- if (object_path != app_proxy_->object_path())
- return;
- LOG(INFO) << "Application '" << object_path.value()
- << "' disappeared, exiting.";
- main_loop_->QuitNow();
-}
-
-dbus::PropertySet* DBusObjectManager::CreateProperties(
- dbus::ObjectProxy *object_proxy,
- const dbus::ObjectPath& object_path,
- const std::string& interface_name) {
- Properties* properties = new Properties(
- object_proxy, interface_name,
- base::Bind(&DBusObjectManager::OnPropertyChanged,
- base::Unretained(this), object_path));
- return static_cast<dbus::PropertySet*>(properties);
-}
-
-void DBusObjectManager::OnPropertyChanged(const dbus::ObjectPath& object_path,
- const std::string& name) {
- if (!running_apps_manager_)
- ConnectToApplicationManager();
-}
-
-void DBusObjectManager::ConnectToApplicationSignal(
- const std::string& signal_name) {
- DCHECK(app_proxy_);
- app_proxy_->ConnectToSignal(kRunningAppIface, signal_name,
- base::Bind(&DBusObjectManager::OnAppSignal,
- weak_ptr_factory_.GetWeakPtr()),
- base::Bind(&DBusObjectManager::OnAppSignalConnected,
- weak_ptr_factory_.GetWeakPtr()));
-}
-
-bool DBusObjectManager::IsApplicationRunning(const std::string& app_id) {
- std::vector<dbus::ObjectPath> objects = running_apps_manager_->GetObjects();
- bool is_running = false;
- for (dbus::ObjectPath obj : objects) {
- Properties* properties =
- static_cast<Properties*>(
- running_apps_manager_->GetProperties(
- obj, kRunningAppIface));
- if (!properties)
- continue;
- if (properties->app_id.value() == app_id) {
- is_running = true;
- break;
- }
- }
- LOG(INFO) << "Application " << app_id << " is "
- << (is_running ? "running." : "not running.");
- return is_running;
-}
-
-void DBusObjectManager::OnAppSignal(dbus::Signal* signal) {
- std::string signal_name = signal->GetMember();
- if (signal_name == kEPChannelCreatedSignalName) {
- if (observer_)
- observer_->OnEPChannelCreated();
- } else {
- LOG(INFO) << "Unknown signal received: " << signal_name;
- }
-}
-
-void DBusObjectManager::OnAppSignalConnected(
- const std::string& interface_name,
- const std::string& signal_name,
- bool success) {
- if (!success)
- LOG(WARNING) << "Failed to connect signal: " << signal_name;
-}
+++ /dev/null
-// Copyright (c) 2013 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_LINUX_DBUS_OBJECT_MANAGER_H_
-#define XWALK_APPLICATION_TOOLS_LINUX_DBUS_OBJECT_MANAGER_H_
-
-#include <map>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "base/macros.h"
-#include "base/threading/thread.h"
-#include "base/values.h"
-#include "dbus/bus.h"
-#include "dbus/exported_object.h"
-#include "dbus/message.h"
-#include "dbus/object_manager.h"
-#include "dbus/object_path.h"
-#include "dbus/object_proxy.h"
-#include "dbus/property.h"
-
-class DBusObjectManager : public dbus::ObjectManager::Interface {
- public:
- class Observer {
- public:
- virtual void OnEPChannelCreated() = 0;
-
- protected:
- virtual ~Observer() {}
- };
-
- DBusObjectManager(dbus::Bus* bus, base::MessageLoop* main_loop);
-
- bool Launch(const std::string& appid_or_url, int launcher_pid,
- bool fullscreen, bool remote_debugging);
- std::pair<std::string, int> GetEPChannel() const;
- bool Suspend();
- bool Resume();
-
- bool IsApplicationRunning(const std::string& app_id);
-
- void SetObserver(Observer* observer) { observer_ = observer; }
-
- private:
- void OnOwnershipCallback(const std::string& service_name, bool success);
- void ObjectAdded(const dbus::ObjectPath& object_path,
- const std::string& interface_name) override;
- void ObjectRemoved(const dbus::ObjectPath& object_path,
- const std::string& interface_name) override;
- dbus::PropertySet* CreateProperties(
- dbus::ObjectProxy* object_proxy,
- const dbus::ObjectPath& object_path,
- const std::string& interface_name) override;
-
- void OnPropertyChanged(const dbus::ObjectPath& object_path,
- const std::string& name);
-
- void ConnectToApplicationManager();
- void ConnectToApplicationSignal(const std::string& signal_name);
- void OnAppSignal(dbus::Signal* signal);
- void OnAppSignalConnected(const std::string& interface_name,
- const std::string& signal_name,
- bool success);
-
- scoped_refptr<dbus::Bus> bus_;
- dbus::ObjectManager* running_apps_manager_;
- dbus::ObjectProxy* running_proxy_;
- dbus::ObjectProxy* app_proxy_;
-
- // this is needed for exit events which come via dbus interface
- base::MessageLoop* main_loop_;
-
- base::WeakPtrFactory<DBusObjectManager> weak_ptr_factory_;
-
- Observer* observer_;
-
- DISALLOW_COPY_AND_ASSIGN(DBusObjectManager);
-};
-
-#endif // XWALK_APPLICATION_TOOLS_LINUX_DBUS_OBJECT_MANAGER_H_
'../../../build/system.gyp:gio',
'../../../extensions/extensions.gyp:xwalk_extensions',
'../../../application/common/xwalk_application_common.gypi:xwalk_application_common_lib',
- '../../../dbus/xwalk_dbus.gyp:xwalk_dbus'
],
'sources': [
- 'dbus_object_manager.cc',
- 'dbus_object_manager.h',
+ 'dbus_connection.cc',
+ 'dbus_connection.h',
'xwalk_extension_process_launcher.cc',
'xwalk_extension_process_launcher.h',
'xwalk_launcher_main.cc',
'../../../build/system.gyp:tizen_appcore_common'
],
'sources': [
- 'xwalk_launcher.cc',
- 'xwalk_launcher.h',
'xwalk_launcher_tizen.cc',
'xwalk_launcher_tizen.h',
'../tizen/xwalk_tizen_user.cc',
+++ /dev/null
-// Copyright (c) 2013 Intel Corporation. All rights reserved.
-// Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <unistd.h>
-
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "dbus/object_proxy.h"
-
-#include "base/logging.h"
-
-#include "xwalk/application/tools/linux/xwalk_launcher.h"
-
-namespace {
-
-const char xwalk_service_name[] = "org.crosswalkproject.Runtime1";
-const char xwalk_running_path[] = "/running1";
-const char xwalk_running_manager_iface[] =
- "org.crosswalkproject.Running.Manager1";
-const char xwalk_running_app_iface[] =
- "org.crosswalkproject.Running.Application1";
-
-} // namespace
-
-XWalkLauncher::XWalkLauncher(bool query_running, base::MessageLoop* main_loop)
- : ep_launcher_(nullptr),
- query_running_(query_running),
- main_loop_(main_loop) {
- base::Thread::Options thread_options;
- thread_options.message_loop_type = base::MessageLoop::TYPE_IO;
- dbus_thread_.reset(new base::Thread("Crosswalk D-Bus thread"));
- dbus_thread_->StartWithOptions(thread_options);
-
- dbus::Bus::Options options;
-#if defined (OS_TIZEN_MOBILE)
- options.bus_type = dbus::Bus::CUSTOM_ADDRESS;
- options.address.assign("unix:path=/run/user/app/dbus/user_bus_socket");
-#endif
- options.bus_type = dbus::Bus::SESSION;
- options.connection_type = dbus::Bus::PRIVATE;
- options.dbus_task_runner = dbus_thread_->message_loop_proxy();
- dbus::Bus* bus = new dbus::Bus(options);
- bus->Connect();
- bus->GetManagedObjects();
-
- dbus_object_manager_.reset(new DBusObjectManager(bus, main_loop));
- dbus_object_manager_->SetObserver(this);
-}
-
-XWalkLauncher::~XWalkLauncher() {
-}
-
-int XWalkLauncher::Launch(const std::string& appid_or_url, bool fullscreen,
- bool remote_debugging, int argc, char* argv[]) {
- appid_or_url_ = appid_or_url;
- fullscreen_ = fullscreen;
- remote_debugging_ = remote_debugging;
-
- // Query app.
- if (query_running_) {
- return dbus_object_manager_->IsApplicationRunning(appid_or_url_);
- }
-
- return !LaunchApplication();
-}
-
-int XWalkLauncher::LaunchApplication() {
- ep_launcher_.reset(new XWalkExtensionProcessLauncher());
-
- launcher_pid_ = getpid();
- if (!dbus_object_manager_->Launch(appid_or_url_, launcher_pid_,
- fullscreen_, remote_debugging_))
- return 1;
- return InitExtensionProcessChannel();
-}
-
-bool XWalkLauncher::InitExtensionProcessChannel() {
- if (ep_launcher_->is_started())
- return false;
-
- // Need to call method via DBus to get EP channel
- std::pair<std::string, int> fd = dbus_object_manager_->GetEPChannel();
- if (fd.first.empty() || fd.second < 0)
- return false;
- ep_launcher_->Launch(fd.first, fd.second);
- return true;
-}
-
-void XWalkLauncher::OnEPChannelCreated() {
- InitExtensionProcessChannel();
-}
+++ /dev/null
-// Copyright (c) 2013 Intel Corporation. All rights reserved.
-// Copyright (c) 2014 Samsung Electronics Co., Ltd 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_LINUX_XWALK_LAUNCHER_H_
-#define XWALK_APPLICATION_TOOLS_LINUX_XWALK_LAUNCHER_H_
-
-#include <memory>
-#include <string>
-
-#include "base/threading/thread.h"
-#include "dbus/bus.h"
-#include "dbus/message.h"
-
-#include "xwalk/application/tools/linux/dbus_object_manager.h"
-#include "xwalk/application/tools/linux/xwalk_extension_process_launcher.h"
-
-class XWalkLauncher : public DBusObjectManager::Observer {
- public:
- XWalkLauncher(bool query_running, base::MessageLoop* main_loop);
- virtual ~XWalkLauncher();
- virtual int Launch(const std::string& appid_or_url, bool fullscreen,
- bool remote_debugging, int argc = 0,
- char* argv[] = nullptr);
-
- protected:
- int LaunchApplication();
-
- std::unique_ptr<XWalkExtensionProcessLauncher> ep_launcher_;
-
- unsigned int launcher_pid_;
- std::string appid_or_url_;
- bool fullscreen_;
- bool remote_debugging_;
- bool query_running_;
-
- base::MessageLoop* main_loop_;
-
- std::unique_ptr<DBusObjectManager> dbus_object_manager_;
-
- private:
- bool InitExtensionProcessChannel();
- virtual void OnEPChannelCreated() override;
-
- std::unique_ptr<base::Thread> dbus_thread_;
-};
-
-#endif // XWALK_APPLICATION_TOOLS_LINUX_XWALK_LAUNCHER_H_
// Copyright (c) 2013 Intel Corporation. All rights reserved.
-// Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <glib.h>
-
-#include <memory>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <pwd.h>
+#include <libgen.h>
-#include "base/message_loop/message_loop.h"
-#include "base/message_loop/message_pump.h"
-#include "base/message_loop/message_pump_glib.h"
-#include "base/run_loop.h"
+#include <glib.h>
+#include <gio/gio.h>
+#include <gio/gunixfdlist.h>
-#include "xwalk/application/tools/linux/xwalk_launcher.h"
+#include "xwalk/application/tools/linux/dbus_connection.h"
+#include "xwalk/application/tools/linux/xwalk_extension_process_launcher.h"
#if defined(OS_TIZEN)
+#include "url/gurl.h"
#include "xwalk/application/tools/linux/xwalk_launcher_tizen.h"
+#include "xwalk/application/tools/tizen/xwalk_tizen_user.h"
#endif
-namespace {
+static const char* xwalk_service_name = "org.crosswalkproject.Runtime1";
+static const char* xwalk_running_path = "/running1";
+static const char* xwalk_running_manager_iface =
+ "org.crosswalkproject.Running.Manager1";
+static const char* xwalk_running_app_iface =
+ "org.crosswalkproject.Running.Application1";
-int g_argc;
-char** g_argv;
-gboolean query_running = FALSE;
-gboolean fullscreen = FALSE;
-gboolean remote_debugging = FALSE;
-gchar** cmd_appid_or_url;
-char* application_object_path;
+static char* application_object_path;
-} // namespace
+static GMainLoop* mainloop;
+static GDBusConnection* g_connection;
+static GDBusObjectManager* g_running_apps_manager;
+static XWalkExtensionProcessLauncher* ep_launcher = NULL;
-static const GOptionEntry entries[] {
+static int g_argc;
+static char** g_argv;
+static gboolean query_running = FALSE;
+static gboolean fullscreen = FALSE;
+static gboolean remote_debugging = FALSE;
+static gchar** cmd_appid_or_url;
+
+static GOptionEntry entries[] = {
{ "running", 'r', 0, G_OPTION_ARG_NONE, &query_running,
- "Check whether the application is running", nullptr },
+ "Check whether the application is running", NULL },
{ "fullscreen", 'f', 0, G_OPTION_ARG_NONE, &fullscreen,
- "Run the application as fullscreen", nullptr },
+ "Run the application as fullscreen", NULL },
{ "debugging_port", 'd', 0, G_OPTION_ARG_NONE, &remote_debugging,
- "Enable remote debugging for the application", nullptr },
- { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY,
- &cmd_appid_or_url,
- "ID of the application to be launched or URL to open", nullptr },
- { nullptr }
+ "Enable remote debugging for the application", NULL },
+ { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &cmd_appid_or_url,
+ "ID of the application to be launched or URL to open", NULL },
+ { NULL }
};
+static void object_removed(GDBusObjectManager* manager, GDBusObject* object,
+ gpointer user_data) {
+ const char* path = g_dbus_object_get_object_path(object);
+
+ if (g_strcmp0(path, application_object_path))
+ return;
+
+ fprintf(stderr, "Application '%s' disappeared, exiting.\n", path);
+
+ delete ep_launcher;
+ g_main_loop_quit(mainloop);
+}
+
+static void on_app_properties_changed(GDBusProxy* proxy,
+ GVariant* changed_properties,
+ GStrv invalidated_properties,
+ gpointer user_data) {
+ const char* interface = g_dbus_proxy_get_interface_name(proxy);
+
+ fprintf(stderr, "properties changed %s\n", interface);
+
+ if (g_variant_n_children(changed_properties) == 0)
+ return;
+
+ if (g_strcmp0(interface, xwalk_running_app_iface))
+ return;
+
+ GVariantIter* iter;
+ const gchar* key;
+ GVariant* value;
+
+ g_variant_get(changed_properties, "a{sv}", &iter);
+
+ while (g_variant_iter_loop(iter, "{&sv}", &key, &value)) {
+ if (g_strcmp0(key, "State"))
+ continue;
+
+ const gchar* state = g_variant_get_string(value, NULL);
+
+ fprintf(stderr, "Application state %s\n", state);
+ }
+}
+
+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 (!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 TRUE;
+}
+
+static void on_app_signal(GDBusProxy* proxy,
+ gchar* sender_name,
+ gchar* signal_name,
+ GVariant* parameters,
+ gpointer user_data) {
+ if (!strcmp(signal_name, "EPChannelCreated")) {
+ init_extension_process_channel(proxy);
+ } else {
+ fprintf(stderr, "Unkown signal received: %s\n", signal_name);
+ }
+}
+
+static int query_application_running(const char* app_id) {
+ GList* objects = g_dbus_object_manager_get_objects(g_running_apps_manager);
+ GList* it;
+ bool is_running = FALSE;
+
+ for (it = objects; it; it = it->next) {
+ GDBusObject* object = reinterpret_cast<GDBusObject*>(it->data);
+ GDBusInterface* iface = g_dbus_object_get_interface(
+ object,
+ xwalk_running_app_iface);
+ if (!iface)
+ continue;
+
+ GDBusProxy* proxy = G_DBUS_PROXY(iface);
+ GVariant* id_variant;
+ id_variant = g_dbus_proxy_get_cached_property(proxy, "AppID");
+ if (!id_variant) {
+ g_object_unref(iface);
+ continue;
+ }
+
+ const gchar* id;
+ g_variant_get(id_variant, "s", &id);
+ if (!strcmp(app_id, id)) {
+ is_running = TRUE;
+ break;
+ }
+
+ g_object_unref(iface);
+ }
+ const char* str = is_running ? "running" : "not running";
+ g_print("Application %s is %s.\n", app_id, str);
+
+ g_list_free_full(objects, g_object_unref);
+ return is_running ? 0 : 1;
+}
+
+static void launch_application(const char* appid_or_url,
+ gboolean fullscreen,
+ gboolean remote_debugging) {
+ ep_launcher = new XWalkExtensionProcessLauncher();
+ GError* error = NULL;
+ g_signal_connect(g_running_apps_manager, "object-removed",
+ G_CALLBACK(object_removed), NULL);
+
+ GDBusProxy* running_proxy = g_dbus_proxy_new_sync(
+ g_connection,
+ G_DBUS_PROXY_FLAGS_NONE, NULL, xwalk_service_name,
+ xwalk_running_path, xwalk_running_manager_iface, NULL, &error);
+ if (!running_proxy) {
+ g_print("Couldn't create proxy for '%s': %s\n", xwalk_running_manager_iface,
+ error->message);
+ g_error_free(error);
+ exit(1);
+ }
+
+ unsigned int launcher_pid = getpid();
+
+ GVariant* result = g_dbus_proxy_call_sync(running_proxy, "Launch",
+ g_variant_new("(subb)", appid_or_url, launcher_pid, fullscreen,
+ remote_debugging),
+ G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+ if (!result) {
+ fprintf(stderr, "Couldn't call 'Launch' method: %s\n", error->message);
+ exit(1);
+ }
+
+ g_variant_get(result, "(o)", &application_object_path);
+ fprintf(stderr, "Application launched with path '%s'\n",
+ application_object_path);
+
+ GDBusProxy* app_proxy = g_dbus_proxy_new_sync(
+ g_connection,
+ G_DBUS_PROXY_FLAGS_NONE, NULL, xwalk_service_name,
+ application_object_path, xwalk_running_app_iface, NULL, &error);
+ if (!app_proxy) {
+ g_print("Couldn't create proxy for '%s': %s\n", xwalk_running_app_iface,
+ error->message);
+ g_error_free(error);
+ exit(1);
+ }
+
+ g_signal_connect(app_proxy, "g-properties-changed",
+ G_CALLBACK(on_app_properties_changed), NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_signal_connect(app_proxy, "g-signal", G_CALLBACK(on_app_signal), NULL);
+
+#if defined(OS_TIZEN)
+ char name[128];
+ snprintf(name, sizeof(name), "xwalk-%s", appid_or_url);
+
+ if (xwalk_appcore_init(g_argc, g_argv, name, app_proxy)) {
+ fprintf(stderr, "Failed to initialize appcore");
+ exit(1);
+ }
+#endif
+
+ init_extension_process_channel(app_proxy);
+ g_main_loop_run(mainloop);
+}
+
+void connect_to_application_manager() {
+ GError* error = NULL;
+ g_connection = get_session_bus_connection(&error);
+ if (!g_connection) {
+ fprintf(stderr, "Couldn't get the session bus connection: %s\n",
+ error->message);
+ exit(1);
+ }
+
+ g_running_apps_manager =
+ g_dbus_object_manager_client_new_sync(
+ g_connection, G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
+ xwalk_service_name, xwalk_running_path,
+ NULL, NULL, NULL, NULL, &error);
+ if (!g_running_apps_manager) {
+ fprintf(stderr, "Service '%s' does could not be reached: %s\n",
+ xwalk_service_name, error->message);
+ exit(1);
+ }
+}
+
int main(int argc, char** argv) {
+ GError* error = NULL;
+ char* appid_or_url;
+
+ g_argc = argc;
+ g_argv = argv;
+
#if !GLIB_CHECK_VERSION(2, 36, 0)
// g_type_init() is deprecated on GLib since 2.36.
g_type_init();
#if defined(OS_TIZEN)
if (xwalk_tizen_check_group_users())
- return 1;
+ exit(1);
#endif
- base::MessageLoop msg_loop(
- make_scoped_ptr<base::MessagePump>(new base::MessagePumpGlib()));
-
- g_argc = argc;
- g_argv = argv;
- GError* error = nullptr;
GOptionContext* context =
g_option_context_new("- Crosswalk Application Launcher");
- g_option_context_add_main_entries(context, entries, nullptr);
+ g_option_context_add_main_entries(context, entries, NULL);
if (!g_option_context_parse(context, &argc, &argv, &error)) {
- LOG(ERROR) << "Option parsing failed: " << error->message;
+ fprintf(stderr, "Option parsing failed: %s\n", error->message);
exit(1);
}
- std::string appid_or_url;
- if (!strcmp(basename(g_argv[0]), "xwalk-launcher")) {
- if (!cmd_appid_or_url) {
- LOG(ERROR) << "No AppID informed, nothing to do.";
- exit(1);
+ connect_to_application_manager();
+
+ // Launch app.
+ if (!strcmp(basename(argv[0]), "xwalk-launcher")) {
+ if (cmd_appid_or_url == NULL) {
+ fprintf(stderr, "No AppID informed, nothing to do.\n");
+ return 0;
}
- appid_or_url = std::string(cmd_appid_or_url[0]);
+ appid_or_url = strdup(cmd_appid_or_url[0]);
+#if defined(OS_TIZEN)
+ if (GURL(appid_or_url).spec().empty()
+ && xwalk_change_cmdline(argc, argv, appid_or_url))
+ exit(1);
+#endif
} else {
- appid_or_url = std::string(basename(g_argv[0]));
+ appid_or_url = strdup(basename(argv[0]));
}
- std::unique_ptr<XWalkLauncher> launcher;
-#if defined(OS_TIZEN)
- launcher.reset(new XWalkLauncherTizen(query_running, &msg_loop));
-#else
- launcher.reset(new XWalkLauncher(query_running, &msg_loop));
-#endif
- int result = launcher->Launch(appid_or_url, fullscreen, remote_debugging,
- argc, argv);
- if (!result)
- msg_loop.Run();
- return result;
+
+ // Query app.
+ if (query_running) {
+ return query_application_running(appid_or_url);
+ }
+
+ launch_application(appid_or_url, fullscreen, remote_debugging);
+ free(appid_or_url);
+ return 0;
}
// Copyright (c) 2013 Intel Corporation. All rights reserved.
-// Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "xwalk/application/tools/linux/xwalk_launcher_tizen.h"
-
-#include <unistd.h>
-#include <pkgmgr-info.h>
+#include <glib.h>
+#include <gio/gio.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
+#include <stdlib.h>
+#include <appcore/appcore-common.h>
+#include <pkgmgr-info.h>
-#include <string>
+#include "xwalk/application/common/id_util.h"
+#include "xwalk/application/tools/linux/xwalk_launcher_tizen.h"
-#include "base/logging.h"
-#include "url/gurl.h"
+enum app_event {
+ AE_UNKNOWN,
+ AE_CREATE,
+ AE_TERMINATE,
+ AE_PAUSE,
+ AE_RESUME,
+ AE_RESET,
+ AE_LOWMEM_POST,
+ AE_MEM_FLUSH,
+ AE_MAX
+};
// Private struct from appcore-internal, necessary to get events from
// the system.
struct ui_ops {
void* data;
- void (*cb_app)(app_event evnt, void* data, bundle* b);
+ void (*cb_app)(enum app_event evnt, void* data, bundle* b);
};
-namespace {
+static struct ui_ops appcore_ops;
-const char* Event2Str(app_event event) {
+static const char* event2str(enum app_event event) {
switch (event) {
case AE_UNKNOWN:
return "AE_UNKNOWN";
return "INVALID EVENT";
}
-ui_ops app_ops;
-
-} // namespace
+static void application_event_cb(enum app_event event, void* data, bundle* b) {
+ fprintf(stderr, "event '%s'\n", event2str(event));
+ GDBusProxy* app_proxy = reinterpret_cast<GDBusProxy*>(data);
-XWalkLauncherTizen::XWalkLauncherTizen(bool query_running,
- base::MessageLoop* main_loop)
- : XWalkLauncher(query_running, main_loop) {
-}
-
-int XWalkLauncherTizen::Launch(const std::string& appid_or_url, bool fullscreen,
- bool remote_debugging, int argc, char* argv[]) {
- appid_or_url_ = appid_or_url;
- fullscreen_ = fullscreen;
- remote_debugging_ = remote_debugging;
- // Query app.
- if (query_running_) {
- return dbus_object_manager_->IsApplicationRunning(appid_or_url_);
+ if (!app_proxy) {
+ fprintf(stderr, "Invalid DBus proxy.");
+ return;
}
- std::string name = "xwalk-" + appid_or_url_;
-
- if (XwalkAppcoreInit(name, argc, argv)) {
- LOG(ERROR) << "Failed to initialize appcore.";
- return 1;
- }
- if (GURL(appid_or_url_).spec().empty()
- && XwalkChangeCmdline(appid_or_url_, argc, argv))
- return 1;
- return 0;
-}
-
-bool XWalkLauncherTizen::Suspend() {
- return dbus_object_manager_->Suspend();
-}
-
-bool XWalkLauncherTizen::Resume() {
- return dbus_object_manager_->Resume();
-}
-
-void XWalkLauncherTizen::application_event_cb(app_event event,
- void* data, bundle* b) {
- XWalkLauncherTizen* xwalk_launcher = static_cast<XWalkLauncherTizen*>(data);
- LOG(INFO) << "event '" << Event2Str(event) << "'";
switch (event) {
case AE_UNKNOWN:
case AE_CREATE:
break;
case AE_TERMINATE:
- xwalk_launcher->main_loop_->QuitNow();
+ exit(0);
break;
case AE_PAUSE:
- if (!xwalk_launcher->Suspend())
- LOG(ERROR) << "Suspending application failed";
+ g_dbus_proxy_call(
+ app_proxy, "Suspend", NULL,
+ G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
break;
case AE_RESUME:
- if (!xwalk_launcher->Resume())
- LOG(ERROR) << "Resuming application failed";
+ g_dbus_proxy_call(
+ app_proxy, "Resume", NULL,
+ G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
break;
case AE_RESET:
- if (!xwalk_launcher->LaunchApplication())
- xwalk_launcher->main_loop_->QuitNow();
- break;
case AE_LOWMEM_POST:
case AE_MEM_FLUSH:
case AE_MAX:
}
}
-int XWalkLauncherTizen::XwalkAppcoreInit(const std::string& name,
- int argc, char* argv[]) {
- app_ops.cb_app = application_event_cb;
- app_ops.data = this;
- return appcore_init(name.c_str(), &app_ops, argc, argv);
+int xwalk_appcore_init(
+ int argc, char** argv, const char* name, GDBusProxy* app_proxy) {
+ appcore_ops.cb_app = application_event_cb;
+ appcore_ops.data = app_proxy;
+
+ return appcore_init(name, &appcore_ops, argc, argv);
}
-int XWalkLauncherTizen::XwalkChangeCmdline(const std::string& app_id,
- int argc, char* argv[]) {
+int xwalk_change_cmdline(int argc, char** argv, const char* app_id) {
// Change /proc/<pid>/cmdline to app exec path. See XWALK-1722 for details.
pkgmgrinfo_appinfo_h handle;
- char* exec_path = nullptr;
+ char* exec_path = NULL;
// todo : add is_admin
- if (pkgmgrinfo_appinfo_get_usr_appinfo(app_id.c_str(),
+ if (pkgmgrinfo_appinfo_get_usr_appinfo(app_id,
getuid(), &handle) != PMINFO_R_OK ||
pkgmgrinfo_appinfo_get_exec(handle, &exec_path) != PMINFO_R_OK ||
!exec_path) {
- if (pkgmgrinfo_appinfo_get_appinfo(app_id.c_str(), &handle) !=
- PMINFO_R_OK ||
+ if (pkgmgrinfo_appinfo_get_appinfo(app_id, &handle) != PMINFO_R_OK ||
pkgmgrinfo_appinfo_get_exec(handle, &exec_path) != PMINFO_R_OK ||
!exec_path) {
- LOG(ERROR) << "Couldn't find exec path for application: " << app_id;
+ fprintf(stderr, "Couldn't find exec path for application: %s\n", app_id);
return -1;
}
}
- // zeros g_argv_
for (int i = 0; i < argc; ++i)
memset(argv[i], 0, strlen(argv[i]));
-
- strncpy(argv[0], exec_path, strlen(exec_path) + 1);
+ strncpy(argv[0], exec_path, strlen(exec_path)+1);
pkgmgrinfo_appinfo_destroy_appinfo(handle);
return 0;
}
// Copyright (c) 2013 Intel Corporation. All rights reserved.
-// Copyright (c) 2014 Samsung Electronics Co., Ltd 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_LINUX_XWALK_LAUNCHER_TIZEN_H_
#define XWALK_APPLICATION_TOOLS_LINUX_XWALK_LAUNCHER_TIZEN_H_
-#include <appcore-common.h>
-#include <glib.h>
+int xwalk_appcore_init(int argc, char** argv,
+ const char* name, GDBusProxy* app_proxy);
-#include <memory>
-#include <string>
-
-#include "base/message_loop/message_loop.h"
-
-#include "xwalk/application/common/id_util.h"
-#include "xwalk/application/tools/linux/xwalk_launcher.h"
-#include "xwalk/application/tools/tizen/xwalk_tizen_user.h"
-
-// Private enum from appcore-internal
-extern "C" enum app_event {
- AE_UNKNOWN,
- AE_CREATE,
- AE_TERMINATE,
- AE_PAUSE,
- AE_RESUME,
- AE_RESET,
- AE_LOWMEM_POST,
- AE_MEM_FLUSH,
- AE_MAX
-};
-
-class XWalkLauncherTizen : public XWalkLauncher {
- public:
- XWalkLauncherTizen(bool query_running, base::MessageLoop* main_loop);
- int Launch(const std::string& appid_or_url, bool fullscreen,
- bool remote_debugging, int argc, char* argv[]);
- bool Suspend();
- bool Resume();
-
- private:
- static void application_event_cb(app_event event, void* data, bundle* b);
- int XwalkAppcoreInit(const std::string& name, int argc, char* argv[]);
- int XwalkChangeCmdline(const std::string& app_id, int argc, char* argv[]);
-
- base::MessageLoop* main_loop_;
-};
+int xwalk_change_cmdline(int argc, char** argv, const char* app_id);
#endif // XWALK_APPLICATION_TOOLS_LINUX_XWALK_LAUNCHER_TIZEN_H_
#include "base/path_service.h"
#include "xwalk/application/common/id_util.h"
#include "xwalk/application/common/tizen/application_storage.h"
+#include "xwalk/application/tools/linux/dbus_connection.h"
#include "xwalk/application/tools/tizen/xwalk_package_installer.h"
#include "xwalk/application/tools/tizen/xwalk_tizen_user.h"
#include "xwalk/runtime/common/xwalk_paths.h"
<uses-sdk
android:minSdkVersion="14"
- android:targetSdkVersion="19" />
+ android:targetSdkVersion="21" />
</manifest>
%define _binary_payload w3.gzdio
Name: crosswalk
-Version: 11.40.271.0
+Version: 11.40.277.0
Release: 0
Summary: Chromium-based app runtime
License: (BSD-3-Clause and LGPL-2.1+)
# does not expect -Wall to be passed to the compiler (see webrtc issue 3307).
export CXXFLAGS=`echo $CXXFLAGS | sed s,-Wall,,g`
+# Do not use -finline-functions: it breaks the build because it causes -Wall to
+# warn about some conditions that cannot really be reached (ie. variables that
+# may be used uninitialized while in fact thay cannot be uninitialized). See
+# TC-2299.
+export CXXFLAGS=`echo $CXXFLAGS | sed s,-finline-functions,,g`
+
# For ffmpeg on ia32. The original CFLAGS set by the gyp and config files in
# src/third_party/ffmpeg already pass -O2 -fomit-frame-pointer, but Tizen's
# CFLAGS end up appending -fno-omit-frame-pointer. See http://crbug.com/37246
mContentsClient.onToggleFullscreen(true);
}
- // Add the video view to the activity's ContentView.
- activity.getWindow().addContentView(view,
+ // Add the video view to the activity's DecorView.
+ FrameLayout decor = (FrameLayout) activity.getWindow().getDecorView();
+ decor.addView(mCustomXWalkView, 0,
new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
android:label="XWalkCoreLibraryEmpty" android:hardwareAccelerated="true">
</application>
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
+ <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
</manifest>
android:authorities="org.xwalk.core.internal.xwview.test.TestContentProvider" />
</application>
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
+ <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
android:authorities="org.xwalk.core.xwview.test.TestContentProvider" />
</application>
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
+ <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
android:label="XWalkCoreLibrary" android:hardwareAccelerated="true" android:icon="@drawable/crosswalk">
</application>
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
+ <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
</manifest>
<uses-sdk
android:minSdkVersion="14"
- android:targetSdkVersion="19" />
+ android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
#include "xwalk/runtime/browser/android/net/url_constants.h"
using base::android::AttachCurrentThread;
+using base::android::DetachFromVM;
using base::PostTaskAndReplyWithResult;
using content::BrowserThread;
using xwalk::InputStream;
base::Bind(callback,
base::Passed(delegate.Pass()),
base::Passed(input_stream.Pass())));
+
+ DetachFromVM();
}
} // namespace
command_line->AppendSwitch(switches::kAllowFileAccessFromFiles);
// Enable SIMD.JS API by default.
- /*std::string js_flags("--simd_object");
+ std::string js_flags("--simd_object");
if (command_line->HasSwitch(switches::kJavaScriptFlags)) {
js_flags += " ";
js_flags +=
command_line->GetSwitchValueASCII(switches::kJavaScriptFlags);
}
- command_line->AppendSwitchASCII(switches::kJavaScriptFlags, js_flags);*/
+ command_line->AppendSwitchASCII(switches::kJavaScriptFlags, js_flags);
startup_url_ = GetURLFromCommandLine(*command_line);
}
return base::StringPiece();
}
+void MoveUserDataDirIfNecessary(const base::FilePath& user_data_dir,
+ const base::FilePath& profile) {
+ if (base::DirectoryExists(profile))
+ return;
+
+ if (!base::CreateDirectory(profile))
+ return;
+
+ const char* possible_data_dir_names[] = {
+ "Cache",
+ "Cookies",
+ "Cookies-journal",
+ "Local Storage",
+ };
+ for (int i = 0; i < 4; i++) {
+ base::FilePath dir = user_data_dir.Append(possible_data_dir_names[i]);
+ if (base::PathExists(dir)) {
+ if (!base::Move(dir, profile.Append(possible_data_dir_names[i]))) {
+ NOTREACHED() << "Failed to import previous user data: "
+ << possible_data_dir_names[i];
+ }
+ }
+ }
+}
+
} // namespace
namespace xwalk {
NOTREACHED() << "Failed to get app data directory for Crosswalk";
}
CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(switches::kXWalkProfileName))
- user_data_dir = user_data_dir.Append(
+ if (command_line->HasSwitch(switches::kXWalkProfileName)) {
+ base::FilePath profile = user_data_dir.Append(
command_line->GetSwitchValuePath(switches::kXWalkProfileName));
+ MoveUserDataDirIfNecessary(user_data_dir, profile);
+ user_data_dir = profile;
+ }
base::FilePath cookie_store_path = user_data_dir.Append(
FILE_PATH_LITERAL("Cookies"));
const std::string name;
};
+XWalkRuntimeFeatures::RuntimeFeature::RuntimeFeature()
+ : status(Experimental),
+ enabled(false) {
+}
+
// static
XWalkRuntimeFeatures* XWalkRuntimeFeatures::GetInstance() {
return Singleton<XWalkRuntimeFeatures>::get();
Experimental
};
-
struct RuntimeFeature {
std::string name;
std::string description;
std::string command_line_switch;
RuntimeFeatureStatus status;
bool enabled;
- RuntimeFeature() = default;
+
+ RuntimeFeature();
};
private:
// if under WARP mode.
if (url.GetOrigin() == app_url.GetOrigin() ||
blink::WebSecurityOrigin::create(app_url).canRequest(url)) {
- LOG(INFO) << "[PASS] " << origin_url.spec() << " request " << url.spec();
+ DLOG(INFO) << "[PASS] " << origin_url.spec() << " request " << url.spec();
return false;
}
<uses-library android:name="android.test.runner" />
</application>
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
+ <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="org.xwalk.core.xwview.shell"
android:label="Test for org.xwalk.core.xwview" />
<uses-library android:name="android.test.runner" />
</application>
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
+ <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="org.xwalk.core.internal.xwview.shell"
android:label="Test for org.xwalk.core.internal.xwview" />
android:authorities="org.xwalk.runtime.client.test.TestContentProvider" />
</application>
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
+ <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="org.xwalk.runtime.client.shell"
android:label="Test for org.xwalk.runtime.client" />
android:authorities="org.xwalk.runtime.client.embedded.test.TestContentProvider" />
</application>
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
+ <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="org.xwalk.runtime.client.embedded.shell"
android:label="Test for org.xwalk.runtime.client.embedded" />
if (attr)
mrp_res_set_attribute_string(attr, app_class.c_str());
- attr = mrp_res_get_attribute_by_name(resource, "resource.set.appid");
+ attr = mrp_res_get_attribute_by_name(resource, "name");
if (attr)
mrp_res_set_attribute_string(attr, app_id.c_str());