| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/gfx/codec/png_codec.h" | 7 #include "app/gfx/codec/png_codec.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/string_util.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/common/time_format.h" | 11 #include "chrome/common/time_format.h" |
| 12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 13 #include "net/base/escape.h" | 13 #include "net/base/escape.h" |
| 14 | 14 |
| 15 // The path used in internal URLs to file icon data. | 15 // The path used in internal URLs to file icon data. |
| 16 static const char kFileIconPath[] = "fileicon"; | 16 static const char kFileIconPath[] = "fileicon"; |
| 17 | 17 |
| 18 FileIconSource::FileIconSource() | 18 FileIconSource::FileIconSource() |
| 19 : DataSource(kFileIconPath, MessageLoop::current()) {} | 19 : DataSource(kFileIconPath, MessageLoop::current()) {} |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 if (icon) { | 64 if (icon) { |
| 65 scoped_refptr<RefCountedBytes> icon_data = new RefCountedBytes; | 65 scoped_refptr<RefCountedBytes> icon_data = new RefCountedBytes; |
| 66 gfx::PNGCodec::EncodeBGRASkBitmap(*icon, false, &icon_data->data); | 66 gfx::PNGCodec::EncodeBGRASkBitmap(*icon, false, &icon_data->data); |
| 67 | 67 |
| 68 SendResponse(request_id, icon_data); | 68 SendResponse(request_id, icon_data); |
| 69 } else { | 69 } else { |
| 70 // TODO(glen): send a dummy icon. | 70 // TODO(glen): send a dummy icon. |
| 71 SendResponse(request_id, NULL); | 71 SendResponse(request_id, NULL); |
| 72 } | 72 } |
| 73 } | 73 } |
| OLD | NEW |