Chromium Code Reviews| 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); |