[M47_2526] Chromium upversion to m47_2526 branch
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / renderer / render_view_observer_efl.h
1 // Copyright 2014 Samsung Electronics. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef RENDER_VIEW_OBSERVER_EFL_H_
6 #define RENDER_VIEW_OBSERVER_EFL_H_
7
8 #include <string>
9
10 #include "base/timer/timer.h"
11 #include "content/public/renderer/render_view_observer.h"
12 #include "content/public/renderer/render_view_observer.h"
13 #include "renderer/content_renderer_client_efl.h"
14 #include "renderer/print_web_view_helper_efl.h"
15 #include "content/public/renderer/render_view_observer.h"
16 #include "private/ewk_hit_test_private.h"
17 #include "public/ewk_hit_test.h"
18 #include "public/ewk_view.h"
19 #include "third_party/WebKit/public/platform/WebSize.h"
20 #include "third_party/WebKit/public/web/WebViewModeEnums.h"
21
22 namespace base {
23 class FilePath;
24 }
25
26 namespace content {
27 class ContentRendererClient;
28 class RenderView;
29 }
30
31 namespace WebKit {
32 class WebHitTestResult;
33 }
34
35 namespace blink {
36 class WebGestureEvent;
37 }
38
39 class EwkViewMsg_LoadData_Params;
40 class Hit_Test_Params;
41 class WebViewSettings;
42
43 class RenderViewObserverEfl: public content::RenderViewObserver {
44  public:
45   explicit RenderViewObserverEfl(
46       content::RenderView* render_view,
47       ContentRendererClientEfl* render_client);
48   virtual ~RenderViewObserverEfl();
49
50   bool OnMessageReceived(const IPC::Message& message) override;
51   virtual void DidCreateDocumentElement(blink::WebLocalFrame* frame) override;
52 #if !defined(EWK_BRINGUP)
53   virtual void DidChangePageScaleFactor() override;
54 #endif
55   void DidFailLoad(blink::WebLocalFrame* frame,
56                    const blink::WebURLError& error) override;
57   void DidFailProvisionalLoad(blink::WebLocalFrame* frame,
58       const blink::WebURLError& error) override { DidFailLoad(frame, error); }
59
60   //Changes in PageScaleFactorLimits are applied when layoutUpdated is called
61   //So using this notification to update minimum and maximum page scale factor values
62   virtual void DidUpdateLayout() override;
63
64   void DidHandleGestureEvent(const blink::WebGestureEvent& event) override;
65
66  private:
67   void OnSetContentSecurityPolicy(const std::string& policy, Ewk_CSP_Header_Type header_type);
68   void OnScale(double scale_factor, int x, int y);
69   void OnSetScroll(int x, int y);
70   void OnUseSettingsFont();
71   void OnPlainTextGet(int plain_text_get_callback_id);
72   void OnGetSelectionStyle();
73   void OnDoHitTest(int x, int y, Ewk_Hit_Test_Mode mode);
74   void OnDoHitTestAsync(int view_x, int view_y, Ewk_Hit_Test_Mode mode, int64_t request_id);
75   bool DoHitTest(int view_x, int view_y, Ewk_Hit_Test_Mode mode, Hit_Test_Params* params);
76   void OnPrintToPdf(int width, int height, const base::FilePath& filename);
77   void OnGetMHTMLData(int callback_id);
78   void OnSetDrawsTransparentBackground(bool enabled);
79   void OnWebAppIconUrlGet(int callback_id);
80   void OnWebAppIconUrlsGet(int callback_id);
81   void OnWebAppCapableGet(int callback_id);
82   void OnSetBrowserFont();
83   void CheckContentsSize();
84   void OnSuspendScheduledTasks();
85   void OnResumeScheduledTasks();
86   void OnUpdateSettings(const WebViewSettings& settings);
87
88   void HandleTap(const blink::WebGestureEvent& event);
89
90   // This function sets CSS "view-mode" media feature value.
91   void OnSetViewMode(blink::WebViewMode view_mode);
92
93   float cached_min_page_scale_factor_;
94   float cached_max_page_scale_factor_;
95   gfx::Size last_sent_contents_size_;
96   base::OneShotTimer check_contents_size_timer_;
97
98   bool link_effect_enabled_;
99
100   content::ContentRendererClient* renderer_client_;
101 };
102
103 #endif /* RENDER_VIEW_OBSERVER_EFL_H_ */