Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
|
sdefresne
2015/09/28 15:24:55
nit: 2015 and remove "(c)"
blundell
2015/09/28 15:28:22
Done.
| |
| 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 COMPONENTS_SESSIONS_CONTENT_CONTENT_LIVE_TAB_H_ | |
| 6 #define COMPONENTS_SESSIONS_CONTENT_CONTENT_LIVE_TAB_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/supports_user_data.h" | |
| 10 #include "components/sessions/core/live_tab.h" | |
| 11 #include "components/sessions/ios/ios_serialized_navigation_builder.h" | |
| 12 #include "ios/web/public/web_state/web_state.h" | |
| 13 | |
| 14 namespace content { | |
| 15 class NavigationManager; | |
| 16 class NavigationEntry; | |
| 17 } | |
| 18 | |
| 19 namespace sessions { | |
| 20 | |
| 21 // An implementation of LiveTab that is backed by web::WebState for use | |
| 22 // on //ios/web-based platforms. | |
| 23 class SESSIONS_EXPORT IOSLiveTab : public LiveTab, | |
| 24 public base::SupportsUserData::Data { | |
| 25 public: | |
| 26 ~IOSLiveTab() override; | |
| 27 | |
| 28 // Returns the IOSLiveTab associated with |web_state|, creating it if | |
| 29 // it has not already been created. | |
| 30 static IOSLiveTab* GetForWebState(web::WebState* web_state); | |
| 31 | |
| 32 // LiveTab: | |
| 33 int GetCurrentEntryIndex() override; | |
| 34 int GetPendingEntryIndex() override; | |
| 35 sessions::SerializedNavigationEntry GetEntryAtIndex(int index) override; | |
| 36 sessions::SerializedNavigationEntry GetPendingEntry() override; | |
| 37 int GetEntryCount() override; | |
| 38 void LoadIfNecessary() override; | |
| 39 const std::string& GetUserAgentOverride() const override; | |
| 40 | |
| 41 web::WebState* web_state() { return web_state_; } | |
| 42 const web::WebState* web_state() const { return web_state_; } | |
| 43 | |
| 44 private: | |
| 45 friend class base::SupportsUserData; | |
| 46 | |
| 47 explicit IOSLiveTab(web::WebState* web_state); | |
| 48 | |
| 49 web::NavigationManager* navigation_manager() { | |
| 50 return web_state_->GetNavigationManager(); | |
| 51 } | |
| 52 | |
| 53 web::WebState* web_state_; | |
| 54 | |
| 55 // Needed to return an empty string in GetUserAgentOverride(). | |
| 56 static std::string user_agent_override_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(IOSLiveTab); | |
| 59 }; | |
| 60 | |
| 61 } // namespace sessions | |
| 62 | |
| 63 #endif // COMPONENTS_SESSIONS_CONTENT_CONTENT_LIVE_TAB_H_ | |
| OLD | NEW |