OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BLIMP_ENGINE_SESSION_TAB_BLIMP_H_ | |
6 #define BLIMP_ENGINE_SESSION_TAB_BLIMP_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "content/public/browser/web_contents_observer.h" | |
10 #include "blimp/engine/session/page_load_tracker.h" | |
11 | |
12 namespace content { | |
13 class RenderViewHost; | |
14 class WebContents; | |
15 } | |
16 | |
17 namespace blimp { | |
18 class BlimpMessageProcessor; | |
19 | |
20 namespace engine { | |
21 class EngineRenderWidgetFeature; | |
22 | |
23 // Owns WebContents, handles operations in the tab, and has one-to-one mapping | |
Kevin M
2016/06/02 18:38:50
This comment is kind of vague.
haibinlu
2016/06/02 20:24:37
any suggestion?
| |
24 // to a client tab. | |
25 class TabBlimp : public content::WebContentsObserver, | |
Kevin M
2016/06/02 18:38:50
How about just "Tab"?
haibinlu
2016/06/02 20:24:37
naming is similar to
chrome/browser/android/tab
| |
26 public PageLoadTrackerClient { | |
27 public: | |
28 // Caller ensures |render_widget_feature| and |navigation_message_sender| | |
29 // outlives this object. | |
30 explicit TabBlimp(std::unique_ptr<content::WebContents> web_contents, | |
Kevin M
2016/06/02 18:38:50
What about having this class responsible for creat
haibinlu
2016/06/02 20:24:37
creating a webcontent needs a reference to browser
| |
31 const int tab_id, | |
Kevin M
2016/06/02 18:38:51
nit: we generally don't const value parameters acr
haibinlu
2016/06/02 20:24:37
Shall we use it consistently across blimp codebase
| |
32 EngineRenderWidgetFeature* render_widget_feature, | |
33 BlimpMessageProcessor* navigation_message_sender); | |
34 ~TabBlimp() override; | |
35 | |
36 content::WebContents* web_contents() { return web_contents_.get(); } | |
37 int tab_id() const { return tab_id_; } | |
38 | |
39 void Close(); | |
Kevin M
2016/06/02 18:38:50
Can you make these into NavigationFeature delegate
haibinlu
2016/06/02 20:24:37
NavFeature delegate will contain tab_id as its par
| |
40 void Resize(float device_pixel_ratio, const gfx::Size& size_in_dips); | |
41 void LoadUrl(const GURL& url); | |
42 void GoBack(); | |
43 void GoForward(); | |
44 void Reload(); | |
45 | |
46 // PageLoadTrackerClient implementation. | |
47 void SendPageLoadStatusUpdate(PageLoadStatus load_status) override; | |
48 | |
49 private: | |
50 // content::WebContentsObserver implementation. | |
51 void RenderViewCreated(content::RenderViewHost* render_view_host) override; | |
52 void RenderViewHostChanged(content::RenderViewHost* old_host, | |
53 content::RenderViewHost* new_host) override; | |
54 void RenderViewDeleted(content::RenderViewHost* render_view_host) override; | |
55 | |
56 std::unique_ptr<content::WebContents> web_contents_; | |
57 const int tab_id_; | |
58 EngineRenderWidgetFeature* render_widget_feature_; | |
59 BlimpMessageProcessor* navigation_message_sender_; | |
60 | |
61 // Tracks the page load status for a tab. Each PageLoadTracker is tied to a | |
62 // WebContents. | |
63 std::unique_ptr<PageLoadTracker> page_load_tracker_; | |
64 | |
65 DISALLOW_COPY_AND_ASSIGN(TabBlimp); | |
66 }; | |
67 | |
68 } // namespace engine | |
69 } // namespace blimp | |
70 | |
71 #endif // BLIMP_ENGINE_SESSION_TAB_BLIMP_H_ | |
OLD | NEW |