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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 else if (type == NotificationType::BROWSER_THEME_CHANGED) | 98 else if (type == NotificationType::BROWSER_THEME_CHANGED) |
99 OnThemeChanged(); | 99 OnThemeChanged(); |
100 else | 100 else |
101 NOTREACHED(); | 101 NOTREACHED(); |
102 } | 102 } |
103 | 103 |
104 // ImageLoadingTracker::Observer implementation. | 104 // ImageLoadingTracker::Observer implementation. |
105 void OnImageLoaded(SkBitmap* image, size_t index) { | 105 void OnImageLoaded(SkBitmap* image, size_t index) { |
106 if (image) | 106 if (image) |
107 default_icon_ = gfx::GdkPixbufFromSkBitmap(image); | 107 default_icon_ = gfx::GdkPixbufFromSkBitmap(image); |
| 108 tracker_ = NULL; // The tracker object will delete itself when we return. |
108 UpdateState(); | 109 UpdateState(); |
109 } | 110 } |
110 | 111 |
111 // Updates the button based on the latest state from the associated | 112 // Updates the button based on the latest state from the associated |
112 // browser action. | 113 // browser action. |
113 void UpdateState() { | 114 void UpdateState() { |
114 int tab_id = toolbar_->GetCurrentTabId(); | 115 int tab_id = toolbar_->GetCurrentTabId(); |
115 if (tab_id < 0) | 116 if (tab_id < 0) |
116 return; | 117 return; |
117 | 118 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 if (extension_button_map_.erase(extension->id())) | 277 if (extension_button_map_.erase(extension->id())) |
277 UpdateVisibility(); | 278 UpdateVisibility(); |
278 } | 279 } |
279 | 280 |
280 void BrowserActionsToolbarGtk::UpdateVisibility() { | 281 void BrowserActionsToolbarGtk::UpdateVisibility() { |
281 if (button_count() == 0) | 282 if (button_count() == 0) |
282 gtk_widget_hide(widget()); | 283 gtk_widget_hide(widget()); |
283 else | 284 else |
284 gtk_widget_show(widget()); | 285 gtk_widget_show(widget()); |
285 } | 286 } |
OLD | NEW |