Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / content / renderer / render_frame_impl.h
index 9523bad..369f177 100644 (file)
@@ -15,6 +15,7 @@
 #include "base/observer_list.h"
 #include "base/process/process_handle.h"
 #include "content/common/accessibility_mode_enums.h"
+#include "content/common/frame_message_enums.h"
 #include "content/common/mojo/service_registry_impl.h"
 #include "content/public/common/javascript_message_type.h"
 #include "content/public/common/referrer.h"
 #include "content/renderer/media/android/renderer_media_player_manager.h"
 #endif
 
+class GURL;
 class TransportDIB;
+struct FrameHostMsg_AddNavigationTransitionData_Params;
 struct FrameMsg_Navigate_Params;
+struct FrameMsg_RequestNavigation_Params;
 
 namespace blink {
 class WebGeolocationClient;
-class WebInputEvent;
 class WebMouseEvent;
 class WebContentDecryptionModule;
 class WebMediaPlayer;
@@ -73,8 +76,11 @@ class MediaStreamRendererFactory;
 class MidiDispatcher;
 class NotificationPermissionDispatcher;
 class NotificationProvider;
+class PageState;
 class PepperPluginInstanceImpl;
+class PluginPowerSaverHelper;
 class PushMessagingDispatcher;
+class PushPermissionDispatcher;
 class RendererAccessibility;
 class RendererCdmManager;
 class RendererMediaPlayerManager;
@@ -85,7 +91,11 @@ class RenderWidget;
 class RenderWidgetFullscreenPepper;
 class ScreenOrientationDispatcher;
 class UserMediaClientImpl;
+struct CommitNavigationParams;
+struct CommonNavigationParams;
 struct CustomContextMenuContext;
+struct RequestNavigationParams;
+struct ResourceResponseHead;
 
 class CONTENT_EXPORT RenderFrameImpl
     : public RenderFrame,
@@ -102,12 +112,16 @@ class CONTENT_EXPORT RenderFrameImpl
 
   // Creates a new RenderFrame with |routing_id| as a child of the RenderFrame
   // identified by |parent_routing_id| or as the top-level frame if the latter
-  // is MSG_ROUTING_NONE. It creates the Blink WebLocalFrame and inserts it in
-  // the proper place in the frame tree.
+  // is MSG_ROUTING_NONE. If |proxy_routing_id| is MSG_ROUTING_NONE, it creates
+  // the Blink WebLocalFrame and inserts it in the proper place in the frame
+  // tree. Otherwise, the frame is semi-orphaned until it commits, at which
+  // point it replaces the proxy identified by |proxy_routing_id|.
   // Note: This is called only when RenderFrame is being created in response to
   // IPC message from the browser process. All other frame creation is driven
   // through Blink and Create.
-  static void CreateFrame(int routing_id, int parent_routing_id);
+  static void CreateFrame(int routing_id,
+                          int parent_routing_id,
+                          int proxy_routing_id);
 
   // Returns the RenderFrameImpl for the given routing ID.
   static RenderFrameImpl* FromRoutingID(int routing_id);
@@ -229,15 +243,16 @@ class CONTENT_EXPORT RenderFrameImpl
   // TODO(jam): remove these once the IPC handler moves from RenderView to
   // RenderFrame.
   void OnImeSetComposition(
-    const base::string16& text,
-    const std::vector<blink::WebCompositionUnderline>& underlines,
-    int selection_start,
-    int selection_end);
- void OnImeConfirmComposition(
-    const base::string16& text,
-    const gfx::Range& replacement_range,
-    bool keep_selection);
-#endif  // ENABLE_PLUGINS
+      const base::string16& text,
+      const std::vector<blink::WebCompositionUnderline>& underlines,
+      int selection_start,
+      int selection_end);
+  void OnImeConfirmComposition(const base::string16& text,
+                               const gfx::Range& replacement_range,
+                               bool keep_selection);
+
+  PluginPowerSaverHelper* plugin_power_saver_helper();
+#endif  // defined(ENABLE_PLUGINS)
 
   // May return NULL in some cases, especially if userMediaClient() returns
   // NULL.
@@ -248,34 +263,41 @@ class CONTENT_EXPORT RenderFrameImpl
 #endif
 
   // IPC::Sender
-  virtual bool Send(IPC::Message* msg) OVERRIDE;
+  bool Send(IPC::Message* msg) override;
 
   // IPC::Listener
-  virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
+  bool OnMessageReceived(const IPC::Message& msg) override;
 
   // RenderFrame implementation:
-  virtual RenderView* GetRenderView() OVERRIDE;
-  virtual int GetRoutingID() OVERRIDE;
-  virtual blink::WebLocalFrame* GetWebFrame() OVERRIDE;
-  virtual WebPreferences& GetWebkitPreferences() OVERRIDE;
-  virtual int ShowContextMenu(ContextMenuClient* client,
-                              const ContextMenuParams& params) OVERRIDE;
-  virtual void CancelContextMenu(int request_id) OVERRIDE;
-  virtual blink::WebNode GetContextMenuNode() const OVERRIDE;
-  virtual blink::WebPlugin* CreatePlugin(
-      blink::WebFrame* frame,
-      const WebPluginInfo& info,
-      const blink::WebPluginParams& params) OVERRIDE;
-  virtual void LoadURLExternally(blink::WebLocalFrame* frame,
-                                 const blink::WebURLRequest& request,
-                                 blink::WebNavigationPolicy policy) OVERRIDE;
-  virtual void ExecuteJavaScript(const base::string16& javascript) OVERRIDE;
-  virtual bool IsHidden() OVERRIDE;
-  virtual ServiceRegistry* GetServiceRegistry() OVERRIDE;
-  virtual bool IsFTPDirectoryListing() OVERRIDE;
-  virtual void AttachGuest(int element_instance_id) OVERRIDE;
+  RenderView* GetRenderView() override;
+  int GetRoutingID() override;
+  blink::WebLocalFrame* GetWebFrame() override;
+  WebPreferences& GetWebkitPreferences() override;
+  int ShowContextMenu(ContextMenuClient* client,
+                      const ContextMenuParams& params) override;
+  void CancelContextMenu(int request_id) override;
+  blink::WebNode GetContextMenuNode() const override;
+  blink::WebPlugin* CreatePlugin(blink::WebFrame* frame,
+                                 const WebPluginInfo& info,
+                                 const blink::WebPluginParams& params) override;
+  void LoadURLExternally(blink::WebLocalFrame* frame,
+                         const blink::WebURLRequest& request,
+                         blink::WebNavigationPolicy policy) override;
+  void ExecuteJavaScript(const base::string16& javascript) override;
+  bool IsHidden() override;
+  ServiceRegistry* GetServiceRegistry() override;
+  bool IsFTPDirectoryListing() override;
+  void AttachGuest(int element_instance_id) override;
+  void SetSelectedText(const base::string16& selection_text,
+                       size_t offset,
+                       const gfx::Range& range) override;
+  void EnsureMojoBuiltinsAreAvailable(v8::Isolate* isolate,
+                                      v8::Handle<v8::Context> context) override;
 
   // blink::WebFrameClient implementation:
+  blink::WebPluginPlaceholder* createPluginPlaceholder(
+      blink::WebLocalFrame*,
+      const blink::WebPluginParams&) override;
   virtual blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
                                          const blink::WebPluginParams& params);
   // TODO(jrummell): Remove this method once blink updated.
@@ -365,9 +387,15 @@ class CONTENT_EXPORT RenderFrameImpl
                                      blink::WebHistoryCommitType commit_type);
   virtual void didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame);
   virtual void addNavigationTransitionData(
+        const blink::WebString& allowedDestinationOrigin,
+        const blink::WebString& selector,
+        const blink::WebString& markup);
+  virtual void addNavigationTransitionData(
       const blink::WebString& allowedDestinationOrigin,
       const blink::WebString& selector,
-      const blink::WebString& markup);
+      const blink::WebString& markup,
+      const blink::WebVector<blink::WebString>& web_names,
+      const blink::WebVector<blink::WebRect>& web_rects);
   virtual void didChangeThemeColor();
   virtual void requestNotificationPermission(
       const blink::WebSecurityOrigin& origin,
@@ -425,10 +453,9 @@ class CONTENT_EXPORT RenderFrameImpl
                                    blink::WebStorageQuotaType type,
                                    unsigned long long requested_size,
                                    blink::WebStorageQuotaCallbacks callbacks);
-  virtual void willOpenSocketStream(
-      blink::WebSocketStreamHandle* handle);
   virtual void willOpenWebSocket(blink::WebSocketHandle* handle);
   virtual blink::WebGeolocationClient* geolocationClient();
+  virtual void requestPushPermission(blink::WebCallback* callback);
   virtual blink::WebPushClient* pushClient();
   virtual void willStartUsingPeerConnectionHandler(
       blink::WebLocalFrame* frame,
@@ -446,17 +473,24 @@ class CONTENT_EXPORT RenderFrameImpl
   virtual bool allowWebGL(blink::WebLocalFrame* frame, bool default_value);
   virtual void didLoseWebGLContext(blink::WebLocalFrame* frame,
                                    int arb_robustness_status_code);
-  virtual void forwardInputEvent(const blink::WebInputEvent* event);
   virtual blink::WebScreenOrientationClient* webScreenOrientationClient();
-  virtual bool isControlledByServiceWorker();
+  virtual bool isControlledByServiceWorker(blink::WebDataSource& data_source);
+  virtual int64_t serviceWorkerID(blink::WebDataSource& data_source);
   virtual void postAccessibilityEvent(const blink::WebAXObject& obj,
                                       blink::WebAXEvent event);
+  virtual void handleAccessibilityFindInPageResult(
+        int identifier,
+        int match_index,
+        const blink::WebAXObject& start_object,
+        int start_offset,
+        const blink::WebAXObject& end_object,
+        int end_offset);
   virtual void didChangeManifest(blink::WebLocalFrame*);
 
   // WebMediaPlayerDelegate implementation:
-  virtual void DidPlay(blink::WebMediaPlayer* player) OVERRIDE;
-  virtual void DidPause(blink::WebMediaPlayer* player) OVERRIDE;
-  virtual void PlayerGone(blink::WebMediaPlayer* player) OVERRIDE;
+  void DidPlay(blink::WebMediaPlayer* player) override;
+  void DidPause(blink::WebMediaPlayer* player) override;
+  void PlayerGone(blink::WebMediaPlayer* player) override;
 
   // TODO(nasko): Make all tests in RenderViewImplTest friends and then move
   // this back to private member.
@@ -467,6 +501,8 @@ class CONTENT_EXPORT RenderFrameImpl
   void BindServiceRegistry(
       mojo::ScopedMessagePipeHandle service_provider_handle);
 
+  ManifestManager* manifest_manager();
+
  protected:
   RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id);
 
@@ -479,8 +515,6 @@ class CONTENT_EXPORT RenderFrameImpl
   FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
   FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest,
                            AccessibilityMessagesQueueWhileSwappedOut);
-  FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest,
-                           ShouldUpdateSelectionTextFromContextMenuParams);
   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
                            OnExtendSelectionAndDelete);
   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ReloadWhileSwappedOut);
@@ -522,8 +556,9 @@ class CONTENT_EXPORT RenderFrameImpl
   void OnPasteAndMatchStyle();
   void OnDelete();
   void OnSelectAll();
-  void OnSelectRange(const gfx::Point& start, const gfx::Point& end);
+  void OnSelectRange(const gfx::Point& base, const gfx::Point& extent);
   void OnUnselect();
+  void OnMoveRangeSelectionExtent(const gfx::Point& point);
   void OnReplace(const base::string16& text);
   void OnReplaceMisspelling(const base::string16& text);
   void OnCSSInsertRequest(const std::string& css);
@@ -553,6 +588,14 @@ class CONTENT_EXPORT RenderFrameImpl
   void OnCopyToFindPboard();
 #endif
 
+  // PlzNavigate
+  void OnRequestNavigation(const CommonNavigationParams& common_params,
+                           const RequestNavigationParams& request_params);
+  void OnCommitNavigation(const ResourceResponseHead& response,
+                          const GURL& stream_url,
+                          const CommonNavigationParams& common_params,
+                          const CommitNavigationParams& commit_params);
+
   // Virtual since overridden by WebTestProxy for layout tests.
   virtual blink::WebNavigationPolicy DecidePolicyForNavigation(
       RenderFrame* render_frame,
@@ -584,14 +627,6 @@ class CONTENT_EXPORT RenderFrameImpl
   // selection handles in sync with the webpage.
   void SyncSelectionIfRequired();
 
-  // Returns whether |params.selection_text| should be synchronized to the
-  // browser before bringing up the context menu. Static for testing.
-  static bool ShouldUpdateSelectionTextFromContextMenuParams(
-      const base::string16& selection_text,
-      size_t selection_text_offset,
-      const gfx::Range& selection_range,
-      const ContextMenuParams& params);
-
   bool RunJavaScriptMessage(JavaScriptMessageType type,
                             const base::string16& message,
                             const base::string16& default_value,
@@ -621,6 +656,18 @@ class CONTENT_EXPORT RenderFrameImpl
   // The method is virtual so that layouttests can override it.
   virtual scoped_ptr<MediaStreamRendererFactory> CreateRendererFactory();
 
+  // Checks that the RenderView is ready to display the navigation to |url|. If
+  // the return value is false, the navigation should be abandonned.
+  bool PrepareRenderViewForNavigation(
+      const GURL& url,
+      FrameMsg_Navigate_Type::Value navigate_type,
+      const PageState& state,
+      bool check_history,
+      int pending_history_list_offset,
+      int32 page_id,
+      bool* is_reload,
+      blink::WebURLRequest::CachePolicy* cache_policy);
+
   // Returns the URL being loaded by the |frame_|'s request.
   GURL GetLoadingUrl() const;
 
@@ -651,10 +698,18 @@ class CONTENT_EXPORT RenderFrameImpl
   RenderFrameProxy* render_frame_proxy_;
   bool is_detaching_;
 
+  // If this frame was created to replace a proxy, this will store the routing
+  // id of the proxy to replace at commit-time, at which time it will be
+  // cleared.
+  // TODO(creis): Remove this after switching to PlzNavigate.
+  int proxy_routing_id_;
+
 #if defined(ENABLE_PLUGINS)
   // Current text input composition text. Empty if no composition is in
   // progress.
   base::string16 pepper_composition_text_;
+
+  PluginPowerSaverHelper* plugin_power_saver_helper_;
 #endif
 
   RendererWebCookieJarImpl cookie_jar_;
@@ -737,7 +792,11 @@ class CONTENT_EXPORT RenderFrameImpl
   // The geolocation dispatcher attached to this frame, lazily initialized.
   GeolocationDispatcher* geolocation_dispatcher_;
 
+  // Dispatches permission requests for the Push API. Lazily initialized.
+  PushPermissionDispatcher* push_permission_dispatcher_;
+
   // The push messaging dispatcher attached to this frame, lazily initialized.
+  // TODO(mvanouwerkerk): Route this functionality through Platform.
   PushMessagingDispatcher* push_messaging_dispatcher_;
 
   ServiceRegistryImpl service_registry_;