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 13 matching lines...) Expand all Loading... |
24 #include "base/time.h" | 24 #include "base/time.h" |
25 | 25 |
26 #if defined(TOOLKIT_USES_GTK) | 26 #if defined(TOOLKIT_USES_GTK) |
27 #include <gtk/gtk.h> // NOLINT | 27 #include <gtk/gtk.h> // NOLINT |
28 | 28 |
29 #include "base/message_loop.h" | 29 #include "base/message_loop.h" |
30 #endif | 30 #endif |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
| 34 class IconTheme; |
| 35 |
34 // None of the XDG stuff is thread-safe, so serialize all access under | 36 // None of the XDG stuff is thread-safe, so serialize all access under |
35 // this lock. | 37 // this lock. |
36 static base::LazyInstance<base::Lock>::Leaky | 38 base::LazyInstance<base::Lock>::Leaky |
37 g_mime_util_xdg_lock = LAZY_INSTANCE_INITIALIZER; | 39 g_mime_util_xdg_lock = LAZY_INSTANCE_INITIALIZER; |
38 | 40 |
39 class IconTheme; | |
40 | |
41 class MimeUtilConstants { | 41 class MimeUtilConstants { |
42 public: | 42 public: |
43 typedef std::map<std::string, IconTheme*> IconThemeMap; | 43 typedef std::map<std::string, IconTheme*> IconThemeMap; |
44 typedef std::map<FilePath, base::Time> IconDirMtimeMap; | 44 typedef std::map<FilePath, base::Time> IconDirMtimeMap; |
45 typedef std::vector<std::string> IconFormats; | 45 typedef std::vector<std::string> IconFormats; |
46 | 46 |
47 // Specified by XDG icon theme specs. | 47 // Specified by XDG icon theme specs. |
48 static const int kUpdateIntervalInSeconds = 5; | 48 static const int kUpdateIntervalInSeconds = 5; |
49 | 49 |
50 static const size_t kDefaultThemeNum = 4; | 50 static const size_t kDefaultThemeNum = 4; |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 icon_file = LookupIconInDefaultTheme(icon_names[i], size); | 667 icon_file = LookupIconInDefaultTheme(icon_names[i], size); |
668 if (!icon_file.empty()) | 668 if (!icon_file.empty()) |
669 return icon_file; | 669 return icon_file; |
670 } | 670 } |
671 } | 671 } |
672 return FilePath(); | 672 return FilePath(); |
673 } | 673 } |
674 | 674 |
675 } // namespace nix | 675 } // namespace nix |
676 } // namespace base | 676 } // namespace base |
OLD | NEW |