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

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

Issue 341016: GTK: touch up appearance of browser actions badge.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | Annotate | Revision Log
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/canvas_paint.h" 10 #include "app/gfx/canvas_paint.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 UpdateState(); 108 UpdateState();
109 } 109 }
110 110
111 // Updates the button based on the latest state from the associated 111 // Updates the button based on the latest state from the associated
112 // browser action. 112 // browser action.
113 void UpdateState() { 113 void UpdateState() {
114 int tab_id = toolbar_->GetCurrentTabId(); 114 int tab_id = toolbar_->GetCurrentTabId();
115 if (tab_id < 0) 115 if (tab_id < 0)
116 return; 116 return;
117 117
118 gtk_widget_set_tooltip_text(button_.get(), 118 std::string tooltip = extension_->browser_action()->GetTitle(tab_id);
119 extension_->browser_action()->GetTitle(tab_id).c_str()); 119 if (tooltip.empty())
120 gtk_widget_set_has_tooltip(button_.get(), FALSE);
121 else
122 gtk_widget_set_tooltip_text(button_.get(), tooltip.c_str());
120 123
121 SkBitmap image = extension_->browser_action()->GetIcon(tab_id); 124 SkBitmap image = extension_->browser_action()->GetIcon(tab_id);
122 if (!image.isNull()) { 125 if (!image.isNull()) {
123 GdkPixbuf* previous_gdk_icon = tab_specific_icon_; 126 GdkPixbuf* previous_gdk_icon = tab_specific_icon_;
124 tab_specific_icon_ = gfx::GdkPixbufFromSkBitmap(&image); 127 tab_specific_icon_ = gfx::GdkPixbufFromSkBitmap(&image);
125 SetImage(tab_specific_icon_); 128 SetImage(tab_specific_icon_);
126 if (previous_gdk_icon) 129 if (previous_gdk_icon)
127 g_object_unref(previous_gdk_icon); 130 g_object_unref(previous_gdk_icon);
128 } else if (default_icon_) { 131 } else if (default_icon_) {
129 SetImage(default_icon_); 132 SetImage(default_icon_);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 if (extension_button_map_.erase(extension->id())) 276 if (extension_button_map_.erase(extension->id()))
274 UpdateVisibility(); 277 UpdateVisibility();
275 } 278 }
276 279
277 void BrowserActionsToolbarGtk::UpdateVisibility() { 280 void BrowserActionsToolbarGtk::UpdateVisibility() {
278 if (button_count() == 0) 281 if (button_count() == 0)
279 gtk_widget_hide(widget()); 282 gtk_widget_hide(widget());
280 else 283 else
281 gtk_widget_show(widget()); 284 gtk_widget_show(widget());
282 } 285 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/extension_action.cc » ('j') | chrome/common/extensions/extension_action.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698