| 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_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" |
| 11 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/gtk/avatar_menu_item_gtk.h" | 13 #include "chrome/browser/ui/gtk/avatar_menu_item_gtk.h" |
| 14 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" | 14 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" |
| 15 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 15 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 16 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 16 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
| 17 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | |
| 18 #include "chrome/browser/ui/gtk/gtk_util.h" | 17 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 19 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" | 18 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
| 19 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 20 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
| 21 #include "content/public/browser/notification_source.h" | 21 #include "content/public/browser/notification_source.h" |
| 22 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
| 23 #include "ui/base/gtk/gtk_hig_constants.h" | 23 #include "ui/base/gtk/gtk_hig_constants.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 // The minimum width in pixels of the bubble. | 28 // The minimum width in pixels of the bubble. |
| 29 const int kBubbleMinWidth = 175; | 29 const int kBubbleMinWidth = 175; |
| 30 | 30 |
| 31 // The number of pixels of padding on the left of the 'New Profile' link at the | 31 // The number of pixels of padding on the left of the 'New Profile' link at the |
| 32 // bottom of the bubble. | 32 // bottom of the bubble. |
| 33 const int kNewProfileLinkLeftPadding = 40; | 33 const int kNewProfileLinkLeftPadding = 40; |
| 34 | 34 |
| 35 } // namespace | 35 } // namespace |
| 36 | 36 |
| 37 AvatarMenuBubbleGtk::AvatarMenuBubbleGtk(Browser* browser, | 37 AvatarMenuBubbleGtk::AvatarMenuBubbleGtk(Browser* browser, |
| 38 GtkWidget* anchor, | 38 GtkWidget* anchor, |
| 39 BubbleGtk::ArrowLocationGtk arrow, | 39 BubbleGtk::ArrowLocationGtk arrow, |
| 40 const gfx::Rect* rect) | 40 const gfx::Rect* rect) |
| 41 : contents_(NULL), | 41 : contents_(NULL), |
| 42 theme_service_(GtkThemeService::GetFrom(browser->profile())), | 42 theme_service_(ThemeServiceGtk::GetFrom(browser->profile())), |
| 43 new_profile_link_(NULL), | 43 new_profile_link_(NULL), |
| 44 minimum_width_(kBubbleMinWidth) { | 44 minimum_width_(kBubbleMinWidth) { |
| 45 avatar_menu_model_.reset(new AvatarMenuModel( | 45 avatar_menu_model_.reset(new AvatarMenuModel( |
| 46 &g_browser_process->profile_manager()->GetProfileInfoCache(), | 46 &g_browser_process->profile_manager()->GetProfileInfoCache(), |
| 47 this, browser)); | 47 this, browser)); |
| 48 | 48 |
| 49 InitContents(); | 49 InitContents(); |
| 50 | 50 |
| 51 OnAvatarMenuModelChanged(avatar_menu_model_.get()); | 51 OnAvatarMenuModelChanged(avatar_menu_model_.get()); |
| 52 | 52 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 g_signal_connect(new_profile_link_, "clicked", | 159 g_signal_connect(new_profile_link_, "clicked", |
| 160 G_CALLBACK(OnNewProfileLinkClickedThunk), this); | 160 G_CALLBACK(OnNewProfileLinkClickedThunk), this); |
| 161 | 161 |
| 162 GtkWidget* link_align = gtk_alignment_new(0, 0, 0, 0); | 162 GtkWidget* link_align = gtk_alignment_new(0, 0, 0, 0); |
| 163 gtk_alignment_set_padding(GTK_ALIGNMENT(link_align), | 163 gtk_alignment_set_padding(GTK_ALIGNMENT(link_align), |
| 164 0, 0, kNewProfileLinkLeftPadding, 0); | 164 0, 0, kNewProfileLinkLeftPadding, 0); |
| 165 gtk_container_add(GTK_CONTAINER(link_align), new_profile_link_); | 165 gtk_container_add(GTK_CONTAINER(link_align), new_profile_link_); |
| 166 | 166 |
| 167 gtk_box_pack_start(GTK_BOX(contents_), link_align, FALSE, FALSE, 0); | 167 gtk_box_pack_start(GTK_BOX(contents_), link_align, FALSE, FALSE, 0); |
| 168 } | 168 } |
| OLD | NEW |