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

Side by Side Diff: chrome/browser/icon_loader_linux.cc

Issue 6995068: Mac: Fix icons in download dom UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix linux build Created 9 years, 6 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/icon_loader.h ('k') | chrome/browser/icon_loader_mac.mm » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/icon_loader.h" 5 #include "chrome/browser/icon_loader.h"
6 6
7 #include <gdk-pixbuf/gdk-pixbuf.h> 7 #include <gdk-pixbuf/gdk-pixbuf.h>
8 #include <gio/gio.h> 8 #include <gio/gio.h>
9 #include <gtk/gtk.h> 9 #include <gtk/gtk.h>
10 10
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/mime_util.h" 14 #include "base/mime_util.h"
15 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 17
18 static int SizeToInt(IconLoader::IconSize size) { 18 static int SizeToInt(IconLoader::IconSize size) {
19 int pixels = 48; 19 int pixels = 0;
20 if (size == IconLoader::NORMAL) 20 switch (size) {
21 pixels = 32; 21 case IconLoader::SMALL:
22 else if (size == IconLoader::SMALL) 22 pixels = 16;
23 pixels = 16; 23 break;
24 24 case IconLoader::NORMAL:
25 pixels = 32;
26 break;
27 case IconLoader::LARGE:
28 pixels = 48;
29 break;
30 default:
31 NOTREACHED();
32 }
25 return pixels; 33 return pixels;
26 } 34 }
27 35
28 void IconLoader::ReadIcon() { 36 void IconLoader::ReadIcon() {
29 filename_ = mime_util::GetMimeIcon(group_, SizeToInt(icon_size_)); 37 filename_ = mime_util::GetMimeIcon(group_, SizeToInt(icon_size_));
30 file_util::ReadFileToString(filename_, &icon_data_); 38 file_util::ReadFileToString(filename_, &icon_data_);
31 target_message_loop_->PostTask(FROM_HERE, 39 target_message_loop_->PostTask(FROM_HERE,
32 NewRunnableMethod(this, &IconLoader::ParseIcon)); 40 NewRunnableMethod(this, &IconLoader::ParseIcon));
33 } 41 }
34 42
(...skipping 19 matching lines...) Expand all
54 image_.reset(new gfx::Image(pixbuf)); 62 image_.reset(new gfx::Image(pixbuf));
55 } else { 63 } else {
56 LOG(WARNING) << "Unsupported file type or load error: " << 64 LOG(WARNING) << "Unsupported file type or load error: " <<
57 filename_.value(); 65 filename_.value();
58 } 66 }
59 67
60 g_object_unref(loader); 68 g_object_unref(loader);
61 69
62 NotifyDelegate(); 70 NotifyDelegate();
63 } 71 }
OLDNEW
« no previous file with comments | « chrome/browser/icon_loader.h ('k') | chrome/browser/icon_loader_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698