| OLD | NEW | 
 | (Empty) | 
|   1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |  | 
|   2 // Use of this source code is governed by a BSD-style license that can be |  | 
|   3 // found in the LICENSE file. |  | 
|   4  |  | 
|   5 #include "chrome/browser/gtk/overflow_button.h" |  | 
|   6  |  | 
|   7 #include <gtk/gtk.h> |  | 
|   8  |  | 
|   9 #include "app/resource_bundle.h" |  | 
|  10 #include "chrome/browser/profiles/profile.h" |  | 
|  11 #include "chrome/browser/gtk/gtk_theme_provider.h" |  | 
|  12 #include "chrome/common/notification_service.h" |  | 
|  13 #include "chrome/common/notification_type.h" |  | 
|  14 #include "grit/theme_resources.h" |  | 
|  15  |  | 
|  16 OverflowButton::OverflowButton(Profile* profile) : profile_(profile) { |  | 
|  17   widget_.Own(GtkThemeProvider::GetFrom(profile)->BuildChromeButton()); |  | 
|  18   gtk_widget_set_no_show_all(widget_.get(), TRUE); |  | 
|  19  |  | 
|  20   registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, |  | 
|  21                  NotificationService::AllSources()); |  | 
|  22   GtkThemeProvider::GetFrom(profile)->InitThemesFor(this); |  | 
|  23 } |  | 
|  24  |  | 
|  25 OverflowButton::~OverflowButton() { |  | 
|  26   widget_.Destroy(); |  | 
|  27 } |  | 
|  28  |  | 
|  29 void OverflowButton::Observe(NotificationType type, |  | 
|  30                              const NotificationSource& source, |  | 
|  31                              const NotificationDetails& details) { |  | 
|  32   GtkWidget* former_child = gtk_bin_get_child(GTK_BIN(widget())); |  | 
|  33   if (former_child) |  | 
|  34     gtk_widget_destroy(former_child); |  | 
|  35  |  | 
|  36   GtkWidget* new_child = |  | 
|  37       GtkThemeProvider::GetFrom(profile_)->UseGtkTheme() ? |  | 
|  38       gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE) : |  | 
|  39       gtk_image_new_from_pixbuf(ResourceBundle::GetSharedInstance(). |  | 
|  40           GetRTLEnabledPixbufNamed(IDR_BOOKMARK_BAR_CHEVRONS)); |  | 
|  41  |  | 
|  42   gtk_container_add(GTK_CONTAINER(widget()), new_child); |  | 
|  43   gtk_widget_show(new_child); |  | 
|  44 } |  | 
| OLD | NEW |