| 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" | |
| 14 #include "chrome/browser/ui/gtk/gtk_util.h" | 13 #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 GtkThemeService* theme_service) | 50 ThemeServiceGtk* 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 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 58 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
| 59 Init(theme_service_); | 59 Init(theme_service_); |
| 60 | 60 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 gtk_widget_get_window(widget), | 209 gtk_widget_get_window(widget), |
| 210 gtk_widget_get_state(widget), | 210 gtk_widget_get_state(widget), |
| 211 &event->area, widget, NULL, | 211 &event->area, widget, NULL, |
| 212 0, 0, | 212 0, 0, |
| 213 allocation.width, allocation.height); | 213 allocation.width, allocation.height); |
| 214 } | 214 } |
| 215 | 215 |
| 216 return TRUE; | 216 return TRUE; |
| 217 } | 217 } |
| 218 | 218 |
| 219 void AvatarMenuItemGtk::Init(GtkThemeService* theme_service) { | 219 void AvatarMenuItemGtk::Init(ThemeServiceGtk* theme_service) { |
| 220 widget_.Own(gtk_event_box_new()); | 220 widget_.Own(gtk_event_box_new()); |
| 221 | 221 |
| 222 g_signal_connect(widget_.get(), "button-press-event", | 222 g_signal_connect(widget_.get(), "button-press-event", |
| 223 G_CALLBACK(OnProfileClickThunk), this); | 223 G_CALLBACK(OnProfileClickThunk), this); |
| 224 g_signal_connect(widget_.get(), "enter-notify-event", | 224 g_signal_connect(widget_.get(), "enter-notify-event", |
| 225 G_CALLBACK(OnProfileEnterThunk), this); | 225 G_CALLBACK(OnProfileEnterThunk), this); |
| 226 g_signal_connect(widget_.get(), "leave-notify-event", | 226 g_signal_connect(widget_.get(), "leave-notify-event", |
| 227 G_CALLBACK(OnProfileLeaveThunk), this); | 227 G_CALLBACK(OnProfileLeaveThunk), this); |
| 228 g_signal_connect(widget_.get(), "focus-in-event", | 228 g_signal_connect(widget_.get(), "focus-in-event", |
| 229 G_CALLBACK(OnProfileFocusInThunk), this); | 229 G_CALLBACK(OnProfileFocusInThunk), this); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 313 |
| 314 GtkSizeGroup* size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | 314 GtkSizeGroup* size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); |
| 315 gtk_size_group_add_widget(size_group, status_label_); | 315 gtk_size_group_add_widget(size_group, status_label_); |
| 316 gtk_size_group_add_widget(size_group, link_alignment_); | 316 gtk_size_group_add_widget(size_group, link_alignment_); |
| 317 g_object_unref(size_group); | 317 g_object_unref(size_group); |
| 318 } | 318 } |
| 319 | 319 |
| 320 gtk_box_pack_start(GTK_BOX(item_hbox), item_vbox, TRUE, TRUE, 0); | 320 gtk_box_pack_start(GTK_BOX(item_hbox), item_vbox, TRUE, TRUE, 0); |
| 321 gtk_container_add(GTK_CONTAINER(widget_.get()), item_hbox); | 321 gtk_container_add(GTK_CONTAINER(widget_.get()), item_hbox); |
| 322 } | 322 } |
| OLD | NEW |