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

Unified Diff: chrome/browser/gtk/extension_shelf_gtk.cc

Issue 160276: mole expand/collapse API (Closed)
Patch Set: fixed a couple of crashers Created 11 years, 5 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
« no previous file with comments | « chrome/browser/gtk/extension_shelf_gtk.h ('k') | chrome/browser/views/extensions/extension_shelf.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/extension_shelf_gtk.cc
diff --git a/chrome/browser/gtk/extension_shelf_gtk.cc b/chrome/browser/gtk/extension_shelf_gtk.cc
index 5f3a4b977e4e71e9b5ed62e1b40f637b93320566..c83d182d5ba68b76da6e046f18042251f9a676db 100644
--- a/chrome/browser/gtk/extension_shelf_gtk.cc
+++ b/chrome/browser/gtk/extension_shelf_gtk.cc
@@ -67,7 +67,7 @@ void ExtensionShelfGtk::Toolstrip::Init() {
ExtensionShelfGtk::ExtensionShelfGtk(Profile* profile, Browser* browser)
: browser_(browser),
theme_provider_(GtkThemeProvider::GetFrom(profile)),
- model_(new ExtensionShelfModel(browser)) {
+ model_(browser->extension_shelf_model()) {
Init(profile);
registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
@@ -75,7 +75,8 @@ ExtensionShelfGtk::ExtensionShelfGtk(Profile* profile, Browser* browser)
}
ExtensionShelfGtk::~ExtensionShelfGtk() {
- model_->RemoveObserver(this);
+ if (model_)
+ model_->RemoveObserver(this);
event_box_.Destroy();
}
@@ -119,8 +120,8 @@ void ExtensionShelfGtk::ToolstripMoved(ExtensionHost* host,
AdjustHeight();
}
-void ExtensionShelfGtk::ToolstripChangedAt(ExtensionHost* host,
- int index) {
+void ExtensionShelfGtk::ToolstripChanged(
+ ExtensionShelfModel::iterator toolstrip) {
// TODO(phajdan.jr): Implement changing toolstrips.
AdjustHeight();
}
@@ -139,6 +140,18 @@ void ExtensionShelfGtk::ShelfModelReloaded() {
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());
@@ -187,12 +200,12 @@ void ExtensionShelfGtk::LoadFromModel() {
DCHECK(toolstrips_.empty());
int count = model_->count();
for (int i = 0; i < count; ++i)
- ToolstripInsertedAt(model_->ToolstripAt(i), i);
+ ToolstripInsertedAt(model_->ToolstripAt(i).host, i);
AdjustHeight();
}
ExtensionShelfGtk::Toolstrip* ExtensionShelfGtk::ToolstripAtIndex(int index) {
- return static_cast<Toolstrip*>(model_->ToolstripDataAt(index));
+ return static_cast<Toolstrip*>(model_->ToolstripAt(index).data);
}
// static
« no previous file with comments | « chrome/browser/gtk/extension_shelf_gtk.h ('k') | chrome/browser/views/extensions/extension_shelf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698