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

Side by Side Diff: chrome/browser/gtk/browser_actions_toolbar_gtk.cc

Issue 264046: Update browser actions api to be like new design doc. (Closed)
Patch Set: rebase Created 11 years, 2 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 unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/image_loading_tracker.cc ('k') | chrome/browser/views/browser_actions_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698