OLD | NEW |
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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/nix/mime_util_xdg.h" | 13 #include "base/nix/mime_util_xdg.h" |
14 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
15 #include "ui/gfx/image/image_skia.h" | 15 #include "ui/gfx/image/image_skia.h" |
16 #include "webkit/glue/image_decoder.h" | 16 #include "webkit/glue/image_decoder.h" |
17 | 17 |
18 using std::string; | 18 using std::string; |
19 | 19 |
| 20 // static |
| 21 IconGroupID IconLoader::ReadGroupIDFromFilepath( |
| 22 const base::FilePath& filepath) { |
| 23 return base::nix::GetFileMimeType(filepath); |
| 24 } |
| 25 |
20 void IconLoader::ReadIcon() { | 26 void IconLoader::ReadIcon() { |
21 int size_pixels = 0; | 27 int size_pixels = 0; |
22 switch (icon_size_) { | 28 switch (icon_size_) { |
23 case IconLoader::SMALL: | 29 case IconLoader::SMALL: |
24 size_pixels = 16; | 30 size_pixels = 16; |
25 break; | 31 break; |
26 case IconLoader::NORMAL: | 32 case IconLoader::NORMAL: |
27 size_pixels = 32; | 33 size_pixels = 32; |
28 break; | 34 break; |
29 case IconLoader::LARGE: | 35 case IconLoader::LARGE: |
(...skipping 23 matching lines...) Expand all Loading... |
53 image_.reset(new gfx::Image(image_skia)); | 59 image_.reset(new gfx::Image(image_skia)); |
54 } else { | 60 } else { |
55 LOG(WARNING) << "Unsupported file type or load error: " | 61 LOG(WARNING) << "Unsupported file type or load error: " |
56 << filename.value(); | 62 << filename.value(); |
57 } | 63 } |
58 } | 64 } |
59 | 65 |
60 target_message_loop_->PostTask( | 66 target_message_loop_->PostTask( |
61 FROM_HERE, base::Bind(&IconLoader::NotifyDelegate, this)); | 67 FROM_HERE, base::Bind(&IconLoader::NotifyDelegate, this)); |
62 } | 68 } |
OLD | NEW |