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

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

Issue 6660028: Decouple TabRestoreService from Browser (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: New version using a seperate class for the delegate 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.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 74ec6ee1281affc118048725c48db01be091ab92..48e60861affb71db38e05a5bfd948ef677993747 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -206,7 +206,8 @@ Browser::Browser(Type type, Profile* profile)
block_command_execution_(false),
last_blocked_command_id_(-1),
last_blocked_command_disposition_(CURRENT_TAB),
- pending_web_app_action_(NONE) {
+ pending_web_app_action_(NONE),
+ tab_restore_service_delegate_(this) {
registrar_.Add(this, NotificationType::SSL_VISIBLE_STATE_CHANGED,
NotificationService::AllSources());
registrar_.Add(this, NotificationType::EXTENSION_UPDATE_DISABLED,
@@ -299,7 +300,7 @@ Browser::~Browser() {
TabRestoreService* tab_restore_service = profile()->GetTabRestoreService();
if (tab_restore_service)
- tab_restore_service->BrowserClosed(this);
+ tab_restore_service->BrowserClosed(tab_restore_service_delegate());
encoding_auto_detect_.Destroy();
printing_enabled_.Destroy();
@@ -894,8 +895,8 @@ void Browser::OnWindowClosing() {
session_service->WindowClosing(session_id());
TabRestoreService* tab_restore_service = profile()->GetTabRestoreService();
- if (tab_restore_service)
- tab_restore_service->BrowserClosing(this);
+ if (tab_restore_service && type() == TYPE_NORMAL && tab_count())
+ tab_restore_service->BrowserClosing(tab_restore_service_delegate());
// TODO(sky): convert session/tab restore to use notification.
NotificationService::current()->Notify(
@@ -966,6 +967,10 @@ void Browser::SelectTabContentsAt(int index, bool user_gesture) {
tab_handler_->GetTabStripModel()->SelectTabContentsAt(index, user_gesture);
}
+bool Browser::IsTabPinned(int index) const {
+ return tabstrip_model()->IsTabPinned(index);
+}
+
void Browser::CloseAllTabs() {
tab_handler_->GetTabStripModel()->CloseAllTabs();
}
@@ -1456,7 +1461,7 @@ void Browser::RestoreTab() {
if (!service)
return;
- service->RestoreMostRecentEntry(this);
+ service->RestoreMostRecentEntry(tab_restore_service_delegate());
}
void Browser::WriteCurrentURLToClipboard() {
@@ -2569,7 +2574,8 @@ void Browser::CreateHistoricalTab(TabContentsWrapper* contents) {
// We only create historical tab entries for tabbed browser windows.
if (CanSupportWindowFeature(FEATURE_TABSTRIP)) {
profile()->GetTabRestoreService()->CreateHistoricalTab(
- &contents->controller());
+ &contents->controller(),
+ tab_handler_->GetTabStripModel()->GetIndexOfTabContents(contents));
}
}

Powered by Google App Engine
This is Rietveld 408576698