From: Eurogiciel-BOT Date: Tue, 25 Nov 2014 17:49:49 +0000 (+0000) Subject: Upstream version 11.39.252.0 X-Git-Tag: submit/tizen_ivi/20141202.061342~12 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fframework%2Fweb%2Fcrosswalk.git;a=commitdiff_plain;h=a5108fcda22462462a0c9692e802750284d31512 Upstream version 11.39.252.0 Upstream commit-id cb597304661d57d6dccd81b85158f1eff9f98287 Change-Id: I9421f34199704d02743ba444ddb9422abc282f7b Signed-off-by: Eurogiciel-BOT --- diff --git a/packaging/Blink-Add-GCC-flag-Wno-narrowing-fix-64bits-build.patch b/packaging/Blink-Add-GCC-flag-Wno-narrowing-fix-64bits-build.patch deleted file mode 100644 index 56e41d2..0000000 --- a/packaging/Blink-Add-GCC-flag-Wno-narrowing-fix-64bits-build.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Yannick GICQUEL -Date: Wed, 29 Jan 2014 11:20:11 +0100 - -Build is broken on x86_64 due to narrowing warning treated as an error. -This patch is a workaround to avoid this warning. Correction should be -placed in generated code V8DOMConfiguration::ConstantConfiguration::value - -BUG=https://crosswalk-project.org/jira/browse/XWALK-917 - -Signed-off-by: Yannick GICQUEL ---- src/third_party/WebKit/Source/config.gyp -+++ src/third_party/WebKit/Source/config.gyp -@@ -84,6 +84,11 @@ - # nullptr) conflict with upcoming c++0x types. - 'cflags_cc': ['-Wno-c++0x-compat'], - }], -+ ['gcc_version>=47', { -+ # Disable warnings about narrowing conversion due to C++11 std. -+ # Jira: https://crosswalk-project.org/jira/browse/XWALK-917 -+ 'cflags_cc': ['-Wno-narrowing'], -+ }], - ['OS=="linux" and target_arch=="arm"', { - # Due to a bug in gcc arm, we get warnings about uninitialized - # timesNewRoman.unstatic.3258 and colorTransparent.unstatic.4879. - diff --git a/packaging/crosswalk.spec b/packaging/crosswalk.spec index 14c1ea0..12c5ffa 100644 --- a/packaging/crosswalk.spec +++ b/packaging/crosswalk.spec @@ -24,7 +24,7 @@ %define _binary_payload w3.gzdio Name: crosswalk -Version: 11.39.250.0 +Version: 11.39.252.0 Release: 0 Summary: Chromium-based app runtime License: (BSD-3-Clause and LGPL-2.1+) @@ -37,9 +37,9 @@ Source3: xwalk.service.in Source1001: crosswalk.manifest Source1002: %{name}.xml.in Source1003: %{name}.png -Patch9: Blink-Add-GCC-flag-Wno-narrowing-fix-64bits-build.patch Patch10: crosswalk-do-not-look-for-gtk-dependencies-on-x11.patch +BuildRequires: binutils-gold BuildRequires: bison BuildRequires: bzip2-devel BuildRequires: elfutils @@ -141,8 +141,6 @@ cp -a src/AUTHORS AUTHORS.chromium cp -a src/LICENSE LICENSE.chromium cp -a src/xwalk/LICENSE LICENSE.xwalk -%patch9 - # The profiles using Wayland (and thus Ozone) do not need this patch. %if !%{with wayland} %patch10 @@ -196,24 +194,18 @@ GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Duse_ozone=1" GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Ddisable_nacl=%{_disable_nacl}" -# Linking fails in Tizen Common when fatal ld warnings are enabled. XWALK-1379. -%if "%{profile}" == "common" || "%{profile}" == "generic" +# Linking fails when fatal ld warnings are enabled. See XWALK-1379. GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Ddisable_fatal_linker_warnings=1" -%endif # For building for arm in OBS, we need : # -> to unset sysroot value. # sysroot variable is automatically set for cross compilation to use arm-sysroot provided by Chromium project -# -> to force system ld binary. -# Indeed the build is made on Emulated / Virtualized environment that correspond -# to the target. -# gold ld used is avaible only for 32/64 bits Intel Arch. # sysroot usage is not needed, we need to use arm libraries from the virtualized environment. # # Crosswalk build fails if the fpu selected in the gcc option is different from neon in case of arm7 compilation # So force it. %ifarch %{arm} -GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Dsysroot= -Dlinux_use_gold_binary=0" +GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Dsysroot= " export CFLAGS=`echo $CFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g` export CXXFLAGS=`echo $CXXFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g` export FFLAGS=`echo $FFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g` @@ -231,6 +223,9 @@ export GYP_GENERATORS='ninja' ${GYP_EXTRA_FLAGS} \ -Dchromeos=0 \ -Dclang=0 \ +-Dlinux_use_bundled_binutils=0 \ +-Dlinux_use_bundled_gold=0 \ +-Dlinux_use_gold_flags=1 \ -Dtizen=1 \ -Dpython_ver=2.7 \ -Duse_aura=1 \ @@ -249,34 +244,34 @@ ninja %{?_smp_mflags} -C src/out/Release xwalk xwalk_launcher xwalk_application_ %install # Binaries. -install -p -D %{SOURCE2} %{buildroot}%{_dbusservicedir}/org.crosswalkproject.Runtime1.service -install -p -D xwalk.service %{buildroot}%{_systemduserservicedir}/xwalk.service -install -p -D src/out/Release/xwalk %{buildroot}%{_libdir}/xwalk/xwalk -install -p -D src/out/Release/xwalkctl %{buildroot}%{_bindir}/xwalkctl -install -p -D src/out/Release/xwalk-launcher %{buildroot}%{_bindir}/xwalk-launcher -install -p -D src/out/Release/xwalk_backend %{buildroot}%{_libdir}/xwalk/xwalk_backend -install -p -D src/out/Release/lib/libxwalk_backend_lib.so %{buildroot}%{_libdir}/xwalk/libxwalk_backend_lib.so +install -m 0755 -p -D src/out/Release/xwalk %{buildroot}%{_libdir}/xwalk/xwalk +install -m 0755 -p -D src/out/Release/xwalkctl %{buildroot}%{_bindir}/xwalkctl +install -m 0755 -p -D src/out/Release/xwalk-launcher %{buildroot}%{_bindir}/xwalk-launcher +install -m 0755 -p -D src/out/Release/xwalk_backend %{buildroot}%{_libdir}/xwalk/xwalk_backend # Supporting libraries and resources. -install -p -D src/out/Release/icudtl.dat %{buildroot}%{_libdir}/xwalk/icudtl.dat -install -p -D src/out/Release/libffmpegsumo.so %{buildroot}%{_libdir}/xwalk/libffmpegsumo.so -install -p -D src/out/Release/xwalk.pak %{buildroot}%{_libdir}/xwalk/xwalk.pak -mkdir -p %{buildroot}%{_datadir}/xwalk -install -p -D src/xwalk/application/common/tizen/configuration/*.xsd %{buildroot}%{_datadir}/xwalk/ +install -m 0644 -p -D %{SOURCE2} %{buildroot}%{_dbusservicedir}/org.crosswalkproject.Runtime1.service +install -m 0644 -p -D xwalk.service %{buildroot}%{_systemduserservicedir}/xwalk.service +install -m 0644 -p -D src/out/Release/lib/libxwalk_backend_lib.so %{buildroot}%{_libdir}/xwalk/libxwalk_backend_lib.so +install -m 0644 -p -D src/out/Release/icudtl.dat %{buildroot}%{_libdir}/xwalk/icudtl.dat +install -m 0644 -p -D src/out/Release/libffmpegsumo.so %{buildroot}%{_libdir}/xwalk/libffmpegsumo.so +install -m 0644 -p -D src/out/Release/xwalk.pak %{buildroot}%{_libdir}/xwalk/xwalk.pak +install -d %{buildroot}%{_datadir}/xwalk +install -m 0644 -p -D src/xwalk/application/common/tizen/configuration/*.xsd %{buildroot}%{_datadir}/xwalk # PNaCl %if ! %{_disable_nacl} -install -p -D src/out/Release/nacl_bootstrap_raw %{buildroot}%{_libdir}/xwalk/nacl_bootstrap_raw -install -p -D src/out/Release/nacl_helper %{buildroot}%{_libdir}/xwalk/nacl_helper -install -p -D src/out/Release/nacl_helper_bootstrap %{buildroot}%{_libdir}/xwalk/nacl_helper_bootstrap -install -p -D src/out/Release/nacl_irt_*.nexe %{buildroot}%{_libdir}/xwalk -install -p -d %{buildroot}%{_libdir}/xwalk/pnacl -install -m 0664 -p -D src/out/Release/pnacl/* %{buildroot}%{_libdir}/xwalk/pnacl +install -m 0755 -p -D src/out/Release/nacl_bootstrap_raw %{buildroot}%{_libdir}/xwalk/nacl_bootstrap_raw +install -m 0755 -p -D src/out/Release/nacl_helper %{buildroot}%{_libdir}/xwalk/nacl_helper +install -m 0755 -p -D src/out/Release/nacl_helper_bootstrap %{buildroot}%{_libdir}/xwalk/nacl_helper_bootstrap +install -m 0644 -p -D src/out/Release/nacl_irt_*.nexe %{buildroot}%{_libdir}/xwalk +install -d %{buildroot}%{_libdir}/xwalk/pnacl +install -m 0644 -p -D src/out/Release/pnacl/* %{buildroot}%{_libdir}/xwalk/pnacl %endif # Register xwalk to the package manager. -install -p -D %{name}.xml %{buildroot}%{_manifestdir}/%{name}.xml -install -p -D %{name}.png %{buildroot}%{_desktop_icondir}/%{name}.png +install -m 0644 -p -D %{name}.xml %{buildroot}%{_manifestdir}/%{name}.xml +install -m 0644 -p -D %{name}.png %{buildroot}%{_desktop_icondir}/%{name}.png %post mkdir -p %{_desktop_icondir_ro} diff --git a/src/ozone/ui/events/event.gypi b/src/ozone/ui/events/event.gypi index 025833c..0e57406 100644 --- a/src/ozone/ui/events/event.gypi +++ b/src/ozone/ui/events/event.gypi @@ -17,6 +17,8 @@ 'keyboard_codes_ozone.h', 'keyboard_code_conversion_ozone.h', 'keyboard_code_conversion_ozone.cc', + 'keyboard_engine_xkb.h', + 'keyboard_engine_xkb.cc', 'output_change_observer.h', 'remote_event_dispatcher.h', 'remote_event_dispatcher.cc', diff --git a/src/ozone/ui/events/event_converter_in_process.cc b/src/ozone/ui/events/event_converter_in_process.cc index e9e5a86..eb759d8 100644 --- a/src/ozone/ui/events/event_converter_in_process.cc +++ b/src/ozone/ui/events/event_converter_in_process.cc @@ -13,10 +13,12 @@ namespace ui { EventConverterInProcess::EventConverterInProcess() : EventConverterOzoneWayland(), observer_(NULL), - output_observer_(NULL) { + output_observer_(NULL), + backend_(NULL) { } EventConverterInProcess::~EventConverterInProcess() { + delete backend_; } void EventConverterInProcess::MotionNotify(float x, float y) { @@ -57,14 +59,35 @@ void EventConverterInProcess::PointerLeave(unsigned handle, } void EventConverterInProcess::KeyNotify(ui::EventType type, - unsigned code, - unsigned modifiers) { + unsigned code) { + unsigned converted_code = backend_->ConvertKeyCodeFromEvdev(code); + unsigned flags = backend_->GetKeyBoardModifiers(); + ui::EventConverterOzoneWayland::PostTaskOnMainLoop(base::Bind( + &EventConverterInProcess::NotifyKeyEvent, this, type, + ui::KeyboardCodeFromNativeKeysym(converted_code), + ui::CharacterCodeFromNativeKeySym(converted_code, flags), flags)); +} + +void EventConverterInProcess::VirtualKeyNotify(ui::EventType type, + uint32_t key, + uint32_t modifiers) { + unsigned code = backend_->ConvertKeyCodeFromEvdev(key); ui::EventConverterOzoneWayland::PostTaskOnMainLoop(base::Bind( &EventConverterInProcess::NotifyKeyEvent, this, type, ui::KeyboardCodeFromNativeKeysym(code), ui::CharacterCodeFromNativeKeySym(code, modifiers), modifiers)); } +void EventConverterInProcess::KeyModifiers(uint32_t mods_depressed, + uint32_t mods_latched, + uint32_t mods_locked, + uint32_t group) { + backend_->OnKeyModifiers(mods_depressed, + mods_latched, + mods_locked, + group); +} + void EventConverterInProcess::TouchNotify(ui::EventType type, float x, float y, @@ -122,6 +145,18 @@ void EventConverterInProcess::PreeditStart() { &EventConverterInProcess::NotifyPreeditStart, this)); } +void EventConverterInProcess::InitializeXKB(base::SharedMemoryHandle fd, + uint32_t size) { + if (backend_) { + delete backend_; + backend_ = NULL; + } + + backend_ = new ui::KeyboardEngineXKB(); + backend_->OnKeyboardKeymap(fd.fd, size); + close(fd.fd); +} + void EventConverterInProcess::SetWindowChangeObserver( ui::WindowChangeObserver* observer) { observer_ = observer; diff --git a/src/ozone/ui/events/event_converter_in_process.h b/src/ozone/ui/events/event_converter_in_process.h index 2007e18..8df876c 100644 --- a/src/ozone/ui/events/event_converter_in_process.h +++ b/src/ozone/ui/events/event_converter_in_process.h @@ -10,6 +10,7 @@ #include "base/memory/scoped_ptr.h" #include "ozone/ui/events/event_converter_ozone_wayland.h" #include "ozone/ui/events/keyboard_code_conversion_ozone.h" +#include "ozone/ui/events/keyboard_engine_xkb.h" #include "ui/events/event.h" #include "ui/events/platform/platform_event_source.h" @@ -34,8 +35,14 @@ class EventConverterInProcess : public ui::EventConverterOzoneWayland, virtual void PointerEnter(unsigned handle, float x, float y) OVERRIDE; virtual void PointerLeave(unsigned handle, float x, float y) OVERRIDE; virtual void KeyNotify(ui::EventType type, - unsigned code, - unsigned modifiers) OVERRIDE; + unsigned code) override; + virtual void VirtualKeyNotify(ui::EventType type, + uint32_t key, + uint32_t modifiers) override; + virtual void KeyModifiers(uint32_t mods_depressed, + uint32_t mods_latched, + uint32_t mods_locked, + uint32_t group) override; virtual void TouchNotify(ui::EventType type, float x, float y, @@ -51,9 +58,11 @@ class EventConverterInProcess : public ui::EventConverterOzoneWayland, virtual void Commit(unsigned handle, const std::string& text) OVERRIDE; virtual void PreeditChanged(unsigned handle, const std::string& text, - const std::string& commit) OVERRIDE; - virtual void PreeditEnd() OVERRIDE; - virtual void PreeditStart() OVERRIDE; + const std::string& commit) override; + virtual void PreeditEnd() override; + virtual void PreeditStart() override; + virtual void InitializeXKB(base::SharedMemoryHandle fd, + uint32_t size) override; virtual void SetWindowChangeObserver( ui::WindowChangeObserver* observer) OVERRIDE; @@ -118,6 +127,7 @@ class EventConverterInProcess : public ui::EventConverterOzoneWayland, ui::WindowChangeObserver* observer_; ui::OutputChangeObserver* output_observer_; + ui::KeyboardEngineXKB* backend_; base::Callback dispatch_callback_; // NOLINT(readability/ // function) DISALLOW_COPY_AND_ASSIGN(EventConverterInProcess); diff --git a/src/ozone/ui/events/event_converter_ozone_wayland.h b/src/ozone/ui/events/event_converter_ozone_wayland.h index 095ef79..e4fb5c5 100644 --- a/src/ozone/ui/events/event_converter_ozone_wayland.h +++ b/src/ozone/ui/events/event_converter_ozone_wayland.h @@ -7,6 +7,7 @@ #include +#include "base/memory/shared_memory.h" #include "base/message_loop/message_loop.h" #include "ozone/platform/ozone_export_wayland.h" #include "ui/events/event_constants.h" @@ -36,8 +37,14 @@ class OZONE_WAYLAND_EXPORT EventConverterOzoneWayland { virtual void PointerEnter(unsigned handle, float x, float y) = 0; virtual void PointerLeave(unsigned handle, float x, float y) = 0; virtual void KeyNotify(ui::EventType type, - unsigned code, - unsigned modifiers) = 0; + unsigned code) = 0; + virtual void VirtualKeyNotify(ui::EventType type, + uint32_t key, + uint32_t modifiers) = 0; + virtual void KeyModifiers(uint32_t mods_depressed, + uint32_t mods_latched, + uint32_t mods_locked, + uint32_t group) = 0; virtual void TouchNotify(ui::EventType type, float x, float y, @@ -55,6 +62,9 @@ class OZONE_WAYLAND_EXPORT EventConverterOzoneWayland { const std::string& commit) = 0; virtual void PreeditEnd() = 0; virtual void PreeditStart() = 0; + virtual void InitializeXKB(base::SharedMemoryHandle fd, + uint32_t size) = 0; + // Sets the window change observer. Ownership is retained by the caller. virtual void SetWindowChangeObserver(WindowChangeObserver* observer); diff --git a/src/ozone/wayland/input/keyboard_engine_xkb.cc b/src/ozone/ui/events/keyboard_engine_xkb.cc similarity index 95% rename from src/ozone/wayland/input/keyboard_engine_xkb.cc rename to src/ozone/ui/events/keyboard_engine_xkb.cc index 60c0c4f..ca566ca 100644 --- a/src/ozone/wayland/input/keyboard_engine_xkb.cc +++ b/src/ozone/ui/events/keyboard_engine_xkb.cc @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ozone/wayland/input/keyboard_engine_xkb.h" +#include "ozone/ui/events/keyboard_engine_xkb.h" #include #include "ozone/ui/events/keyboard_codes_ozone.h" #include "ui/events/event.h" -namespace ozonewayland { +namespace ui { KeyboardEngineXKB::KeyboardEngineXKB() : keyboard_modifiers_(0), mods_depressed_(0), @@ -113,22 +113,6 @@ unsigned KeyboardEngineXKB::ConvertKeyCodeFromEvdev(unsigned hardwarecode) { return cached_sym_; } -bool KeyboardEngineXKB::IgnoreKeyNotify( - unsigned hardwarecode, bool pressed) { - // If the key is pressed or it's a special modifier key i.e altgr, we cannot - // ignore it. - // TODO(kalyan): Handle all needed cases here. - if (pressed || IsSpecialModifier(hardwarecode)) - return false; - - // No modifiers set, we don't have to deal with any special cases. Ignore the - // release events. - if (!keyboard_modifiers_ || IsOnlyCapsLocked()) - return true; - - return false; -} - void KeyboardEngineXKB::InitXKB() { if (context_) return; @@ -153,16 +137,6 @@ void KeyboardEngineXKB::FiniXKB() { } } -bool KeyboardEngineXKB::IsSpecialModifier(unsigned hardwarecode) { - switch (ConvertKeyCodeFromEvdev(hardwarecode)) { - case XKB_KEY_ISO_Level3_Shift: // altgr - return true; - break; - default: - return false; - } -} - bool KeyboardEngineXKB::IsOnlyCapsLocked() const { if ((keyboard_modifiers_ & ui::EF_CONTROL_DOWN) != 0) return false; @@ -529,4 +503,4 @@ void KeyboardEngineXKB::NormalizeKey() { } } -} // namespace ozonewayland +} // namespace ui diff --git a/src/ozone/wayland/input/keyboard_engine_xkb.h b/src/ozone/ui/events/keyboard_engine_xkb.h similarity index 80% rename from src/ozone/wayland/input/keyboard_engine_xkb.h rename to src/ozone/ui/events/keyboard_engine_xkb.h index b6eea61..db88e12 100644 --- a/src/ozone/wayland/input/keyboard_engine_xkb.h +++ b/src/ozone/ui/events/keyboard_engine_xkb.h @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef OZONE_WAYLAND_INPUT_KEYBOARD_ENGINE_XKB_H_ -#define OZONE_WAYLAND_INPUT_KEYBOARD_ENGINE_XKB_H_ +#ifndef OZONE_UI_EVENTS_INPUT_KEYBOARD_ENGINE_XKB_H_ +#define OZONE_UI_EVENTS_INPUT_KEYBOARD_ENGINE_XKB_H_ #include #include "base/basictypes.h" -namespace ozonewayland { +namespace ui { class KeyboardEngineXKB { public: @@ -22,14 +22,12 @@ class KeyboardEngineXKB { uint32_t mods_locked, uint32_t group); unsigned ConvertKeyCodeFromEvdev(unsigned hardwarecode); - bool IgnoreKeyNotify(unsigned hardwarecode, bool pressed); uint32_t GetKeyBoardModifiers() const { return keyboard_modifiers_; } private: void InitXKB(); void FiniXKB(); - bool IsSpecialModifier(unsigned hardwarecode); bool IsOnlyCapsLocked() const; void NormalizeKey(); @@ -52,6 +50,6 @@ class KeyboardEngineXKB { DISALLOW_COPY_AND_ASSIGN(KeyboardEngineXKB); }; -} // namespace ozonewayland +} // namespace ui -#endif // OZONE_WAYLAND_INPUT_KEYBOARD_ENGINE_XKB_H_ +#endif // OZONE_UI_EVENTS_INPUT_KEYBOARD_ENGINE_XKB_H_ diff --git a/src/ozone/ui/events/remote_event_dispatcher.cc b/src/ozone/ui/events/remote_event_dispatcher.cc index 1850705..8c367a1 100644 --- a/src/ozone/ui/events/remote_event_dispatcher.cc +++ b/src/ozone/ui/events/remote_event_dispatcher.cc @@ -54,9 +54,24 @@ void RemoteEventDispatcher::PointerLeave(unsigned handle, } void RemoteEventDispatcher::KeyNotify(ui::EventType type, - unsigned code, - unsigned modifiers) { - Dispatch(new WaylandInput_KeyNotify(type, code, modifiers)); + unsigned code) { + Dispatch(new WaylandInput_KeyNotify(type, code)); +} + +void RemoteEventDispatcher::VirtualKeyNotify(ui::EventType type, + uint32_t key, + uint32_t modifiers) { + Dispatch(new WaylandInput_VirtualKeyNotify(type, key, modifiers)); +} + +void RemoteEventDispatcher::KeyModifiers(uint32_t mods_depressed, + uint32_t mods_latched, + uint32_t mods_locked, + uint32_t group) { + Dispatch(new WaylandInput_KeyModifiers(mods_depressed, + mods_latched, + mods_locked, + group)); } void RemoteEventDispatcher::TouchNotify(ui::EventType type, @@ -105,6 +120,11 @@ void RemoteEventDispatcher::PreeditStart() { Dispatch(new WaylandInput_PreeditStart()); } +void RemoteEventDispatcher::InitializeXKB(base::SharedMemoryHandle fd, + uint32_t size) { + Dispatch(new WaylandInput_InitializeXKB(fd, size)); +} + void RemoteEventDispatcher::Dispatch(IPC::Message* message) { ui::EventConverterOzoneWayland::PostTaskOnMainLoop( base::Bind(&RemoteEventDispatcher::Send, this, message)); diff --git a/src/ozone/ui/events/remote_event_dispatcher.h b/src/ozone/ui/events/remote_event_dispatcher.h index a80cfca..1514c97 100644 --- a/src/ozone/ui/events/remote_event_dispatcher.h +++ b/src/ozone/ui/events/remote_event_dispatcher.h @@ -36,8 +36,14 @@ class RemoteEventDispatcher : public ui::EventConverterOzoneWayland { virtual void PointerEnter(unsigned handle, float x, float y) OVERRIDE; virtual void PointerLeave(unsigned handle, float x, float y) OVERRIDE; virtual void KeyNotify(ui::EventType type, - unsigned code, - unsigned modifiers) OVERRIDE; + unsigned code) override; + virtual void VirtualKeyNotify(ui::EventType type, + uint32_t key, + uint32_t modifiers) override; + virtual void KeyModifiers(uint32_t mods_depressed, + uint32_t mods_latched, + uint32_t mods_locked, + uint32_t group) override; virtual void TouchNotify(ui::EventType type, float x, float y, @@ -54,9 +60,11 @@ class RemoteEventDispatcher : public ui::EventConverterOzoneWayland { virtual void Commit(unsigned handle, const std::string& text) OVERRIDE; virtual void PreeditChanged(unsigned handle, const std::string& text, - const std::string& commit) OVERRIDE; - virtual void PreeditEnd() OVERRIDE; - virtual void PreeditStart() OVERRIDE; + const std::string& commit) override; + virtual void PreeditEnd() override; + virtual void PreeditStart() override; + virtual void InitializeXKB(base::SharedMemoryHandle fd, + uint32_t size) override; private: void Dispatch(IPC::Message* message); diff --git a/src/ozone/ui/public/messages.h b/src/ozone/ui/public/messages.h index ca351a9..f97c37b 100644 --- a/src/ozone/ui/public/messages.h +++ b/src/ozone/ui/public/messages.h @@ -7,6 +7,7 @@ #include #include "base/basictypes.h" +#include "base/memory/shared_memory.h" #include "base/strings/string16.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_utils.h" @@ -29,6 +30,25 @@ IPC_ENUM_TRAITS_MAX_VALUE(ui::WidgetState, IPC_ENUM_TRAITS_MAX_VALUE(ui::WidgetType, ui::POPUP) +IPC_MESSAGE_CONTROL2(WaylandInput_InitializeXKB, // NOLINT(readability/fn_size) + base::SharedMemoryHandle /*fd*/, + uint32_t /*size*/) + +IPC_MESSAGE_CONTROL2(WaylandInput_KeyNotify, // NOLINT(readability/fn_size) + ui::EventType /*type*/, + unsigned /*code*/) + +IPC_MESSAGE_CONTROL3(WaylandInput_VirtualKeyNotify, // NOLINT(readability/fn_size) + ui::EventType /*type*/, + uint32_t /*key*/, + uint32_t /*modifiers*/) + +IPC_MESSAGE_CONTROL4(WaylandInput_KeyModifiers, // NOLINT(readability/fn_size) + uint32_t /*mods_depressed*/, + uint32_t /*mods_latched*/, + uint32_t /*mods_locked*/, + uint32_t /*group*/) + IPC_MESSAGE_CONTROL2(WaylandInput_MotionNotify, // NOLINT(readability/fn_size) float /*x*/, float /*y*/) @@ -63,11 +83,6 @@ IPC_MESSAGE_CONTROL3(WaylandInput_PointerLeave, // NOLINT(readability/fn_size) float /*x*/, float /*y*/) -IPC_MESSAGE_CONTROL3(WaylandInput_KeyNotify, // NOLINT(readability/fn_size) - ui::EventType /*type*/, - unsigned /*code*/, - unsigned /*modifiers*/) - IPC_MESSAGE_CONTROL2(WaylandInput_OutputSize, // NOLINT(readability/fn_size) unsigned /*width*/, unsigned /*height*/) diff --git a/src/ozone/ui/public/ozone_channel_host.cc b/src/ozone/ui/public/ozone_channel_host.cc index 88fba8c..f17d080 100644 --- a/src/ozone/ui/public/ozone_channel_host.cc +++ b/src/ozone/ui/public/ozone_channel_host.cc @@ -53,6 +53,8 @@ bool OzoneChannelHost::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(WaylandInput_PointerEnter, OnPointerEnter) IPC_MESSAGE_HANDLER(WaylandInput_PointerLeave, OnPointerLeave) IPC_MESSAGE_HANDLER(WaylandInput_KeyNotify, OnKeyNotify) + IPC_MESSAGE_HANDLER(WaylandInput_VirtualKeyNotify, OnVirtualKeyNotify) + IPC_MESSAGE_HANDLER(WaylandInput_KeyModifiers, OnKeyModifiers) IPC_MESSAGE_HANDLER(WaylandInput_OutputSize, OnOutputSizeChanged) IPC_MESSAGE_HANDLER(WaylandInput_CloseWidget, OnCloseWidget) IPC_MESSAGE_HANDLER(WaylandWindow_Resized, OnWindowResized) @@ -61,6 +63,7 @@ bool OzoneChannelHost::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(WaylandInput_PreeditChanged, OnPreeditChanged) IPC_MESSAGE_HANDLER(WaylandInput_PreeditEnd, OnPreeditEnd) IPC_MESSAGE_HANDLER(WaylandInput_PreeditStart, OnPreeditStart) + IPC_MESSAGE_HANDLER(WaylandInput_InitializeXKB, OnInitializeXKB) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -107,9 +110,24 @@ void OzoneChannelHost::OnPointerLeave(unsigned handle, } void OzoneChannelHost::OnKeyNotify(ui::EventType type, - unsigned code, - unsigned modifiers) { - event_converter_->KeyNotify(type, code, modifiers); + unsigned code) { + event_converter_->KeyNotify(type, code); +} + +void OzoneChannelHost::OnVirtualKeyNotify(ui::EventType type, + uint32_t key, + uint32_t modifiers) { + event_converter_->VirtualKeyNotify(type, key, modifiers); +} + +void OzoneChannelHost::OnKeyModifiers(uint32_t mods_depressed, + uint32_t mods_latched, + uint32_t mods_locked, + uint32_t group) { + event_converter_->KeyModifiers(mods_depressed, + mods_latched, + mods_locked, + group); } void OzoneChannelHost::OnOutputSizeChanged(unsigned width, @@ -146,4 +164,9 @@ void OzoneChannelHost::OnPreeditEnd() { void OzoneChannelHost::OnPreeditStart() { } +void OzoneChannelHost::OnInitializeXKB(base::SharedMemoryHandle fd, + uint32_t size) { + event_converter_->InitializeXKB(fd, size); +} + } // namespace ui diff --git a/src/ozone/ui/public/ozone_channel_host.h b/src/ozone/ui/public/ozone_channel_host.h index ca73db7..1b08f40 100644 --- a/src/ozone/ui/public/ozone_channel_host.h +++ b/src/ozone/ui/public/ozone_channel_host.h @@ -7,6 +7,7 @@ #include +#include "base/memory/shared_memory.h" #include "ui/events/event_constants.h" #include "ui/ozone/public/gpu_platform_support_host.h" @@ -40,7 +41,14 @@ class OzoneChannelHost : public GpuPlatformSupportHost { void OnAxisNotify(float x, float y, int xoffset, int yoffset); void OnPointerEnter(unsigned handle, float x, float y); void OnPointerLeave(unsigned handle, float x, float y); - void OnKeyNotify(ui::EventType type, unsigned code, unsigned modifiers); + void OnKeyNotify(ui::EventType type, unsigned code); + void OnVirtualKeyNotify(ui::EventType type, + uint32_t key, + uint32_t modifiers); + void OnKeyModifiers(uint32_t mods_depressed, + uint32_t mods_latched, + uint32_t mods_locked, + uint32_t group); void OnOutputSizeChanged(unsigned width, unsigned height); void OnCloseWidget(unsigned handle); void OnWindowResized(unsigned handle, @@ -51,6 +59,7 @@ class OzoneChannelHost : public GpuPlatformSupportHost { void OnPreeditChanged(unsigned handle, std::string text, std::string commit); void OnPreeditEnd(); void OnPreeditStart(); + void OnInitializeXKB(base::SharedMemoryHandle fd, uint32_t size); private: RemoteStateChangeHandler* state_handler_; diff --git a/src/ozone/wayland/display.cc b/src/ozone/wayland/display.cc index 0cf82ac..cf3a6b3 100644 --- a/src/ozone/wayland/display.cc +++ b/src/ozone/wayland/display.cc @@ -430,6 +430,7 @@ void WaylandDisplay::DisplayHandleGlobal(void *data, } else if (strcmp(interface, "wl_shm") == 0) { disp->shm_ = static_cast( wl_registry_bind(registry, name, &wl_shm_interface, 1)); + WaylandCursor::InitializeCursorData(disp->shm_); } else if (strcmp(interface, "wl_text_input_manager") == 0) { disp->text_input_manager_ = static_cast( wl_registry_bind(registry, name, &wl_text_input_manager_interface, 1)); diff --git a/src/ozone/wayland/display_poll_thread.cc b/src/ozone/wayland/display_poll_thread.cc index 4d24c99..421d67e 100644 --- a/src/ozone/wayland/display_poll_thread.cc +++ b/src/ozone/wayland/display_poll_thread.cc @@ -62,6 +62,9 @@ WaylandDisplayPollThread::WaylandDisplayPollThread(wl_display* display) polling_(true, false), stop_polling_(true, false) { DCHECK(display_); + epoll_fd_ = osEpollCreateCloExec(); + if (epoll_fd_ < 0) + LOG(ERROR) << "Epoll creation failed."; } WaylandDisplayPollThread::~WaylandDisplayPollThread() { @@ -69,7 +72,7 @@ WaylandDisplayPollThread::~WaylandDisplayPollThread() { } void WaylandDisplayPollThread::StartProcessingEvents() { - DCHECK(!polling_.IsSignaled()); + DCHECK(!polling_.IsSignaled() && epoll_fd_); base::Thread::Options options; options.message_loop_type = base::MessageLoop::TYPE_IO; StartWithOptions(options); @@ -87,6 +90,8 @@ void WaylandDisplayPollThread::StopProcessingEvents() { void WaylandDisplayPollThread::CleanUp() { SetThreadWasQuitProperly(true); + if (epoll_fd_) + close(epoll_fd_); } void WaylandDisplayPollThread::DisplayRun(WaylandDisplayPollThread* data) { @@ -95,16 +100,12 @@ void WaylandDisplayPollThread::DisplayRun(WaylandDisplayPollThread* data) { uint32_t event = 0; bool epoll_err = false; unsigned display_fd = wl_display_get_fd(data->display_); - int epoll_fd = osEpollCreateCloExec(); - if (epoll_fd < 0) { - LOG(ERROR) << "Epoll creation failed."; - return; - } - + int epoll_fd = data->epoll_fd_; ep[0].events = EPOLLIN; ep[0].data.ptr = 0; if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, display_fd, &ep[0]) < 0) { close(epoll_fd); + data->epoll_fd_ = 0; LOG(ERROR) << "epoll_ctl Add failed"; return; } @@ -163,7 +164,6 @@ void WaylandDisplayPollThread::DisplayRun(WaylandDisplayPollThread* data) { break; } - close(epoll_fd); data->polling_.Reset(); data->stop_polling_.Reset(); } diff --git a/src/ozone/wayland/display_poll_thread.h b/src/ozone/wayland/display_poll_thread.h index ed2ec98..2c4b611 100644 --- a/src/ozone/wayland/display_poll_thread.h +++ b/src/ozone/wayland/display_poll_thread.h @@ -32,6 +32,7 @@ class WaylandDisplayPollThread : public base::Thread { static void DisplayRun(WaylandDisplayPollThread* data); base::WaitableEvent polling_; // Is set as long as the thread is polling. base::WaitableEvent stop_polling_; + int epoll_fd_; wl_display* display_; DISALLOW_COPY_AND_ASSIGN(WaylandDisplayPollThread); }; diff --git a/src/ozone/wayland/input/cursor.cc b/src/ozone/wayland/input/cursor.cc index 58b6c23..c291037 100644 --- a/src/ozone/wayland/input/cursor.cc +++ b/src/ozone/wayland/input/cursor.cc @@ -106,7 +106,7 @@ WaylandCursorData::~WaylandCursorData() { WaylandCursor::WaylandCursor(wl_shm* shm) : input_pointer_(NULL), pointer_surface_(NULL), current_cursor_(CURSOR_UNSET) { - WaylandCursorData::InitializeCursorData(shm); + DCHECK(WaylandCursorData::GetInstance()); WaylandDisplay* display = WaylandDisplay::GetInstance(); pointer_surface_ = wl_compositor_create_surface(display->GetCompositor()); } @@ -120,6 +120,10 @@ void WaylandCursor::Clear() { WaylandCursorData::DestroyCursorData(); } +void WaylandCursor::InitializeCursorData(wl_shm* shm) { + WaylandCursorData::InitializeCursorData(shm); +} + void WaylandCursor::Update(CursorType type, uint32_t serial) { if (!input_pointer_) return; diff --git a/src/ozone/wayland/input/cursor.h b/src/ozone/wayland/input/cursor.h index d0ae84c..37ab6ba 100644 --- a/src/ozone/wayland/input/cursor.h +++ b/src/ozone/wayland/input/cursor.h @@ -49,6 +49,11 @@ class WaylandCursor { // needed. No other class should call this. static void Clear(); + // Initializes CursorData. WaylandDisplay is responsible for calling this as + // needed. No other class should call this. We do it this way to avoid + // initializing theme under sandbox. + static void InitializeCursorData(wl_shm* shm); + void Update(CursorType type, uint32_t serial); wl_pointer* GetInputPointer() const { return input_pointer_; } diff --git a/src/ozone/wayland/input/keyboard.cc b/src/ozone/wayland/input/keyboard.cc index cd29a04..b786d9f 100644 --- a/src/ozone/wayland/input/keyboard.cc +++ b/src/ozone/wayland/input/keyboard.cc @@ -5,18 +5,14 @@ #include "ozone/wayland/input/keyboard.h" #include "ozone/ui/events/event_factory_ozone_wayland.h" -#include "ozone/wayland/input/keyboard_engine_xkb.h" namespace ozonewayland { WaylandKeyboard::WaylandKeyboard() : input_keyboard_(NULL), - dispatcher_(NULL), - backend_(NULL) { + dispatcher_(NULL) { } WaylandKeyboard::~WaylandKeyboard() { - delete backend_; - if (input_keyboard_) wl_keyboard_destroy(input_keyboard_); } @@ -33,17 +29,10 @@ void WaylandKeyboard::OnSeatCapabilities(wl_seat *seat, uint32_t caps) { dispatcher_ = ui::EventFactoryOzoneWayland::GetInstance()->EventConverter(); if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input_keyboard_) { - DCHECK(!backend_); - backend_ = new KeyboardEngineXKB(); input_keyboard_ = wl_seat_get_keyboard(seat); wl_keyboard_add_listener(input_keyboard_, &kInputKeyboardListener, this); } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input_keyboard_) { - if (backend_) { - delete backend_; - backend_ = NULL; - } - wl_keyboard_destroy(input_keyboard_); input_keyboard_ = NULL; } @@ -61,13 +50,7 @@ void WaylandKeyboard::OnKeyNotify(void* data, if (state == WL_KEYBOARD_KEY_STATE_RELEASED) type = ui::ET_KEY_RELEASED; - // Check if we can ignore the KeyEvent notification, saves an IPC call. - if (device->backend_->IgnoreKeyNotify(key, type == ui::ET_KEY_PRESSED)) - return; - - device->dispatcher_->KeyNotify(type, - device->backend_->ConvertKeyCodeFromEvdev(key), - device->backend_->GetKeyBoardModifiers()); + device->dispatcher_->KeyNotify(type, key); } void WaylandKeyboard::OnKeyboardKeymap(void *data, @@ -87,8 +70,8 @@ void WaylandKeyboard::OnKeyboardKeymap(void *data, return; } - device->backend_->OnKeyboardKeymap(fd, size); - close(fd); + base::SharedMemoryHandle section = base::FileDescriptor(fd, true); + device->dispatcher_->InitializeXKB(section, size); } void WaylandKeyboard::OnKeyboardEnter(void* data, @@ -114,7 +97,7 @@ void WaylandKeyboard::OnKeyModifiers(void *data, uint32_t mods_locked, uint32_t group) { WaylandKeyboard* device = static_cast(data); - device->backend_->OnKeyModifiers(mods_depressed, + device->dispatcher_->KeyModifiers(mods_depressed, mods_latched, mods_locked, group); diff --git a/src/ozone/wayland/input/keyboard.h b/src/ozone/wayland/input/keyboard.h index ef29bbe..6a9295e 100644 --- a/src/ozone/wayland/input/keyboard.h +++ b/src/ozone/wayland/input/keyboard.h @@ -5,8 +5,6 @@ #ifndef OZONE_WAYLAND_INPUT_KEYBOARD_H_ #define OZONE_WAYLAND_INPUT_KEYBOARD_H_ -#include - #include "ozone/wayland/display.h" namespace ui { @@ -15,13 +13,10 @@ class EventConverterOzoneWayland; namespace ozonewayland { -class KeyboardEngineXKB; - class WaylandKeyboard { public: WaylandKeyboard(); ~WaylandKeyboard(); - KeyboardEngineXKB* GetBackend() { return backend_;} void OnSeatCapabilities(wl_seat *seat, uint32_t caps); @@ -60,7 +55,6 @@ class WaylandKeyboard { wl_keyboard* input_keyboard_; ui::EventConverterOzoneWayland* dispatcher_; - KeyboardEngineXKB* backend_; DISALLOW_COPY_AND_ASSIGN(WaylandKeyboard); }; diff --git a/src/ozone/wayland/input/text_input.cc b/src/ozone/wayland/input/text_input.cc index 11a2b54..4b8c70f 100644 --- a/src/ozone/wayland/input/text_input.cc +++ b/src/ozone/wayland/input/text_input.cc @@ -10,7 +10,6 @@ #include "ozone/ui/events/keyboard_codes_ozone.h" #include "ozone/wayland/display.h" #include "ozone/wayland/input/keyboard.h" -#include "ozone/wayland/input/keyboard_engine_xkb.h" #include "ozone/wayland/input_device.h" #include "ozone/wayland/shell/shell_surface.h" #include "ozone/wayland/window.h" @@ -93,42 +92,15 @@ void WaylandTextInput::OnKeysym(void* data, uint32_t key, uint32_t state, uint32_t modifiers) { - WaylandTextInput* textInuput = static_cast(data); - // Copid from WaylandKeyboard::OnKeyNotify() ui::EventType type = ui::ET_KEY_PRESSED; WaylandDisplay::GetInstance()->SetSerial(serial); if (state == WL_KEYBOARD_KEY_STATE_RELEASED) type = ui::ET_KEY_RELEASED; - // Check if we can ignore the KeyEvent notification, saves an IPC call. - if (textInuput->getInputDevice()->GetKeyBoard()->GetBackend()-> - IgnoreKeyNotify(key, type == ui::ET_KEY_PRESSED)) - return; - ui::EventConverterOzoneWayland* dispatcher = ui::EventFactoryOzoneWayland::GetInstance()->EventConverter(); - - switch (key) { - case XKB_KEY_KP_Enter: - case XKB_KEY_Return: - case XKB_KEY_ISO_Enter: - dispatcher->KeyNotify(type, ui::OZONEACTIONKEY_RETURN, modifiers); - break; - case XKB_KEY_BackSpace: // FIXME: Back space is not handled. - dispatcher->KeyNotify(type, ui::OZONEACTIONKEY_BACK, modifiers); - break; - case XKB_KEY_Left: - case XKB_KEY_KP_Left: - dispatcher->KeyNotify(type, ui::OZONEACTIONKEY_LEFT, modifiers); - break; - case XKB_KEY_Right: - case XKB_KEY_KP_Right: - dispatcher->KeyNotify(type, ui::OZONEACTIONKEY_RIGHT, modifiers); - break; - default: - break; - } + dispatcher->VirtualKeyNotify(type, key, modifiers); } void WaylandTextInput::OnEnter(void* data, diff --git a/src/ozone/wayland/wayland.gyp b/src/ozone/wayland/wayland.gyp index 160935c..652ada2 100644 --- a/src/ozone/wayland/wayland.gyp +++ b/src/ozone/wayland/wayland.gyp @@ -71,8 +71,6 @@ 'input/cursor.h', 'input/keyboard.cc', 'input/keyboard.h', - 'input/keyboard_engine_xkb.h', - 'input/keyboard_engine_xkb.cc', 'input/pointer.cc', 'input/pointer.h', 'input/text_input.h', diff --git a/src/xwalk/DEPS.xwalk b/src/xwalk/DEPS.xwalk index a7fdaeb..c5ad9ca 100644 --- a/src/xwalk/DEPS.xwalk +++ b/src/xwalk/DEPS.xwalk @@ -19,7 +19,7 @@ chromium_crosswalk_rev = '35b73bc7d43d8dcab600c2afedcdcf21de0651ee' v8_crosswalk_rev = '5b2efeab77f1cda6d70f98f20b393fe40ea6898a' -ozone_wayland_rev = '8f3a1b59dd183087269400208947031cac5fcfcd' +ozone_wayland_rev = '6379cd118da098b55a5934ce1a90b377a177ed40' # |blink_crosswalk_rev| specifies the SHA1 hash of the blink-crosswalk commit # we want to point to, very much like the variables above. diff --git a/src/xwalk/VERSION b/src/xwalk/VERSION index 56be335..4d9f482 100644 --- a/src/xwalk/VERSION +++ b/src/xwalk/VERSION @@ -1,4 +1,4 @@ MAJOR=11 MINOR=39 -BUILD=250 +BUILD=252 PATCH=0 diff --git a/src/xwalk/application/browser/application.cc b/src/xwalk/application/browser/application.cc index 8b7acc4..ed9b1c0 100644 --- a/src/xwalk/application/browser/application.cc +++ b/src/xwalk/application/browser/application.cc @@ -109,8 +109,11 @@ GURL Application::GetStartURL() { #if defined(OS_TIZEN) if (data_->IsHostedApp()) { std::string source; - data_->GetManifest()->GetString(widget_keys::kLaunchLocalPathKey, &source); - GURL url = GURL(source); + GURL url; + if (data_->GetManifest()->GetString( + widget_keys::kLaunchLocalPathKey, &source)) { + url = GURL(source); + } if (url.is_valid() && url.SchemeIsHTTPOrHTTPS()) return url; @@ -135,9 +138,10 @@ template<> GURL Application::GetStartURL() { if (data_->IsHostedApp()) { std::string source; - data_->GetManifest()->GetString(keys::kStartURLKey, &source); // Not trying to get a relative path for the "fake" application. - return GURL(source); + if (data_->GetManifest()->GetString(keys::kStartURLKey, &source)) + return GURL(source); + return GURL(); } GURL url = GetAbsoluteURLFromKey(keys::kStartURLKey); @@ -393,9 +397,9 @@ bool Application::SetPermission(PermissionType type, void Application::InitSecurityPolicy() { // CSP policy takes precedence over WARP. if (data_->HasCSPDefined()) - security_policy_.reset(new SecurityPolicyCSP(this)); + security_policy_.reset(new ApplicationSecurityPolicyCSP(this)); else if (data_->manifest_type() == Manifest::TYPE_WIDGET) - security_policy_.reset(new SecurityPolicyWARP(this)); + security_policy_.reset(new ApplicationSecurityPolicyWARP(this)); if (security_policy_) security_policy_->Enforce(); diff --git a/src/xwalk/application/browser/application.h b/src/xwalk/application/browser/application.h index 24522e2..b8ef3ea 100644 --- a/src/xwalk/application/browser/application.h +++ b/src/xwalk/application/browser/application.h @@ -19,8 +19,8 @@ #include "base/observer_list.h" #include "content/public/browser/render_process_host_observer.h" #include "ui/base/ui_base_types.h" +#include "xwalk/application/browser/application_security_policy.h" #include "xwalk/application/common/application_data.h" -#include "xwalk/application/common/security_policy.h" #include "xwalk/runtime/browser/runtime.h" #include "xwalk/runtime/browser/runtime_ui_strategy.h" @@ -37,7 +37,7 @@ namespace application { class ApplicationHost; class Manifest; -class SecurityPolicy; +class ApplicationSecurityPolicy; // The Application class is representing an active (running) application. // Application instances are owned by ApplicationService. @@ -174,7 +174,7 @@ class Application : public Runtime::Observer, // Application's session permissions. StoredPermissionMap permission_map_; // Security policy. - scoped_ptr security_policy_; + scoped_ptr security_policy_; // Remote debugging enabled or not for this Application bool remote_debugging_enabled_; // WeakPtrFactory should be always declared the last. diff --git a/src/xwalk/application/common/security_policy.cc b/src/xwalk/application/browser/application_security_policy.cc similarity index 84% rename from src/xwalk/application/common/security_policy.cc rename to src/xwalk/application/browser/application_security_policy.cc index bef3cd0..e8f936f 100644 --- a/src/xwalk/application/common/security_policy.cc +++ b/src/xwalk/application/browser/application_security_policy.cc @@ -1,8 +1,9 @@ // Copyright (c) 2014 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/common/security_policy.h" +#include "xwalk/application/browser/application_security_policy.h" #include #include @@ -57,20 +58,21 @@ CSPInfo* GetDefaultCSPInfo() { } // namespace -SecurityPolicy::WhitelistEntry::WhitelistEntry(const GURL& url, bool subdomains) - : url(url), - subdomains(subdomains) { +ApplicationSecurityPolicy::WhitelistEntry::WhitelistEntry( + const GURL& url, bool subdomains) + : url(url), + subdomains(subdomains) { } -SecurityPolicy::SecurityPolicy(Application* app) - : app_(app), - enabled_(false) { +ApplicationSecurityPolicy::ApplicationSecurityPolicy(Application* app) + : app_(app), + enabled_(false) { } -SecurityPolicy::~SecurityPolicy() { +ApplicationSecurityPolicy::~ApplicationSecurityPolicy() { } -bool SecurityPolicy::IsAccessAllowed(const GURL& url) const { +bool ApplicationSecurityPolicy::IsAccessAllowed(const GURL& url) const { if (!enabled_) return true; @@ -91,10 +93,11 @@ bool SecurityPolicy::IsAccessAllowed(const GURL& url) const { return false; } -void SecurityPolicy::Enforce() { +void ApplicationSecurityPolicy::Enforce() { } -void SecurityPolicy::AddWhitelistEntry(const GURL& url, bool subdomains) { +void ApplicationSecurityPolicy::AddWhitelistEntry( + const GURL& url, bool subdomains) { GURL app_url = app_->data()->URL(); DCHECK(app_->render_process_host()); WhitelistEntry entry = WhitelistEntry(url, subdomains); @@ -109,14 +112,14 @@ void SecurityPolicy::AddWhitelistEntry(const GURL& url, bool subdomains) { whitelist_entries_.push_back(entry); } -SecurityPolicyWARP::SecurityPolicyWARP(Application* app) - : SecurityPolicy(app) { +ApplicationSecurityPolicyWARP::ApplicationSecurityPolicyWARP(Application* app) + : ApplicationSecurityPolicy(app) { } -SecurityPolicyWARP::~SecurityPolicyWARP() { +ApplicationSecurityPolicyWARP::~ApplicationSecurityPolicyWARP() { } -void SecurityPolicyWARP::Enforce() { +void ApplicationSecurityPolicyWARP::Enforce() { const WARPInfo* info = static_cast( app_->data()->GetManifestData(widget_keys::kAccessKey)); if (!info) { @@ -125,7 +128,7 @@ void SecurityPolicyWARP::Enforce() { app_->render_process_host()->Send( new ViewMsg_EnableSecurityMode( ApplicationData::GetBaseURLFromApplicationId(app_->id()), - SecurityPolicy::WARP)); + ApplicationSecurityPolicy::WARP)); return; } @@ -156,18 +159,18 @@ void SecurityPolicyWARP::Enforce() { app_->render_process_host()->Send( new ViewMsg_EnableSecurityMode( ApplicationData::GetBaseURLFromApplicationId(app_->id()), - SecurityPolicy::WARP)); + ApplicationSecurityPolicy::WARP)); } } -SecurityPolicyCSP::SecurityPolicyCSP(Application* app) - : SecurityPolicy(app) { +ApplicationSecurityPolicyCSP::ApplicationSecurityPolicyCSP(Application* app) + : ApplicationSecurityPolicy(app) { } -SecurityPolicyCSP::~SecurityPolicyCSP() { +ApplicationSecurityPolicyCSP::~ApplicationSecurityPolicyCSP() { } -void SecurityPolicyCSP::Enforce() { +void ApplicationSecurityPolicyCSP::Enforce() { Manifest::Type manifest_type = app_->data()->manifest_type(); const char* scp_key = GetCSPKey(manifest_type); CSPInfo* csp_info = @@ -228,7 +231,7 @@ void SecurityPolicyCSP::Enforce() { app_->render_process_host()->Send( new ViewMsg_EnableSecurityMode( ApplicationData::GetBaseURLFromApplicationId(app_->id()), - SecurityPolicy::CSP)); + ApplicationSecurityPolicy::CSP)); } } diff --git a/src/xwalk/application/common/security_policy.h b/src/xwalk/application/browser/application_security_policy.h similarity index 56% rename from src/xwalk/application/common/security_policy.h rename to src/xwalk/application/browser/application_security_policy.h index 9c14a74..01577bb 100644 --- a/src/xwalk/application/common/security_policy.h +++ b/src/xwalk/application/browser/application_security_policy.h @@ -1,9 +1,10 @@ // Copyright (c) 2014 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_COMMON_SECURITY_POLICY_H_ -#define XWALK_APPLICATION_COMMON_SECURITY_POLICY_H_ +#ifndef XWALK_APPLICATION_BROWSER_APPLICATION_SECURITY_POLICY_H_ +#define XWALK_APPLICATION_BROWSER_APPLICATION_SECURITY_POLICY_H_ #include @@ -14,9 +15,7 @@ namespace application { class Application; -// FIXME(Mikhail): Move to application/browser folder. -// Rename to ApplicationSecurityPolicy. -class SecurityPolicy { +class ApplicationSecurityPolicy { public: enum SecurityMode { NoSecurity, @@ -24,8 +23,8 @@ class SecurityPolicy { WARP }; - explicit SecurityPolicy(Application* app); - virtual ~SecurityPolicy(); + explicit ApplicationSecurityPolicy(Application* app); + virtual ~ApplicationSecurityPolicy(); bool IsAccessAllowed(const GURL& url) const; @@ -49,18 +48,18 @@ class SecurityPolicy { bool enabled_; }; -class SecurityPolicyWARP : public SecurityPolicy { +class ApplicationSecurityPolicyWARP : public ApplicationSecurityPolicy { public: - explicit SecurityPolicyWARP(Application* app); - virtual ~SecurityPolicyWARP(); + explicit ApplicationSecurityPolicyWARP(Application* app); + virtual ~ApplicationSecurityPolicyWARP(); virtual void Enforce() OVERRIDE; }; -class SecurityPolicyCSP : public SecurityPolicy { +class ApplicationSecurityPolicyCSP : public ApplicationSecurityPolicy { public: - explicit SecurityPolicyCSP(Application* app); - virtual ~SecurityPolicyCSP(); + explicit ApplicationSecurityPolicyCSP(Application* app); + virtual ~ApplicationSecurityPolicyCSP(); virtual void Enforce() OVERRIDE; }; @@ -68,4 +67,4 @@ class SecurityPolicyCSP : public SecurityPolicy { } // namespace application } // namespace xwalk -#endif // XWALK_APPLICATION_COMMON_SECURITY_POLICY_H_ +#endif // XWALK_APPLICATION_BROWSER_APPLICATION_SECURITY_POLICY_H_ diff --git a/src/xwalk/application/browser/application_system.cc b/src/xwalk/application/browser/application_system.cc index 740fc3a..c2c44e0 100644 --- a/src/xwalk/application/browser/application_system.cc +++ b/src/xwalk/application/browser/application_system.cc @@ -54,10 +54,10 @@ namespace { Application::LaunchParams launch_params( const base::CommandLine& cmd_line) { - Application::LaunchParams params; - params.force_fullscreen = cmd_line.HasSwitch(switches::kFullscreen); - params.remote_debugging = - cmd_line.HasSwitch(switches::kRemoteDebuggingPort); + Application::LaunchParams params = { + 0, + cmd_line.HasSwitch(switches::kFullscreen), + cmd_line.HasSwitch(switches::kRemoteDebuggingPort)}; return params; } diff --git a/src/xwalk/application/common/application_file_util.cc b/src/xwalk/application/common/application_file_util.cc index 19b7aca..52ee13d 100644 --- a/src/xwalk/application/common/application_file_util.cc +++ b/src/xwalk/application/common/application_file_util.cc @@ -62,6 +62,7 @@ const char kDirRLOKey[] = "rlo"; const char* kSingletonElements[] = { "allow-navigation", + "author", "content-security-policy-report-only", "content-security-policy", "content" diff --git a/src/xwalk/application/common/manifest_handlers/widget_handler.cc b/src/xwalk/application/common/manifest_handlers/widget_handler.cc index 084a353..4fb5bbb 100644 --- a/src/xwalk/application/common/manifest_handlers/widget_handler.cc +++ b/src/xwalk/application/common/manifest_handlers/widget_handler.cc @@ -125,8 +125,8 @@ bool WidgetHandler::Parse(scoped_refptr application, for (KeyMapIterator iter = map.begin(); iter != map.end(); ++iter) { std::string string; - manifest->GetString(iter->first, &string); - widget_info->SetString(iter->second, string); + bool result = manifest->GetString(iter->first, &string); + widget_info->SetString(iter->second, result ? string : ""); } base::Value* pref_value = NULL; diff --git a/src/xwalk/application/common/package/package.cc b/src/xwalk/application/common/package/package.cc index c5d4e5e..8adc5fa 100644 --- a/src/xwalk/application/common/package/package.cc +++ b/src/xwalk/application/common/package/package.cc @@ -16,11 +16,13 @@ namespace xwalk { namespace application { -Package::Package(const base::FilePath& source_path) +Package::Package(const base::FilePath& source_path, + Manifest::Type manifest_type) : source_path_(source_path), is_extracted_(false), is_valid_(false), - name_(source_path_.BaseName().AsUTF8Unsafe()) { + name_(source_path_.BaseName().AsUTF8Unsafe()), + manifest_type_(manifest_type) { } Package::~Package() { diff --git a/src/xwalk/application/common/package/package.h b/src/xwalk/application/common/package/package.h index b8fc9fb..138fcab 100644 --- a/src/xwalk/application/common/package/package.h +++ b/src/xwalk/application/common/package/package.h @@ -37,7 +37,7 @@ class Package { virtual bool ExtractTo(const base::FilePath& target_path); protected: - explicit Package(const base::FilePath& source_path); + Package(const base::FilePath& source_path, Manifest::Type manifest_type); // Unzipping of the zipped file happens in a temporary directory bool CreateTempDirectory(); scoped_ptr file_; diff --git a/src/xwalk/application/common/package/wgt_package.cc b/src/xwalk/application/common/package/wgt_package.cc index 8a471d8..b80fea5 100644 --- a/src/xwalk/application/common/package/wgt_package.cc +++ b/src/xwalk/application/common/package/wgt_package.cc @@ -32,10 +32,9 @@ WGTPackage::~WGTPackage() { } WGTPackage::WGTPackage(const base::FilePath& path) - : Package(path) { + : Package(path, Manifest::TYPE_WIDGET) { if (!base::PathExists(path)) return; - manifest_type_ = Manifest::TYPE_WIDGET; base::FilePath extracted_path; // FIXME : we should not call 'extract' here! if (!ExtractToTemporaryDir(&extracted_path)) diff --git a/src/xwalk/application/common/package/xpk_package.cc b/src/xwalk/application/common/package/xpk_package.cc index 7f55632..17c09d4 100644 --- a/src/xwalk/application/common/package/xpk_package.cc +++ b/src/xwalk/application/common/package/xpk_package.cc @@ -25,10 +25,10 @@ XPKPackage::~XPKPackage() { } XPKPackage::XPKPackage(const base::FilePath& path) - : Package(path) { + : Package(path, Manifest::TYPE_MANIFEST), + zip_addr_(0) { if (!base::PathExists(path)) return; - manifest_type_ = Manifest::TYPE_MANIFEST; scoped_ptr file( new base::ScopedFILE(base::OpenFile(path, "rb"))); file_ = file.Pass(); @@ -44,7 +44,10 @@ XPKPackage::XPKPackage(const base::FilePath& path) header_.signature_size <= XPKPackage::kMaxSignatureKeySize) { is_valid_ = true; zip_addr_ = sizeof(header_) + header_.key_size + header_.signature_size; - fseek(file_->get(), sizeof(header_), SEEK_SET); + if (fseek(file_->get(), sizeof(header_), SEEK_SET)) { + is_valid_ = false; + return; + } key_.resize(header_.key_size); size_t len = fread(&key_.front(), sizeof(uint8), header_.key_size, file_->get()); @@ -69,7 +72,8 @@ XPKPackage::XPKPackage(const base::FilePath& path) bool XPKPackage::VerifySignature() { // Set the file read position to the beginning of compressed resource file, // which is behind the magic header, public key and signature key. - fseek(file_->get(), zip_addr_, SEEK_SET); + if (fseek(file_->get(), zip_addr_, SEEK_SET)) + return false; crypto::SignatureVerifier verifier; if (!verifier.VerifyInit(kSignatureAlgorithm, sizeof(kSignatureAlgorithm), diff --git a/src/xwalk/application/extension/application_widget_storage.cc b/src/xwalk/application/extension/application_widget_storage.cc index 01569e7..7dc6caa 100644 --- a/src/xwalk/application/extension/application_widget_storage.cc +++ b/src/xwalk/application/extension/application_widget_storage.cc @@ -97,10 +97,11 @@ bool AppWidgetStorage::SaveConfigInfoItem(base::DictionaryValue* dict) { std::string key; std::string value; bool read_only = false; - dict->GetString(kPreferencesName, &key); - dict->GetString(kPreferencesValue, &value); - dict->GetBoolean(kPreferencesReadonly, &read_only); - return AddEntry(key, value, read_only); + if (dict->GetString(kPreferencesName, &key) && + dict->GetString(kPreferencesValue, &value) && + dict->GetBoolean(kPreferencesReadonly, &read_only)) + return AddEntry(key, value, read_only); + return false; } bool AppWidgetStorage::SaveConfigInfoInDB() { diff --git a/src/xwalk/application/xwalk_application.gypi b/src/xwalk/application/xwalk_application.gypi index b9728c2..b8a7be0 100644 --- a/src/xwalk/application/xwalk_application.gypi +++ b/src/xwalk/application/xwalk_application.gypi @@ -21,14 +21,13 @@ 'browser/application.h', 'browser/application_protocols.cc', 'browser/application_protocols.h', + 'browser/application_security_policy.cc', + 'browser/application_security_policy.h', 'browser/application_service.cc', 'browser/application_service.h', 'browser/application_system.cc', 'browser/application_system.h', - 'common/security_policy.cc', - 'common/security_policy.h', - 'extension/application_runtime_extension.cc', 'extension/application_runtime_extension.h', 'extension/application_widget_extension.cc', diff --git a/src/xwalk/extensions/common/android/xwalk_extension_android.cc b/src/xwalk/extensions/common/android/xwalk_extension_android.cc index 69b5b03..5ec1369 100644 --- a/src/xwalk/extensions/common/android/xwalk_extension_android.cc +++ b/src/xwalk/extensions/common/android/xwalk_extension_android.cc @@ -169,11 +169,11 @@ void XWalkExtensionAndroidInstance::HandleMessage( void XWalkExtensionAndroidInstance::HandleSyncMessage( scoped_ptr msg) { - base::StringValue* ret_val = new base::StringValue(""); + scoped_ptr ret_val(new base::StringValue("")); std::string value; if (!msg->GetAsString(&value)) { - SendSyncReplyToJS(scoped_ptr(ret_val)); + SendSyncReplyToJS(ret_val.Pass()); return; } @@ -181,7 +181,7 @@ void XWalkExtensionAndroidInstance::HandleSyncMessage( ScopedJavaLocalRef obj = java_ref_.get(env); if (obj.is_null()) { LOG(ERROR) << "No valid Java object is referenced for sync message routing"; - SendSyncReplyToJS(scoped_ptr(ret_val)); + SendSyncReplyToJS(ret_val.Pass()); return; } @@ -191,10 +191,10 @@ void XWalkExtensionAndroidInstance::HandleSyncMessage( env, obj.obj(), getID(), buffer.obj()); const char *str = env->GetStringUTFChars(ret.obj(), 0); - ret_val = new base::StringValue(str); + ret_val.reset(new base::StringValue(str)); env->ReleaseStringUTFChars(ret.obj(), str); - SendSyncReplyToJS(scoped_ptr(ret_val)); + SendSyncReplyToJS(ret_val.Pass()); } static jlong GetOrCreateExtension(JNIEnv* env, jobject obj, jstring name, diff --git a/src/xwalk/extensions/renderer/xwalk_extension_client.cc b/src/xwalk/extensions/renderer/xwalk_extension_client.cc index 9f6622c..aac329b 100644 --- a/src/xwalk/extensions/renderer/xwalk_extension_client.cc +++ b/src/xwalk/extensions/renderer/xwalk_extension_client.cc @@ -74,7 +74,8 @@ void XWalkExtensionClient::OnPostMessageToJS(int64_t instance_id, return; const base::Value* value; - msg.Get(0, &value); + if (!msg.Get(0, &value)) + return; it->second->HandleMessageFromNative(*value); } @@ -83,7 +84,8 @@ void XWalkExtensionClient::OnPostOutOfLineMessageToJS( CHECK(base::SharedMemory::IsHandleValid(handle)); base::SharedMemory shared_memory(handle, true); - shared_memory.Map(size); + if (!shared_memory.Map(size)) + return; IPC::Message message(static_cast(shared_memory.memory()), size); OnMessageReceived(message); diff --git a/src/xwalk/packaging/Blink-Add-GCC-flag-Wno-narrowing-fix-64bits-build.patch b/src/xwalk/packaging/Blink-Add-GCC-flag-Wno-narrowing-fix-64bits-build.patch deleted file mode 100644 index 56e41d2..0000000 --- a/src/xwalk/packaging/Blink-Add-GCC-flag-Wno-narrowing-fix-64bits-build.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Yannick GICQUEL -Date: Wed, 29 Jan 2014 11:20:11 +0100 - -Build is broken on x86_64 due to narrowing warning treated as an error. -This patch is a workaround to avoid this warning. Correction should be -placed in generated code V8DOMConfiguration::ConstantConfiguration::value - -BUG=https://crosswalk-project.org/jira/browse/XWALK-917 - -Signed-off-by: Yannick GICQUEL ---- src/third_party/WebKit/Source/config.gyp -+++ src/third_party/WebKit/Source/config.gyp -@@ -84,6 +84,11 @@ - # nullptr) conflict with upcoming c++0x types. - 'cflags_cc': ['-Wno-c++0x-compat'], - }], -+ ['gcc_version>=47', { -+ # Disable warnings about narrowing conversion due to C++11 std. -+ # Jira: https://crosswalk-project.org/jira/browse/XWALK-917 -+ 'cflags_cc': ['-Wno-narrowing'], -+ }], - ['OS=="linux" and target_arch=="arm"', { - # Due to a bug in gcc arm, we get warnings about uninitialized - # timesNewRoman.unstatic.3258 and colorTransparent.unstatic.4879. - diff --git a/src/xwalk/packaging/crosswalk.spec b/src/xwalk/packaging/crosswalk.spec index 14c1ea0..12c5ffa 100644 --- a/src/xwalk/packaging/crosswalk.spec +++ b/src/xwalk/packaging/crosswalk.spec @@ -24,7 +24,7 @@ %define _binary_payload w3.gzdio Name: crosswalk -Version: 11.39.250.0 +Version: 11.39.252.0 Release: 0 Summary: Chromium-based app runtime License: (BSD-3-Clause and LGPL-2.1+) @@ -37,9 +37,9 @@ Source3: xwalk.service.in Source1001: crosswalk.manifest Source1002: %{name}.xml.in Source1003: %{name}.png -Patch9: Blink-Add-GCC-flag-Wno-narrowing-fix-64bits-build.patch Patch10: crosswalk-do-not-look-for-gtk-dependencies-on-x11.patch +BuildRequires: binutils-gold BuildRequires: bison BuildRequires: bzip2-devel BuildRequires: elfutils @@ -141,8 +141,6 @@ cp -a src/AUTHORS AUTHORS.chromium cp -a src/LICENSE LICENSE.chromium cp -a src/xwalk/LICENSE LICENSE.xwalk -%patch9 - # The profiles using Wayland (and thus Ozone) do not need this patch. %if !%{with wayland} %patch10 @@ -196,24 +194,18 @@ GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Duse_ozone=1" GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Ddisable_nacl=%{_disable_nacl}" -# Linking fails in Tizen Common when fatal ld warnings are enabled. XWALK-1379. -%if "%{profile}" == "common" || "%{profile}" == "generic" +# Linking fails when fatal ld warnings are enabled. See XWALK-1379. GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Ddisable_fatal_linker_warnings=1" -%endif # For building for arm in OBS, we need : # -> to unset sysroot value. # sysroot variable is automatically set for cross compilation to use arm-sysroot provided by Chromium project -# -> to force system ld binary. -# Indeed the build is made on Emulated / Virtualized environment that correspond -# to the target. -# gold ld used is avaible only for 32/64 bits Intel Arch. # sysroot usage is not needed, we need to use arm libraries from the virtualized environment. # # Crosswalk build fails if the fpu selected in the gcc option is different from neon in case of arm7 compilation # So force it. %ifarch %{arm} -GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Dsysroot= -Dlinux_use_gold_binary=0" +GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Dsysroot= " export CFLAGS=`echo $CFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g` export CXXFLAGS=`echo $CXXFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g` export FFLAGS=`echo $FFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g` @@ -231,6 +223,9 @@ export GYP_GENERATORS='ninja' ${GYP_EXTRA_FLAGS} \ -Dchromeos=0 \ -Dclang=0 \ +-Dlinux_use_bundled_binutils=0 \ +-Dlinux_use_bundled_gold=0 \ +-Dlinux_use_gold_flags=1 \ -Dtizen=1 \ -Dpython_ver=2.7 \ -Duse_aura=1 \ @@ -249,34 +244,34 @@ ninja %{?_smp_mflags} -C src/out/Release xwalk xwalk_launcher xwalk_application_ %install # Binaries. -install -p -D %{SOURCE2} %{buildroot}%{_dbusservicedir}/org.crosswalkproject.Runtime1.service -install -p -D xwalk.service %{buildroot}%{_systemduserservicedir}/xwalk.service -install -p -D src/out/Release/xwalk %{buildroot}%{_libdir}/xwalk/xwalk -install -p -D src/out/Release/xwalkctl %{buildroot}%{_bindir}/xwalkctl -install -p -D src/out/Release/xwalk-launcher %{buildroot}%{_bindir}/xwalk-launcher -install -p -D src/out/Release/xwalk_backend %{buildroot}%{_libdir}/xwalk/xwalk_backend -install -p -D src/out/Release/lib/libxwalk_backend_lib.so %{buildroot}%{_libdir}/xwalk/libxwalk_backend_lib.so +install -m 0755 -p -D src/out/Release/xwalk %{buildroot}%{_libdir}/xwalk/xwalk +install -m 0755 -p -D src/out/Release/xwalkctl %{buildroot}%{_bindir}/xwalkctl +install -m 0755 -p -D src/out/Release/xwalk-launcher %{buildroot}%{_bindir}/xwalk-launcher +install -m 0755 -p -D src/out/Release/xwalk_backend %{buildroot}%{_libdir}/xwalk/xwalk_backend # Supporting libraries and resources. -install -p -D src/out/Release/icudtl.dat %{buildroot}%{_libdir}/xwalk/icudtl.dat -install -p -D src/out/Release/libffmpegsumo.so %{buildroot}%{_libdir}/xwalk/libffmpegsumo.so -install -p -D src/out/Release/xwalk.pak %{buildroot}%{_libdir}/xwalk/xwalk.pak -mkdir -p %{buildroot}%{_datadir}/xwalk -install -p -D src/xwalk/application/common/tizen/configuration/*.xsd %{buildroot}%{_datadir}/xwalk/ +install -m 0644 -p -D %{SOURCE2} %{buildroot}%{_dbusservicedir}/org.crosswalkproject.Runtime1.service +install -m 0644 -p -D xwalk.service %{buildroot}%{_systemduserservicedir}/xwalk.service +install -m 0644 -p -D src/out/Release/lib/libxwalk_backend_lib.so %{buildroot}%{_libdir}/xwalk/libxwalk_backend_lib.so +install -m 0644 -p -D src/out/Release/icudtl.dat %{buildroot}%{_libdir}/xwalk/icudtl.dat +install -m 0644 -p -D src/out/Release/libffmpegsumo.so %{buildroot}%{_libdir}/xwalk/libffmpegsumo.so +install -m 0644 -p -D src/out/Release/xwalk.pak %{buildroot}%{_libdir}/xwalk/xwalk.pak +install -d %{buildroot}%{_datadir}/xwalk +install -m 0644 -p -D src/xwalk/application/common/tizen/configuration/*.xsd %{buildroot}%{_datadir}/xwalk # PNaCl %if ! %{_disable_nacl} -install -p -D src/out/Release/nacl_bootstrap_raw %{buildroot}%{_libdir}/xwalk/nacl_bootstrap_raw -install -p -D src/out/Release/nacl_helper %{buildroot}%{_libdir}/xwalk/nacl_helper -install -p -D src/out/Release/nacl_helper_bootstrap %{buildroot}%{_libdir}/xwalk/nacl_helper_bootstrap -install -p -D src/out/Release/nacl_irt_*.nexe %{buildroot}%{_libdir}/xwalk -install -p -d %{buildroot}%{_libdir}/xwalk/pnacl -install -m 0664 -p -D src/out/Release/pnacl/* %{buildroot}%{_libdir}/xwalk/pnacl +install -m 0755 -p -D src/out/Release/nacl_bootstrap_raw %{buildroot}%{_libdir}/xwalk/nacl_bootstrap_raw +install -m 0755 -p -D src/out/Release/nacl_helper %{buildroot}%{_libdir}/xwalk/nacl_helper +install -m 0755 -p -D src/out/Release/nacl_helper_bootstrap %{buildroot}%{_libdir}/xwalk/nacl_helper_bootstrap +install -m 0644 -p -D src/out/Release/nacl_irt_*.nexe %{buildroot}%{_libdir}/xwalk +install -d %{buildroot}%{_libdir}/xwalk/pnacl +install -m 0644 -p -D src/out/Release/pnacl/* %{buildroot}%{_libdir}/xwalk/pnacl %endif # Register xwalk to the package manager. -install -p -D %{name}.xml %{buildroot}%{_manifestdir}/%{name}.xml -install -p -D %{name}.png %{buildroot}%{_desktop_icondir}/%{name}.png +install -m 0644 -p -D %{name}.xml %{buildroot}%{_manifestdir}/%{name}.xml +install -m 0644 -p -D %{name}.png %{buildroot}%{_desktop_icondir}/%{name}.png %post mkdir -p %{_desktop_icondir_ro} diff --git a/src/xwalk/runtime/browser/runtime_download_manager_delegate.cc b/src/xwalk/runtime/browser/runtime_download_manager_delegate.cc index baa63bf..6e2b941 100644 --- a/src/xwalk/runtime/browser/runtime_download_manager_delegate.cc +++ b/src/xwalk/runtime/browser/runtime_download_manager_delegate.cc @@ -103,8 +103,11 @@ void RuntimeDownloadManagerDelegate::GenerateFilename( const base::FilePath& generated_name, const base::FilePath& suggested_directory) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - if (!base::PathExists(suggested_directory)) - base::CreateDirectory(suggested_directory); + if (!base::CreateDirectory(suggested_directory)) { + LOG(ERROR) << "Failed to create directory: " + << suggested_directory.value(); + return; + } base::FilePath suggested_path(suggested_directory.Append(generated_name)); BrowserThread::PostTask( diff --git a/src/xwalk/runtime/browser/runtime_resource_dispatcher_host_delegate_android.cc b/src/xwalk/runtime/browser/runtime_resource_dispatcher_host_delegate_android.cc index ba63063..267538a 100644 --- a/src/xwalk/runtime/browser/runtime_resource_dispatcher_host_delegate_android.cc +++ b/src/xwalk/runtime/browser/runtime_resource_dispatcher_host_delegate_android.cc @@ -26,6 +26,7 @@ #include "xwalk/runtime/browser/android/xwalk_download_resource_throttle.h" #include "xwalk/runtime/browser/android/xwalk_login_delegate.h" #include "xwalk/runtime/browser/xwalk_content_browser_client.h" +#include "xwalk/runtime/common/xwalk_content_client.h" using content::BrowserThread; using navigation_interception::InterceptNavigationDelegate; @@ -248,9 +249,9 @@ void RuntimeResourceDispatcherHostDelegateAndroid::DownloadStarting( std::string mime_type; int64 content_length = request->GetExpectedContentSize(); - request->extra_request_headers().GetHeader( - net::HttpRequestHeaders::kUserAgent, &user_agent); - + if (!request->extra_request_headers().GetHeader( + net::HttpRequestHeaders::kUserAgent, &user_agent)) + user_agent = xwalk::GetUserAgent(); net::HttpResponseHeaders* response_headers = request->response_headers(); if (response_headers) { diff --git a/src/xwalk/runtime/browser/xwalk_browser_main_parts.cc b/src/xwalk/runtime/browser/xwalk_browser_main_parts.cc index f3c0b31..74f72b3 100644 --- a/src/xwalk/runtime/browser/xwalk_browser_main_parts.cc +++ b/src/xwalk/runtime/browser/xwalk_browser_main_parts.cc @@ -76,6 +76,7 @@ namespace xwalk { XWalkBrowserMainParts::XWalkBrowserMainParts( const content::MainFunctionParams& parameters) : xwalk_runner_(XWalkRunner::GetInstance()), + extension_service_(NULL), startup_url_(url::kAboutBlankURL), parameters_(parameters), run_default_message_loop_(true) { diff --git a/src/xwalk/runtime/common/xwalk_common_messages.h b/src/xwalk/runtime/common/xwalk_common_messages.h index ba45c02..aa6da1b 100644 --- a/src/xwalk/runtime/common/xwalk_common_messages.h +++ b/src/xwalk/runtime/common/xwalk_common_messages.h @@ -11,7 +11,7 @@ #include "ipc/ipc_message_macros.h" #include "ipc/ipc_platform_file.h" #include "url/gurl.h" -#include "xwalk/application/common/security_policy.h" +#include "xwalk/application/browser/application_security_policy.h" // Singly-included section for enums and custom IPC traits. #ifndef XWALK_RUNTIME_COMMON_XWALK_COMMON_MESSAGES_H_ @@ -27,7 +27,7 @@ namespace IPC { #define IPC_MESSAGE_START ViewMsgStart -IPC_ENUM_TRAITS(xwalk::application::SecurityPolicy::SecurityMode) +IPC_ENUM_TRAITS(xwalk::application::ApplicationSecurityPolicy::SecurityMode) //----------------------------------------------------------------------------- // RenderView messages // These are messages sent from the browser to the renderer process. @@ -39,7 +39,7 @@ IPC_MESSAGE_CONTROL3(ViewMsg_SetAccessWhiteList, // NOLINT IPC_MESSAGE_CONTROL2(ViewMsg_EnableSecurityMode, // NOLINT GURL /* application url */, - xwalk::application::SecurityPolicy::SecurityMode + xwalk::application::ApplicationSecurityPolicy::SecurityMode /* security mode */) IPC_MESSAGE_CONTROL1(ViewMsg_SuspendJSEngine, // NOLINT diff --git a/src/xwalk/runtime/common/xwalk_runtime_features.cc b/src/xwalk/runtime/common/xwalk_runtime_features.cc index ceb7166..1b525a6 100644 --- a/src/xwalk/runtime/common/xwalk_runtime_features.cc +++ b/src/xwalk/runtime/common/xwalk_runtime_features.cc @@ -30,8 +30,9 @@ XWalkRuntimeFeatures* XWalkRuntimeFeatures::GetInstance() { } XWalkRuntimeFeatures::XWalkRuntimeFeatures() - : command_line_(0) - , initialized_(false) {} + : command_line_(0), + initialized_(false), + experimental_features_enabled_(false) {} void XWalkRuntimeFeatures::Initialize(const CommandLine* cmd) { command_line_ = cmd; @@ -72,6 +73,7 @@ void XWalkRuntimeFeatures::AddFeature(const char* name, feature.description = description; feature.command_line_switch = command_line_switch; feature.status = status; + feature.enabled = false; if (experimental_features_enabled_) { feature.enabled = true; diff --git a/src/xwalk/runtime/renderer/xwalk_render_process_observer_generic.cc b/src/xwalk/runtime/renderer/xwalk_render_process_observer_generic.cc index 7723358..b192b7b 100644 --- a/src/xwalk/runtime/renderer/xwalk_render_process_observer_generic.cc +++ b/src/xwalk/runtime/renderer/xwalk_render_process_observer_generic.cc @@ -48,7 +48,7 @@ void AddAccessWhiteListEntry( XWalkRenderProcessObserver::XWalkRenderProcessObserver() : is_webkit_initialized_(false), is_suspended_(false), - security_mode_(application::SecurityPolicy::NoSecurity) { + security_mode_(application::ApplicationSecurityPolicy::NoSecurity) { } XWalkRenderProcessObserver::~XWalkRenderProcessObserver() { @@ -93,7 +93,8 @@ void XWalkRenderProcessObserver::OnSetAccessWhiteList(const GURL& source, } void XWalkRenderProcessObserver::OnEnableSecurityMode( - const GURL& url, application::SecurityPolicy::SecurityMode mode) { + const GURL& url, + application::ApplicationSecurityPolicy::SecurityMode mode) { app_url_ = url; security_mode_ = mode; } diff --git a/src/xwalk/runtime/renderer/xwalk_render_process_observer_generic.h b/src/xwalk/runtime/renderer/xwalk_render_process_observer_generic.h index 4a28977..9d648b6 100644 --- a/src/xwalk/runtime/renderer/xwalk_render_process_observer_generic.h +++ b/src/xwalk/runtime/renderer/xwalk_render_process_observer_generic.h @@ -12,7 +12,7 @@ #include "content/public/renderer/render_process_observer.h" #include "url/gurl.h" #include "v8/include/v8.h" -#include "xwalk/application/common/security_policy.h" +#include "xwalk/application/browser/application_security_policy.h" namespace blink { class WebFrame; @@ -35,10 +35,10 @@ class XWalkRenderProcessObserver : public content::RenderProcessObserver { virtual void OnRenderProcessShutdown() OVERRIDE; bool IsWarpMode() const { - return security_mode_ == application::SecurityPolicy::WARP; + return security_mode_ == application::ApplicationSecurityPolicy::WARP; } bool IsCSPMode() const { - return security_mode_ == application::SecurityPolicy::CSP; + return security_mode_ == application::ApplicationSecurityPolicy::CSP; } const GURL& app_url() const { return app_url_; } @@ -50,7 +50,8 @@ class XWalkRenderProcessObserver : public content::RenderProcessObserver { void OnSetAccessWhiteList( const GURL& source, const GURL& dest, bool allow_subdomains); void OnEnableSecurityMode( - const GURL& url, application::SecurityPolicy::SecurityMode mode); + const GURL& url, + application::ApplicationSecurityPolicy::SecurityMode mode); void OnSuspendJSEngine(bool is_pause); #if defined(OS_TIZEN) void OnUserAgentChanged(const std::string& userAgentString); @@ -59,7 +60,7 @@ class XWalkRenderProcessObserver : public content::RenderProcessObserver { bool is_webkit_initialized_; bool is_suspended_; - application::SecurityPolicy::SecurityMode security_mode_; + application::ApplicationSecurityPolicy::SecurityMode security_mode_; GURL app_url_; }; } // namespace xwalk