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

Unified Diff: chrome/browser/sessions/tab_restore_service_delegate.h

Issue 6660028: Decouple TabRestoreService from Browser (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add doc references and fix lint Created 9 years, 9 months 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: chrome/browser/sessions/tab_restore_service_delegate.h
diff --git a/chrome/browser/sessions/tab_restore_service_delegate.h b/chrome/browser/sessions/tab_restore_service_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..2c457e22476512f483a8ead4539bfef2931ac4fa
--- /dev/null
+++ b/chrome/browser/sessions/tab_restore_service_delegate.h
@@ -0,0 +1,73 @@
+// Copyright (c) 2011 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 CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_
+#define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_
+
+#include <string>
+#include <vector>
+
+#include "chrome/browser/sessions/session_id.h"
+
+class BrowserWindow;
+class Profile;
+class SessionStorageNamespace;
+class TabContents;
+class TabNavigation;
+class TabRestoreService;
+
+// Objects implement this interface to provide necessary functionality for
+// TabRestoreService to operate. These methods are mostly copies of existing
+// Browser methods.
+class TabRestoreServiceDelegate {
+ public:
+ // see BrowserWindow::Show()
+ virtual void ShowBrowserWindow() = 0;
+
+ // see Browser::session_id()
+ virtual const SessionID& GetSessionID() const = 0;
+
+ // see Browser::tab_count()
+ virtual int GetTabCount() const = 0;
+
+ // see Browser::selected_index()
+ virtual int GetSelectedIndex() const = 0;
+
+ // see Browser methods with the same names
+ virtual TabContents* GetTabContentsAt(int index) const = 0;
+ virtual TabContents* GetSelectedTabContents() const = 0;
+ virtual bool IsTabPinned(int index) const = 0;
+ virtual TabContents* AddRestoredTab(
+ const std::vector<TabNavigation>& navigations,
+ int tab_index,
+ int selected_navigation,
+ const std::string& extension_app_id,
+ bool select,
+ bool pin,
+ bool from_last_session,
+ SessionStorageNamespace* storage_namespace) = 0;
+ virtual void ReplaceRestoredTab(
+ const std::vector<TabNavigation>& navigations,
+ int selected_navigation,
+ bool from_last_session,
+ const std::string& extension_app_id,
+ SessionStorageNamespace* session_storage_namespace) = 0;
+ virtual void CloseTab() = 0;
+
+
sky 2011/03/11 17:40:37 Nuke one of these lines.
torne_google.com 2011/03/14 15:07:25 Done.
+ virtual ~TabRestoreServiceDelegate() {}
sky 2011/03/11 17:40:37 destructor should be protected.
torne_google.com 2011/03/14 15:07:25 Why? Browser's scoped_ptr can't destroy the object
sky 2011/03/14 15:26:21 To make it clear TabRestoreService doesn't own the
+
+ // see Browser::Create
+ static TabRestoreServiceDelegate* CreateBrowser(Profile* profile);
sky 2011/03/11 17:40:37 CreateBrowser -> Create
torne_google.com 2011/03/14 15:07:25 Done.
+
+ // see BrowserList::GetBrowserForController
+ static TabRestoreServiceDelegate* GetBrowserForController(
+ const NavigationController* controller, int* index);
sky 2011/03/11 17:40:37 wrap int* onto its own line. Also, name this FindD
torne_google.com 2011/03/14 15:07:25 Done.
+
+ // see BrowserList::FindBrowserWithID
+ static TabRestoreServiceDelegate* FindBrowserWithID(
sky 2011/03/11 17:40:37 FindDelegateWithID
torne_google.com 2011/03/14 15:07:25 Done.
+ SessionID::id_type desired_id);
+};
+
+#endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698