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

Unified Diff: chrome/browser/ui/browser.h

Issue 6660028: Decouple TabRestoreService from Browser (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 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/ui/browser.h
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index 8427344163191a1a50e807411b30a24b11402560..982c919df61a55ec8a2ce837db59ece7f700bfa4 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -22,6 +22,7 @@
#include "chrome/browser/instant/instant_delegate.h"
#include "chrome/browser/prefs/pref_member.h"
#include "chrome/browser/sessions/session_id.h"
+#include "chrome/browser/sessions/tab_restore_service_delegate.h"
#include "chrome/browser/sessions/tab_restore_service_observer.h"
#include "chrome/browser/sync/profile_sync_service_observer.h"
#include "chrome/browser/tabs/tab_handler.h"
@@ -65,6 +66,7 @@ class Browser : public TabHandlerDelegate,
public CommandUpdater::CommandUpdaterDelegate,
public NotificationObserver,
public SelectFileDialog::Listener,
+ public TabRestoreServiceDelegate,
public TabRestoreServiceObserver,
public ProfileSyncServiceObserver,
public InstantDelegate {
@@ -176,8 +178,9 @@ class Browser : public TabHandlerDelegate,
// Accessors ////////////////////////////////////////////////////////////////
Type type() const { return type_; }
+ virtual bool IsNormalBrowser() const { return type_ == TYPE_NORMAL; }
const std::string& app_name() const { return app_name_; }
- Profile* profile() const { return profile_; }
+ virtual Profile* profile() const { return profile_; }
const std::vector<std::wstring>& user_data_dir_profiles() const;
// Returns the InstantController or NULL if there is no InstantController for
@@ -196,9 +199,9 @@ class Browser : public TabHandlerDelegate,
// |window()| will return NULL if called before |CreateBrowserWindow()|
// is done.
- BrowserWindow* window() const { return window_; }
+ virtual BrowserWindow* window() const { return window_; }
ToolbarModel* toolbar_model() { return &toolbar_model_; }
- const SessionID& session_id() const { return session_id_; }
+ virtual const SessionID& session_id() const { return session_id_; }
CommandUpdater* command_updater() { return &command_updater_; }
bool block_command_execution() const { return block_command_execution_; }
@@ -334,9 +337,10 @@ class Browser : public TabHandlerDelegate,
return tab_handler_->GetTabStripModel();
}
- int tab_count() const;
- int selected_index() const;
- int GetIndexOfController(const NavigationController* controller) const;
+ virtual int tab_count() const;
+ virtual int selected_index() const;
+ virtual int GetIndexOfController(
+ const NavigationController* controller) const;
TabContentsWrapper* GetSelectedTabContentsWrapper() const;
TabContentsWrapper* GetTabContentsWrapperAt(int index) const;
// Same as above but correctly handles if GetSelectedTabContents() is NULL
@@ -345,9 +349,10 @@ class Browser : public TabHandlerDelegate,
// objects, but that would require changing about 50+ other files. In order
// to keep changes localized, the default is to return a TabContents. Note
// this differs from the TabStripModel because it has far fewer clients.
- TabContents* GetSelectedTabContents() const;
- TabContents* GetTabContentsAt(int index) const;
+ virtual TabContents* GetSelectedTabContents() const;
+ virtual TabContents* GetTabContentsAt(int index) const;
void SelectTabContentsAt(int index, bool user_gesture);
+ virtual bool IsTabPinned(int index) const;
void CloseAllTabs();
// Tab adding/showing functions /////////////////////////////////////////////
@@ -380,14 +385,15 @@ class Browser : public TabHandlerDelegate,
// extension. If |pin| is true and |tab_index|/ is the last pinned tab, then
// the newly created tab is pinned. If |from_last_session| is true,
// |navigations| are from the previous session.
- 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);
+ virtual TabContents* AddRestoredTab(
Ben Goodger (Google) 2011/03/10 18:28:35 In Chrome code we tend to put all the overrides fr
+ 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);
// Creates a new tab with the already-created TabContents 'new_contents'.
// The window for the added contents will be reparented correctly when this
// method returns. If |disposition| is NEW_POPUP, |pos| should hold the
@@ -414,7 +420,7 @@ class Browser : public TabHandlerDelegate,
// Replaces the state of the currently selected tab with the session
// history restored from the SessionRestore system.
- void ReplaceRestoredTab(
+ virtual void ReplaceRestoredTab(
const std::vector<TabNavigation>& navigations,
int selected_navigation,
bool from_last_session,
@@ -454,7 +460,7 @@ class Browser : public TabHandlerDelegate,
void NewIncognitoWindow();
void CloseWindow();
void NewTab();
- void CloseTab();
+ virtual void CloseTab();
void SelectNextTab();
void SelectPreviousTab();
void OpenTabpose();

Powered by Google App Engine
This is Rietveld 408576698