OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <limits> | 5 #include <limits> |
6 #include <set> | 6 #include <set> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "chrome/browser/history/text_database.h" | 9 #include "chrome/browser/history/text_database.h" |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 // static | 83 // static |
84 FilePath TextDatabase::IDToFileName(DBIdent id) { | 84 FilePath TextDatabase::IDToFileName(DBIdent id) { |
85 // Identifiers are intended to be a combination of the year and month, for | 85 // Identifiers are intended to be a combination of the year and month, for |
86 // example, 200801 for January 2008. We convert this to | 86 // example, 200801 for January 2008. We convert this to |
87 // "History Index 2008-01". However, we don't make assumptions about this | 87 // "History Index 2008-01". However, we don't make assumptions about this |
88 // scheme: the caller should assign IDs as it feels fit with the knowledge | 88 // scheme: the caller should assign IDs as it feels fit with the knowledge |
89 // that they will apppear on disk in this form. | 89 // that they will apppear on disk in this form. |
90 FilePath::StringType filename(file_base()); | 90 FilePath::StringType filename(file_base()); |
91 StringAppendF(&filename, FILE_PATH_LITERAL("%d-%02d"), | 91 base::StringAppendF(&filename, FILE_PATH_LITERAL("%d-%02d"), |
92 id / 100, id % 100); | 92 id / 100, id % 100); |
93 return FilePath(filename); | 93 return FilePath(filename); |
94 } | 94 } |
95 | 95 |
96 // static | 96 // static |
97 TextDatabase::DBIdent TextDatabase::FileNameToID(const FilePath& file_path) { | 97 TextDatabase::DBIdent TextDatabase::FileNameToID(const FilePath& file_path) { |
98 FilePath::StringType file_name = file_path.BaseName().value(); | 98 FilePath::StringType file_name = file_path.BaseName().value(); |
99 | 99 |
100 // We don't actually check the prefix here. Since the file system could | 100 // We don't actually check the prefix here. Since the file system could |
101 // be case insensitive in ways we can't predict (NTFS), checking could | 101 // be case insensitive in ways we can't predict (NTFS), checking could |
102 // potentially be the wrong thing to do. Instead, we just look for a suffix. | 102 // potentially be the wrong thing to do. Instead, we just look for a suffix. |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 } else { | 374 } else { |
375 // Since we got the results in order, we know the last item is the last | 375 // Since we got the results in order, we know the last item is the last |
376 // time we considered. | 376 // time we considered. |
377 *first_time_searched = results->back().time; | 377 *first_time_searched = results->back().time; |
378 } | 378 } |
379 | 379 |
380 statement.Reset(); | 380 statement.Reset(); |
381 } | 381 } |
382 | 382 |
383 } // namespace history | 383 } // namespace history |
OLD | NEW |