OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 BLIMP_ENGINE_SESSION_TAB_H_ | 5 #ifndef BLIMP_ENGINE_SESSION_TAB_H_ |
6 #define BLIMP_ENGINE_SESSION_TAB_H_ | 6 #define BLIMP_ENGINE_SESSION_TAB_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "blimp/engine/feature/engine_render_widget_feature.h" |
9 #include "blimp/engine/session/page_load_tracker.h" | 10 #include "blimp/engine/session/page_load_tracker.h" |
10 #include "content/public/browser/invalidate_type.h" | 11 #include "content/public/browser/invalidate_type.h" |
11 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 class RenderViewHost; | 15 class RenderViewHost; |
15 class WebContents; | 16 class WebContents; |
16 } | 17 } |
17 | 18 |
18 namespace blimp { | 19 namespace blimp { |
19 | 20 |
20 class BlimpMessageProcessor; | 21 class BlimpMessageProcessor; |
21 | 22 |
22 namespace engine { | 23 namespace engine { |
23 | 24 |
24 class EngineRenderWidgetFeature; | 25 class EngineRenderWidgetFeature; |
25 | 26 |
26 // Owns WebContents, handles operations such as navigation requests in the tab, | 27 // Owns WebContents, handles operations such as navigation requests in the tab, |
27 // and has one-to-one mapping to a client tab. | 28 // and has one-to-one mapping to a client tab. |
28 class Tab : public content::WebContentsObserver, public PageLoadTrackerClient { | 29 class Tab : public content::WebContentsObserver, |
| 30 public PageLoadTrackerClient, |
| 31 public EngineRenderWidgetFeature::RenderWidgetMessageDelegate { |
29 public: | 32 public: |
30 // Caller ensures |render_widget_feature| and |navigation_message_sender| | 33 // Caller ensures |render_widget_feature| and |navigation_message_sender| |
31 // outlives this object. | 34 // outlives this object. |
32 // |web_contents|: the WebContents this tab owns. | 35 // |web_contents|: the WebContents this tab owns. |
33 // |tab_id|: the ID of this tab. | 36 // |tab_id|: the ID of this tab. |
34 // |render_widget_feature|: render widget feature. | 37 // |render_widget_feature|: render widget feature. |
35 // |navigation_message_sender|: for sending navigation messages to client. | 38 // |navigation_message_sender|: for sending navigation messages to client. |
36 Tab(std::unique_ptr<content::WebContents> web_contents, | 39 Tab(std::unique_ptr<content::WebContents> web_contents, |
37 const int tab_id, | 40 const int tab_id, |
38 EngineRenderWidgetFeature* render_widget_feature, | 41 EngineRenderWidgetFeature* render_widget_feature, |
(...skipping 11 matching lines...) Expand all Loading... |
50 void GoBack(); | 53 void GoBack(); |
51 void GoForward(); | 54 void GoForward(); |
52 void Reload(); | 55 void Reload(); |
53 | 56 |
54 // Handles navigation state changed event. | 57 // Handles navigation state changed event. |
55 void NavigationStateChanged(content::InvalidateTypes changed_flags); | 58 void NavigationStateChanged(content::InvalidateTypes changed_flags); |
56 | 59 |
57 // PageLoadTrackerClient implementation. | 60 // PageLoadTrackerClient implementation. |
58 void SendPageLoadStatusUpdate(PageLoadStatus load_status) override; | 61 void SendPageLoadStatusUpdate(PageLoadStatus load_status) override; |
59 | 62 |
| 63 // RenderWidgetMessage handler methods. |
| 64 // RenderWidgetMessageDelegate implementation. |
| 65 void OnWebGestureEvent( |
| 66 content::RenderWidgetHost* render_widget_host, |
| 67 std::unique_ptr<blink::WebGestureEvent> event) override; |
| 68 void OnCompositorMessageReceived( |
| 69 content::RenderWidgetHost* render_widget_host, |
| 70 const std::vector<uint8_t>& message) override; |
| 71 |
60 private: | 72 private: |
61 // content::WebContentsObserver implementation. | 73 // content::WebContentsObserver implementation. |
62 void RenderViewCreated(content::RenderViewHost* render_view_host) override; | 74 void RenderViewCreated(content::RenderViewHost* render_view_host) override; |
63 void RenderViewHostChanged(content::RenderViewHost* old_host, | 75 void RenderViewHostChanged(content::RenderViewHost* old_host, |
64 content::RenderViewHost* new_host) override; | 76 content::RenderViewHost* new_host) override; |
65 void RenderViewDeleted(content::RenderViewHost* render_view_host) override; | 77 void RenderViewDeleted(content::RenderViewHost* render_view_host) override; |
66 | 78 |
67 std::unique_ptr<content::WebContents> web_contents_; | 79 std::unique_ptr<content::WebContents> web_contents_; |
68 const int tab_id_; | 80 const int tab_id_; |
69 EngineRenderWidgetFeature* render_widget_feature_; | 81 EngineRenderWidgetFeature* render_widget_feature_; |
70 BlimpMessageProcessor* navigation_message_sender_; | 82 BlimpMessageProcessor* navigation_message_sender_; |
71 | 83 |
72 // Tracks the page load status for a tab. | 84 // Tracks the page load status for a tab. |
73 PageLoadTracker page_load_tracker_; | 85 PageLoadTracker page_load_tracker_; |
74 | 86 |
75 DISALLOW_COPY_AND_ASSIGN(Tab); | 87 DISALLOW_COPY_AND_ASSIGN(Tab); |
76 }; | 88 }; |
77 | 89 |
78 } // namespace engine | 90 } // namespace engine |
79 } // namespace blimp | 91 } // namespace blimp |
80 | 92 |
81 #endif // BLIMP_ENGINE_SESSION_TAB_H_ | 93 #endif // BLIMP_ENGINE_SESSION_TAB_H_ |
OLD | NEW |