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 "base/nix/mime_util_xdg.h" | 5 #include "base/nix/mime_util_xdg.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 icon_path = dir_iter->Append(subdir); | 248 icon_path = dir_iter->Append(subdir); |
249 icon_path = icon_path.Append(icon_name + (*icon_formats)[i]); | 249 icon_path = icon_path.Append(icon_name + (*icon_formats)[i]); |
250 if (PathExists(icon_path)) | 250 if (PathExists(icon_path)) |
251 return icon_path; | 251 return icon_path; |
252 } | 252 } |
253 } | 253 } |
254 return FilePath(); | 254 return FilePath(); |
255 } | 255 } |
256 | 256 |
257 bool IconTheme::LoadIndexTheme(const FilePath& file) { | 257 bool IconTheme::LoadIndexTheme(const FilePath& file) { |
258 FILE* fp = base::OpenFile(file, "r"); | 258 FILE* fp = file_util::OpenFile(file, "r"); |
259 SubDirInfo* current_info = NULL; | 259 SubDirInfo* current_info = NULL; |
260 if (!fp) | 260 if (!fp) |
261 return false; | 261 return false; |
262 | 262 |
263 // Read entries. | 263 // Read entries. |
264 while (!feof(fp) && !ferror(fp)) { | 264 while (!feof(fp) && !ferror(fp)) { |
265 std::string buf = ReadLine(fp); | 265 std::string buf = ReadLine(fp); |
266 if (buf == "") | 266 if (buf == "") |
267 break; | 267 break; |
268 | 268 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 } else { | 309 } else { |
310 if (key.compare("Directories") == 0 && !info_array_.get()) { | 310 if (key.compare("Directories") == 0 && !info_array_.get()) { |
311 if (!SetDirectories(value)) break; | 311 if (!SetDirectories(value)) break; |
312 } else if (key.compare("Inherits") == 0) { | 312 } else if (key.compare("Inherits") == 0) { |
313 if (value != "hicolor") | 313 if (value != "hicolor") |
314 inherits_ = value; | 314 inherits_ = value; |
315 } | 315 } |
316 } | 316 } |
317 } | 317 } |
318 | 318 |
319 base::CloseFile(fp); | 319 file_util::CloseFile(fp); |
320 return info_array_.get() != NULL; | 320 return info_array_.get() != NULL; |
321 } | 321 } |
322 | 322 |
323 size_t IconTheme::MatchesSize(SubDirInfo* info, size_t size) { | 323 size_t IconTheme::MatchesSize(SubDirInfo* info, size_t size) { |
324 if (info->type == SubDirInfo::Fixed) { | 324 if (info->type == SubDirInfo::Fixed) { |
325 if (size > info->size) | 325 if (size > info->size) |
326 return size - info->size; | 326 return size - info->size; |
327 else | 327 else |
328 return info->size - size; | 328 return info->size - size; |
329 } else if (info->type == SubDirInfo::Scalable) { | 329 } else if (info->type == SubDirInfo::Scalable) { |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 icon_file = LookupIconInDefaultTheme(icon_names[i], size); | 644 icon_file = LookupIconInDefaultTheme(icon_names[i], size); |
645 if (!icon_file.empty()) | 645 if (!icon_file.empty()) |
646 return icon_file; | 646 return icon_file; |
647 } | 647 } |
648 } | 648 } |
649 return FilePath(); | 649 return FilePath(); |
650 } | 650 } |
651 | 651 |
652 } // namespace nix | 652 } // namespace nix |
653 } // namespace base | 653 } // namespace base |
OLD | NEW |