Create profile-common binary for unified environment. 04/96504/12
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Wed, 9 Nov 2016 07:21:59 +0000 (16:21 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Fri, 24 Feb 2017 04:29:16 +0000 (13:29 +0900)
In Tizen 4.0, supporting "Configurability / Building Blocks",
a package is highly recommended to have a single common binary
for every profile.

If the behavior is different per profile,
1. (highly recommended) probe the profile at init/run time.
2. (highly recommended) distinguish at install time.
3. (not so recommended, but acceptable) create multiple binaries and choose one at install time;
the spec file becomes extremely messy and build time does not become shorter.
4. (CANNOT accept), different external headers (devel package) per profile.

To create an example of case 1, I've updated crosswalk-tizen.

Because there are other packages in case 4 and there are buildrequires cannot be met in some profiles,
this commit targets the future "unified" OBS project only. For the conventional profiles, the
common-ness with case 1 is limited.

To maintainer: PLEASE remove model_build_features soon. Replace it with some vconf/capi values as it is done
for other features with common/platform_info.h

- Update at patch set 3:
  : Added workaround due to chromium-efl's devel package issue (header contents different per profile for Tizen internal packages)

Change-Id: I17f2be3107e4085373af644330b5d971fce1cdd7
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
17 files changed:
common/application_data.cc
common/application_data.h
common/common.gyp
common/platform_info.cc [new file with mode: 0644]
common/platform_info.h [new file with mode: 0644]
packaging/crosswalk-tizen.spec
runtime/browser/native_window.cc
runtime/browser/native_window.h
runtime/browser/runtime.cc
runtime/browser/runtime_process.cc
runtime/browser/web_application.cc
runtime/browser/web_application.h
runtime/browser/web_view.cc
runtime/browser/web_view.h
runtime/browser/web_view_impl.cc
runtime/browser/web_view_impl.h
runtime/runtime.gyp

index 0559c10ebaf7313430526777308438363cfeb51c..b25d347568ee988b84b3c57260c928a2e13e4151 100755 (executable)
@@ -27,6 +27,7 @@
 #include "common/file_utils.h"
 #include "common/logger.h"
 #include "common/profiler.h"
+#include "common/platform_info.h"
 
 namespace common {
 
@@ -36,13 +37,9 @@ const char* kPathSeparator = "/";
 const char* kConfigXml = "config.xml";
 const char* kWgtPath = "wgt";
 
-#ifdef IME_FEATURE_SUPPORT
 const char* kImeCategory = "http://tizen.org/category/ime";
-#endif  // IME_FEATURE_SUPPORT
-#ifdef WATCH_FACE_FEATURE_SUPPORT
 const char* kIdleClockCategory = "com.samsung.wmanager.WATCH_CLOCK";
 const char* kWearableClockCategory = "http://tizen.org/category/wearable_clock";
-#endif  // WATCH_FACE_FEATURE_SUPPORT
 
 }  // namespace
 
@@ -147,16 +144,13 @@ ApplicationData::AppType ApplicationData::GetAppType() {
     auto it = category_list.begin();
     auto end = category_list.end();
     for (; it != end; ++it) {
-#ifdef IME_FEATURE_SUPPORT
-      if (*it == kImeCategory) {
+      if (TIZEN_FEATURE_web_ime_support && *it == kImeCategory) {
         return IME;
       }
-#endif  // IME_FEATURE_SUPPORT
-#ifdef WATCH_FACE_FEATURE_SUPPORT
-      if (*it == kIdleClockCategory || *it == kWearableClockCategory) {
+      if (TIZEN_FEATURE_watch_face_support &&
+          (*it == kIdleClockCategory || *it == kWearableClockCategory)) {
         return WATCH;
       }
-#endif  // WATCH_FACE_FEATURE_SUPPORT
     }
   }
   return UI;
index 1a58ca90481efe622bf0e4aa09bc4d74faceb7e6..aa910e21f5d522377b6162e8a9ed09d797898c6c 100755 (executable)
@@ -43,12 +43,8 @@ class ApplicationData {
  public:
   enum AppType {
     UI = 0
-#ifdef IME_FEATURE_SUPPORT
     ,IME
-#endif  // IME_FEATURE_SUPPORT
-#ifdef WATCH_FACE_FEATURE_SUPPORT
     ,WATCH
-#endif  // WATCH_FACE_FEATURE_SUPPORT
   };
 
   explicit ApplicationData(const std::string& appid);
index 7ba07502b8631872003cdc6d8bc41dd615a1ecc0..6d7d88baf98ca6bee11bde8b2dd5059cf88b5703 100644 (file)
@@ -30,6 +30,8 @@
         'locale_manager.cc',
         'resource_manager.h',
         'resource_manager.cc',
+       'platform_info.h',
+       'platform_info.cc',
       ],
       'cflags': [
         '-fvisibility=default',
diff --git a/common/platform_info.cc b/common/platform_info.cc
new file mode 100644 (file)
index 0000000..ab32e5d
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#include <cstdlib>
+#include <system_info.h>
+#include "common/platform_info.h"
+
+namespace common {
+
+enum _profile getProfile(void) {
+  static enum _profile profile = kPROFILE_UNKNOWN;
+
+  // This is false only for the first execution. Let's optimize it.
+  if (__builtin_expect(profile != kPROFILE_UNKNOWN, 1))
+    return profile;
+
+  char *profileName;
+  system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+  switch (*profileName) {
+  case 'm':
+  case 'M':
+    profile = kPROFILE_MOBILE;
+    break;
+  case 'w':
+  case 'W':
+    profile = kPROFILE_WEARABLE;
+    break;
+  case 't':
+  case 'T':
+    profile = kPROFILE_TV;
+    break;
+  case 'i':
+  case 'I':
+    profile = kPROFILE_IVI;
+    break;
+  default: // common or unknown ==> ALL ARE COMMON.
+    profile = kPROFILE_COMMON;
+  }
+  free(profileName);
+
+  return profile;
+}
+
+} // namespace common
diff --git a/common/platform_info.h b/common/platform_info.h
new file mode 100644 (file)
index 0000000..009c6f7
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#ifndef XWALK_COMMON_PLATFORM_INFO_H_
+#define XWALK_COMMON_PLATFORM_INFO_H_
+
+namespace common {
+
+enum _profile {
+  kPROFILE_UNKNOWN = 0,
+  kPROFILE_MOBILE = 0x1,
+  kPROFILE_WEARABLE = 0x2,
+  kPROFILE_TV = 0x4,
+  kPROFILE_IVI = 0x8,
+  kPROFILE_COMMON = 0x10,
+};
+
+// To optimize for GBMs, you may define the following values based on profile (e.g., #define TIZEN_FEATURE_blahblah (1))
+
+#define TIZEN_FEATURE_web_ime_support          \
+       (common::getProfile() & ((common::kPROFILE_WEARABLE) | (common::kPROFILE_TV)))
+#define TIZEN_FEATURE_manual_rotate_support    \
+       (common::getProfile() & ((common::kPROFILE_MOBILE)))
+#define TIZEN_FEATURE_watch_face_support       \
+       (common::getProfile() & ((common::kPROFILE_WEARABLE)))
+#define TIZEN_FEATURE_rotary_event_support     \
+       (common::getProfile() & ((common::kPROFILE_WEARABLE)))
+
+extern enum _profile getProfile(void);
+
+} // namespace common
+#endif // XWALK_COMMON_PLATFORM_INFO_H_
index e908515cc9943e303e296c88ac3790a3b2114cda..083798bd11f07e681ea34bc2fe68f2f13ea3bda2 100755 (executable)
@@ -28,6 +28,7 @@ BuildRequires: pkgconfig(capi-appfw-application)
 BuildRequires: pkgconfig(capi-appfw-app-manager)
 BuildRequires: pkgconfig(capi-appfw-package-manager)
 BuildRequires: pkgconfig(capi-system-system-settings)
+BuildRequires: pkgconfig(capi-system-info)
 BuildRequires: pkgconfig(capi-ui-efl-util)
 BuildRequires: pkgconfig(chromium-efl)
 BuildRequires: pkgconfig(cynara-client)
@@ -49,27 +50,43 @@ BuildRequires: pkgconfig(launchpad)
 BuildRequires: pkgconfig(ttrace)
 BuildRequires: pkgconfig(jsoncpp)
 
+%define chromium_efl_workaround_ewk_settings   0
+
 %if "%{?profile}" == "mobile"
 %define tizen_feature_rotary_event_support     0
 %define tizen_feature_web_ime_support          0
 %define tizen_feature_watch_face_support       0
-%define tizen_feature_manual_rotate_support    1
 %endif
 
 %if "%{?profile}" == "wearable"
 %define tizen_feature_rotary_event_support     1
 %define tizen_feature_web_ime_support          1
 %define tizen_feature_watch_face_support       1
-%define tizen_feature_manual_rotate_support    0
+%define chromium_efl_workaround_ewk_settings   1
 %endif
 
 %if "%{?profile}" == "tv"
 %define tizen_feature_rotary_event_support     0
 %define tizen_feature_web_ime_support          1
 %define tizen_feature_watch_face_support       0
-%define tizen_feature_manual_rotate_support    0
 %endif
 
+# If it is unified environment.
+%if "%{?profile}" != "mobile" && "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
+%define tizen_feature_rotary_event_support     1
+%define tizen_feature_web_ime_support          1
+%define tizen_feature_watch_face_support       1
+%endif
+
+# In "unified" build environment, where "profile" is none of mobile/wearable/tv/common/ivi, but a new value or undefined,
+# all the "feature"s are to be supported and be activated selectively at runtime/inittime.
+# (the profile is probed at runtime)
+
+# tizen_feature_rotary..._support          (==> platform_info / wearable)
+# tizen_feature_web_ime_support            (==> platform_info / wearable || TV)
+# tizen_feature_watch_face_support         (==> platform_info / wearable)
+# tizen_feature_manual_rotate_support      (==> platform_info / mobile)
+
 %if 0%{?tizen_feature_web_ime_support}
 BuildRequires: pkgconfig(capi-ui-inputmethod)
 %endif
@@ -92,8 +109,9 @@ cp %{SOURCE1001} .
 
 %build
 export GYP_GENERATORS='ninja'
-GYP_OPTIONS="--depth=.
--Dprofile=%{profile}"
+GYP_OPTIONS="--depth=."
+# Not required anymore
+#-Dprofile=%{profile}"
 
 # BuildType: Debug / Release
 %if 0%{?tizen_build_devel_mode}
@@ -103,10 +121,14 @@ GYP_OPTIONS="$GYP_OPTIONS -Dbuild_type=Release"
 %endif
 
 # Feature flags
+# TODO: in unified environment, the following feature flags are useless (always on)
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_rotary_event_support=%{?tizen_feature_rotary_event_support}"
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_web_ime_support=%{?tizen_feature_web_ime_support}"
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_watch_face_support=%{?tizen_feature_watch_face_support}"
-GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_manual_rotate_support=%{?tizen_feature_manual_rotate_support}"
+# Not required anymore
+#GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_manual_rotate_support=%{?tizen_feature_manual_rotate_support}"
+
+# TODO: do not use model_build_feature.
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_model_formfactor=%{?model_build_feature_formfactor}"
 
 # Extension Path
@@ -115,6 +137,11 @@ GYP_OPTIONS="$GYP_OPTIONS -Dextension_path=%{extension_path}"
 # Injected bundle
 GYP_OPTIONS="$GYP_OPTIONS -Dinjected_bundle_path=%{injected_bundle_path}"
 
+# Chromium-EFL generated CAPI header files differently per profile.
+# Until they are unified a function "ewk_settings_form_candidate_data_enabled_set()" cannot be used for wearable.
+# Therefore, until chromium-efl gets refactored to emit devel packages equally for every profile, let's keep this.
+GYP_OPTIONS="$GYP_OPTIONS -Dchromium_efl_workaround_ewk_settings=%{chromium_efl_workaround_ewk_settings}"
+
 # Tizen product tv
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_product_tv=%{!?TIZEN_PRODUCT_TV:0}"
 
index 9350c660190d75aca75a81d649d9f1357ca23864..6e723e5a37e46ac3d7c7cd8e50d50151ec4e4353 100755 (executable)
@@ -293,7 +293,6 @@ void NativeWindow::FullScreen(bool enable) {
       (enable || currentViewModeFullScreen_) ? ELM_WIN_INDICATOR_TRANSPARENT : ELM_WIN_INDICATOR_OPAQUE);
 }
 
-#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
 void NativeWindow::EnableManualRotation(bool enable) {
   LOGGER(DEBUG) << "set manual rotation : " << (enable ? "enabled" : "disabled");
   elm_win_wm_rotation_manual_rotation_done_set(window_, enable ? EINA_TRUE : EINA_FALSE);
@@ -304,6 +303,5 @@ void NativeWindow::ManualRotationDone() {
     elm_win_wm_rotation_manual_rotation_done(window_);
   }
 }
-#endif  // MANUAL_ROTATE_FEATURE_SUPPORT
 
 }  // namespace runtime
index 7d23aa0e5b8bfb911953fa8e759fcc58fdad111c..0a5f23c412cc41a5157fe72ce79882ce1e010ad5 100755 (executable)
@@ -61,10 +61,8 @@ class NativeWindow {
   void FullScreen(bool enable);
   ScreenOrientation natural_orientation() const { return natural_orientation_;}
   Type type() const { return window_type_;}
-#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
   void EnableManualRotation(bool enable);
   void ManualRotationDone();
-#endif  // MANUAL_ROTATE_FEATURE_SUPPORT
 
  protected:
   virtual Evas_Object* CreateWindowInternal() = 0;
index 2254bfc43929a989a3d66c062a700d6f49901153..8e68210b404687f89da31a824e400988c4680dbd 100644 (file)
@@ -21,6 +21,7 @@
 #include "common/application_data.h"
 #include "common/command_line.h"
 #include "common/logger.h"
+#include "common/platform_info.h"
 #include "runtime/common/constants.h"
 #include "runtime/browser/runtime.h"
 #include "runtime/browser/ui_runtime.h"
@@ -44,12 +45,14 @@ std::unique_ptr<Runtime> Runtime::MakeRuntime(
     return std::unique_ptr<Runtime>(new UiRuntime(app_data));
   }
 #ifdef IME_FEATURE_SUPPORT
-  else if (app_data->app_type() == common::ApplicationData::IME) {
+  else if (TIZEN_FEATURE_web_ime_support &&
+           app_data->app_type() == common::ApplicationData::IME) {
     return std::unique_ptr<Runtime>(new ImeRuntime(app_data));
   }
 #endif  // IME_FEATURE_SUPPORT
 #ifdef WATCH_FACE_FEATURE_SUPPORT
-  else if (app_data->app_type() == common::ApplicationData::WATCH) {
+  else if (TIZEN_FEATURE_watch_face_support &&
+           app_data->app_type() == common::ApplicationData::WATCH) {
     return std::unique_ptr<Runtime>(new WatchRuntime(app_data));
   }
 #endif  // WATCH_FACE_FEATURE_SUPPORT
index a085bbc9d2febea5c1c0eed8cc5778e3f73ed704..e51887a9c7325a17fa046cae49cef7ec34e3eb01 100755 (executable)
 
 #include <Elementary.h>
 
-#ifdef WATCH_FACE_FEATURE_SUPPORT
 #include <bundle_internal.h>
 #include <Ecore_Wayland.h>
-#endif  // WATCH_FACE_FEATURE_SUPPORT
 
 #include "common/application_data.h"
 #include "common/command_line.h"
 #include "common/logger.h"
 #include "common/profiler.h"
+#include "common/platform_info.h"
 #include "extensions/renderer/xwalk_extension_renderer_controller.h"
 #include "runtime/browser/runtime.h"
 #include "runtime/common/constants.h"
 #include "runtime/browser/prelauncher.h"
 #include "runtime/browser/preload_manager.h"
+#include "runtime/browser/web_view_impl.h"
 
 #include "runtime/browser/ui_runtime.h"
 
 using namespace extensions;
 bool g_prelaunch = false;
 
-#ifdef WATCH_FACE_FEATURE_SUPPORT
 static int setWatchEnv(int argc, char **argv) {
   bundle *kb = NULL;
   char *wayland_display = NULL;
@@ -79,7 +78,6 @@ static int setWatchEnv(int argc, char **argv) {
   }
   return 0;
 }
-#endif  // WATCH_FACE_FEATURE_SUPPORT
 
 int real_main(int argc, char* argv[]) {
   STEP_PROFILE_START("Start -> Launch Completed");
@@ -97,11 +95,10 @@ int real_main(int argc, char* argv[]) {
     return false;
   }
 
-#ifdef WATCH_FACE_FEATURE_SUPPORT
-  if (appdata->app_type() == common::ApplicationData::WATCH) {
+  if (TIZEN_FEATURE_watch_face_support &&
+      appdata->app_type() == common::ApplicationData::WATCH) {
     setWatchEnv(argc, argv);
   }
-#endif  // WATCH_FACE_FEATURE_SUPPORT
 
   // Default behavior, run as runtime.
   LOGGER(INFO) << "Runtime process has been created.";
@@ -118,14 +115,13 @@ int real_main(int argc, char* argv[]) {
     const int chromium_arg_cnt =
         sizeof(chromium_arg_options) / sizeof(chromium_arg_options[0]);
     ewk_set_arguments(chromium_arg_cnt, chromium_arg_options);
-#ifdef WATCH_FACE_FEATURE_SUPPORT
   } else {
-    if (appdata->app_type() == common::ApplicationData::WATCH) {
+    if (TIZEN_FEATURE_watch_face_support &&
+        appdata->app_type() == common::ApplicationData::WATCH) {
       // Below code will be enabled after testing
       //ecore_wl_shutdown();
       //ecore_wl_init(NULL);
     }
-#endif  // WATCH_FACE_FEATURE_SUPPORT
   }
 
   // Runtime's destructor should be called before ewk_shutdown()
index a99a8764e1497fc6de29b8c995290980ba79e968..700cc13085e577dfd13325097863f8d2de63f112 100755 (executable)
@@ -42,6 +42,7 @@
 #include "common/resource_manager.h"
 #include "common/string_utils.h"
 #include "extensions/renderer/xwalk_extension_renderer_controller.h"
+#include "common/platform_info.h"
 #include "runtime/browser/native_window.h"
 #include "runtime/browser/notification_manager.h"
 #include "runtime/browser/popup.h"
@@ -469,10 +470,9 @@ bool WebApplication::Initialize() {
     security_model_version_ = 1;
   }
 
-#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
   // Set manual rotation
-  window_->EnableManualRotation(true);
-#endif  // MANUAL_ROTATE_FEATURE_SUPPORT
+  if (TIZEN_FEATURE_manual_rotate_support)
+    window_->EnableManualRotation(true);
 
   return true;
 }
@@ -512,27 +512,25 @@ void WebApplication::Launch(std::unique_ptr<common::AppControl> appcontrol) {
 
   window_->SetContent(view->evas_object());
 
-#ifdef PROFILE_MOBILE
   // rotate and resize window forcibily for landscape mode.
   // window rotate event is generated after window show. so
   // when app get width and height from viewport, wrong value can be returned.
-  if (app_data_->setting_info()->screen_orientation() ==
+  if (common::getProfile() == common::kPROFILE_MOBILE &&
+      app_data_->setting_info()->screen_orientation() ==
              wgt::parse::SettingInfo::ScreenOrientation::LANDSCAPE) {
     LOGGER(DEBUG) << "rotate and resize window for landscape mode";
     elm_win_rotation_with_resize_set(window_->evas_object(), 270);
     evas_norender(evas_object_evas_get(window_->evas_object()));
   }
-#endif  // PROFILE_MOBILE
 
   view->LoadUrl(res->uri(), res->mime());
   view_stack_.push_front(view);
 
-#ifdef PROFILE_WEARABLE
   // ewk_view_bg_color_set is not working at webview initialization.
-  if (app_data_->app_type() == common::ApplicationData::WATCH) {
+  if (common::getProfile() == common::kPROFILE_WEARABLE &&
+      app_data_->app_type() == common::ApplicationData::WATCH) {
     view->SetBGColor(0, 0, 0, 255);
   }
-#endif  // PROFILE_WEARABLE
 
   if (appcontrol->data(AUL_K_DEBUG) == "1") {
     debug_mode_ = true;
@@ -544,13 +542,12 @@ void WebApplication::Launch(std::unique_ptr<common::AppControl> appcontrol) {
 
   launched_ = true;
 
-#ifdef PROFILE_MOBILE
-  if (!common::utils::StartsWith(view->GetUrl(), kFileScheme)) {
+  if (common::getProfile() == common::kPROFILE_MOBILE &&
+      !common::utils::StartsWith(view->GetUrl(), kFileScheme)) {
     LOGGER(DEBUG) << "Show window after launch for remote URL";
     window_->Show();
     window_->Active();
   }
-#endif  // PROFILE_MOBILE
 }
 
 void WebApplication::AppControl(
@@ -714,13 +711,16 @@ void WebApplication::Exit() {
       LOGGER(ERROR) << "app_ui_exit";
       ui_app_exit();
       break;
-#ifdef WATCH_FACE_FEATURE_SUPPORT
     case common::ApplicationData::AppType::WATCH:
-      LOGGER(ERROR) << "watch_ui_exit";
-      watch_app_exit();
-      break;
-#endif
+      if (TIZEN_FEATURE_watch_face_support) {
+        LOGGER(ERROR) << "watch_ui_exit";
+        watch_app_exit();
+        break;
+      } else {
+        goto __default;
+      }
     default:
+__default:
       LOGGER(ERROR) << "default terminator";
       elm_exit();
   }
@@ -1029,7 +1029,6 @@ void WebApplication::OnSoftKeyboardChangeEvent(WebView* /*view*/,
     view_stack_.front()->EvalJavascript(kSoftKeyboardScript.c_str());
 }
 
-#ifdef ROTARY_EVENT_FEATURE_SUPPORT
 void WebApplication::OnRotaryEvent(WebView* /*view*/,
                                    RotaryEventType type) {
   LOGGER(DEBUG) << "OnRotaryEvent";
@@ -1051,7 +1050,6 @@ void WebApplication::OnRotaryEvent(WebView* /*view*/,
   if (view_stack_.size() > 0 && view_stack_.front() != NULL)
     view_stack_.front()->EvalJavascript(kRotaryEventScript.c_str());
 }
-#endif  // ROTARY_EVENT_FEATURE_SUPPORT
 
 void WebApplication::OnTimeTick(long time) {
 #if 0
@@ -1111,26 +1109,24 @@ void WebApplication::OnRendered(WebView* view) {
   // Do not show(), active() for language change
   if(lang_changed_mode_ == false){
       // Show window after frame rendered.
-#ifdef PROFILE_MOBILE
-      if (common::utils::StartsWith(view->GetUrl(), kFileScheme)) {
+      if (common::getProfile() == common::kPROFILE_MOBILE) {
+        if (common::utils::StartsWith(view->GetUrl(), kFileScheme)) {
+          window_->Show();
+          window_->Active();
+        }
+      } else {
         window_->Show();
         window_->Active();
       }
-#else  // PROFILE_MOBILE
-      window_->Show();
-      window_->Active();
-#endif
   }
   else{
       lang_changed_mode_ = false;
   }
 }
 
-#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
 void WebApplication::OnRotatePrepared(WebView* /*view*/) {
   window_->ManualRotationDone();
 }
-#endif  // MANUAL_ROTATE_FEATURE_SUPPORT
 
 void WebApplication::LaunchInspector(common::AppControl* appcontrol) {
   unsigned int port = ewk_context_inspector_server_start(ewk_context_, 0);
index 20d9082b49dc8cc9d2667ecde6cefdc9287d74bb..0e1096761babe3110954ac8a3e84d33342feb94f 100755 (executable)
@@ -99,13 +99,9 @@ class WebApplication : public WebView::EventListener {
       std::function<void(bool)> result_handler);
   virtual void OnSoftKeyboardChangeEvent(
       WebView* view, SoftKeyboardChangeEventValue softkeyboard_value);
-#ifdef ROTARY_EVENT_FEATURE_SUPPORT
   virtual void OnRotaryEvent(
       WebView* view, RotaryEventType type);
-#endif  // ROTARY_EVENT_FEATURE_SUPPORT
-#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
   virtual void OnRotatePrepared(WebView* view);
-#endif // MANUAL_ROTATE_FEATURE_SUPPORT
   static Eina_Bool CheckPluginSession(void* user_data);
   static Eina_Bool ClosePageInExtendedMainLoop(void* user_data);
   struct Timer
index 7f2b4feb86f7e2b7d45d1b2bcd928305fced431e..b3d69b7f0fa7eb5d2e5434dfb12fe519b8b86eee 100644 (file)
@@ -97,10 +97,8 @@ void WebView::SetLongPolling(unsigned long longpolling) {
   impl_->SetLongPolling(longpolling);
 }
 
-#ifdef PROFILE_WEARABLE
 void WebView::SetBGColor(int r, int g, int b, int a) {
   impl_->SetBGColor(r, g, b, a);
 }
-#endif  // PROFILE_WEARABLE
 
 }  // namespace runtime
index 9441db274c145584f9d13e7db691b79ac0cd3fcd..82bbe843679caf7cbf3440e91b51a06c664fcf78 100644 (file)
@@ -103,14 +103,10 @@ class WebView {
     virtual void OnSoftKeyboardChangeEvent(
         WebView* /*view*/,
         SoftKeyboardChangeEventValue /*softkeyboard_value*/) {}
-#ifdef ROTARY_EVENT_FEATURE_SUPPORT
     virtual void OnRotaryEvent(
         WebView* /*view*/,
         RotaryEventType /*type*/) {}
-#endif  // ROTARY_EVENT_FEATURE_SUPPORT
-#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
     virtual void OnRotatePrepared(WebView* /*view*/) {}
-#endif // MANUAL_ROTATE_FEATURE_SUPPORT
   };
 
   WebView(NativeWindow* window, Ewk_Context* context);
@@ -131,9 +127,7 @@ class WebView {
   void SetCSPRule(const std::string& rule, bool report_only);
   void SetDefaultEncoding(const std::string& encoding);
   void SetLongPolling(unsigned long longpolling);
-#ifdef PROFILE_WEARABLE
   void SetBGColor(int r, int g, int b, int a);
-#endif
 
   void SetEventListener(EventListener* listener);
   Evas_Object* evas_object() const;
index 162bca963ed559cd64a0c5e3361cfc2c905f7a30..7be9b8bd7df55a94a6b9ec1edf9a561a4ce82743 100644 (file)
@@ -23,6 +23,7 @@
 #include "common/file_utils.h"
 #include "common/logger.h"
 #include "common/profiler.h"
+#include "common/platform_info.h"
 #include "runtime/browser/native_window.h"
 
 namespace runtime {
@@ -226,13 +227,19 @@ void WebViewImpl::Initialize() {
   InitUsermediaCallback();
   InitEditorClientImeCallback();
 #ifdef ROTARY_EVENT_FEATURE_SUPPORT
-  InitRotaryEventCallback();
+  if (TIZEN_FEATURE_rotary_event_support)
+    InitRotaryEventCallback();
 #endif  // ROTARY_EVENT_FEATURE_SUPPORT
 
   Ewk_Settings* settings = ewk_view_settings_get(ewk_view_);
   ewk_settings_scripts_can_open_windows_set(settings, EINA_TRUE);
-#ifndef PROFILE_WEARABLE
-  ewk_settings_form_candidate_data_enabled_set(settings, EINA_TRUE);
+// From chromium-efl's ewk_settings.h
+// TODO: After chromium-efl is refactored to supply the same header for tizen internal package building, this condition should be removed.
+//    This is because chromium-efl does not declare ewk_settings_form_candidate_data_enabled_set() if it's wearable.
+//    Chromium-efl should declare all function for Tizen packages while unsupported functions return errorcode or 0 without doing anything.
+#ifndef CHROMIUM_EFL_WORKAROUND_EWK_SETTINGS
+  if (common::getProfile() != common::kPROFILE_WEARABLE)
+    ewk_settings_form_candidate_data_enabled_set(settings, EINA_TRUE);
 #endif
   ewk_settings_default_text_encoding_name_set(settings, kDefaultEncoding);
 
@@ -357,21 +364,21 @@ void WebViewImpl::InitLoaderCallback() {
   smart_callbacks_["load,progress"] = loadprogress_callback;
   smart_callbacks_["frame,rendered"] = rendered_callback;
 
-#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
   // rotate prepared callback
-  auto rotateprepared_callback = [](void* user_data,
-                              Evas_Object*,
-                              void*) {
-    WebViewImpl* self = static_cast<WebViewImpl*>(user_data);
-    if (self->listener_)
-      self->listener_->OnRotatePrepared(self->view_);
-  };
-  evas_object_smart_callback_add(ewk_view_,
-                                 "rotate,prepared",
-                                 rotateprepared_callback,
-                                 this);
-  smart_callbacks_["rotate,prepared"] = rotateprepared_callback;
-#endif  // MANUAL_ROTATE_FEATURE_SUPPORT
+  if (TIZEN_FEATURE_manual_rotate_support) {
+    auto rotateprepared_callback = [](void* user_data,
+                                Evas_Object*,
+                                void*) {
+      WebViewImpl* self = static_cast<WebViewImpl*>(user_data);
+      if (self->listener_)
+        self->listener_->OnRotatePrepared(self->view_);
+    };
+    evas_object_smart_callback_add(ewk_view_,
+                                   "rotate,prepared",
+                                   rotateprepared_callback,
+                                   this);
+    smart_callbacks_["rotate,prepared"] = rotateprepared_callback;
+  }
 }
 
 void WebViewImpl::InitPolicyDecideCallback() {
@@ -836,18 +843,16 @@ void WebViewImpl::InitPopupWaitCallback() {
       [](void* user_data, Evas_Object* /*obj*/, void*) {
         WebViewImpl* self = static_cast<WebViewImpl*>(user_data);
         self->internal_popup_opened_ = true;
-#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
-        self->window_->EnableManualRotation(false);
-#endif  // MANUAL_ROTATE_FEATURE_SUPPORT
+        if (TIZEN_FEATURE_manual_rotate_support)
+          self->window_->EnableManualRotation(false);
       }, this);
   evas_object_smart_callback_add(ewk_view_,
       "popup,reply,wait,finish",
       [](void* user_data, Evas_Object* /*obj*/, void*) {
         WebViewImpl* self = static_cast<WebViewImpl*>(user_data);
         self->internal_popup_opened_ = false;
-#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
-        self->window_->EnableManualRotation(true);
-#endif  // MANUAL_ROTATE_FEATURE_SUPPORT
+        if (TIZEN_FEATURE_manual_rotate_support)
+          self->window_->EnableManualRotation(true);
       }, this);
 }
 
@@ -1030,10 +1035,8 @@ void WebViewImpl::SetLongPolling(unsigned long longpolling) {
     ewk_view_session_timeout_set(ewk_view_, longpolling);
 }
 
-#ifdef PROFILE_WEARABLE
 void WebViewImpl::SetBGColor(int r, int g, int b, int a) {
   ewk_view_bg_color_set(ewk_view_, r, g, b, a);
 }
-#endif
 
 }  // namespace runtime
index b97fb7982e7d306ca2aa78d4e3b38c0d9769c681..da2f297e3012c03b34cddc3c2e1d24bb05c35e52 100644 (file)
@@ -51,9 +51,7 @@ class WebViewImpl {
   void SetCSPRule(const std::string& rule, bool report_only);
   void SetDefaultEncoding(const std::string& encoding);
   void SetLongPolling(unsigned long longpolling);
-#ifdef PROFILE_WEARABLE
   void SetBGColor(int r, int g, int b, int a);
-#endif
 
   void SetEventListener(WebView::EventListener* listener);
   Evas_Object* evas_object() const;
@@ -81,9 +79,7 @@ class WebViewImpl {
   void InitPopupWaitCallback();
   void InitUsermediaCallback();
   void InitEditorClientImeCallback();
-#ifdef ROTARY_EVENT_FEATURE_SUPPORT
   void InitRotaryEventCallback();
-#endif  // ROTARY_EVENT_FEATURE_SUPPORT
 
   std::function<bool (const char*, const char*, char**, void*)> mime_set_cb_;
 
@@ -100,6 +96,7 @@ class WebViewImpl {
   bool internal_popup_opened_;
   size_t ime_width_;
   size_t ime_height_;
+
 };
 }  // namespace runtime
 
index 4348b5f0499eacf54806979693a1fc4568f2ab13..168f13a711dc03edf9c03597f90690c791e5a17a 100755 (executable)
@@ -54,6 +54,7 @@
         'packages': [
           'capi-appfw-application',
           'capi-ui-efl-util',
+          'capi-system-info',
           'chromium-efl',
           'ecore',
           'ecore-wayland',
         ],
       },
       'conditions': [
-        ['profile == "mobile"', {
-          'defines': ['PROFILE_MOBILE'],
-        }],
-        ['profile == "wearable"', {
-          'defines': ['PROFILE_WEARABLE'],
-        }],
-        ['profile == "tv"', {
-          'defines': ['PROFILE_TV'],
-        }],
         ['tizen_product_tv == "1"', {
           'defines': ['TIZEN_PRODUCT_TV'],
         }],
             ],
           },
         }],
-        ['tizen_feature_manual_rotate_support == 1', {
-          'defines': ['MANUAL_ROTATE_FEATURE_SUPPORT'],
+        ['chromium_efl_workaround_ewk_settings == 1', {
+          'defines': ['CHROMIUM_EFL_WORKAROUND_EWK_SETTINGS'],
         }],
       ],
     }, # end of target 'xwalk_runtime'