Index: blimp/engine/session/tab_blimp.h |
diff --git a/blimp/engine/session/tab_blimp.h b/blimp/engine/session/tab_blimp.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3616e70862396503a42a902f67c03697aaca3386 |
--- /dev/null |
+++ b/blimp/engine/session/tab_blimp.h |
@@ -0,0 +1,71 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef BLIMP_ENGINE_SESSION_TAB_BLIMP_H_ |
+#define BLIMP_ENGINE_SESSION_TAB_BLIMP_H_ |
+ |
+#include "base/macros.h" |
+#include "content/public/browser/web_contents_observer.h" |
+#include "blimp/engine/session/page_load_tracker.h" |
+ |
+namespace content { |
+class RenderViewHost; |
+class WebContents; |
+} |
+ |
+namespace blimp { |
+class BlimpMessageProcessor; |
+ |
+namespace engine { |
+class EngineRenderWidgetFeature; |
+ |
+// 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?
|
+// to a client tab. |
+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
|
+ public PageLoadTrackerClient { |
+ public: |
+ // Caller ensures |render_widget_feature| and |navigation_message_sender| |
+ // outlives this object. |
+ 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
|
+ 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
|
+ EngineRenderWidgetFeature* render_widget_feature, |
+ BlimpMessageProcessor* navigation_message_sender); |
+ ~TabBlimp() override; |
+ |
+ content::WebContents* web_contents() { return web_contents_.get(); } |
+ int tab_id() const { return tab_id_; } |
+ |
+ 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
|
+ void Resize(float device_pixel_ratio, const gfx::Size& size_in_dips); |
+ void LoadUrl(const GURL& url); |
+ void GoBack(); |
+ void GoForward(); |
+ void Reload(); |
+ |
+ // PageLoadTrackerClient implementation. |
+ void SendPageLoadStatusUpdate(PageLoadStatus load_status) override; |
+ |
+ private: |
+ // content::WebContentsObserver implementation. |
+ void RenderViewCreated(content::RenderViewHost* render_view_host) override; |
+ void RenderViewHostChanged(content::RenderViewHost* old_host, |
+ content::RenderViewHost* new_host) override; |
+ void RenderViewDeleted(content::RenderViewHost* render_view_host) override; |
+ |
+ std::unique_ptr<content::WebContents> web_contents_; |
+ const int tab_id_; |
+ EngineRenderWidgetFeature* render_widget_feature_; |
+ BlimpMessageProcessor* navigation_message_sender_; |
+ |
+ // Tracks the page load status for a tab. Each PageLoadTracker is tied to a |
+ // WebContents. |
+ std::unique_ptr<PageLoadTracker> page_load_tracker_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TabBlimp); |
+}; |
+ |
+} // namespace engine |
+} // namespace blimp |
+ |
+#endif // BLIMP_ENGINE_SESSION_TAB_BLIMP_H_ |