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/invalidate_type.h" | |
10 #include "content/public/browser/web_contents_observer.h" | |
11 #include "blimp/engine/session/page_load_tracker.h" | |
12 | |
13 namespace content { | |
14 class RenderViewHost; | |
15 class WebContents; | |
16 } | |
17 | |
18 namespace blimp { | |
19 class BlimpMessageProcessor; | |
20 | |
21 namespace engine { | |
22 class EngineRenderWidgetFeature; | |
23 | |
24 // Owns WebContents, handles operations in the tab, and has one-to-one mapping | |
25 // to a client tab. | |
26 class TabBlimp : public content::WebContentsObserver, | |
27 public PageLoadTrackerClient { | |
28 public: | |
29 // Caller ensures |render_widget_feature| and |navigation_message_sender| | |
Kevin M
2016/06/02 21:54:05
Document ctor parameters.
haibinlu
2016/06/02 23:24:33
Done.
| |
30 // outlives this object. | |
31 explicit TabBlimp(std::unique_ptr<content::WebContents> web_contents, | |
32 const int tab_id, | |
33 EngineRenderWidgetFeature* render_widget_feature, | |
34 BlimpMessageProcessor* navigation_message_sender); | |
35 ~TabBlimp() override; | |
36 | |
37 content::WebContents* web_contents() { return web_contents_.get(); } | |
38 int tab_id() const { return tab_id_; } | |
39 | |
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 void NavigationStateChanged(content::InvalidateTypes changed_flags); | |
46 | |
47 // PageLoadTrackerClient implementation. | |
48 void SendPageLoadStatusUpdate(PageLoadStatus load_status) override; | |
49 | |
50 private: | |
51 // content::WebContentsObserver implementation. | |
52 void RenderViewCreated(content::RenderViewHost* render_view_host) override; | |
53 void RenderViewHostChanged(content::RenderViewHost* old_host, | |
54 content::RenderViewHost* new_host) override; | |
55 void RenderViewDeleted(content::RenderViewHost* render_view_host) override; | |
56 | |
57 std::unique_ptr<content::WebContents> web_contents_; | |
58 const int tab_id_; | |
59 EngineRenderWidgetFeature* render_widget_feature_; | |
60 BlimpMessageProcessor* navigation_message_sender_; | |
61 | |
62 // Tracks the page load status for a tab. Each PageLoadTracker is tied to a | |
Kevin M
2016/06/02 21:54:05
What does "tied to" mean in this case? Must be del
haibinlu
2016/06/02 23:24:33
Updated comments. page_load_tracker_ takes webcont
| |
63 // WebContents. | |
64 std::unique_ptr<PageLoadTracker> page_load_tracker_; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(TabBlimp); | |
67 }; | |
68 | |
69 } // namespace engine | |
70 } // namespace blimp | |
71 | |
72 #endif // BLIMP_ENGINE_SESSION_TAB_BLIMP_H_ | |
OLD | NEW |