Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Unified Diff: ios/chrome/browser/sessions/tab_restore_service_delegate_impl_ios.h

Issue 2585233003: Upstream Chrome on iOS source code [2/11]. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/sessions/tab_restore_service_delegate_impl_ios.h
diff --git a/ios/chrome/browser/sessions/tab_restore_service_delegate_impl_ios.h b/ios/chrome/browser/sessions/tab_restore_service_delegate_impl_ios.h
new file mode 100644
index 0000000000000000000000000000000000000000..52d8f2ce0742d67f5cbcd12b3acedf1b02596d75
--- /dev/null
+++ b/ios/chrome/browser/sessions/tab_restore_service_delegate_impl_ios.h
@@ -0,0 +1,71 @@
+// Copyright 2012 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 IOS_CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_IMPL_IOS_H_
+#define IOS_CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_IMPL_IOS_H_
+
+#include <string>
+#include <vector>
+
+#include "base/macros.h"
+#include "components/keyed_service/core/keyed_service.h"
+#include "components/sessions/core/live_tab_context.h"
+
+@class TabModel;
+
+namespace ios {
+class ChromeBrowserState;
+}
+
+// Implementation of sessions::LiveTabContext which uses an instance
+// of TabModel in order to fulfil its duties.
+class TabRestoreServiceDelegateImplIOS : public sessions::LiveTabContext,
+ public KeyedService {
+ public:
+ explicit TabRestoreServiceDelegateImplIOS(
+ ios::ChromeBrowserState* browser_state);
+ ~TabRestoreServiceDelegateImplIOS() override;
+
+ // Overridden from KeyedService:
+ void Shutdown() override {}
+
+ // Overridden from sessions::LiveTabContext:
+ void ShowBrowserWindow() override;
+ const SessionID& GetSessionID() const override;
+ int GetTabCount() const override;
+ int GetSelectedIndex() const override;
+ std::string GetAppName() const override;
+ sessions::LiveTab* GetLiveTabAt(int index) const override;
+ sessions::LiveTab* GetActiveLiveTab() const override;
+ bool IsTabPinned(int index) const override;
+ sessions::LiveTab* AddRestoredTab(
+ const std::vector<sessions::SerializedNavigationEntry>& navigations,
+ int tab_index,
+ int selected_navigation,
+ const std::string& extension_app_id,
+ bool select,
+ bool pin,
+ bool from_last_session,
+ const sessions::PlatformSpecificTabData* tab_platform_data,
+ const std::string& user_agent_override) override;
+ sessions::LiveTab* ReplaceRestoredTab(
+ const std::vector<sessions::SerializedNavigationEntry>& navigations,
+ int selected_navigation,
+ bool from_last_session,
+ const std::string& extension_app_id,
+ const sessions::PlatformSpecificTabData* tab_platform_data,
+ const std::string& user_agent_override) override;
+ void CloseTab() override;
+
+ private:
+ // Retrieves the current |TabModel| corresponding to |browser_state_|;
+ TabModel* tab_model() const;
+
+ ios::ChromeBrowserState* browser_state_; // weak
+ SessionID session_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabRestoreServiceDelegateImplIOS);
+};
+
+#endif // IOS_CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_IMPL_IOS_H_

Powered by Google App Engine
This is Rietveld 408576698