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

Side by Side Diff: chrome/browser/ui/gtk/overflow_button.cc

Issue 10337010: Revert r123782. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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/theme_service_gtk.h" 10 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
11 #include "chrome/common/chrome_notification_types.h" 11 #include "chrome/common/chrome_notification_types.h"
12 #include "content/public/browser/notification_source.h" 12 #include "content/public/browser/notification_source.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 #include "ui/gfx/image/image.h" 15 #include "ui/gfx/image/image.h"
16 16
17 OverflowButton::OverflowButton(Profile* profile) : profile_(profile) { 17 OverflowButton::OverflowButton(Profile* profile) : profile_(profile) {
18 widget_.Own(ThemeServiceGtk::GetFrom(profile)->BuildChromeButton()); 18 widget_.Own(GtkThemeService::GetFrom(profile)->BuildChromeButton());
19 gtk_widget_set_no_show_all(widget_.get(), TRUE); 19 gtk_widget_set_no_show_all(widget_.get(), TRUE);
20 20
21 ThemeServiceGtk* theme_service = ThemeServiceGtk::GetFrom(profile); 21 GtkThemeService* theme_service = GtkThemeService::GetFrom(profile);
22 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, 22 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
23 content::Source<ThemeService>(theme_service)); 23 content::Source<ThemeService>(theme_service));
24 theme_service->InitThemesFor(this); 24 theme_service->InitThemesFor(this);
25 } 25 }
26 26
27 OverflowButton::~OverflowButton() { 27 OverflowButton::~OverflowButton() {
28 widget_.Destroy(); 28 widget_.Destroy();
29 } 29 }
30 30
31 void OverflowButton::Observe(int type, 31 void OverflowButton::Observe(int type,
32 const content::NotificationSource& source, 32 const content::NotificationSource& source,
33 const content::NotificationDetails& details) { 33 const content::NotificationDetails& details) {
34 GtkWidget* former_child = gtk_bin_get_child(GTK_BIN(widget())); 34 GtkWidget* former_child = gtk_bin_get_child(GTK_BIN(widget()));
35 if (former_child) 35 if (former_child)
36 gtk_widget_destroy(former_child); 36 gtk_widget_destroy(former_child);
37 37
38 GtkWidget* new_child; 38 GtkWidget* new_child;
39 if (ThemeServiceGtk::GetFrom(profile_)->UsingNativeTheme()) { 39 if (GtkThemeService::GetFrom(profile_)->UsingNativeTheme()) {
40 new_child = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE); 40 new_child = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE);
41 } else { 41 } else {
42 const gfx::Image& image = ui::ResourceBundle::GetSharedInstance(). 42 const gfx::Image& image = ui::ResourceBundle::GetSharedInstance().
43 GetNativeImageNamed(IDR_BOOKMARK_BAR_CHEVRONS, 43 GetNativeImageNamed(IDR_BOOKMARK_BAR_CHEVRONS,
44 ui::ResourceBundle::RTL_ENABLED); 44 ui::ResourceBundle::RTL_ENABLED);
45 new_child = gtk_image_new_from_pixbuf(image.ToGdkPixbuf()); 45 new_child = gtk_image_new_from_pixbuf(image.ToGdkPixbuf());
46 } 46 }
47 47
48 gtk_container_add(GTK_CONTAINER(widget()), new_child); 48 gtk_container_add(GTK_CONTAINER(widget()), new_child);
49 gtk_widget_show(new_child); 49 gtk_widget_show(new_child);
50 } 50 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/one_click_signin_bubble_gtk.cc ('k') | chrome/browser/ui/gtk/page_info_bubble_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698