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

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

Issue 10377122: Convert GdkPixbufFromSkBitmap and GdkPixbufToSkBitmap (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/browser_titlebar.h" 5 #include "chrome/browser/ui/gtk/browser_titlebar.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 switch (browser_window_->browser()->type()) { 604 switch (browser_window_->browser()->type()) {
605 case Browser::TYPE_POPUP: { 605 case Browser::TYPE_POPUP: {
606 // Update the system app icon. We don't need to update the icon in the 606 // Update the system app icon. We don't need to update the icon in the
607 // top left of the custom frame, that will get updated when the 607 // top left of the custom frame, that will get updated when the
608 // throbber is updated. 608 // throbber is updated.
609 Profile* profile = browser_window_->browser()->profile(); 609 Profile* profile = browser_window_->browser()->profile();
610 SkBitmap icon = browser_window_->browser()->GetCurrentPageIcon(); 610 SkBitmap icon = browser_window_->browser()->GetCurrentPageIcon();
611 if (icon.empty()) { 611 if (icon.empty()) {
612 gtk_util::SetWindowIcon(window_, profile); 612 gtk_util::SetWindowIcon(window_, profile);
613 } else { 613 } else {
614 GdkPixbuf* icon_pixbuf = gfx::GdkPixbufFromSkBitmap(&icon); 614 GdkPixbuf* icon_pixbuf = gfx::GdkPixbufFromSkBitmap(icon);
615 gtk_util::SetWindowIcon(window_, profile, icon_pixbuf); 615 gtk_util::SetWindowIcon(window_, profile, icon_pixbuf);
616 g_object_unref(icon_pixbuf); 616 g_object_unref(icon_pixbuf);
617 } 617 }
618 break; 618 break;
619 } 619 }
620 case Browser::TYPE_TABBED: { 620 case Browser::TYPE_TABBED: {
621 NOTREACHED() << "We should never have a tabbed app window."; 621 NOTREACHED() << "We should never have a tabbed app window.";
622 break; 622 break;
623 } 623 }
624 case Browser::TYPE_PANEL: { 624 case Browser::TYPE_PANEL: {
(...skipping 16 matching lines...) Expand all
641 641
642 // Note: we want to exclude the application popup/panel window. 642 // Note: we want to exclude the application popup/panel window.
643 if ((browser_window_->browser()->is_app() && 643 if ((browser_window_->browser()->is_app() &&
644 !browser_window_->browser()->is_type_tabbed())) { 644 !browser_window_->browser()->is_type_tabbed())) {
645 SkBitmap icon = browser_window_->browser()->GetCurrentPageIcon(); 645 SkBitmap icon = browser_window_->browser()->GetCurrentPageIcon();
646 if (icon.empty()) { 646 if (icon.empty()) {
647 // Fallback to the Chromium icon if the page has no icon. 647 // Fallback to the Chromium icon if the page has no icon.
648 gtk_image_set_from_pixbuf(GTK_IMAGE(app_mode_favicon_), 648 gtk_image_set_from_pixbuf(GTK_IMAGE(app_mode_favicon_),
649 rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_16).ToGdkPixbuf()); 649 rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_16).ToGdkPixbuf());
650 } else { 650 } else {
651 GdkPixbuf* icon_pixbuf = gfx::GdkPixbufFromSkBitmap(&icon); 651 GdkPixbuf* icon_pixbuf = gfx::GdkPixbufFromSkBitmap(icon);
652 gtk_image_set_from_pixbuf(GTK_IMAGE(app_mode_favicon_), icon_pixbuf); 652 gtk_image_set_from_pixbuf(GTK_IMAGE(app_mode_favicon_), icon_pixbuf);
653 g_object_unref(icon_pixbuf); 653 g_object_unref(icon_pixbuf);
654 } 654 }
655 } else { 655 } else {
656 gtk_image_set_from_pixbuf(GTK_IMAGE(app_mode_favicon_), 656 gtk_image_set_from_pixbuf(GTK_IMAGE(app_mode_favicon_),
657 rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_16).ToGdkPixbuf()); 657 rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_16).ToGdkPixbuf());
658 } 658 }
659 throbber_.Reset(); 659 throbber_.Reset();
660 } 660 }
661 } 661 }
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 1066
1067 // Each frame of the animation is a square, so we use the height as the 1067 // Each frame of the animation is a square, so we use the height as the
1068 // frame size. 1068 // frame size.
1069 int frame_size = frame_strip->height(); 1069 int frame_size = frame_strip->height();
1070 size_t num_frames = frame_strip->width() / frame_size; 1070 size_t num_frames = frame_strip->width() / frame_size;
1071 1071
1072 // Make a separate GdkPixbuf for each frame of the animation. 1072 // Make a separate GdkPixbuf for each frame of the animation.
1073 for (size_t i = 0; i < num_frames; ++i) { 1073 for (size_t i = 0; i < num_frames; ++i) {
1074 SkBitmap frame = SkBitmapOperations::CreateTiledBitmap(*frame_strip, 1074 SkBitmap frame = SkBitmapOperations::CreateTiledBitmap(*frame_strip,
1075 i * frame_size, 0, frame_size, frame_size); 1075 i * frame_size, 0, frame_size, frame_size);
1076 frames->push_back(gfx::GdkPixbufFromSkBitmap(&frame)); 1076 frames->push_back(gfx::GdkPixbufFromSkBitmap(frame));
1077 } 1077 }
1078 } 1078 }
1079 1079
1080 GdkPixbuf* BrowserTitlebar::Throbber::GetNextFrame(bool is_waiting) { 1080 GdkPixbuf* BrowserTitlebar::Throbber::GetNextFrame(bool is_waiting) {
1081 Throbber::InitFrames(); 1081 Throbber::InitFrames();
1082 if (is_waiting) { 1082 if (is_waiting) {
1083 return (*g_throbber_waiting_frames)[current_waiting_frame_++ % 1083 return (*g_throbber_waiting_frames)[current_waiting_frame_++ %
1084 g_throbber_waiting_frames->size()]; 1084 g_throbber_waiting_frames->size()];
1085 } else { 1085 } else {
1086 return (*g_throbber_frames)[current_frame_++ % g_throbber_frames->size()]; 1086 return (*g_throbber_frames)[current_frame_++ % g_throbber_frames->size()];
(...skipping 22 matching lines...) Expand all
1109 ui::SimpleMenuModel::Delegate* delegate) 1109 ui::SimpleMenuModel::Delegate* delegate)
1110 : SimpleMenuModel(delegate) { 1110 : SimpleMenuModel(delegate) {
1111 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); 1111 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB);
1112 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); 1112 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB);
1113 AddSeparator(); 1113 AddSeparator();
1114 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); 1114 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER);
1115 AddSeparator(); 1115 AddSeparator();
1116 AddCheckItemWithStringId(kShowWindowDecorationsCommand, 1116 AddCheckItemWithStringId(kShowWindowDecorationsCommand,
1117 IDS_SHOW_WINDOW_DECORATIONS_MENU); 1117 IDS_SHOW_WINDOW_DECORATIONS_MENU);
1118 } 1118 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc ('k') | chrome/browser/ui/gtk/content_setting_bubble_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698