OLD | NEW |
(Empty) | |
| 1 // Copyright 2012 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 IOS_CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_IMPL_IOS_H_ |
| 6 #define IOS_CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_IMPL_IOS_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "components/keyed_service/core/keyed_service.h" |
| 13 #include "components/sessions/core/live_tab_context.h" |
| 14 |
| 15 @class TabModel; |
| 16 |
| 17 namespace ios { |
| 18 class ChromeBrowserState; |
| 19 } |
| 20 |
| 21 // Implementation of sessions::LiveTabContext which uses an instance |
| 22 // of TabModel in order to fulfil its duties. |
| 23 class TabRestoreServiceDelegateImplIOS : public sessions::LiveTabContext, |
| 24 public KeyedService { |
| 25 public: |
| 26 explicit TabRestoreServiceDelegateImplIOS( |
| 27 ios::ChromeBrowserState* browser_state); |
| 28 ~TabRestoreServiceDelegateImplIOS() override; |
| 29 |
| 30 // Overridden from KeyedService: |
| 31 void Shutdown() override {} |
| 32 |
| 33 // Overridden from sessions::LiveTabContext: |
| 34 void ShowBrowserWindow() override; |
| 35 const SessionID& GetSessionID() const override; |
| 36 int GetTabCount() const override; |
| 37 int GetSelectedIndex() const override; |
| 38 std::string GetAppName() const override; |
| 39 sessions::LiveTab* GetLiveTabAt(int index) const override; |
| 40 sessions::LiveTab* GetActiveLiveTab() const override; |
| 41 bool IsTabPinned(int index) const override; |
| 42 sessions::LiveTab* AddRestoredTab( |
| 43 const std::vector<sessions::SerializedNavigationEntry>& navigations, |
| 44 int tab_index, |
| 45 int selected_navigation, |
| 46 const std::string& extension_app_id, |
| 47 bool select, |
| 48 bool pin, |
| 49 bool from_last_session, |
| 50 const sessions::PlatformSpecificTabData* tab_platform_data, |
| 51 const std::string& user_agent_override) override; |
| 52 sessions::LiveTab* ReplaceRestoredTab( |
| 53 const std::vector<sessions::SerializedNavigationEntry>& navigations, |
| 54 int selected_navigation, |
| 55 bool from_last_session, |
| 56 const std::string& extension_app_id, |
| 57 const sessions::PlatformSpecificTabData* tab_platform_data, |
| 58 const std::string& user_agent_override) override; |
| 59 void CloseTab() override; |
| 60 |
| 61 private: |
| 62 // Retrieves the current |TabModel| corresponding to |browser_state_|; |
| 63 TabModel* tab_model() const; |
| 64 |
| 65 ios::ChromeBrowserState* browser_state_; // weak |
| 66 SessionID session_id_; |
| 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(TabRestoreServiceDelegateImplIOS); |
| 69 }; |
| 70 |
| 71 #endif // IOS_CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_IMPL_IOS_H_ |
OLD | NEW |