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/gtk_util.h" | 10 #include "app/gfx/gtk_util.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 // NotificationObserver implementation. | 87 // NotificationObserver implementation. |
88 void Observe(NotificationType type, | 88 void Observe(NotificationType type, |
89 const NotificationSource& source, | 89 const NotificationSource& source, |
90 const NotificationDetails& details) { | 90 const NotificationDetails& details) { |
91 OnStateUpdated(); | 91 OnStateUpdated(); |
92 } | 92 } |
93 | 93 |
94 // ImageLoadingTracker::Observer implementation. | 94 // ImageLoadingTracker::Observer implementation. |
95 void OnImageLoaded(SkBitmap* image, size_t index) { | 95 void OnImageLoaded(SkBitmap* image, size_t index) { |
96 browser_action_icons_[index] = gfx::GdkPixbufFromSkBitmap(image); | 96 if (image) { |
| 97 browser_action_icons_[index] = gfx::GdkPixbufFromSkBitmap(image); |
| 98 } else { |
| 99 SkBitmap empty; |
| 100 browser_action_icons_[index] = gfx::GdkPixbufFromSkBitmap(&empty); |
| 101 } |
| 102 |
97 OnStateUpdated(); | 103 OnStateUpdated(); |
98 } | 104 } |
99 | 105 |
100 private: | 106 private: |
101 // The Browser that executes a command when the button is pressed. | 107 // The Browser that executes a command when the button is pressed. |
102 Browser* browser_; | 108 Browser* browser_; |
103 | 109 |
104 // The extension that contains this browser action. | 110 // The extension that contains this browser action. |
105 Extension* extension_; | 111 Extension* extension_; |
106 | 112 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 if (extension_button_map_.erase(extension->id())) | 194 if (extension_button_map_.erase(extension->id())) |
189 UpdateVisibility(); | 195 UpdateVisibility(); |
190 } | 196 } |
191 | 197 |
192 void BrowserActionsToolbarGtk::UpdateVisibility() { | 198 void BrowserActionsToolbarGtk::UpdateVisibility() { |
193 if (button_count() == 0) | 199 if (button_count() == 0) |
194 gtk_widget_hide(widget()); | 200 gtk_widget_hide(widget()); |
195 else | 201 else |
196 gtk_widget_show(widget()); | 202 gtk_widget_show(widget()); |
197 } | 203 } |
OLD | NEW |