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