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

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

Issue 10657036: [linux] fix (inconsistent) crash when switching themes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/gtk_theme_service.h" 5 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 // static 571 // static
572 gfx::Image GtkThemeService::GetFolderIcon(bool native) { 572 gfx::Image GtkThemeService::GetFolderIcon(bool native) {
573 if (native) { 573 if (native) {
574 if (!icon_widget_) 574 if (!icon_widget_)
575 icon_widget_ = gtk_window_new(GTK_WINDOW_TOPLEVEL); 575 icon_widget_ = gtk_window_new(GTK_WINDOW_TOPLEVEL);
576 576
577 if (default_folder_icon_.Get().IsEmpty()) { 577 if (default_folder_icon_.Get().IsEmpty()) {
578 // This seems to leak. 578 // This seems to leak.
579 GdkPixbuf* pixbuf = gtk_widget_render_icon( 579 GdkPixbuf* pixbuf = gtk_widget_render_icon(
580 icon_widget_, GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU, NULL); 580 icon_widget_, GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU, NULL);
581 if (pixbuf) { 581 if (pixbuf)
582 default_folder_icon_.Get() = gfx::Image(pixbuf); 582 default_folder_icon_.Get() = gfx::Image(pixbuf);
583 g_object_unref(pixbuf);
584 }
585 } 583 }
586 if (!default_folder_icon_.Get().IsEmpty()) 584 if (!default_folder_icon_.Get().IsEmpty())
587 return default_folder_icon_.Get(); 585 return default_folder_icon_.Get();
588 } 586 }
589 587
590 return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( 588 return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(
591 IDR_BOOKMARK_BAR_FOLDER); 589 IDR_BOOKMARK_BAR_FOLDER);
592 } 590 }
593 591
594 // static 592 // static
595 gfx::Image GtkThemeService::GetDefaultFavicon(bool native) { 593 gfx::Image GtkThemeService::GetDefaultFavicon(bool native) {
596 if (native) { 594 if (native) {
597 if (!icon_widget_) 595 if (!icon_widget_)
598 icon_widget_ = gtk_window_new(GTK_WINDOW_TOPLEVEL); 596 icon_widget_ = gtk_window_new(GTK_WINDOW_TOPLEVEL);
599 597
600 if (default_bookmark_icon_.Get().IsEmpty()) { 598 if (default_bookmark_icon_.Get().IsEmpty()) {
601 // This seems to leak. 599 // This seems to leak.
602 GdkPixbuf* pixbuf = gtk_widget_render_icon( 600 GdkPixbuf* pixbuf = gtk_widget_render_icon(
603 icon_widget_, GTK_STOCK_FILE, GTK_ICON_SIZE_MENU, NULL); 601 icon_widget_, GTK_STOCK_FILE, GTK_ICON_SIZE_MENU, NULL);
604 if (pixbuf) { 602 if (pixbuf)
605 default_bookmark_icon_.Get() = gfx::Image(pixbuf); 603 default_bookmark_icon_.Get() = gfx::Image(pixbuf);
606 g_object_unref(pixbuf);
607 }
608 } 604 }
609 if (!default_bookmark_icon_.Get().IsEmpty()) 605 if (!default_bookmark_icon_.Get().IsEmpty())
610 return default_bookmark_icon_.Get(); 606 return default_bookmark_icon_.Get();
611 } 607 }
612 608
613 return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( 609 return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(
614 IDR_DEFAULT_FAVICON); 610 IDR_DEFAULT_FAVICON);
615 } 611 }
616 612
617 // static 613 // static
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 cairo_new_path(cr); 1145 cairo_new_path(cr);
1150 cairo_set_line_width(cr, 1.0); 1146 cairo_set_line_width(cr, 1.0);
1151 cairo_move_to(cr, start_x, allocation.y); 1147 cairo_move_to(cr, start_x, allocation.y);
1152 cairo_line_to(cr, start_x, allocation.y + allocation.height); 1148 cairo_line_to(cr, start_x, allocation.y + allocation.height);
1153 cairo_stroke(cr); 1149 cairo_stroke(cr);
1154 cairo_destroy(cr); 1150 cairo_destroy(cr);
1155 cairo_pattern_destroy(pattern); 1151 cairo_pattern_destroy(pattern);
1156 1152
1157 return TRUE; 1153 return TRUE;
1158 } 1154 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698