%bcond_with wayland
Name: crosswalk
-Version: 6.35.131.0
+Version: 6.35.132.0
Release: 0
Summary: Crosswalk is an app runtime based on Chromium
License: (BSD-3-Clause and LGPL-2.1+)
MAJOR=6
MINOR=35
-BUILD=131
+BUILD=132
PATCH=0
#include "net/url_request/url_request_error_job.h"
#include "net/url_request/url_request_file_job.h"
#include "net/url_request/url_request_simple_job.h"
+#include "xwalk/runtime/browser/xwalk_runner.h"
#include "xwalk/application/browser/application_service.h"
#include "xwalk/application/common/application_data.h"
#include "xwalk/application/common/application_file_util.h"
DISALLOW_COPY_AND_ASSIGN(ApplicationProtocolHandler);
};
+// The |locale| should be expanded to user agent locale.
+// Such as, "en-us" will be expaned as "en-us, en".
+void GetUserAgentLocales(const std::string& sys_locale,
+ std::list<std::string>& ua_locales) {
+ if (sys_locale.empty())
+ return;
+
+ std::string locale = StringToLowerASCII(sys_locale);
+ size_t position;
+ do {
+ ua_locales.push_back(locale);
+ position = locale.find_last_of("-");
+ locale = locale.substr(0, position);
+ } while (position != std::string::npos);
+}
+
net::URLRequestJob*
ApplicationProtocolHandler::MaybeCreateJob(
net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
}
std::list<std::string> locales;
- // FIXME(Xinchao): Get the user agent locales into |locales|.
+ if (application->GetPackageType() == Manifest::TYPE_WGT) {
+ GetUserAgentLocales(
+ xwalk::XWalkRunner::GetInstance()->GetLocale(), locales);
+ GetUserAgentLocales(application->GetManifest()->default_locale(), locales);
+ }
+
return new URLRequestApplicationJob(
request,
network_delegate,
#include <string>
#include "base/values.h"
#include "base/bind.h"
+#include "content/public/browser/browser_thread.h"
#include "dbus/bus.h"
#include "dbus/message.h"
#include "dbus/exported_object.h"
void RunningApplicationObject::OnGetExtensionProcessChannel(
dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender response_sender) {
- scoped_ptr<dbus::Response> response =
- dbus::Response::FromMethodCall(method_call);
- dbus::MessageWriter writer(response.get());
-
- writer.AppendString(ep_bp_channel_.name);
- dbus::FileDescriptor client_fd(ep_bp_channel_.socket.fd);
- client_fd.CheckValidity();
- writer.AppendFileDescriptor(client_fd);
- response_sender.Run(response.Pass());
+ content::BrowserThread::PostTaskAndReplyWithResult(
+ content::BrowserThread::FILE,
+ FROM_HERE,
+ base::Bind(&RunningApplicationObject::CreateClientFileDescriptor,
+ base::Unretained(this)),
+ base::Bind(&RunningApplicationObject::SendChannel,
+ base::Unretained(this),
+ method_call,
+ response_sender));
}
#if defined(OS_TIZEN)
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) {
+ scoped_ptr<dbus::Response> response =
+ dbus::Response::FromMethodCall(method_call);
+ dbus::MessageWriter writer(response.get());
+
+ writer.AppendString(ep_bp_channel_.name);
+ writer.AppendFileDescriptor(*client_fd);
+ response_sender.Run(response.Pass());
+}
+
void RunningApplicationObject::ExtensionProcessCreated(
const IPC::ChannelHandle& handle) {
ep_bp_channel_ = handle;
#include "xwalk/application/browser/application.h"
#include "xwalk/dbus/object_manager_adaptor.h"
+namespace dbus {
+class FileDescriptor;
+}
+
namespace xwalk {
namespace application {
void OnLauncherDisappeared();
+ scoped_ptr<dbus::FileDescriptor> CreateClientFileDescriptor();
+ void SendChannel(dbus::MethodCall* method_call,
+ dbus::ExportedObject::ResponseSender response_sender,
+ scoped_ptr<dbus::FileDescriptor> client_fd);
+
scoped_refptr<dbus::Bus> bus_;
std::string launcher_name_;
dbus::Bus::GetServiceOwnerCallback owner_change_callback_;
const char kCSPReportOnlyKey[] =
"widget.content-security-policy-report-only.#text";
const char kTizenSettingKey[] = "widget.setting";
-const char kTizenHardwareKey[] = "widget.setting.@hwkey";
+const char kTizenHardwareKey[] = "widget.setting.@hwkey-event";
const char kTizenMetaDataKey[] = "widget.metadata";
// Child keys inside 'kTizenMetaDataKey'
const char kTizenMetaDataNameKey[] = "@key";
get_first_one = ParseWGTI18nEachElement(*it, path, kLocaleFirstOne);
}
}
- // After Parse we remove this path from data_ for saving memory.
- scoped_ptr<base::Value> remove_value;
- data_->Remove(path, &remove_value);
}
bool Manifest::ParseWGTI18nEachElement(base::Value* value,
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/at_exit.h"
#include "base/message_loop/message_loop.h"
#include "xwalk/application/tools/linux/xwalk_extension_process_launcher.h"
#include "xwalk/extensions/extension_process/xwalk_extension_process.h"
XWalkExtensionProcessLauncher::XWalkExtensionProcessLauncher()
: base::Thread("LauncherExtensionService"),
is_started_(false) {
+ exit_manager_.reset(new base::AtExitManager);
base::Thread::Options thread_options;
thread_options.message_loop_type = base::MessageLoop::TYPE_DEFAULT;
StartWithOptions(thread_options);
Stop();
}
+void XWalkExtensionProcessLauncher::CleanUp() {
+ extension_process_.reset();
+}
+
void XWalkExtensionProcessLauncher::Launch(
const std::string& channel_id, int channel_fd) {
is_started_ = true;
#include "base/threading/thread.h"
+namespace base {
+class AtExitManager;
+}
+
namespace xwalk {
namespace extensions {
class XWalkExtensionProcess;
XWalkExtensionProcessLauncher();
~XWalkExtensionProcessLauncher();
+ // Implement base::Thread.
+ virtual void CleanUp() OVERRIDE;
+
// Will be called in launcher's main thread.
void Launch(const std::string& channel_id, int channel_fd);
void StartExtensionProcess(const std::string& channel_id, int channel_fd);
bool is_started_;
+ scoped_ptr<base::AtExitManager> exit_manager_;
scoped_ptr<xwalk::extensions::XWalkExtensionProcess> extension_process_;
};
%bcond_with wayland
Name: crosswalk
-Version: 6.35.131.0
+Version: 6.35.132.0
Release: 0
Summary: Crosswalk is an app runtime based on Chromium
License: (BSD-3-Clause and LGPL-2.1+)
private Activity mActivity;
private Context mContext;
private XWalkExtensionManager mExtensionManager;
+ private boolean mIsTimerPaused;
+ private boolean mIsHidden;
/** Normal reload mode as default. */
public static final int RELOAD_NORMAL = 0;
}
private void initXWalkContent(Context context, AttributeSet attrs) {
+ mIsTimerPaused = false;
+ mIsHidden = false;
mContent = new XWalkContent(context, attrs, this);
addView(mContent,
new FrameLayout.LayoutParams(
}
/**
- * Pause timers of rendering engine. Typically it should be called
- * when the activity for this view is paused.
+ * Pause all layout, parsing and JavaScript timers for all XWalkView instances.
+ * Typically it should be called when the activity for this view is paused,
+ * and accordingly {@link #resumeTimers} should be called when the activity
+ * is resumed again.
+ *
+ * Note that it will globally impact all XWalkView instances, not limited to
+ * just this XWalkView.
*/
public void pauseTimers() {
- if (mContent == null) return;
+ if (mContent == null || mIsTimerPaused) return;
checkThreadSafety();
mContent.pauseTimers();
+ mIsTimerPaused = true;
}
/**
- * Resume timers of rendering engine. Typically it should be called
- * when the activyt for this view is resumed.
+ * Resume all layout, parsing and JavaScript timers for all XWalkView instances.
+ * Typically it should be called when the activity for this view is resumed.
+ *
+ * Note that it will globally impact all XWalkView instances, not limited to
+ * just this XWalkView.
*/
public void resumeTimers() {
- if (mContent == null) return;
+ if (mContent == null || !mIsTimerPaused) return;
checkThreadSafety();
mContent.resumeTimers();
+ mIsTimerPaused = false;
}
/**
- * Aside from timers, this method can pause many other things inside
- * rendering engine, like video player, modal dialogs, etc.
+ * Pause many other things except JavaScript timers inside rendering engine,
+ * like video player, modal dialogs, etc. See {@link #pauseTimers} about pausing
+ * JavaScript timers.
* Typically it should be called when the activity for this view is paused.
*/
public void onHide() {
- if (mContent == null) return;
+ if (mContent == null || mIsHidden) return;
mExtensionManager.onPause();
mContent.onPause();
+ mIsHidden = true;
}
/**
* Typically it should be called when the activity for this view is resumed.
*/
public void onShow() {
- if (mContent == null) return;
+ if (mContent == null || !mIsHidden ) return;
mExtensionManager.onResume();
mContent.onResume();
+ mIsHidden = false;
}
/**
@Override
public void onResume() {
+ mXWalkView.resumeTimers();
mXWalkView.onShow();
}
@Override
public void onPause() {
+ mXWalkView.pauseTimers();
mXWalkView.onHide();
}
command_line->AppendSwitch(switches::kEnableWebAudio);
#endif
+ // For fullscreen video playback, the ContentVideoView is still buggy, so
+ // we switch back to ContentVideoViewLegacy for temp.
+ // TODO(shouqun): Remove this flag when ContentVideoView is ready.
+ command_line->AppendSwitch(
+ switches::kDisableOverlayFullscreenVideoSubtitle);
+
XWalkBrowserMainParts::PreMainMessageLoopStart();
startup_url_ = GURL();