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

Side by Side Diff: chrome/browser/parsers/metadata_parser_filebase.cc

Issue 12314090: Add utf_string_conversions to base namespace. (Closed) Base URL: svn://svn.chromium.org/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
OLDNEW
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 "chrome/browser/parsers/metadata_parser_filebase.h" 5 #include "chrome/browser/parsers/metadata_parser_filebase.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 10
11 FileMetadataParser::FileMetadataParser(const base::FilePath& path) 11 FileMetadataParser::FileMetadataParser(const base::FilePath& path)
12 : MetadataParser(path), 12 : MetadataParser(path),
13 path_(path) { 13 path_(path) {
14 } 14 }
15 15
16 FileMetadataParser::~FileMetadataParser() {} 16 FileMetadataParser::~FileMetadataParser() {}
17 17
18 bool FileMetadataParser::Parse() { 18 bool FileMetadataParser::Parse() {
19 std::string value; 19 std::string value;
20 int64 size; 20 int64 size;
21 if (file_util::GetFileSize(path_, &size)) { 21 if (file_util::GetFileSize(path_, &size)) {
22 properties_[MetadataParser::kPropertyFilesize] = base::Int64ToString(size); 22 properties_[MetadataParser::kPropertyFilesize] = base::Int64ToString(size);
23 } 23 }
24 #if defined(OS_WIN) 24 #if defined(OS_WIN)
25 value = WideToUTF8(path_.BaseName().value()); 25 value = base::WideToUTF8(path_.BaseName().value());
26 properties_[MetadataParser::kPropertyTitle] = value; 26 properties_[MetadataParser::kPropertyTitle] = value;
27 #elif defined(OS_POSIX) 27 #elif defined(OS_POSIX)
28 properties_[MetadataParser::kPropertyTitle] = path_.BaseName().value(); 28 properties_[MetadataParser::kPropertyTitle] = path_.BaseName().value();
29 #endif 29 #endif
30 return true; 30 return true;
31 } 31 }
32 32
33 bool FileMetadataParser::GetProperty(const std::string& key, 33 bool FileMetadataParser::GetProperty(const std::string& key,
34 std::string* value) { 34 std::string* value) {
35 PropertyMap::iterator it = properties_.find(key.c_str()); 35 PropertyMap::iterator it = properties_.find(key.c_str());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return properties_.size(); 67 return properties_.size();
68 } 68 }
69 69
70 bool FileMetadataPropertyIterator::IsEnd() { 70 bool FileMetadataPropertyIterator::IsEnd() {
71 if (it == properties_.end()) { 71 if (it == properties_.end()) {
72 return true; 72 return true;
73 } else { 73 } else {
74 return false; 74 return false;
75 } 75 }
76 } 76 }
OLDNEW
« no previous file with comments | « chrome/browser/net/url_fixer_upper_unittest.cc ('k') | chrome/browser/parsers/metadata_parser_filebase_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698