OLD | NEW |
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/avatar_menu_item_gtk.h" | 5 #include "chrome/browser/ui/gtk/avatar_menu_item_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 g_signal_connect_after(widget_.get(), "expose-event", | 194 g_signal_connect_after(widget_.get(), "expose-event", |
195 G_CALLBACK(OnEventBoxExposeThunk), this); | 195 G_CALLBACK(OnEventBoxExposeThunk), this); |
196 | 196 |
197 GtkWidget* item_hbox = gtk_hbox_new(FALSE, ui::kControlSpacing); | 197 GtkWidget* item_hbox = gtk_hbox_new(FALSE, ui::kControlSpacing); |
198 GdkPixbuf* avatar_pixbuf = NULL; | 198 GdkPixbuf* avatar_pixbuf = NULL; |
199 | 199 |
200 // If this profile is active then draw a check mark on the bottom right | 200 // If this profile is active then draw a check mark on the bottom right |
201 // of the profile icon. | 201 // of the profile icon. |
202 if (item_.active) { | 202 if (item_.active) { |
203 const SkBitmap* avatar_image = item_.icon.ToSkBitmap(); | 203 const SkBitmap* avatar_image = item_.icon.ToSkBitmap(); |
204 gfx::ImageSkiaRep avatar_image_rep = | 204 gfx::ImageSkiaRep avatar_image_rep = gfx::ImageSkiaRep(*avatar_image, 1.0f); |
205 gfx::ImageSkiaRep(*avatar_image, ui::SCALE_FACTOR_100P); | |
206 gfx::Canvas canvas(avatar_image_rep, /* is_opaque */ true); | 205 gfx::Canvas canvas(avatar_image_rep, /* is_opaque */ true); |
207 | 206 |
208 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 207 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
209 const gfx::ImageSkia* check_image = rb.GetImageNamed( | 208 const gfx::ImageSkia* check_image = rb.GetImageNamed( |
210 IDR_PROFILE_SELECTED).ToImageSkia(); | 209 IDR_PROFILE_SELECTED).ToImageSkia(); |
211 gfx::Rect check_rect(0, 0, check_image->width(), check_image->height()); | 210 gfx::Rect check_rect(0, 0, check_image->width(), check_image->height()); |
212 int y = avatar_image->height() - check_image->height(); | 211 int y = avatar_image->height() - check_image->height(); |
213 int x = avatar_image->width() - check_image->width() + kCheckMarkXOffset; | 212 int x = avatar_image->width() - check_image->width() + kCheckMarkXOffset; |
214 canvas.DrawImageInt(*check_image, x, y); | 213 canvas.DrawImageInt(*check_image, x, y); |
215 | 214 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 279 |
281 GtkSizeGroup* size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | 280 GtkSizeGroup* size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); |
282 gtk_size_group_add_widget(size_group, status_label_); | 281 gtk_size_group_add_widget(size_group, status_label_); |
283 gtk_size_group_add_widget(size_group, link_alignment_); | 282 gtk_size_group_add_widget(size_group, link_alignment_); |
284 g_object_unref(size_group); | 283 g_object_unref(size_group); |
285 } | 284 } |
286 | 285 |
287 gtk_box_pack_start(GTK_BOX(item_hbox), item_vbox, TRUE, TRUE, 0); | 286 gtk_box_pack_start(GTK_BOX(item_hbox), item_vbox, TRUE, TRUE, 0); |
288 gtk_container_add(GTK_CONTAINER(widget_.get()), item_hbox); | 287 gtk_container_add(GTK_CONTAINER(widget_.get()), item_hbox); |
289 } | 288 } |
OLD | NEW |