OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_VIEW_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ | 6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <deque> | 11 #include <deque> |
12 #include <map> | 12 #include <map> |
13 #include <memory> | 13 #include <memory> |
14 #include <set> | 14 #include <set> |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "base/gtest_prod_util.h" | 18 #include "base/gtest_prod_util.h" |
19 #include "base/id_map.h" | 19 #include "base/id_map.h" |
20 #include "base/macros.h" | 20 #include "base/macros.h" |
21 #include "base/memory/weak_ptr.h" | |
22 #include "base/observer_list.h" | 21 #include "base/observer_list.h" |
23 #include "base/process/process.h" | 22 #include "base/process/process.h" |
24 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
25 #include "base/timer/timer.h" | 24 #include "base/timer/timer.h" |
26 #include "build/build_config.h" | 25 #include "build/build_config.h" |
27 #include "cc/input/browser_controls_state.h" | 26 #include "cc/input/browser_controls_state.h" |
28 #include "cc/resources/shared_bitmap.h" | 27 #include "cc/resources/shared_bitmap.h" |
29 #include "content/common/content_export.h" | 28 #include "content/common/content_export.h" |
30 #include "content/common/frame_message_enums.h" | 29 #include "content/common/frame_message_enums.h" |
31 #include "content/common/navigation_gesture.h" | 30 #include "content/common/navigation_gesture.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // | 114 // |
116 // DEPRECATED: RenderViewImpl is being removed as part of the SiteIsolation | 115 // DEPRECATED: RenderViewImpl is being removed as part of the SiteIsolation |
117 // project. New code should be added to RenderFrameImpl instead. | 116 // project. New code should be added to RenderFrameImpl instead. |
118 // | 117 // |
119 // For context, please see https://crbug.com/467770 and | 118 // For context, please see https://crbug.com/467770 and |
120 // http://www.chromium.org/developers/design-documents/site-isolation. | 119 // http://www.chromium.org/developers/design-documents/site-isolation. |
121 class CONTENT_EXPORT RenderViewImpl | 120 class CONTENT_EXPORT RenderViewImpl |
122 : public RenderWidget, | 121 : public RenderWidget, |
123 NON_EXPORTED_BASE(public blink::WebViewClient), | 122 NON_EXPORTED_BASE(public blink::WebViewClient), |
124 public RenderWidgetOwnerDelegate, | 123 public RenderWidgetOwnerDelegate, |
125 public RenderView, | 124 public RenderView { |
126 public base::SupportsWeakPtr<RenderViewImpl> { | |
127 public: | 125 public: |
128 // Creates a new RenderView. Note that if the original opener has been closed, | 126 // Creates a new RenderView. Note that if the original opener has been closed, |
129 // |params.window_was_created_with_opener| will be true and | 127 // |params.window_was_created_with_opener| will be true and |
130 // |params.opener_frame_route_id| will be MSG_ROUTING_NONE. When | 128 // |params.opener_frame_route_id| will be MSG_ROUTING_NONE. When |
131 // |params.swapped_out| is true, |params.proxy_routing_id| is specified, so a | 129 // |params.swapped_out| is true, |params.proxy_routing_id| is specified, so a |
132 // RenderFrameProxy can be created for this RenderView's main RenderFrame. The | 130 // RenderFrameProxy can be created for this RenderView's main RenderFrame. The |
133 // opener should provide a non-null value for |show_callback| if it needs to | 131 // opener should provide a non-null value for |show_callback| if it needs to |
134 // send an additional IPC to finish making this view visible. | 132 // send an additional IPC to finish making this view visible. |
135 static RenderViewImpl* Create( | 133 static RenderViewImpl* Create( |
136 CompositorDependencies* compositor_deps, | 134 CompositorDependencies* compositor_deps, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 return page_zoom_level_; | 204 return page_zoom_level_; |
207 } | 205 } |
208 | 206 |
209 // Sets page-level focus in this view and notifies plugins and Blink's | 207 // Sets page-level focus in this view and notifies plugins and Blink's |
210 // FocusController. | 208 // FocusController. |
211 void SetFocus(bool enable); | 209 void SetFocus(bool enable); |
212 | 210 |
213 void AttachWebFrameWidget(blink::WebFrameWidget* frame_widget); | 211 void AttachWebFrameWidget(blink::WebFrameWidget* frame_widget); |
214 | 212 |
215 void TransferActiveWheelFlingAnimation( | 213 void TransferActiveWheelFlingAnimation( |
216 const blink::WebActiveWheelFlingParameters& params); | 214 const blink::WebActiveWheelFlingParameters& params) override; |
217 | 215 |
218 // Starts a timer to send an UpdateState message on behalf of |frame|, if the | 216 // Starts a timer to send an UpdateState message on behalf of |frame|, if the |
219 // timer isn't already running. This allows multiple state changing events to | 217 // timer isn't already running. This allows multiple state changing events to |
220 // be coalesced into one update. | 218 // be coalesced into one update. |
221 void StartNavStateSyncTimerIfNecessary(RenderFrameImpl* frame); | 219 void StartNavStateSyncTimerIfNecessary(RenderFrameImpl* frame); |
222 | 220 |
223 // Synchronously sends the current navigation state to the browser. | 221 // Synchronously sends the current navigation state to the browser. |
224 void SendUpdateState(); | 222 void SendUpdateState(); |
225 | 223 |
226 // A popup widget opened by this view needs to be shown. | 224 // A popup widget opened by this view needs to be shown. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 void ConvertViewportToWindowViaWidget(blink::WebRect* rect) override; | 385 void ConvertViewportToWindowViaWidget(blink::WebRect* rect) override; |
388 gfx::RectF ElementBoundsInWindow(const blink::WebElement& element) override; | 386 gfx::RectF ElementBoundsInWindow(const blink::WebElement& element) override; |
389 bool HasAddedInputHandler() const override; | 387 bool HasAddedInputHandler() const override; |
390 | 388 |
391 bool uses_temporary_zoom_level() const { return uses_temporary_zoom_level_; } | 389 bool uses_temporary_zoom_level() const { return uses_temporary_zoom_level_; } |
392 | 390 |
393 // Please do not add your stuff randomly to the end here. If there is an | 391 // Please do not add your stuff randomly to the end here. If there is an |
394 // appropriate section, add it there. If not, there are some random functions | 392 // appropriate section, add it there. If not, there are some random functions |
395 // nearer to the top you can add it to. | 393 // nearer to the top you can add it to. |
396 | 394 |
| 395 base::WeakPtr<RenderViewImpl> GetWeakPtr() { |
| 396 return weak_ptr_factory_.GetWeakPtr(); |
| 397 } |
| 398 |
397 protected: | 399 protected: |
398 // RenderWidget overrides: | 400 // RenderWidget overrides: |
399 blink::WebWidget* GetWebWidget() const override; | 401 blink::WebWidget* GetWebWidget() const override; |
400 void CloseForFrame() override; | 402 void CloseForFrame() override; |
401 void Close() override; | 403 void Close() override; |
402 void OnResize(const ResizeParams& params) override; | 404 void OnResize(const ResizeParams& params) override; |
403 void OnSetFocus(bool enable) override; | 405 void OnSetFocus(bool enable) override; |
404 GURL GetURLForGraphicsContext3D() override; | 406 GURL GetURLForGraphicsContext3D() override; |
405 void OnOrientationChange() override; | 407 void OnOrientationChange() override; |
406 void DidCommitCompositorFrame() override; | 408 void DidCommitCompositorFrame() override; |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 // is fine. | 828 // is fine. |
827 base::ObserverList<RenderViewObserver> observers_; | 829 base::ObserverList<RenderViewObserver> observers_; |
828 | 830 |
829 // NOTE: stats_collection_observer_ should be the last members because their | 831 // NOTE: stats_collection_observer_ should be the last members because their |
830 // constructors call the AddObservers method of RenderViewImpl. | 832 // constructors call the AddObservers method of RenderViewImpl. |
831 std::unique_ptr<StatsCollectionObserver> stats_collection_observer_; | 833 std::unique_ptr<StatsCollectionObserver> stats_collection_observer_; |
832 | 834 |
833 typedef std::map<cc::SharedBitmapId, cc::SharedBitmap*> BitmapMap; | 835 typedef std::map<cc::SharedBitmapId, cc::SharedBitmap*> BitmapMap; |
834 BitmapMap disambiguation_bitmaps_; | 836 BitmapMap disambiguation_bitmaps_; |
835 | 837 |
836 bool has_added_input_handler_; | |
837 | |
838 // --------------------------------------------------------------------------- | 838 // --------------------------------------------------------------------------- |
839 // ADDING NEW DATA? Please see if it fits appropriately in one of the above | 839 // ADDING NEW DATA? Please see if it fits appropriately in one of the above |
840 // sections rather than throwing it randomly at the end. If you're adding a | 840 // sections rather than throwing it randomly at the end. If you're adding a |
841 // bunch of stuff, you should probably create a helper class and put your | 841 // bunch of stuff, you should probably create a helper class and put your |
842 // data and methods on that to avoid bloating RenderView more. You can | 842 // data and methods on that to avoid bloating RenderView more. You can |
843 // use the Observer interface to filter IPC messages and receive frame change | 843 // use the Observer interface to filter IPC messages and receive frame change |
844 // notifications. | 844 // notifications. |
845 // --------------------------------------------------------------------------- | 845 // --------------------------------------------------------------------------- |
846 | 846 |
| 847 base::WeakPtrFactory<RenderViewImpl> weak_ptr_factory_; |
| 848 |
847 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); | 849 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); |
848 }; | 850 }; |
849 | 851 |
850 } // namespace content | 852 } // namespace content |
851 | 853 |
852 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ | 854 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
OLD | NEW |