OLD | NEW |
1 // Copyright (c) 2010 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 |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 default_themes[j] = NULL; | 518 default_themes[j] = NULL; |
519 } | 519 } |
520 } | 520 } |
521 } | 521 } |
522 | 522 |
523 // Try to find an icon with the name |icon_name| that's |size| pixels. | 523 // Try to find an icon with the name |icon_name| that's |size| pixels. |
524 FilePath LookupIconInDefaultTheme(const std::string& icon_name, int size) { | 524 FilePath LookupIconInDefaultTheme(const std::string& icon_name, int size) { |
525 EnsureUpdated(); | 525 EnsureUpdated(); |
526 MimeUtilConstants* constants = MimeUtilConstants::GetInstance(); | 526 MimeUtilConstants* constants = MimeUtilConstants::GetInstance(); |
527 std::map<std::string, IconTheme*>* icon_themes = constants->icon_themes_; | 527 std::map<std::string, IconTheme*>* icon_themes = constants->icon_themes_; |
528 if (icon_themes->size() == 0) | 528 if (icon_themes->empty()) |
529 InitDefaultThemes(); | 529 InitDefaultThemes(); |
530 | 530 |
531 FilePath icon_path; | 531 FilePath icon_path; |
532 IconTheme** default_themes = constants->default_themes_; | 532 IconTheme** default_themes = constants->default_themes_; |
533 for (size_t i = 0; i < MimeUtilConstants::kDefaultThemeNum; i++) { | 533 for (size_t i = 0; i < MimeUtilConstants::kDefaultThemeNum; i++) { |
534 if (default_themes[i]) { | 534 if (default_themes[i]) { |
535 icon_path = default_themes[i]->GetIconPath(icon_name, size, true); | 535 icon_path = default_themes[i]->GetIconPath(icon_name, size, true); |
536 if (!icon_path.empty()) | 536 if (!icon_path.empty()) |
537 return icon_path; | 537 return icon_path; |
538 } | 538 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 } else { | 619 } else { |
620 icon_file = LookupIconInDefaultTheme(icon_names[i], size); | 620 icon_file = LookupIconInDefaultTheme(icon_names[i], size); |
621 if (!icon_file.empty()) | 621 if (!icon_file.empty()) |
622 return icon_file; | 622 return icon_file; |
623 } | 623 } |
624 } | 624 } |
625 return FilePath(); | 625 return FilePath(); |
626 } | 626 } |
627 | 627 |
628 } // namespace mime_util | 628 } // namespace mime_util |
OLD | NEW |