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

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

Issue 10377122: Convert GdkPixbufFromSkBitmap and GdkPixbufToSkBitmap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/gtk/browser_actions_toolbar_gtk.h" 5 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 if (!path.empty()) { 123 if (!path.empty()) {
124 tracker_.LoadImage(extension_, extension_->GetResource(path), 124 tracker_.LoadImage(extension_, extension_->GetResource(path),
125 gfx::Size(Extension::kBrowserActionIconMaxSize, 125 gfx::Size(Extension::kBrowserActionIconMaxSize,
126 Extension::kBrowserActionIconMaxSize), 126 Extension::kBrowserActionIconMaxSize),
127 ImageLoadingTracker::DONT_CACHE); 127 ImageLoadingTracker::DONT_CACHE);
128 } else { 128 } else {
129 const SkBitmap* bm = 129 const SkBitmap* bm =
130 ui::ResourceBundle::GetSharedInstance().GetImageNamed( 130 ui::ResourceBundle::GetSharedInstance().GetImageNamed(
131 IDR_EXTENSIONS_FAVICON).ToSkBitmap(); 131 IDR_EXTENSIONS_FAVICON).ToSkBitmap();
132 default_skbitmap_ = *bm; 132 default_skbitmap_ = *bm;
133 default_icon_ = gfx::GdkPixbufFromSkBitmap(bm); 133 default_icon_ = gfx::GdkPixbufFromSkBitmap(*bm);
134 } 134 }
135 135
136 UpdateState(); 136 UpdateState();
137 137
138 signals_.Connect(button(), "button-press-event", 138 signals_.Connect(button(), "button-press-event",
139 G_CALLBACK(OnButtonPress), this); 139 G_CALLBACK(OnButtonPress), this);
140 signals_.Connect(button(), "clicked", 140 signals_.Connect(button(), "clicked",
141 G_CALLBACK(OnClicked), this); 141 G_CALLBACK(OnClicked), this);
142 signals_.Connect(button(), "drag-begin", 142 signals_.Connect(button(), "drag-begin",
143 G_CALLBACK(&OnDragBegin), this); 143 G_CALLBACK(&OnDragBegin), this);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 std::string tooltip = extension_->browser_action()->GetTitle(tab_id); 221 std::string tooltip = extension_->browser_action()->GetTitle(tab_id);
222 if (tooltip.empty()) 222 if (tooltip.empty())
223 gtk_widget_set_has_tooltip(button(), FALSE); 223 gtk_widget_set_has_tooltip(button(), FALSE);
224 else 224 else
225 gtk_widget_set_tooltip_text(button(), tooltip.c_str()); 225 gtk_widget_set_tooltip_text(button(), tooltip.c_str());
226 226
227 SkBitmap image = extension_->browser_action()->GetIcon(tab_id); 227 SkBitmap image = extension_->browser_action()->GetIcon(tab_id);
228 if (!image.isNull()) { 228 if (!image.isNull()) {
229 GdkPixbuf* previous_gdk_icon = tab_specific_icon_; 229 GdkPixbuf* previous_gdk_icon = tab_specific_icon_;
230 tab_specific_icon_ = gfx::GdkPixbufFromSkBitmap(&image); 230 tab_specific_icon_ = gfx::GdkPixbufFromSkBitmap(image);
231 SetImage(tab_specific_icon_); 231 SetImage(tab_specific_icon_);
232 if (previous_gdk_icon) 232 if (previous_gdk_icon)
233 g_object_unref(previous_gdk_icon); 233 g_object_unref(previous_gdk_icon);
234 } else if (default_icon_) { 234 } else if (default_icon_) {
235 SetImage(default_icon_); 235 SetImage(default_icon_);
236 } 236 }
237 gtk_widget_queue_draw(button()); 237 gtk_widget_queue_draw(button());
238 } 238 }
239 239
240 SkBitmap GetIcon() { 240 SkBitmap GetIcon() {
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 1079
1080 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), 1080 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root),
1081 event->time); 1081 event->time);
1082 return TRUE; 1082 return TRUE;
1083 } 1083 }
1084 1084
1085 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { 1085 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) {
1086 if (!resize_animation_.is_animating()) 1086 if (!resize_animation_.is_animating())
1087 UpdateChevronVisibility(); 1087 UpdateChevronVisibility();
1088 } 1088 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc ('k') | chrome/browser/ui/gtk/browser_titlebar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698