Chromium Code Reviews| 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, | |
|
Kevin M
2016/06/06 21:44:39
"Tab" ?
haibinlu
2016/06/06 22:32:28
Done.
| |
| 27 public PageLoadTrackerClient { | |
| 28 public: | |
| 29 // Caller ensures |render_widget_feature| and |navigation_message_sender| | |
| 30 // outlives this object. | |
| 31 // |web_contents|: the WebContents this tab owns. | |
| 32 // |tab_id|: the ID of this tab. | |
| 33 // |render_widget_feature|: render widget feature. | |
| 34 // |navigation_message_sender|: for sending navigation messages to client. | |
| 35 explicit TabBlimp(std::unique_ptr<content::WebContents> web_contents, | |
|
Kevin M
2016/06/06 21:44:39
"explicit" not needed for this many ctor arguments
haibinlu
2016/06/06 22:32:28
Done.
| |
| 36 const int tab_id, | |
| 37 EngineRenderWidgetFeature* render_widget_feature, | |
| 38 BlimpMessageProcessor* navigation_message_sender); | |
| 39 ~TabBlimp() override; | |
| 40 | |
| 41 content::WebContents* web_contents() { return web_contents_.get(); } | |
| 42 int tab_id() const { return tab_id_; } | |
| 43 | |
| 44 void Resize(float device_pixel_ratio, const gfx::Size& size_in_dips); | |
| 45 void LoadUrl(const GURL& url); | |
| 46 void GoBack(); | |
| 47 void GoForward(); | |
| 48 void Reload(); | |
| 49 void NavigationStateChanged(content::InvalidateTypes changed_flags); | |
| 50 | |
| 51 // PageLoadTrackerClient implementation. | |
| 52 void SendPageLoadStatusUpdate(PageLoadStatus load_status) override; | |
| 53 | |
| 54 private: | |
| 55 // content::WebContentsObserver implementation. | |
| 56 void RenderViewCreated(content::RenderViewHost* render_view_host) override; | |
| 57 void RenderViewHostChanged(content::RenderViewHost* old_host, | |
| 58 content::RenderViewHost* new_host) override; | |
| 59 void RenderViewDeleted(content::RenderViewHost* render_view_host) override; | |
| 60 | |
| 61 std::unique_ptr<content::WebContents> web_contents_; | |
| 62 const int tab_id_; | |
| 63 EngineRenderWidgetFeature* render_widget_feature_; | |
| 64 BlimpMessageProcessor* navigation_message_sender_; | |
| 65 | |
| 66 // Tracks the page load status for a tab. | |
| 67 std::unique_ptr<PageLoadTracker> page_load_tracker_; | |
| 68 | |
| 69 DISALLOW_COPY_AND_ASSIGN(TabBlimp); | |
| 70 }; | |
| 71 | |
| 72 } // namespace engine | |
| 73 } // namespace blimp | |
| 74 | |
| 75 #endif // BLIMP_ENGINE_SESSION_TAB_BLIMP_H_ | |
| OLD | NEW |