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