| 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.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 12 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
| 13 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 13 #include "chrome/browser/ui/gtk/gtk_util.h" | 14 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 14 #include "chrome/browser/ui/gtk/theme_service_gtk.h" | |
| 15 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
| 16 #include "content/public/browser/notification_source.h" | 16 #include "content/public/browser/notification_source.h" |
| 17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
| 18 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 19 #include "grit/theme_resources_standard.h" | 19 #include "grit/theme_resources_standard.h" |
| 20 #include "third_party/skia/include/core/SkBitmap.h" | 20 #include "third_party/skia/include/core/SkBitmap.h" |
| 21 #include "ui/base/gtk/gtk_hig_constants.h" | 21 #include "ui/base/gtk/gtk_hig_constants.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| 24 #include "ui/base/text/text_elider.h" | 24 #include "ui/base/text/text_elider.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 40 const GdkColor kHighlightColor = GDK_COLOR_RGB(0xe3, 0xed, 0xf6); | 40 const GdkColor kHighlightColor = GDK_COLOR_RGB(0xe3, 0xed, 0xf6); |
| 41 | 41 |
| 42 // The color of the background when we're in chrome-theme mode. | 42 // The color of the background when we're in chrome-theme mode. |
| 43 const GdkColor kBackgroundColor = GDK_COLOR_RGB(0xff, 0xff, 0xff); | 43 const GdkColor kBackgroundColor = GDK_COLOR_RGB(0xff, 0xff, 0xff); |
| 44 | 44 |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 AvatarMenuItemGtk::AvatarMenuItemGtk(Delegate* delegate, | 47 AvatarMenuItemGtk::AvatarMenuItemGtk(Delegate* delegate, |
| 48 const AvatarMenuModel::Item& item, | 48 const AvatarMenuModel::Item& item, |
| 49 size_t item_index, | 49 size_t item_index, |
| 50 ThemeServiceGtk* theme_service) | 50 GtkThemeService* theme_service) |
| 51 : delegate_(delegate), | 51 : delegate_(delegate), |
| 52 item_(item), | 52 item_(item), |
| 53 item_index_(item_index), | 53 item_index_(item_index), |
| 54 theme_service_(theme_service), | 54 theme_service_(theme_service), |
| 55 status_label_(NULL), | 55 status_label_(NULL), |
| 56 link_alignment_(NULL), | 56 link_alignment_(NULL), |
| 57 edit_profile_link_(NULL) { | 57 edit_profile_link_(NULL) { |
| 58 Init(theme_service_); | 58 Init(theme_service_); |
| 59 | 59 |
| 60 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 60 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 gtk_widget_get_window(widget), | 176 gtk_widget_get_window(widget), |
| 177 gtk_widget_get_state(widget), | 177 gtk_widget_get_state(widget), |
| 178 &event->area, widget, NULL, | 178 &event->area, widget, NULL, |
| 179 0, 0, | 179 0, 0, |
| 180 allocation.width, allocation.height); | 180 allocation.width, allocation.height); |
| 181 } | 181 } |
| 182 | 182 |
| 183 return TRUE; | 183 return TRUE; |
| 184 } | 184 } |
| 185 | 185 |
| 186 void AvatarMenuItemGtk::Init(ThemeServiceGtk* theme_service) { | 186 void AvatarMenuItemGtk::Init(GtkThemeService* theme_service) { |
| 187 widget_.Own(gtk_event_box_new()); | 187 widget_.Own(gtk_event_box_new()); |
| 188 | 188 |
| 189 g_signal_connect(widget_.get(), "button-press-event", | 189 g_signal_connect(widget_.get(), "button-press-event", |
| 190 G_CALLBACK(OnProfileClickThunk), this); | 190 G_CALLBACK(OnProfileClickThunk), this); |
| 191 g_signal_connect(widget_.get(), "enter-notify-event", | 191 g_signal_connect(widget_.get(), "enter-notify-event", |
| 192 G_CALLBACK(OnProfileEnterThunk), this); | 192 G_CALLBACK(OnProfileEnterThunk), this); |
| 193 g_signal_connect(widget_.get(), "leave-notify-event", | 193 g_signal_connect(widget_.get(), "leave-notify-event", |
| 194 G_CALLBACK(OnProfileLeaveThunk), this); | 194 G_CALLBACK(OnProfileLeaveThunk), this); |
| 195 g_signal_connect(widget_.get(), "focus-in-event", | 195 g_signal_connect(widget_.get(), "focus-in-event", |
| 196 G_CALLBACK(OnProfileFocusInThunk), this); | 196 G_CALLBACK(OnProfileFocusInThunk), this); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 281 |
| 282 GtkSizeGroup* size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | 282 GtkSizeGroup* size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); |
| 283 gtk_size_group_add_widget(size_group, status_label_); | 283 gtk_size_group_add_widget(size_group, status_label_); |
| 284 gtk_size_group_add_widget(size_group, link_alignment_); | 284 gtk_size_group_add_widget(size_group, link_alignment_); |
| 285 g_object_unref(size_group); | 285 g_object_unref(size_group); |
| 286 } | 286 } |
| 287 | 287 |
| 288 gtk_box_pack_start(GTK_BOX(item_hbox), item_vbox, TRUE, TRUE, 0); | 288 gtk_box_pack_start(GTK_BOX(item_hbox), item_vbox, TRUE, TRUE, 0); |
| 289 gtk_container_add(GTK_CONTAINER(widget_.get()), item_hbox); | 289 gtk_container_add(GTK_CONTAINER(widget_.get()), item_hbox); |
| 290 } | 290 } |
| OLD | NEW |