| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/gtk/browser_actions_toolbar_gtk.h" | 5 #include "chrome/browser/gtk/browser_actions_toolbar_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/gfx/canvas_paint.h" | 10 #include "app/gfx/canvas_paint.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // If the browser action has a default icon, it will be here. | 194 // If the browser action has a default icon, it will be here. |
| 195 GdkPixbuf* default_icon_; | 195 GdkPixbuf* default_icon_; |
| 196 | 196 |
| 197 NotificationRegistrar registrar_; | 197 NotificationRegistrar registrar_; |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 BrowserActionsToolbarGtk::BrowserActionsToolbarGtk(Browser* browser) | 200 BrowserActionsToolbarGtk::BrowserActionsToolbarGtk(Browser* browser) |
| 201 : browser_(browser), | 201 : browser_(browser), |
| 202 profile_(browser->profile()), | 202 profile_(browser->profile()), |
| 203 hbox_(gtk_hbox_new(FALSE, kBrowserActionButtonPadding)) { | 203 hbox_(gtk_hbox_new(FALSE, kBrowserActionButtonPadding)) { |
| 204 ExtensionsService* extension_service = profile_->GetExtensionsService(); | |
| 205 registrar_.Add(this, NotificationType::EXTENSION_LOADED, | 204 registrar_.Add(this, NotificationType::EXTENSION_LOADED, |
| 206 Source<ExtensionsService>(extension_service)); | 205 Source<Profile>(profile_)); |
| 207 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, | 206 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, |
| 208 Source<ExtensionsService>(extension_service)); | 207 Source<Profile>(profile_)); |
| 209 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED_DISABLED, | 208 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED_DISABLED, |
| 210 Source<ExtensionsService>(extension_service)); | 209 Source<Profile>(profile_)); |
| 211 | 210 |
| 212 CreateAllButtons(); | 211 CreateAllButtons(); |
| 213 } | 212 } |
| 214 | 213 |
| 215 BrowserActionsToolbarGtk::~BrowserActionsToolbarGtk() { | 214 BrowserActionsToolbarGtk::~BrowserActionsToolbarGtk() { |
| 216 hbox_.Destroy(); | 215 hbox_.Destroy(); |
| 217 } | 216 } |
| 218 | 217 |
| 219 int BrowserActionsToolbarGtk::GetCurrentTabId() { | 218 int BrowserActionsToolbarGtk::GetCurrentTabId() { |
| 220 TabContents* selected_tab = browser_->GetSelectedTabContents(); | 219 TabContents* selected_tab = browser_->GetSelectedTabContents(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 if (extension_button_map_.erase(extension->id())) | 276 if (extension_button_map_.erase(extension->id())) |
| 278 UpdateVisibility(); | 277 UpdateVisibility(); |
| 279 } | 278 } |
| 280 | 279 |
| 281 void BrowserActionsToolbarGtk::UpdateVisibility() { | 280 void BrowserActionsToolbarGtk::UpdateVisibility() { |
| 282 if (button_count() == 0) | 281 if (button_count() == 0) |
| 283 gtk_widget_hide(widget()); | 282 gtk_widget_hide(widget()); |
| 284 else | 283 else |
| 285 gtk_widget_show(widget()); | 284 gtk_widget_show(widget()); |
| 286 } | 285 } |
| OLD | NEW |