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

Side by Side Diff: chrome/browser/ui/panels/panel_browser_titlebar_gtk.cc

Issue 10827259: Change panels to use gfx::Image instead of SkBitmap for favicon. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: applied change to panel_titlebar_gtk.cc after syncing Created 8 years, 4 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 | « chrome/browser/ui/panels/panel.cc ('k') | chrome/browser/ui/panels/panel_host.h » ('j') | 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/panels/panel_browser_titlebar_gtk.h" 5 #include "chrome/browser/ui/panels/panel_browser_titlebar_gtk.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/gtk/custom_button.h" 9 #include "chrome/browser/ui/gtk/custom_button.h"
10 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 10 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
11 #include "chrome/browser/ui/gtk/gtk_util.h" 11 #include "chrome/browser/ui/gtk/gtk_util.h"
12 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 12 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
13 #include "chrome/browser/ui/panels/panel.h" 13 #include "chrome/browser/ui/panels/panel.h"
14 #include "chrome/browser/ui/panels/panel_browser_window_gtk.h" 14 #include "chrome/browser/ui/panels/panel_browser_window_gtk.h"
15 #include "chrome/common/chrome_notification_types.h" 15 #include "chrome/common/chrome_notification_types.h"
16 #include "content/public/browser/notification_service.h" 16 #include "content/public/browser/notification_service.h"
17 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
19 #include "grit/theme_resources.h" 19 #include "grit/theme_resources.h"
20 #include "third_party/skia/include/core/SkBitmap.h"
21 #include "ui/base/gtk/gtk_compat.h" 20 #include "ui/base/gtk/gtk_compat.h"
22 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
23 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
23 #include "ui/gfx/image/image.h"
24 #include "ui/gfx/skia_utils_gtk.h" 24 #include "ui/gfx/skia_utils_gtk.h"
25 25
26 namespace { 26 namespace {
27 27
28 // Padding around the titlebar. 28 // Padding around the titlebar.
29 const int kPanelTitlebarPaddingTop = 7; 29 const int kPanelTitlebarPaddingTop = 7;
30 const int kPanelTitlebarPaddingBottom = 7; 30 const int kPanelTitlebarPaddingBottom = 7;
31 const int kPanelTitlebarPaddingLeft = 4; 31 const int kPanelTitlebarPaddingLeft = 4;
32 const int kPanelTitlebarPaddingRight = 8; 32 const int kPanelTitlebarPaddingRight = 8;
33 33
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 void PanelBrowserTitlebarGtk::UpdateThrobber( 229 void PanelBrowserTitlebarGtk::UpdateThrobber(
230 content::WebContents* web_contents) { 230 content::WebContents* web_contents) {
231 if (web_contents && web_contents->IsLoading()) { 231 if (web_contents && web_contents->IsLoading()) {
232 GdkPixbuf* icon_pixbuf = 232 GdkPixbuf* icon_pixbuf =
233 throbber_.GetNextFrame(web_contents->IsWaitingForResponse()); 233 throbber_.GetNextFrame(web_contents->IsWaitingForResponse());
234 gtk_image_set_from_pixbuf(GTK_IMAGE(icon_), icon_pixbuf); 234 gtk_image_set_from_pixbuf(GTK_IMAGE(icon_), icon_pixbuf);
235 } else { 235 } else {
236 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 236 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
237 237
238 SkBitmap icon = browser_window_->panel()->GetCurrentPageIcon(); 238 gfx::Image icon = browser_window_->panel()->GetCurrentPageIcon();
239 if (icon.empty()) { 239 if (icon.IsEmpty()) {
240 // Fallback to the Chromium icon if the page has no icon. 240 // Fallback to the Chromium icon if the page has no icon.
241 gtk_image_set_from_pixbuf(GTK_IMAGE(icon_), 241 gtk_image_set_from_pixbuf(GTK_IMAGE(icon_),
242 rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_16).ToGdkPixbuf()); 242 rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_16).ToGdkPixbuf());
243 } else { 243 } else {
244 GdkPixbuf* icon_pixbuf = gfx::GdkPixbufFromSkBitmap(icon); 244 GdkPixbuf* icon_pixbuf = icon.ToGdkPixbuf();
245 gtk_image_set_from_pixbuf(GTK_IMAGE(icon_), icon_pixbuf); 245 gtk_image_set_from_pixbuf(GTK_IMAGE(icon_), icon_pixbuf);
246 g_object_unref(icon_pixbuf);
247 } 246 }
248 247
249 throbber_.Reset(); 248 throbber_.Reset();
250 } 249 }
251 } 250 }
252 251
253 void PanelBrowserTitlebarGtk::ShowContextMenu(GdkEventButton* event) { 252 void PanelBrowserTitlebarGtk::ShowContextMenu(GdkEventButton* event) {
254 // Panel does not show any context menu. 253 // Panel does not show any context menu.
255 } 254 }
256 255
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 } 351 }
353 352
354 void PanelBrowserTitlebarGtk::set_window(GtkWindow* window) { 353 void PanelBrowserTitlebarGtk::set_window(GtkWindow* window) {
355 window_ = window; 354 window_ = window;
356 } 355 }
357 356
358 AvatarMenuButtonGtk* PanelBrowserTitlebarGtk::avatar_button() const { 357 AvatarMenuButtonGtk* PanelBrowserTitlebarGtk::avatar_button() const {
359 // Not supported in panel. 358 // Not supported in panel.
360 return NULL; 359 return NULL;
361 } 360 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel.cc ('k') | chrome/browser/ui/panels/panel_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698