Upstream version 6.35.132.0 39/20439/1
authorEurogiciel-BOT <eurogiciel.tizen@gmail.com>
Wed, 7 May 2014 08:44:51 +0000 (08:44 +0000)
committerEurogiciel-BOT <eurogiciel.tizen@gmail.com>
Wed, 7 May 2014 08:44:51 +0000 (08:44 +0000)
Upstream commit-id 2d7493e1cdc071bbcc6df7f1bd641b722e55464c

Change-Id: I549ddb27f573fdf1d77efb27c345905ca0fdd8b0
Signed-off-by: Eurogiciel-BOT <eurogiciel.tizen@gmail.com>
13 files changed:
packaging/crosswalk.spec
src/xwalk/VERSION
src/xwalk/application/browser/application_protocols.cc
src/xwalk/application/browser/linux/running_application_object.cc
src/xwalk/application/browser/linux/running_application_object.h
src/xwalk/application/common/application_manifest_constants.cc
src/xwalk/application/common/manifest.cc
src/xwalk/application/tools/linux/xwalk_extension_process_launcher.cc
src/xwalk/application/tools/linux/xwalk_extension_process_launcher.h
src/xwalk/packaging/crosswalk.spec
src/xwalk/runtime/android/core/src/org/xwalk/core/XWalkView.java
src/xwalk/runtime/android/runtime/src/org/xwalk/runtime/XWalkCoreProviderImpl.java
src/xwalk/runtime/browser/xwalk_browser_main_parts_android.cc

index 292de2f..6cedf75 100644 (file)
@@ -2,7 +2,7 @@
 %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+)
index 7ac2bcc..efaa7da 100644 (file)
@@ -1,4 +1,4 @@
 MAJOR=6
 MINOR=35
-BUILD=131
+BUILD=132
 PATCH=0
index 78a252e..d81fcd2 100644 (file)
@@ -27,6 +27,7 @@
 #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"
@@ -265,6 +266,22 @@ class ApplicationProtocolHandler
   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 {
@@ -303,7 +320,12 @@ ApplicationProtocolHandler::MaybeCreateJob(
   }
 
   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,
index b53b19d..19b8cd5 100644 (file)
@@ -7,6 +7,7 @@
 #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"
@@ -133,15 +134,15 @@ void RunningApplicationObject::OnTerminate(
 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)
@@ -193,6 +194,27 @@ void RunningApplicationObject::OnLauncherDisappeared() {
   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;
index 02e0812..3dc2ad1 100644 (file)
 #include "xwalk/application/browser/application.h"
 #include "xwalk/dbus/object_manager_adaptor.h"
 
+namespace dbus {
+class FileDescriptor;
+}
+
 namespace xwalk {
 namespace application {
 
@@ -58,6 +62,11 @@ class RunningApplicationObject : public dbus::ManagedObject {
 
   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_;
index 40dc276..345e9a1 100644 (file)
@@ -86,7 +86,7 @@ const char kAllowNavigationKey[] = "widget.allow-navigation.#text";
 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";
index ba9647d..8495e35 100644 (file)
@@ -270,9 +270,6 @@ void Manifest::ParseWGTI18nEachPath(const std::string& path) {
         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,
index 75ffc9c..30cc2ba 100644 (file)
@@ -2,6 +2,7 @@
 // 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"
@@ -9,6 +10,7 @@
 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);
@@ -18,6 +20,10 @@ XWalkExtensionProcessLauncher::~XWalkExtensionProcessLauncher() {
   Stop();
 }
 
+void XWalkExtensionProcessLauncher::CleanUp() {
+  extension_process_.reset();
+}
+
 void XWalkExtensionProcessLauncher::Launch(
     const std::string& channel_id, int channel_fd) {
   is_started_ = true;
index 573aa66..776293a 100644 (file)
@@ -9,6 +9,10 @@
 
 #include "base/threading/thread.h"
 
+namespace base {
+class AtExitManager;
+}
+
 namespace xwalk {
 namespace extensions {
 class XWalkExtensionProcess;
@@ -20,6 +24,9 @@ class XWalkExtensionProcessLauncher: public base::Thread {
   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);
 
@@ -29,6 +36,7 @@ class XWalkExtensionProcessLauncher: public base::Thread {
   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_;
 };
 
index 292de2f..6cedf75 100644 (file)
@@ -2,7 +2,7 @@
 %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+)
index 8cd941d..49771f4 100644 (file)
@@ -53,6 +53,8 @@ public class XWalkView extends android.widget.FrameLayout {
     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;
@@ -186,6 +188,8 @@ public class XWalkView extends android.widget.FrameLayout {
     }
 
     private void initXWalkContent(Context context, AttributeSet attrs) {
+        mIsTimerPaused = false;
+        mIsHidden = false;
         mContent = new XWalkContent(context, attrs, this);
         addView(mContent,
                 new FrameLayout.LayoutParams(
@@ -369,34 +373,46 @@ public class XWalkView extends android.widget.FrameLayout {
     }
 
     /**
-     * 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;
     }
 
     /**
@@ -405,9 +421,10 @@ public class XWalkView extends android.widget.FrameLayout {
      * 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;
     }
 
     /**
index a432f86..d8ad1db 100644 (file)
@@ -52,11 +52,13 @@ class XWalkCoreProviderImpl implements XWalkRuntimeViewProvider {
 
     @Override
     public void onResume() {
+        mXWalkView.resumeTimers();
         mXWalkView.onShow();
     }
 
     @Override
     public void onPause() {
+        mXWalkView.pauseTimers();
         mXWalkView.onHide();
     }
 
index 7310f5d..10fe45d 100644 (file)
@@ -102,6 +102,12 @@ void XWalkBrowserMainPartsAndroid::PreMainMessageLoopStart() {
     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();