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

Unified Diff: chrome/browser/views/tabs/tab_strip.cc

Issue 1001003: Allow dynamic switching in and out of sidetabs mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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/views/tabs/tab_strip.cc
===================================================================
--- chrome/browser/views/tabs/tab_strip.cc (revision 41630)
+++ chrome/browser/views/tabs/tab_strip.cc (working copy)
@@ -744,8 +744,7 @@
TabStrip::~TabStrip() {
active_animation_.reset(NULL);
- // TODO(beng): (1031854) Restore this line once XPFrame/VistaFrame are dead.
- // model_->RemoveObserver(this);
+ model_->RemoveObserver(this);
// TODO(beng): remove this if it doesn't work to fix the TabSelectedAt bug.
drag_controller_.reset(NULL);
@@ -818,6 +817,15 @@
return model_->profile() == other->model()->profile();
}
+void TabStrip::InitFromModel() {
+ // Walk the model, calling our insertion observer method for each item within
+ // it.
+ for (int i = 0; i < model_->count(); ++i) {
+ TabInsertedAt(model_->GetTabContentsAt(i), i,
+ i == model_->selected_index());
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////
// TabStrip, BaseTabStrip implementation:
@@ -1270,6 +1278,7 @@
}
bool TabStrip::IsTabPinned(const Tab* tab) const {
+ // TODO(beng): This "closing" state should be stored in the model.
sky 2010/03/19 16:14:02 You sure? It's only the ui that knows about it. It
if (tab->closing())
return false;
@@ -1309,6 +1318,18 @@
return false;
}
+bool TabStrip::IsCommandCheckedForTab(
+ TabStripModel::ContextMenuCommand command_id, const Tab* tab) const {
+ // TODO(beng): move to TabStripModel, see note in IsTabPinned.
+ if (command_id == TabStripModel::CommandTogglePinned)
+ return IsTabPinned(tab);
+
+ int index = GetIndexOfTab(tab);
+ if (model_->ContainsIndex(index))
+ return model_->IsContextMenuCommandChecked(index, command_id);
+ return false;
+}
+
void TabStrip::ExecuteCommandForTab(
TabStripModel::ContextMenuCommand command_id, Tab* tab) {
int index = GetIndexOfTab(tab);

Powered by Google App Engine
This is Rietveld 408576698