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

Unified Diff: chrome/browser/icon_loader_gtk.cc

Issue 8501030: aura: Make the Linux version of IconLoader not require GTK+. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move platform-specific include Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/icon_loader_aura.cc ('k') | chrome/browser/icon_loader_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/icon_loader_gtk.cc
diff --git a/chrome/browser/icon_loader_gtk.cc b/chrome/browser/icon_loader_gtk.cc
deleted file mode 100644
index c5b04237187935ba498e73c9eddc80ad1baf87b9..0000000000000000000000000000000000000000
--- a/chrome/browser/icon_loader_gtk.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/icon_loader.h"
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gio/gio.h>
-#include <gtk/gtk.h>
-
-#include "base/file_util.h"
-#include "base/logging.h"
-#include "base/message_loop.h"
-#include "base/mime_util.h"
-#include "base/threading/thread.h"
-#include "base/string_util.h"
-
-static int SizeToInt(IconLoader::IconSize size) {
- int pixels = 0;
- switch (size) {
- case IconLoader::SMALL:
- pixels = 16;
- break;
- case IconLoader::NORMAL:
- pixels = 32;
- break;
- case IconLoader::LARGE:
- pixels = 48;
- break;
- default:
- NOTREACHED();
- }
- return pixels;
-}
-
-void IconLoader::ReadIcon() {
- filename_ = mime_util::GetMimeIcon(group_, SizeToInt(icon_size_));
- file_util::ReadFileToString(filename_, &icon_data_);
- target_message_loop_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &IconLoader::ParseIcon));
-}
-
-void IconLoader::ParseIcon() {
- int size = SizeToInt(icon_size_);
-
- // It would be more convenient to use gdk_pixbuf_new_from_stream_at_scale
- // but that is only available after 2.14.
- GdkPixbufLoader* loader = gdk_pixbuf_loader_new();
- gdk_pixbuf_loader_set_size(loader, size, size);
- gdk_pixbuf_loader_write(loader,
- reinterpret_cast<const guchar*>(icon_data_.data()),
- icon_data_.length(), NULL);
- gdk_pixbuf_loader_close(loader, NULL);
- // At this point, the pixbuf is owned by the loader.
- GdkPixbuf* pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
-
- if (pixbuf) {
- DCHECK_EQ(size, gdk_pixbuf_get_width(pixbuf));
- DCHECK_EQ(size, gdk_pixbuf_get_height(pixbuf));
- // Takes ownership of |pixbuf|.
- g_object_ref(pixbuf);
- image_.reset(new gfx::Image(pixbuf));
- } else {
- LOG(WARNING) << "Unsupported file type or load error: " <<
- filename_.value();
- }
-
- g_object_unref(loader);
-
- NotifyDelegate();
-}
« no previous file with comments | « chrome/browser/icon_loader_aura.cc ('k') | chrome/browser/icon_loader_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698