[M120 Migration]URL of _Ewk_Error set wrong
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / eweb_view.h
index 2108ae3..08fc8e7 100644 (file)
 #include "public/ewk_value_product.h"
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+#include "third_party/blink/public/common/mediastream/media_devices.h"
+#endif
+
 namespace aura {
 namespace client {
 class FocusClient;
@@ -86,6 +90,10 @@ class _Ewk_Hit_Test;
 class Ewk_Context;
 class _Ewk_Quota_Permission_Request;
 
+#if BUILDFLAG(IS_TIZEN_TV)
+struct _Ewk_File_Chooser_Request;
+#endif
+
 #if defined(TIZEN_ATK_SUPPORT)
 class EWebAccessibility;
 #endif
@@ -286,6 +294,45 @@ class DidChangeThemeColorCallback {
   void* user_data_;
 };
 
+#if BUILDFLAG(IS_TIZEN_TV)
+class GetMediaDeviceCallback {
+ public:
+  GetMediaDeviceCallback() : func_(nullptr), user_data_(nullptr) {}
+
+  void Set(Ewk_Media_Device_List_Get_Callback func, void* user_data) {
+    func_ = func;
+    user_data_ = user_data;
+  }
+
+  void Run(EwkMediaDeviceInfo* device_list, int size) {
+    if (func_) {
+      (func_)(device_list, size, user_data_);
+    }
+  }
+
+ private:
+  Ewk_Media_Device_List_Get_Callback func_;
+  void* user_data_;
+};
+#endif
+
+#if BUILDFLAG(IS_TIZEN_TV)
+class IsVideoPlayingCallback {
+ public:
+  IsVideoPlayingCallback(Ewk_Is_Video_Playing_Callback func, void* user_data)
+      : func_(func), user_data_(user_data) {}
+  void Run(Evas_Object* obj, bool isplaying) {
+    if (func_) {
+      (func_)(obj, isplaying ? EINA_TRUE : EINA_FALSE, user_data_);
+    }
+  }
+
+ private:
+  Ewk_Is_Video_Playing_Callback func_;
+  void* user_data_;
+};
+#endif
+
 class WebViewAsyncRequestHitTestDataCallback;
 class JavaScriptDialogManagerEfl;
 class PermissionPopupManager;
@@ -346,6 +393,16 @@ class EWebView {
   void Stop();
 #if BUILDFLAG(IS_TIZEN_TV)
   void SetFloatVideoWindowState(bool enabled);
+  void NotifyDownloadableFontInfo(const char* scheme_id_uri,
+                                  const char* value,
+                                  const char* data,
+                                  int type);
+  std::vector<std::string> NotifyPlaybackState(int state,
+                                               int player_id,
+                                               const char* url,
+                                               const char* mime_type);
+  void SuspendNetworkLoading();
+  void ResumeNetworkLoading();
 #endif // IS_TIZEN_TV
   void SetSessionTimeout(uint64_t timeout);
   double GetTextZoomFactor() const;
@@ -362,6 +419,8 @@ class EWebView {
   void SetTouchEventsEnabled(bool enabled);
   bool MouseEventsEnabled() const;
   void SetMouseEventsEnabled(bool enabled);
+  void SendKeyEvent(Evas_Object* ewk_view, void* key_event, bool is_press);
+  bool SetKeyEventsEnabled(bool enabled);
   void HandleTouchEvents(Ewk_Touch_Event_Type type,
                          const Eina_List* points,
                          const Evas_Modifier* modifiers);
@@ -516,10 +575,9 @@ class EWebView {
 
   void SetViewLoadErrorPageCallback(Ewk_View_Error_Page_Load_Callback callback,
                                     void* user_data);
-  const char* InvokeViewLoadErrorPageCallback(
-      const GURL& url,
-      int error_code,
-      const std::string& error_description);
+  const char* InvokeViewLoadErrorPageCallback(const GURL& url,
+                                              int error_code,
+                                              bool is_cancellation);
   bool IsLoadErrorPageCallbackSet() const;
   void SetViewUnfocusAllowCallback(Ewk_View_Unfocus_Allow_Callback callback,
                                    void* user_data);
@@ -587,7 +645,7 @@ class EWebView {
 
   void GetSessionData(const char** data, unsigned* length) const;
   bool RestoreFromSessionData(const char* data, unsigned length);
-  void ShowFileChooser(content::RenderFrameHost* render_frame_host,
+  void ShowFileChooser(scoped_refptr<content::FileSelectListener> listener,
                        const blink::mojom::FileChooserParams&);
   void SetBrowserFont();
   bool IsDragging() const;
@@ -696,6 +754,9 @@ class EWebView {
   bool EdgeScrollBy(int delta_x, int delta_y);
   void GetMousePosition(gfx::Point&);
   void InvokeEdgeScrollByCallback(const gfx::Point&, bool);
+  // notify web browser video playing status
+  bool IsVideoPlaying(Ewk_Is_Video_Playing_Callback callback, void* user_data);
+  void InvokeIsVideoPlayingCallback(bool is_playing, int callback_id);
 #endif
 
   void OnOverscrolled(const gfx::Vector2dF& accumulated_overscroll,
@@ -739,6 +800,37 @@ class EWebView {
   bool RWIInfoShowed() { return rwi_info_showed_; }
   GURL RWIURL() { return rwi_gurl_; }
   void OnDialogClosed();
+  void NotifyMediaStateChanged(uint32_t type,
+                               uint32_t previous,
+                               uint32_t current);
+  void SetHighBitRate(Eina_Bool is_high_bitrate);
+  bool IsHighBitRate() const { return is_high_bitrate_; }
+  void NotifyFirstTimeStamp(unsigned long long timestamp,
+                            int time_base_num,
+                            int time_base_den);
+  void NotifyPESData(const std::string& buf,
+                     unsigned int len,
+                     int media_position);
+  void SetPreferSubtitleLang(const char* lang_list);
+  void NotifySubtitleState(int state, double time_stamp);
+  void NotifySubtitlePlay(int active_track_id,
+                          const char* url,
+                          const char* lang);
+  void NotifySubtitleData(int track_id,
+                          double time_stamp,
+                          const std::string& data,
+                          unsigned int size);
+  void UpdateCurrentTime(double current_time);
+  void UpdateEventData(void* data);
+  double GetCurrentTime() { return current_time_; }
+  void GetMediaDeviceList(Ewk_Media_Device_List_Get_Callback callback,
+                          void* userData);
+  using MediaDeviceEnumeration =
+      std::array<blink::WebMediaDeviceInfoArray, NUM_MEDIA_DEVICE_TYPES>;
+  void OnDeviceListed(const MediaDeviceEnumeration& devices);
+  void SetTranslatedURL(const char* url);
+  void NotifyParentalRatingInfo(const char* info, const char* url);
+  void SetParentalRatingResult(const char* info, bool is_pass);
 #endif  // IS_TIZEN_TV
 
   void SetDidChangeThemeColorCallback(
@@ -768,15 +860,7 @@ class EWebView {
   void InitInspectorServer();
 
   void RunPendingSetFocus(Eina_Bool focus);
-#endif
-
-#if BUILDFLAG(IS_TIZEN) && !defined(EWK_BRINGUP)
-  static void cameraResultCb(service_h request,
-                             service_h reply,
-                             service_result_e result,
-                             void* data);
-
-  bool LaunchCamera(std::u16string mimetype);
+  void SetFocusInternal(Eina_Bool focus);
 #endif
 
   JavaScriptDialogManagerEfl* GetJavaScriptDialogManagerEfl();
@@ -826,6 +910,7 @@ class EWebView {
   std::unique_ptr<_Ewk_Policy_Decision> window_policy_;
   Evas_Object* ewk_view_;
   Evas_Object* efl_main_layout_;
+  bool key_events_enabled_ = true;
   bool mouse_events_enabled_;
   double text_zoom_factor_;
   mutable std::string user_agent_;
@@ -834,7 +919,9 @@ class EWebView {
   std::string selected_text_cached_;
 
   std::unique_ptr<content::ContextMenuControllerEfl> context_menu_;
-#if !defined(EWK_BRINGUP)  // FIXME: m71 bringup
+#if BUILDFLAG(IS_TIZEN_TV)
+  std::unique_ptr<_Ewk_File_Chooser_Request> file_chooser_request_;
+#else
   std::unique_ptr<content::FileChooserControllerEfl> file_chooser_;
 #endif
   std::unique_ptr<content::PopupControllerEfl> popup_controller_;
@@ -850,6 +937,10 @@ class EWebView {
       MHTMLCallbackDetails;
   base::IDMap<MHTMLCallbackDetails*> mhtml_callback_map_;
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  base::IDMap<IsVideoPlayingCallback*> is_video_playing_callback_map_;
+#endif
+
   typedef WebViewCallback<Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback,
                           bool>
       MainFrameScrollbarVisibleGetCallback;
@@ -858,6 +949,10 @@ class EWebView {
 
   base::IDMap<BackgroundColorGetCallback*> background_color_get_callback_map_;
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  GetMediaDeviceCallback device_cb_;
+#endif
+
   gfx::Size contents_size_;
   double progress_;
   mutable std::string title_;
@@ -934,8 +1029,20 @@ class EWebView {
   bool use_early_rwi_;
   bool rwi_info_showed_;
   GURL rwi_gurl_;
+  bool is_high_bitrate_ = false;
 
   base::OnceClosure pending_setfocus_closure_;
+
+  enum PlaybackState {
+    kPlaybackLoad = 0,
+    // kPlaybackReady: player with both audio and video starts prepare and will
+    // acquire audio and video resources (if they are not already taken)
+    kPlaybackReady,
+    kPlaybackStart,
+    kPlaybackFinish,
+    kPlaybackStop,
+  };
+  double current_time_ = 0.0;
 #endif
 
   std::unique_ptr<_Ewk_Back_Forward_List> back_forward_list_;
@@ -977,6 +1084,7 @@ class EWebView {
 #endif
 
   Ecore_Timer* delayed_show_context_menu_timer_ = nullptr;
+  base::WeakPtrFactory<EWebView> weak_factory_{this};
 };
 
 const unsigned int g_default_tilt_motion_sensitivity = 3;