| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/mime_util.h" | 5 #include "base/mime_util.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 #include <sys/time.h> | 8 #include <sys/time.h> |
| 9 #include <time.h> | 9 #include <time.h> |
| 10 | 10 |
| 11 #include <cstdlib> | 11 #include <cstdlib> |
| 12 #include <list> | 12 #include <list> |
| 13 #include <map> | 13 #include <map> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
| 19 #include "base/scoped_ptr.h" | 19 #include "base/scoped_ptr.h" |
| 20 #include "base/singleton.h" | 20 #include "base/singleton.h" |
| 21 #include "base/string_split.h" |
| 21 #include "base/string_util.h" | 22 #include "base/string_util.h" |
| 22 #include "base/third_party/xdg_mime/xdgmime.h" | 23 #include "base/third_party/xdg_mime/xdgmime.h" |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 class IconTheme; | 27 class IconTheme; |
| 27 | 28 |
| 28 class MimeUtilConstants { | 29 class MimeUtilConstants { |
| 29 public: | 30 public: |
| 30 | 31 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 continue; | 266 continue; |
| 266 } else if (entry[0] == '[' && info_array_) { | 267 } else if (entry[0] == '[' && info_array_) { |
| 267 current_info = NULL; | 268 current_info = NULL; |
| 268 std::string subdir = entry.substr(1, entry.length() - 2); | 269 std::string subdir = entry.substr(1, entry.length() - 2); |
| 269 if (subdirs_.find(subdir) != subdirs_.end()) | 270 if (subdirs_.find(subdir) != subdirs_.end()) |
| 270 current_info = &info_array_[subdirs_[subdir]]; | 271 current_info = &info_array_[subdirs_[subdir]]; |
| 271 } | 272 } |
| 272 | 273 |
| 273 std::string key, value; | 274 std::string key, value; |
| 274 std::vector<std::string> r; | 275 std::vector<std::string> r; |
| 275 SplitStringDontTrim(entry, '=', &r); | 276 base::SplitStringDontTrim(entry, '=', &r); |
| 276 if (r.size() < 2) | 277 if (r.size() < 2) |
| 277 continue; | 278 continue; |
| 278 | 279 |
| 279 TrimWhitespaceASCII(r[0], TRIM_ALL, &key); | 280 TrimWhitespaceASCII(r[0], TRIM_ALL, &key); |
| 280 for (size_t i = 1; i < r.size(); i++) | 281 for (size_t i = 1; i < r.size(); i++) |
| 281 value.append(r[i]); | 282 value.append(r[i]); |
| 282 TrimWhitespaceASCII(value, TRIM_ALL, &value); | 283 TrimWhitespaceASCII(value, TRIM_ALL, &value); |
| 283 | 284 |
| 284 if (current_info) { | 285 if (current_info) { |
| 285 if (key == "Size") { | 286 if (key == "Size") { |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 } else { | 611 } else { |
| 611 icon_file = LookupIconInDefaultTheme(icon_names[i], size); | 612 icon_file = LookupIconInDefaultTheme(icon_names[i], size); |
| 612 if (!icon_file.empty()) | 613 if (!icon_file.empty()) |
| 613 return icon_file; | 614 return icon_file; |
| 614 } | 615 } |
| 615 } | 616 } |
| 616 return FilePath(); | 617 return FilePath(); |
| 617 } | 618 } |
| 618 | 619 |
| 619 } // namespace mime_util | 620 } // namespace mime_util |
| OLD | NEW |