| 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_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/profiles/avatar_menu_model.h" | 9 #include "chrome/browser/profiles/avatar_menu_model.h" |
| 10 #include "chrome/browser/profiles/profile_info_cache.h" | 10 #include "chrome/browser/profiles/profile_info_cache.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 const int kBubbleMinWidth = 175; | 26 const int kBubbleMinWidth = 175; |
| 27 | 27 |
| 28 // The number of pixels of padding on the left of the 'New Profile' link at the | 28 // The number of pixels of padding on the left of the 'New Profile' link at the |
| 29 // bottom of the bubble. | 29 // bottom of the bubble. |
| 30 const int kNewProfileLinkLeftPadding = 40; | 30 const int kNewProfileLinkLeftPadding = 40; |
| 31 | 31 |
| 32 } // namespace | 32 } // namespace |
| 33 | 33 |
| 34 AvatarMenuBubbleGtk::AvatarMenuBubbleGtk(Browser* browser, | 34 AvatarMenuBubbleGtk::AvatarMenuBubbleGtk(Browser* browser, |
| 35 GtkWidget* anchor, | 35 GtkWidget* anchor, |
| 36 BubbleGtk::ArrowLocationGtk arrow) | 36 BubbleGtk::ArrowLocationGtk arrow, |
| 37 const gfx::Rect* rect) |
| 37 : contents_(NULL), | 38 : contents_(NULL), |
| 38 theme_service_(GtkThemeService::GetFrom(browser->profile())), | 39 theme_service_(GtkThemeService::GetFrom(browser->profile())), |
| 39 minimum_width_(kBubbleMinWidth) { | 40 minimum_width_(kBubbleMinWidth) { |
| 40 avatar_menu_model_.reset(new AvatarMenuModel( | 41 avatar_menu_model_.reset(new AvatarMenuModel( |
| 41 &g_browser_process->profile_manager()->GetProfileInfoCache(), | 42 &g_browser_process->profile_manager()->GetProfileInfoCache(), |
| 42 this, browser)); | 43 this, browser)); |
| 43 | 44 |
| 44 InitContents(); | 45 InitContents(); |
| 45 | 46 |
| 46 OnAvatarMenuModelChanged(avatar_menu_model_.get()); | 47 OnAvatarMenuModelChanged(avatar_menu_model_.get()); |
| 47 | 48 |
| 48 bubble_ = BubbleGtk::Show(anchor, | 49 bubble_ = BubbleGtk::Show(anchor, |
| 49 NULL, // |rect| | 50 rect, |
| 50 contents_, | 51 contents_, |
| 51 arrow, | 52 arrow, |
| 52 true, // |match_system_theme| | 53 true, // |match_system_theme| |
| 53 true, // |grab_input| | 54 true, // |grab_input| |
| 54 theme_service_, | 55 theme_service_, |
| 55 this); // |delegate| | 56 this); // |delegate| |
| 56 } | 57 } |
| 57 | 58 |
| 58 AvatarMenuBubbleGtk::~AvatarMenuBubbleGtk() { | 59 AvatarMenuBubbleGtk::~AvatarMenuBubbleGtk() { |
| 59 STLDeleteContainerPointers(items_.begin(), items_.end()); | 60 STLDeleteContainerPointers(items_.begin(), items_.end()); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 g_signal_connect(new_profile_link, "clicked", | 126 g_signal_connect(new_profile_link, "clicked", |
| 126 G_CALLBACK(OnNewProfileLinkClickedThunk), this); | 127 G_CALLBACK(OnNewProfileLinkClickedThunk), this); |
| 127 | 128 |
| 128 GtkWidget* link_align = gtk_alignment_new(0, 0, 0, 0); | 129 GtkWidget* link_align = gtk_alignment_new(0, 0, 0, 0); |
| 129 gtk_alignment_set_padding(GTK_ALIGNMENT(link_align), | 130 gtk_alignment_set_padding(GTK_ALIGNMENT(link_align), |
| 130 0, 0, kNewProfileLinkLeftPadding, 0); | 131 0, 0, kNewProfileLinkLeftPadding, 0); |
| 131 gtk_container_add(GTK_CONTAINER(link_align), new_profile_link); | 132 gtk_container_add(GTK_CONTAINER(link_align), new_profile_link); |
| 132 | 133 |
| 133 gtk_box_pack_start(GTK_BOX(contents_), link_align, FALSE, FALSE, 0); | 134 gtk_box_pack_start(GTK_BOX(contents_), link_align, FALSE, FALSE, 0); |
| 134 } | 135 } |
| OLD | NEW |