| 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 // For a xdg directory |dir|, add the appropriate icon sub-directories. | 407 // For a xdg directory |dir|, add the appropriate icon sub-directories. |
| 408 void AddXDGDataDir(const FilePath& dir) { | 408 void AddXDGDataDir(const FilePath& dir) { |
| 409 if (!DirectoryExists(dir)) | 409 if (!DirectoryExists(dir)) |
| 410 return; | 410 return; |
| 411 TryAddIconDir(dir.Append("icons")); | 411 TryAddIconDir(dir.Append("icons")); |
| 412 TryAddIconDir(dir.Append("pixmaps")); | 412 TryAddIconDir(dir.Append("pixmaps")); |
| 413 } | 413 } |
| 414 | 414 |
| 415 // Add all the xdg icon directories. | 415 // Add all the xdg icon directories. |
| 416 void InitIconDir() { | 416 void InitIconDir() { |
| 417 FilePath home = file_util::GetHomeDir(); | 417 FilePath home = GetHomeDir(); |
| 418 if (!home.empty()) { | 418 if (!home.empty()) { |
| 419 FilePath legacy_data_dir(home); | 419 FilePath legacy_data_dir(home); |
| 420 legacy_data_dir = legacy_data_dir.AppendASCII(".icons"); | 420 legacy_data_dir = legacy_data_dir.AppendASCII(".icons"); |
| 421 if (DirectoryExists(legacy_data_dir)) | 421 if (DirectoryExists(legacy_data_dir)) |
| 422 TryAddIconDir(legacy_data_dir); | 422 TryAddIconDir(legacy_data_dir); |
| 423 } | 423 } |
| 424 const char* env = getenv("XDG_DATA_HOME"); | 424 const char* env = getenv("XDG_DATA_HOME"); |
| 425 if (env) { | 425 if (env) { |
| 426 AddXDGDataDir(FilePath(env)); | 426 AddXDGDataDir(FilePath(env)); |
| 427 } else if (!home.empty()) { | 427 } else if (!home.empty()) { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 icon_file = LookupIconInDefaultTheme(icon_names[i], size); | 646 icon_file = LookupIconInDefaultTheme(icon_names[i], size); |
| 647 if (!icon_file.empty()) | 647 if (!icon_file.empty()) |
| 648 return icon_file; | 648 return icon_file; |
| 649 } | 649 } |
| 650 } | 650 } |
| 651 return FilePath(); | 651 return FilePath(); |
| 652 } | 652 } |
| 653 | 653 |
| 654 } // namespace nix | 654 } // namespace nix |
| 655 } // namespace base | 655 } // namespace base |
| OLD | NEW |