| Index: chrome/browser/gtk/extension_shelf_gtk.cc
|
| ===================================================================
|
| --- chrome/browser/gtk/extension_shelf_gtk.cc (revision 22246)
|
| +++ chrome/browser/gtk/extension_shelf_gtk.cc (working copy)
|
| @@ -67,7 +67,7 @@
|
| ExtensionShelfGtk::ExtensionShelfGtk(Profile* profile, Browser* browser)
|
| : browser_(browser),
|
| theme_provider_(GtkThemeProvider::GetFrom(profile)),
|
| - model_(browser->extension_shelf_model()) {
|
| + model_(new ExtensionShelfModel(browser)) {
|
| Init(profile);
|
|
|
| registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
|
| @@ -75,8 +75,7 @@
|
| }
|
|
|
| ExtensionShelfGtk::~ExtensionShelfGtk() {
|
| - if (model_)
|
| - model_->RemoveObserver(this);
|
| + model_->RemoveObserver(this);
|
| event_box_.Destroy();
|
| }
|
|
|
| @@ -120,8 +119,8 @@
|
| AdjustHeight();
|
| }
|
|
|
| -void ExtensionShelfGtk::ToolstripChanged(
|
| - ExtensionShelfModel::iterator toolstrip) {
|
| +void ExtensionShelfGtk::ToolstripChangedAt(ExtensionHost* host,
|
| + int index) {
|
| // TODO(phajdan.jr): Implement changing toolstrips.
|
| AdjustHeight();
|
| }
|
| @@ -140,18 +139,6 @@
|
| LoadFromModel();
|
| }
|
|
|
| -void ExtensionShelfGtk::ShelfModelDeleting() {
|
| - for (std::set<Toolstrip*>::iterator iter = toolstrips_.begin();
|
| - iter != toolstrips_.end(); ++iter) {
|
| - (*iter)->RemoveToolstripFromBox(shelf_hbox_);
|
| - delete *iter;
|
| - }
|
| - toolstrips_.clear();
|
| -
|
| - model_->RemoveObserver(this);
|
| - model_ = NULL;
|
| -}
|
| -
|
| void ExtensionShelfGtk::Init(Profile* profile) {
|
| event_box_.Own(gtk_event_box_new());
|
|
|
| @@ -200,12 +187,12 @@
|
| DCHECK(toolstrips_.empty());
|
| int count = model_->count();
|
| for (int i = 0; i < count; ++i)
|
| - ToolstripInsertedAt(model_->ToolstripAt(i).host, i);
|
| + ToolstripInsertedAt(model_->ToolstripAt(i), i);
|
| AdjustHeight();
|
| }
|
|
|
| ExtensionShelfGtk::Toolstrip* ExtensionShelfGtk::ToolstripAtIndex(int index) {
|
| - return static_cast<Toolstrip*>(model_->ToolstripAt(index).data);
|
| + return static_cast<Toolstrip*>(model_->ToolstripDataAt(index));
|
| }
|
|
|
| // static
|
|
|