This source file includes following definitions.
- ReadGroupIDFromFilepath
- IsIconMutableFromFilepath
- ReadIconThreadID
- ReadIcon
#include "chrome/browser/icon_loader.h"
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/nix/mime_util_xdg.h"
#include "ui/views/linux_ui/linux_ui.h"
IconGroupID IconLoader::ReadGroupIDFromFilepath(
const base::FilePath& filepath) {
return base::nix::GetFileMimeType(filepath);
}
bool IconLoader::IsIconMutableFromFilepath(const base::FilePath&) {
return false;
}
content::BrowserThread::ID IconLoader::ReadIconThreadID() {
return content::BrowserThread::UI;
}
void IconLoader::ReadIcon() {
int size_pixels = 0;
switch (icon_size_) {
case IconLoader::SMALL:
size_pixels = 16;
break;
case IconLoader::NORMAL:
size_pixels = 32;
break;
case IconLoader::LARGE:
size_pixels = 48;
break;
default:
NOTREACHED();
}
views::LinuxUI* ui = views::LinuxUI::instance();
if (ui) {
gfx::Image image = ui->GetIconForContentType(group_, size_pixels);
if (!image.IsEmpty())
image_.reset(new gfx::Image(image));
}
target_message_loop_->PostTask(
FROM_HERE, base::Bind(&IconLoader::NotifyDelegate, this));
}