| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef BASE_NIX_MIME_UTIL_XDG_H_ | 5 #ifndef BASE_NIX_MIME_UTIL_XDG_H_ |
| 6 #define BASE_NIX_MIME_UTIL_XDG_H_ | 6 #define BASE_NIX_MIME_UTIL_XDG_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 | 14 |
| 15 class FilePath; | 15 class FilePath; |
| 16 | 16 |
| 17 namespace nix { | 17 namespace nix { |
| 18 | 18 |
| 19 // Gets the mime type for a file based on its filename. The file path does not | 19 // Gets the mime type for a file based on its filename. The file path does not |
| 20 // have to exist. Please note because it doesn't touch the disk, this does not | 20 // have to exist. Please note because it doesn't touch the disk, this does not |
| 21 // work for directories. | 21 // work for directories. |
| 22 // If the mime type is unknown, this will return application/octet-stream. | 22 // If the mime type is unknown, this will return application/octet-stream. |
| 23 BASE_EXPORT std::string GetFileMimeType(const FilePath& filepath); | 23 BASE_EXPORT std::string GetFileMimeType(const FilePath& filepath); |
| 24 | 24 |
| 25 // Get the mime type for a byte vector. | 25 // Get the mime type for a byte vector. |
| 26 BASE_EXPORT std::string GetDataMimeType(const std::string& data); | 26 BASE_EXPORT std::string GetDataMimeType(const std::string& data); |
| 27 | 27 |
| 28 #if defined(TOOLKIT_GTK) | 28 // Sets the current icon theme that we've detected from the desktop |
| 29 // This detects the current GTK theme by calling gtk_settings_get_default(). | 29 // environment. Currently only works when we believe we're in a GTK |
| 30 // It should only be executed on the UI thread and must be called before | 30 // environment. |
| 31 // GetMimeIcon(). | 31 BASE_EXPORT void SetIconThemeName(const std::string& name); |
| 32 BASE_EXPORT void DetectGtkTheme(); | |
| 33 #endif | |
| 34 | 32 |
| 35 // Gets the file name for an icon given the mime type and icon pixel size. | 33 // Gets the file name for an icon given the mime type and icon pixel size. |
| 36 // Where an icon is a square image of |size| x |size|. | 34 // Where an icon is a square image of |size| x |size|. |
| 37 // This will try to find the closest matching icon. If that's not available, | 35 // This will try to find the closest matching icon. If that's not available, |
| 38 // then a generic icon, and finally an empty FilePath if all else fails. | 36 // then a generic icon, and finally an empty FilePath if all else fails. |
| 39 BASE_EXPORT FilePath GetMimeIcon(const std::string& mime_type, size_t size); | 37 BASE_EXPORT FilePath GetMimeIcon(const std::string& mime_type, size_t size); |
| 40 | 38 |
| 41 } // namespace nix | 39 } // namespace nix |
| 42 } // namespace base | 40 } // namespace base |
| 43 | 41 |
| 44 #endif // BASE_NIX_MIME_UTIL_XDG_H_ | 42 #endif // BASE_NIX_MIME_UTIL_XDG_H_ |
| OLD | NEW |