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

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

Issue 10332163: Revert 137075 - Get rid of Image::Image(SkBitmap*) (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
« no previous file with comments | « chrome/browser/icon_loader_chromeos.cc ('k') | chrome/browser/icon_loader_win.cc » ('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/icon_loader.h" 5 #include "chrome/browser/icon_loader.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 22 matching lines...) Expand all
33 } 33 }
34 34
35 FilePath filename = base::nix::GetMimeIcon(group_, size_pixels); 35 FilePath filename = base::nix::GetMimeIcon(group_, size_pixels);
36 // We don't support SVG icons; this just spams the terminal so fail quickly 36 // We don't support SVG icons; this just spams the terminal so fail quickly
37 // and don't try to read the file from disk first. 37 // and don't try to read the file from disk first.
38 if (filename.Extension() != ".svg") { 38 if (filename.Extension() != ".svg") {
39 string icon_data; 39 string icon_data;
40 file_util::ReadFileToString(filename, &icon_data); 40 file_util::ReadFileToString(filename, &icon_data);
41 41
42 webkit_glue::ImageDecoder decoder; 42 webkit_glue::ImageDecoder decoder;
43 SkBitmap bitmap; 43 scoped_ptr<SkBitmap> bitmap(new SkBitmap());
44 bitmap = decoder.Decode( 44 *bitmap = decoder.Decode(
45 reinterpret_cast<const unsigned char*>(icon_data.data()), 45 reinterpret_cast<const unsigned char*>(icon_data.data()),
46 icon_data.length()); 46 icon_data.length());
47 if (!bitmap.empty()) { 47 if (!bitmap->empty()) {
48 DCHECK_EQ(size_pixels, bitmap.width()); 48 DCHECK_EQ(size_pixels, bitmap->width());
49 DCHECK_EQ(size_pixels, bitmap.height()); 49 DCHECK_EQ(size_pixels, bitmap->height());
50 image_.reset(new gfx::Image(bitmap)); 50 image_.reset(new gfx::Image(bitmap.release()));
51 } else { 51 } else {
52 LOG(WARNING) << "Unsupported file type or load error: " 52 LOG(WARNING) << "Unsupported file type or load error: "
53 << filename.value(); 53 << filename.value();
54 } 54 }
55 } 55 }
56 56
57 target_message_loop_->PostTask( 57 target_message_loop_->PostTask(
58 FROM_HERE, base::Bind(&IconLoader::NotifyDelegate, this)); 58 FROM_HERE, base::Bind(&IconLoader::NotifyDelegate, this));
59 } 59 }
OLDNEW
« no previous file with comments | « chrome/browser/icon_loader_chromeos.cc ('k') | chrome/browser/icon_loader_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698