Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: chrome/browser/icon_loader_chromeos.cc

Issue 2643333002: Convert USE_PROPRIETARY_CODECS to a buildflag header. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/lazy_instance.h" 15 #include "base/lazy_instance.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ref_counted_memory.h" 17 #include "base/memory/ref_counted_memory.h"
18 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
19 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
20 #include "chrome/grit/theme_resources.h" 20 #include "chrome/grit/theme_resources.h"
21 #include "media/media_features.h"
21 #include "third_party/skia/include/core/SkBitmap.h" 22 #include "third_party/skia/include/core/SkBitmap.h"
22 #include "ui/base/layout.h" 23 #include "ui/base/layout.h"
23 #include "ui/base/resource/resource_bundle.h" 24 #include "ui/base/resource/resource_bundle.h"
24 #include "ui/gfx/canvas.h" 25 #include "ui/gfx/canvas.h"
25 #include "ui/gfx/codec/png_codec.h" 26 #include "ui/gfx/codec/png_codec.h"
26 #include "ui/gfx/image/image.h" 27 #include "ui/gfx/image/image.h"
27 #include "ui/gfx/image/image_skia.h" 28 #include "ui/gfx/image/image_skia.h"
28 #include "ui/gfx/image/image_skia_operations.h" 29 #include "ui/gfx/image/image_skia_operations.h"
29 30
30 namespace { 31 namespace {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 const IdrBySize kGenericIdrs = { 64 const IdrBySize kGenericIdrs = {
64 IDR_FILETYPE_GENERIC, 65 IDR_FILETYPE_GENERIC,
65 IDR_FILETYPE_LARGE_GENERIC, 66 IDR_FILETYPE_LARGE_GENERIC,
66 IDR_FILETYPE_LARGE_GENERIC 67 IDR_FILETYPE_LARGE_GENERIC
67 }; 68 };
68 const IdrBySize kImageIdrs = { 69 const IdrBySize kImageIdrs = {
69 IDR_FILETYPE_IMAGE, 70 IDR_FILETYPE_IMAGE,
70 IDR_FILETYPE_IMAGE, 71 IDR_FILETYPE_IMAGE,
71 IDR_FILETYPE_IMAGE 72 IDR_FILETYPE_IMAGE
72 }; 73 };
73 #if defined(USE_PROPRIETARY_CODECS) 74 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
74 const IdrBySize kPdfIdrs = { 75 const IdrBySize kPdfIdrs = {
75 IDR_FILETYPE_PDF, 76 IDR_FILETYPE_PDF,
76 IDR_FILETYPE_PDF, 77 IDR_FILETYPE_PDF,
77 IDR_FILETYPE_PDF 78 IDR_FILETYPE_PDF
78 }; 79 };
79 #endif 80 #endif
80 const IdrBySize kVideoIdrs = { 81 const IdrBySize kVideoIdrs = {
81 IDR_FILETYPE_VIDEO, 82 IDR_FILETYPE_VIDEO,
82 IDR_FILETYPE_LARGE_VIDEO, 83 IDR_FILETYPE_LARGE_VIDEO,
83 IDR_FILETYPE_LARGE_VIDEO 84 IDR_FILETYPE_LARGE_VIDEO
84 }; 85 };
85 86
86 IconMapper::IconMapper() { 87 IconMapper::IconMapper() {
87 // The code below should match translation in 88 // The code below should match translation in
88 // ui/file_manager/file_manager/js/file_manager.js 89 // ui/file_manager/file_manager/js/file_manager.js
89 // ui/file_manager/file_manager/css/file_manager.css 90 // ui/file_manager/file_manager/css/file_manager.css
90 // 'audio': /\.(mp3|m4a|oga|ogg|wav)$/i, 91 // 'audio': /\.(mp3|m4a|oga|ogg|wav)$/i,
91 // 'html': /\.(html?)$/i, 92 // 'html': /\.(html?)$/i,
92 // 'image': /\.(bmp|gif|jpe?g|ico|png|webp)$/i, 93 // 'image': /\.(bmp|gif|jpe?g|ico|png|webp)$/i,
93 // 'pdf' : /\.(pdf)$/i, 94 // 'pdf' : /\.(pdf)$/i,
94 // 'text': /\.(pod|rst|txt|log)$/i, 95 // 'text': /\.(pod|rst|txt|log)$/i,
95 // 'video': /\.(mov|mp4|m4v|mpe?g4?|ogm|ogv|ogx|webm)$/i 96 // 'video': /\.(mov|mp4|m4v|mpe?g4?|ogm|ogv|ogx|webm)$/i
96 97
97 const ExtensionIconMap::value_type kExtensionIdrBySizeData[] = { 98 const ExtensionIconMap::value_type kExtensionIdrBySizeData[] = {
98 #if defined(USE_PROPRIETARY_CODECS) 99 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
99 std::make_pair(".m4a", kAudioIdrs), 100 std::make_pair(".m4a", kAudioIdrs),
100 std::make_pair(".mp3", kAudioIdrs), 101 std::make_pair(".mp3", kAudioIdrs),
101 std::make_pair(".pdf", kPdfIdrs), 102 std::make_pair(".pdf", kPdfIdrs),
102 std::make_pair(".3gp", kVideoIdrs), 103 std::make_pair(".3gp", kVideoIdrs),
103 std::make_pair(".avi", kVideoIdrs), 104 std::make_pair(".avi", kVideoIdrs),
104 std::make_pair(".m4v", kVideoIdrs), 105 std::make_pair(".m4v", kVideoIdrs),
105 std::make_pair(".mov", kVideoIdrs), 106 std::make_pair(".mov", kVideoIdrs),
106 std::make_pair(".mp4", kVideoIdrs), 107 std::make_pair(".mp4", kVideoIdrs),
107 std::make_pair(".mpeg", kVideoIdrs), 108 std::make_pair(".mpeg", kVideoIdrs),
108 std::make_pair(".mpg", kVideoIdrs), 109 std::make_pair(".mpg", kVideoIdrs),
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 int idr = icon_mapper.Get().Lookup(group_, icon_size_); 200 int idr = icon_mapper.Get().Lookup(group_, icon_size_);
200 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 201 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
201 gfx::ImageSkia image_skia(ResizeImage(*(rb.GetImageNamed(idr)).ToImageSkia(), 202 gfx::ImageSkia image_skia(ResizeImage(*(rb.GetImageNamed(idr)).ToImageSkia(),
202 IconSizeToDIPSize(icon_size_))); 203 IconSizeToDIPSize(icon_size_)));
203 image_skia.MakeThreadSafe(); 204 image_skia.MakeThreadSafe();
204 image_.reset(new gfx::Image(image_skia)); 205 image_.reset(new gfx::Image(image_skia));
205 target_task_runner_->PostTask( 206 target_task_runner_->PostTask(
206 FROM_HERE, base::Bind(callback_, base::Passed(&image_), group_)); 207 FROM_HERE, base::Bind(callback_, base::Passed(&image_), group_));
207 delete this; 208 delete this;
208 } 209 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698