OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/fileicon_source.h" | 5 #include "chrome/browser/dom_ui/fileicon_source.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/ref_counted_memory.h" | 9 #include "base/ref_counted_memory.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/common/time_format.h" | 12 #include "chrome/common/time_format.h" |
13 #include "gfx/codec/png_codec.h" | |
14 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
15 #include "net/base/escape.h" | 14 #include "net/base/escape.h" |
| 15 #include "ui/gfx/codec/png_codec.h" |
16 | 16 |
17 // The path used in internal URLs to file icon data. | 17 // The path used in internal URLs to file icon data. |
18 static const char kFileIconPath[] = "fileicon"; | 18 static const char kFileIconPath[] = "fileicon"; |
19 | 19 |
20 FileIconSource::FileIconSource() | 20 FileIconSource::FileIconSource() |
21 : DataSource(kFileIconPath, MessageLoop::current()) {} | 21 : DataSource(kFileIconPath, MessageLoop::current()) {} |
22 | 22 |
23 FileIconSource::~FileIconSource() { | 23 FileIconSource::~FileIconSource() { |
24 cancelable_consumer_.CancelAllRequests(); | 24 cancelable_consumer_.CancelAllRequests(); |
25 } | 25 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 if (icon) { | 72 if (icon) { |
73 scoped_refptr<RefCountedBytes> icon_data(new RefCountedBytes); | 73 scoped_refptr<RefCountedBytes> icon_data(new RefCountedBytes); |
74 gfx::PNGCodec::EncodeBGRASkBitmap(*icon, false, &icon_data->data); | 74 gfx::PNGCodec::EncodeBGRASkBitmap(*icon, false, &icon_data->data); |
75 | 75 |
76 SendResponse(request_id, icon_data); | 76 SendResponse(request_id, icon_data); |
77 } else { | 77 } else { |
78 // TODO(glen): send a dummy icon. | 78 // TODO(glen): send a dummy icon. |
79 SendResponse(request_id, NULL); | 79 SendResponse(request_id, NULL); |
80 } | 80 } |
81 } | 81 } |
OLD | NEW |