Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7871)

Unified Diff: chrome/browser/ui/gtk/avatar_menu_bubble_gtk.cc

Issue 8402005: GTK: Fix profile selection bubble to match the chrome-theme when selected. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comment fix Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h ('k') | chrome/browser/ui/gtk/avatar_menu_item_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/avatar_menu_bubble_gtk.cc
diff --git a/chrome/browser/ui/gtk/avatar_menu_bubble_gtk.cc b/chrome/browser/ui/gtk/avatar_menu_bubble_gtk.cc
index 732d98326a439888e94c6eace0717eae7bdfec68..c92a7902b692bc0a300f74078dc00b319379d281 100644
--- a/chrome/browser/ui/gtk/avatar_menu_bubble_gtk.cc
+++ b/chrome/browser/ui/gtk/avatar_menu_bubble_gtk.cc
@@ -16,6 +16,8 @@
#include "chrome/browser/ui/gtk/gtk_chrome_link_button.h"
#include "chrome/browser/ui/gtk/gtk_theme_service.h"
#include "chrome/browser/ui/gtk/location_bar_view_gtk.h"
+#include "chrome/common/chrome_notification_types.h"
+#include "content/public/browser/notification_source.h"
#include "grit/generated_resources.h"
#include "ui/base/gtk/gtk_hig_constants.h"
#include "ui/base/l10n/l10n_util.h"
@@ -37,6 +39,7 @@ AvatarMenuBubbleGtk::AvatarMenuBubbleGtk(Browser* browser,
const gfx::Rect* rect)
: contents_(NULL),
theme_service_(GtkThemeService::GetFrom(browser->profile())),
+ new_profile_link_(NULL),
minimum_width_(kBubbleMinWidth) {
avatar_menu_model_.reset(new AvatarMenuModel(
&g_browser_process->profile_manager()->GetProfileInfoCache(),
@@ -56,6 +59,10 @@ AvatarMenuBubbleGtk::AvatarMenuBubbleGtk(Browser* browser,
this); // |delegate|
g_signal_connect(contents_, "destroy",
G_CALLBACK(&OnDestroyThunk), this);
+
+ registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
+ content::Source<ThemeService>(theme_service_));
+ theme_service_->InitThemesFor(this);
}
AvatarMenuBubbleGtk::~AvatarMenuBubbleGtk() {
@@ -91,6 +98,15 @@ void AvatarMenuBubbleGtk::EditProfile(size_t profile_index) {
bubble_->Close();
}
+void AvatarMenuBubbleGtk::Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ DCHECK_EQ(type, chrome::NOTIFICATION_BROWSER_THEME_CHANGED);
+ gtk_chrome_link_button_set_use_gtk_theme(
+ GTK_CHROME_LINK_BUTTON(new_profile_link_),
+ theme_service_->UsingNativeTheme());
+}
+
void AvatarMenuBubbleGtk::OnSizeRequest(GtkWidget* widget,
GtkRequisition* req) {
// Always use the maximum width ever requested.
@@ -129,15 +145,15 @@ void AvatarMenuBubbleGtk::InitContents() {
gtk_box_pack_start(GTK_BOX(contents_), gtk_hseparator_new(), TRUE, TRUE, 0);
// The new profile link.
- GtkWidget* new_profile_link = gtk_chrome_link_button_new(
+ new_profile_link_ = gtk_chrome_link_button_new(
l10n_util::GetStringUTF8(IDS_PROFILES_CREATE_NEW_PROFILE_LINK).c_str());
- g_signal_connect(new_profile_link, "clicked",
+ g_signal_connect(new_profile_link_, "clicked",
G_CALLBACK(OnNewProfileLinkClickedThunk), this);
GtkWidget* link_align = gtk_alignment_new(0, 0, 0, 0);
gtk_alignment_set_padding(GTK_ALIGNMENT(link_align),
0, 0, kNewProfileLinkLeftPadding, 0);
- gtk_container_add(GTK_CONTAINER(link_align), new_profile_link);
+ gtk_container_add(GTK_CONTAINER(link_align), new_profile_link_);
gtk_box_pack_start(GTK_BOX(contents_), link_align, FALSE, FALSE, 0);
}
« no previous file with comments | « chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h ('k') | chrome/browser/ui/gtk/avatar_menu_item_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698