OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_button_gtk.h" | 5 #include "chrome/browser/ui/gtk/avatar_menu_button_gtk.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "chrome/browser/profiles/profile_metrics.h" | 8 #include "chrome/browser/profiles/profile_metrics.h" |
9 #include "chrome/browser/profiles/profile_info_util.h" | 9 #include "chrome/browser/profiles/profile_info_util.h" |
10 #include "chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h" | 10 #include "chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 void AvatarMenuButtonGtk::ShowAvatarBubble() { | 60 void AvatarMenuButtonGtk::ShowAvatarBubble() { |
61 // Only show the avatar bubble if the avatar button is in the title bar. | 61 // Only show the avatar bubble if the avatar button is in the title bar. |
62 if (gtk_widget_get_parent_window(widget_.get())) | 62 if (gtk_widget_get_parent_window(widget_.get())) |
63 new AvatarMenuBubbleGtk(browser_, widget_.get(), arrow_location_, NULL); | 63 new AvatarMenuBubbleGtk(browser_, widget_.get(), arrow_location_, NULL); |
64 } | 64 } |
65 | 65 |
66 void AvatarMenuButtonGtk::UpdateButtonIcon() { | 66 void AvatarMenuButtonGtk::UpdateButtonIcon() { |
67 if (!icon_.get()) | 67 if (!icon_.get()) |
68 return; | 68 return; |
69 | 69 |
70 old_height_ = widget()->allocation.height; | 70 GtkAllocation allocation; |
| 71 gtk_widget_get_allocation(widget(), &allocation); |
| 72 old_height_ = allocation.height; |
71 gfx::Image icon = profiles::GetAvatarIconForTitleBar(*icon_, is_gaia_picture_, | 73 gfx::Image icon = profiles::GetAvatarIconForTitleBar(*icon_, is_gaia_picture_, |
72 profiles::kAvatarIconWidth, old_height_); | 74 profiles::kAvatarIconWidth, old_height_); |
73 gtk_image_set_from_pixbuf(GTK_IMAGE(image_), icon.ToGdkPixbuf()); | 75 gtk_image_set_from_pixbuf(GTK_IMAGE(image_), icon.ToGdkPixbuf()); |
74 gtk_misc_set_alignment(GTK_MISC(image_), 0.0, 1.0); | 76 gtk_misc_set_alignment(GTK_MISC(image_), 0.0, 1.0); |
75 gtk_widget_set_size_request(image_, -1, 0); | 77 gtk_widget_set_size_request(image_, -1, 0); |
76 } | 78 } |
OLD | NEW |