Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(634)

Side by Side Diff: base/nix/mime_util_xdg.cc

Issue 12278014: Make base compile with no "using base::FilePath". (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/json/json_file_value_serializer.cc ('k') | base/path_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
22 #include "base/third_party/xdg_mime/xdgmime.h" 22 #include "base/third_party/xdg_mime/xdgmime.h"
23 #include "base/threading/thread_restrictions.h" 23 #include "base/threading/thread_restrictions.h"
24 #include "base/time.h" 24 #include "base/time.h"
25 25
26 #if defined(TOOLKIT_GTK) 26 #if defined(TOOLKIT_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 base {
33 namespace nix {
34
32 namespace { 35 namespace {
33 36
34 class IconTheme; 37 class IconTheme;
35 38
36 // None of the XDG stuff is thread-safe, so serialize all access under 39 // None of the XDG stuff is thread-safe, so serialize all access under
37 // this lock. 40 // this lock.
38 base::LazyInstance<base::Lock>::Leaky 41 base::LazyInstance<base::Lock>::Leaky
39 g_mime_util_xdg_lock = LAZY_INSTANCE_INITIALIZER; 42 g_mime_util_xdg_lock = LAZY_INSTANCE_INITIALIZER;
40 43
41 class MimeUtilConstants { 44 class MimeUtilConstants {
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 return LookupFallbackIcon(icon_name); 579 return LookupFallbackIcon(icon_name);
577 } 580 }
578 581
579 MimeUtilConstants::~MimeUtilConstants() { 582 MimeUtilConstants::~MimeUtilConstants() {
580 for (size_t i = 0; i < kDefaultThemeNum; i++) 583 for (size_t i = 0; i < kDefaultThemeNum; i++)
581 delete default_themes_[i]; 584 delete default_themes_[i];
582 } 585 }
583 586
584 } // namespace 587 } // namespace
585 588
586 namespace base {
587 namespace nix {
588
589 std::string GetFileMimeType(const FilePath& filepath) { 589 std::string GetFileMimeType(const FilePath& filepath) {
590 if (filepath.empty()) 590 if (filepath.empty())
591 return std::string(); 591 return std::string();
592 base::ThreadRestrictions::AssertIOAllowed(); 592 base::ThreadRestrictions::AssertIOAllowed();
593 base::AutoLock scoped_lock(g_mime_util_xdg_lock.Get()); 593 base::AutoLock scoped_lock(g_mime_util_xdg_lock.Get());
594 return xdg_mime_get_mime_type_from_file_name(filepath.value().c_str()); 594 return xdg_mime_get_mime_type_from_file_name(filepath.value().c_str());
595 } 595 }
596 596
597 std::string GetDataMimeType(const std::string& data) { 597 std::string GetDataMimeType(const std::string& data) {
598 base::ThreadRestrictions::AssertIOAllowed(); 598 base::ThreadRestrictions::AssertIOAllowed();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 icon_file = LookupIconInDefaultTheme(icon_names[i], size); 668 icon_file = LookupIconInDefaultTheme(icon_names[i], size);
669 if (!icon_file.empty()) 669 if (!icon_file.empty())
670 return icon_file; 670 return icon_file;
671 } 671 }
672 } 672 }
673 return FilePath(); 673 return FilePath();
674 } 674 }
675 675
676 } // namespace nix 676 } // namespace nix
677 } // namespace base 677 } // namespace base
OLDNEW
« no previous file with comments | « base/json/json_file_value_serializer.cc ('k') | base/path_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698