| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
| 6 #define CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 6 #define CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/id_map.h" | 13 #include "base/id_map.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/process/process_handle.h" | 16 #include "base/process/process_handle.h" |
| 17 #include "content/public/common/javascript_message_type.h" | 17 #include "content/public/common/javascript_message_type.h" |
| 18 #include "content/public/common/referrer.h" | 18 #include "content/public/common/referrer.h" |
| 19 #include "content/public/renderer/render_frame.h" | 19 #include "content/public/renderer/render_frame.h" |
| 20 #include "content/renderer/media/webmediaplayer_delegate.h" | 20 #include "content/renderer/media/webmediaplayer_delegate.h" |
| 21 #include "content/renderer/render_frame_proxy.h" |
| 21 #include "content/renderer/renderer_webcookiejar_impl.h" | 22 #include "content/renderer/renderer_webcookiejar_impl.h" |
| 22 #include "ipc/ipc_message.h" | 23 #include "ipc/ipc_message.h" |
| 23 #include "third_party/WebKit/public/web/WebDataSource.h" | 24 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 24 #include "third_party/WebKit/public/web/WebFrameClient.h" | 25 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 25 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" | 26 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" |
| 26 #include "ui/gfx/range/range.h" | 27 #include "ui/gfx/range/range.h" |
| 27 | 28 |
| 28 class TransportDIB; | 29 class TransportDIB; |
| 29 struct FrameMsg_BuffersSwapped_Params; | 30 struct FrameMsg_BuffersSwapped_Params; |
| 30 struct FrameMsg_CompositorFrameSwapped_Params; | 31 struct FrameMsg_CompositorFrameSwapped_Params; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 : public RenderFrame, | 68 : public RenderFrame, |
| 68 NON_EXPORTED_BASE(public blink::WebFrameClient), | 69 NON_EXPORTED_BASE(public blink::WebFrameClient), |
| 69 NON_EXPORTED_BASE(public WebMediaPlayerDelegate) { | 70 NON_EXPORTED_BASE(public WebMediaPlayerDelegate) { |
| 70 public: | 71 public: |
| 71 // Creates a new RenderFrame. |render_view| is the RenderView object that this | 72 // Creates a new RenderFrame. |render_view| is the RenderView object that this |
| 72 // frame belongs to. | 73 // frame belongs to. |
| 73 // Callers *must* call |SetWebFrame| immediately after creation. | 74 // Callers *must* call |SetWebFrame| immediately after creation. |
| 74 // TODO(creis): We should structure this so that |SetWebFrame| isn't needed. | 75 // TODO(creis): We should structure this so that |SetWebFrame| isn't needed. |
| 75 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id); | 76 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id); |
| 76 | 77 |
| 78 // Returns the RenderFrameImpl for the given routing ID. |
| 79 static RenderFrameImpl* FromRoutingID(int routing_id); |
| 80 |
| 77 // Just like RenderFrame::FromWebFrame but returns the implementation. | 81 // Just like RenderFrame::FromWebFrame but returns the implementation. |
| 78 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame); | 82 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame); |
| 79 | 83 |
| 80 // Used by content_layouttest_support to hook into the creation of | 84 // Used by content_layouttest_support to hook into the creation of |
| 81 // RenderFrameImpls. | 85 // RenderFrameImpls. |
| 82 static void InstallCreateHook( | 86 static void InstallCreateHook( |
| 83 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)); | 87 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)); |
| 84 | 88 |
| 85 virtual ~RenderFrameImpl(); | 89 virtual ~RenderFrameImpl(); |
| 86 | 90 |
| 87 bool is_swapped_out() const { | 91 bool is_swapped_out() const { |
| 88 return is_swapped_out_; | 92 return is_swapped_out_; |
| 89 } | 93 } |
| 90 | 94 |
| 95 // TODO(nasko): This can be removed once we don't have a swapped out state on |
| 96 // RenderFrames. See https://crbug.com/357747. |
| 97 void set_render_frame_proxy(RenderFrameProxy* proxy) { |
| 98 render_frame_proxy_ = proxy; |
| 99 } |
| 100 |
| 91 // Out-of-process child frames receive a signal from RenderWidgetCompositor | 101 // Out-of-process child frames receive a signal from RenderWidgetCompositor |
| 92 // when a compositor frame has committed. | 102 // when a compositor frame has committed. |
| 93 void DidCommitCompositorFrame(); | 103 void DidCommitCompositorFrame(); |
| 94 | 104 |
| 95 // TODO(jam): this is a temporary getter until all the code is transitioned | 105 // TODO(jam): this is a temporary getter until all the code is transitioned |
| 96 // to using RenderFrame instead of RenderView. | 106 // to using RenderFrame instead of RenderView. |
| 97 RenderViewImpl* render_view() { return render_view_.get(); } | 107 RenderViewImpl* render_view() { return render_view_.get(); } |
| 98 | 108 |
| 99 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; } | 109 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; } |
| 100 | 110 |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 | 415 |
| 406 // Gets the focused element. If no such element exists then the element will | 416 // Gets the focused element. If no such element exists then the element will |
| 407 // be NULL. | 417 // be NULL. |
| 408 blink::WebElement GetFocusedElement(); | 418 blink::WebElement GetFocusedElement(); |
| 409 | 419 |
| 410 // IPC message handlers ------------------------------------------------------ | 420 // IPC message handlers ------------------------------------------------------ |
| 411 // | 421 // |
| 412 // The documentation for these functions should be in | 422 // The documentation for these functions should be in |
| 413 // content/common/*_messages.h for the message that the function is handling. | 423 // content/common/*_messages.h for the message that the function is handling. |
| 414 void OnBeforeUnload(); | 424 void OnBeforeUnload(); |
| 415 void OnSwapOut(); | 425 void OnSwapOut(int proxy_routing_id); |
| 416 void OnChildFrameProcessGone(); | 426 void OnChildFrameProcessGone(); |
| 417 void OnBuffersSwapped(const FrameMsg_BuffersSwapped_Params& params); | 427 void OnBuffersSwapped(const FrameMsg_BuffersSwapped_Params& params); |
| 418 void OnCompositorFrameSwapped(const IPC::Message& message); | 428 void OnCompositorFrameSwapped(const IPC::Message& message); |
| 419 void OnShowContextMenu(const gfx::Point& location); | 429 void OnShowContextMenu(const gfx::Point& location); |
| 420 void OnContextMenuClosed(const CustomContextMenuContext& custom_context); | 430 void OnContextMenuClosed(const CustomContextMenuContext& custom_context); |
| 421 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context, | 431 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context, |
| 422 unsigned action); | 432 unsigned action); |
| 423 void OnUndo(); | 433 void OnUndo(); |
| 424 void OnRedo(); | 434 void OnRedo(); |
| 425 void OnCut(); | 435 void OnCut(); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 const blink::WebURL& url, | 525 const blink::WebURL& url, |
| 516 blink::WebMediaPlayerClient* client); | 526 blink::WebMediaPlayerClient* client); |
| 517 #endif | 527 #endif |
| 518 | 528 |
| 519 // Stores the WebLocalFrame we are associated with. | 529 // Stores the WebLocalFrame we are associated with. |
| 520 blink::WebLocalFrame* frame_; | 530 blink::WebLocalFrame* frame_; |
| 521 | 531 |
| 522 base::WeakPtr<RenderViewImpl> render_view_; | 532 base::WeakPtr<RenderViewImpl> render_view_; |
| 523 int routing_id_; | 533 int routing_id_; |
| 524 bool is_swapped_out_; | 534 bool is_swapped_out_; |
| 535 // RenderFrameProxy exists only when is_swapped_out_ is true. |
| 536 // TODO(nasko): This can be removed once we don't have a swapped out state on |
| 537 // RenderFrame. See https://crbug.com/357747. |
| 538 RenderFrameProxy* render_frame_proxy_; |
| 525 bool is_detaching_; | 539 bool is_detaching_; |
| 526 | 540 |
| 527 #if defined(ENABLE_PLUGINS) | 541 #if defined(ENABLE_PLUGINS) |
| 528 // Current text input composition text. Empty if no composition is in | 542 // Current text input composition text. Empty if no composition is in |
| 529 // progress. | 543 // progress. |
| 530 base::string16 pepper_composition_text_; | 544 base::string16 pepper_composition_text_; |
| 531 #endif | 545 #endif |
| 532 | 546 |
| 533 RendererWebCookieJarImpl cookie_jar_; | 547 RendererWebCookieJarImpl cookie_jar_; |
| 534 | 548 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 blink::WebUserMediaClient* web_user_media_client_; | 594 blink::WebUserMediaClient* web_user_media_client_; |
| 581 | 595 |
| 582 base::WeakPtrFactory<RenderFrameImpl> weak_factory_; | 596 base::WeakPtrFactory<RenderFrameImpl> weak_factory_; |
| 583 | 597 |
| 584 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); | 598 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); |
| 585 }; | 599 }; |
| 586 | 600 |
| 587 } // namespace content | 601 } // namespace content |
| 588 | 602 |
| 589 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 603 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
| OLD | NEW |