Merge "[Tizen] Enable HWKey emulation for all native platform" into tizen accepted/tizen_3.0.2015.q1_common accepted/tizen_common accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable tizen tizen_3.0.2015.q1_common tizen_3.0.2015.q2_common accepted/tizen/3.0.2015.q1/common/20150323.084221 accepted/tizen/common/20150310.163227 accepted/tizen/mobile/20150310.231412 accepted/tizen/tv/20150310.225659 accepted/tizen/wearable/20150310.230843 submit/tizen/20150310.001416 submit/tizen_3.0.2015.q1_common/20150320.000000
authorSung-su Kim <sung-su.kim@samsung.com>
Tue, 10 Mar 2015 00:13:39 +0000 (17:13 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 10 Mar 2015 00:13:39 +0000 (17:13 -0700)
src/xwalk/application/browser/application_tizen.cc
src/xwalk/application/browser/application_tizen.h

index ddf9e17..0ee055b 100644 (file)
 #include "xwalk/runtime/browser/ui/native_app_window_tizen.h"
 #include "xwalk/runtime/common/xwalk_common_messages.h"
 
-#if defined(USE_OZONE)
 #include "content/public/browser/render_view_host.h"
 #include "ui/events/event.h"
 #include "ui/events/event_constants.h"
+#include "ui/events/event_utils.h"
 #include "ui/events/keycodes/keyboard_codes_posix.h"
 #include "ui/events/platform/platform_event_source.h"
-#endif
 
 #include "xwalk/application/common/application_manifest_constants.h"
 #include "xwalk/application/common/manifest_handlers/tizen_setting_handler.h"
@@ -149,17 +148,13 @@ ApplicationTizen::ApplicationTizen(
       root_window_(NULL),
 #endif
       is_suspended_(false) {
-#if defined(USE_OZONE)
   ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver(this);
-#endif
   cookie_manager_ = scoped_ptr<CookieManager>(
       new CookieManager(id(), browser_context_));
 }
 
 ApplicationTizen::~ApplicationTizen() {
-#if defined(USE_OZONE)
   ui::PlatformEventSource::GetInstance()->RemovePlatformEventObserver(this);
-#endif
 }
 
 void ApplicationTizen::Hide() {
@@ -262,16 +257,17 @@ void ApplicationTizen::Resume() {
   is_suspended_ = false;
 }
 
-#if defined(USE_OZONE)
 void ApplicationTizen::WillProcessEvent(const ui::PlatformEvent& event) {}
 
 void ApplicationTizen::DidProcessEvent(
     const ui::PlatformEvent& event) {
-  ui::Event* ui_event = static_cast<ui::Event*>(event);
-  if (!ui_event->IsKeyEvent() || ui_event->type() != ui::ET_KEY_PRESSED)
+
+  scoped_ptr<ui::Event> ui_event(ui::EventFromNative(event));
+  if (!ui_event ||
+      !ui_event->IsKeyEvent() || ui_event->type() != ui::ET_KEY_PRESSED)
     return;
 
-  ui::KeyEvent* key_event = static_cast<ui::KeyEvent*>(ui_event);
+  ui::KeyEvent* key_event = static_cast<ui::KeyEvent*>(ui_event.get());
 
   // FIXME: Most Wayland devices don't have similar hardware button for 'back'
   // and 'memu' as Tizen Mobile, even that hardare buttons could be different
@@ -293,7 +289,6 @@ void ApplicationTizen::DidProcessEvent(
         (*it)->web_contents()->GetRoutingID(), key_event->key_code()));
   }
 }
-#endif
 
 void ApplicationTizen::RemoveAllCookies() {
   cookie_manager_->RemoveAllCookies();
index 2e5a6c6..60748b4 100644 (file)
 #include "xwalk/application/browser/application.h"
 #include "xwalk/application/common/tizen/cookie_manager.h"
 
-#if defined(USE_OZONE)
 #include "ui/events/platform/platform_event_observer.h"
 #include "ui/events/platform/platform_event_types.h"
-#endif
 
 namespace xwalk {
 namespace application {
 
 class ApplicationTizen :  // NOLINT
-#if defined(USE_OZONE)
   public ui::PlatformEventObserver,
-#endif
   public Application {
  public:
   virtual ~ApplicationTizen();
@@ -46,10 +42,9 @@ class ApplicationTizen :  // NOLINT
   void OnNewRuntimeAdded(Runtime* runtime) override;
   void OnRuntimeClosed(Runtime* runtime) override;
 
-#if defined(USE_OZONE)
   void WillProcessEvent(const ui::PlatformEvent& event) override;
   void DidProcessEvent(const ui::PlatformEvent& event) override;
-#endif
+
   bool CanBeSuspended() const;
 
 #if defined(OS_TIZEN_MOBILE)