Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / icon_loader_auralinux.cc
blob7783751e22209b52229242888ff873ff36782818
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/icon_loader.h"
7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h"
9 #include "base/nix/mime_util_xdg.h"
10 #include "ui/views/linux_ui/linux_ui.h"
12 // static
13 IconGroupID IconLoader::ReadGroupIDFromFilepath(
14 const base::FilePath& filepath) {
15 return base::nix::GetFileMimeType(filepath);
18 // static
19 bool IconLoader::IsIconMutableFromFilepath(const base::FilePath&) {
20 return false;
23 // static
24 content::BrowserThread::ID IconLoader::ReadIconThreadID() {
25 // ReadIcon() calls into views::LinuxUI and GTK2 code, so it must be on the UI
26 // thread.
27 return content::BrowserThread::UI;
30 void IconLoader::ReadIcon() {
31 int size_pixels = 0;
32 switch (icon_size_) {
33 case IconLoader::SMALL:
34 size_pixels = 16;
35 break;
36 case IconLoader::NORMAL:
37 size_pixels = 32;
38 break;
39 case IconLoader::LARGE:
40 size_pixels = 48;
41 break;
42 default:
43 NOTREACHED();
46 views::LinuxUI* ui = views::LinuxUI::instance();
47 if (ui) {
48 gfx::Image image = ui->GetIconForContentType(group_, size_pixels);
49 if (!image.IsEmpty())
50 image_.reset(new gfx::Image(image));
53 target_task_runner_->PostTask(
54 FROM_HERE, base::Bind(&IconLoader::NotifyDelegate, this));