| 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 | 20 // static |
| 21 IconGroupID IconLoader::ReadGroupIDFromFilepath( | 21 IconGroupID IconLoader::ReadGroupIDFromFilepath( |
| 22 const base::FilePath& filepath) { | 22 const base::FilePath& filepath) { |
| 23 return base::nix::GetFileMimeType(filepath); | 23 return base::nix::GetFileMimeType(filepath); |
| 24 } | 24 } |
| 25 | 25 |
| 26 bool IconLoader::IsIconMutableFromFilepath(const base::FilePath&) { |
| 27 return false; |
| 28 } |
| 29 |
| 26 void IconLoader::ReadIcon() { | 30 void IconLoader::ReadIcon() { |
| 27 int size_pixels = 0; | 31 int size_pixels = 0; |
| 28 switch (icon_size_) { | 32 switch (icon_size_) { |
| 29 case IconLoader::SMALL: | 33 case IconLoader::SMALL: |
| 30 size_pixels = 16; | 34 size_pixels = 16; |
| 31 break; | 35 break; |
| 32 case IconLoader::NORMAL: | 36 case IconLoader::NORMAL: |
| 33 size_pixels = 32; | 37 size_pixels = 32; |
| 34 break; | 38 break; |
| 35 case IconLoader::LARGE: | 39 case IconLoader::LARGE: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 59 image_.reset(new gfx::Image(image_skia)); | 63 image_.reset(new gfx::Image(image_skia)); |
| 60 } else { | 64 } else { |
| 61 LOG(WARNING) << "Unsupported file type or load error: " | 65 LOG(WARNING) << "Unsupported file type or load error: " |
| 62 << filename.value(); | 66 << filename.value(); |
| 63 } | 67 } |
| 64 } | 68 } |
| 65 | 69 |
| 66 target_message_loop_->PostTask( | 70 target_message_loop_->PostTask( |
| 67 FROM_HERE, base::Bind(&IconLoader::NotifyDelegate, this)); | 71 FROM_HERE, base::Bind(&IconLoader::NotifyDelegate, this)); |
| 68 } | 72 } |
| OLD | NEW |