OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/overflow_button.h" | 5 #include "chrome/browser/ui/gtk/overflow_button.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 10 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 11 #include "chrome/common/chrome_notification_types.h" |
11 #include "content/common/notification_service.h" | 12 #include "content/common/notification_service.h" |
12 #include "content/common/notification_type.h" | |
13 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
15 | 15 |
16 OverflowButton::OverflowButton(Profile* profile) : profile_(profile) { | 16 OverflowButton::OverflowButton(Profile* profile) : profile_(profile) { |
17 widget_.Own(GtkThemeService::GetFrom(profile)->BuildChromeButton()); | 17 widget_.Own(GtkThemeService::GetFrom(profile)->BuildChromeButton()); |
18 gtk_widget_set_no_show_all(widget_.get(), TRUE); | 18 gtk_widget_set_no_show_all(widget_.get(), TRUE); |
19 | 19 |
20 GtkThemeService* theme_service = GtkThemeService::GetFrom(profile); | 20 GtkThemeService* theme_service = GtkThemeService::GetFrom(profile); |
21 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, | 21 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
22 Source<ThemeService>(theme_service)); | 22 Source<ThemeService>(theme_service)); |
23 theme_service->InitThemesFor(this); | 23 theme_service->InitThemesFor(this); |
24 } | 24 } |
25 | 25 |
26 OverflowButton::~OverflowButton() { | 26 OverflowButton::~OverflowButton() { |
27 widget_.Destroy(); | 27 widget_.Destroy(); |
28 } | 28 } |
29 | 29 |
30 void OverflowButton::Observe(NotificationType type, | 30 void OverflowButton::Observe(int type, |
31 const NotificationSource& source, | 31 const NotificationSource& source, |
32 const NotificationDetails& details) { | 32 const NotificationDetails& details) { |
33 GtkWidget* former_child = gtk_bin_get_child(GTK_BIN(widget())); | 33 GtkWidget* former_child = gtk_bin_get_child(GTK_BIN(widget())); |
34 if (former_child) | 34 if (former_child) |
35 gtk_widget_destroy(former_child); | 35 gtk_widget_destroy(former_child); |
36 | 36 |
37 GtkWidget* new_child = | 37 GtkWidget* new_child = |
38 GtkThemeService::GetFrom(profile_)->UsingNativeTheme() ? | 38 GtkThemeService::GetFrom(profile_)->UsingNativeTheme() ? |
39 gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE) : | 39 gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE) : |
40 gtk_image_new_from_pixbuf(ResourceBundle::GetSharedInstance(). | 40 gtk_image_new_from_pixbuf(ResourceBundle::GetSharedInstance(). |
41 GetRTLEnabledPixbufNamed(IDR_BOOKMARK_BAR_CHEVRONS)); | 41 GetRTLEnabledPixbufNamed(IDR_BOOKMARK_BAR_CHEVRONS)); |
42 | 42 |
43 gtk_container_add(GTK_CONTAINER(widget()), new_child); | 43 gtk_container_add(GTK_CONTAINER(widget()), new_child); |
44 gtk_widget_show(new_child); | 44 gtk_widget_show(new_child); |
45 } | 45 } |
OLD | NEW |