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

Side by Side Diff: chrome/browser/history/text_database.h

Issue 7995: Move Time, TimeDelta and TimeTicks into namespace base. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_BROWSER_HISTORY_TEXT_DATABASE_H__ 5 #ifndef CHROME_BROWSER_HISTORY_TEXT_DATABASE_H__
6 #define CHROME_BROWSER_HISTORY_TEXT_DATABASE_H__ 6 #define CHROME_BROWSER_HISTORY_TEXT_DATABASE_H__
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 18 matching lines...) Expand all
29 struct Match { 29 struct Match {
30 // URL of the match. 30 // URL of the match.
31 GURL url; 31 GURL url;
32 32
33 // The title is returned because the title in the text database and the URL 33 // The title is returned because the title in the text database and the URL
34 // database may differ. This happens because we capture the title when the 34 // database may differ. This happens because we capture the title when the
35 // body is captured, and don't update it later. 35 // body is captured, and don't update it later.
36 std::wstring title; 36 std::wstring title;
37 37
38 // Time the page that was returned was visited. 38 // Time the page that was returned was visited.
39 Time time; 39 base::Time time;
40 40
41 // Identifies any found matches in the title of the document. These are not 41 // Identifies any found matches in the title of the document. These are not
42 // included in the snippet. 42 // included in the snippet.
43 Snippet::MatchPositions title_match_positions; 43 Snippet::MatchPositions title_match_positions;
44 44
45 // Snippet of the match we generated from the body. 45 // Snippet of the match we generated from the body.
46 Snippet snippet; 46 Snippet snippet;
47 }; 47 };
48 48
49 // Note: You must call init which must succeed before using this class. 49 // Note: You must call init which must succeed before using this class.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 static const wchar_t* file_base(); 91 static const wchar_t* file_base();
92 92
93 // Converts a filename on disk (optionally including a path) to a database 93 // Converts a filename on disk (optionally including a path) to a database
94 // identifier. If the filename doesn't have the correct format, returns 0. 94 // identifier. If the filename doesn't have the correct format, returns 0.
95 static DBIdent FileNameToID(const std::wstring& file_path); 95 static DBIdent FileNameToID(const std::wstring& file_path);
96 96
97 // Changing operations ------------------------------------------------------- 97 // Changing operations -------------------------------------------------------
98 98
99 // Adds the given data to the page. Returns true on success. The data should 99 // Adds the given data to the page. Returns true on success. The data should
100 // already be converted to UTF-8. 100 // already be converted to UTF-8.
101 bool AddPageData(Time time, 101 bool AddPageData(base::Time time,
102 const std::string& url, 102 const std::string& url,
103 const std::string& title, 103 const std::string& title,
104 const std::string& contents); 104 const std::string& contents);
105 105
106 // Deletes the indexed data exactly matching the given URL/time pair. 106 // Deletes the indexed data exactly matching the given URL/time pair.
107 void DeletePageData(Time time, const std::string& url); 107 void DeletePageData(base::Time time, const std::string& url);
108 108
109 // Optimizes the tree inside the database. This will, in addition to making 109 // Optimizes the tree inside the database. This will, in addition to making
110 // access faster, remove any deleted data from the database (normally it is 110 // access faster, remove any deleted data from the database (normally it is
111 // added again as "removed" and it is manually cleaned up when it decides to 111 // added again as "removed" and it is manually cleaned up when it decides to
112 // optimize it naturally). It is bad for privacy if a user is deleting a 112 // optimize it naturally). It is bad for privacy if a user is deleting a
113 // page from history but it still exists in the full text database in some 113 // page from history but it still exists in the full text database in some
114 // form. This function will clean that up. 114 // form. This function will clean that up.
115 void Optimize(); 115 void Optimize();
116 116
117 // Querying ------------------------------------------------------------------ 117 // Querying ------------------------------------------------------------------
118 118
119 // Executes the given query. See QueryOptions for more info on input. 119 // Executes the given query. See QueryOptions for more info on input.
120 // 120 //
121 // The results are appended to any existing ones in |*results|, and the first 121 // The results are appended to any existing ones in |*results|, and the first
122 // time considered for the output is in |first_time_searched| 122 // time considered for the output is in |first_time_searched|
123 // (see QueryResults for more). 123 // (see QueryResults for more).
124 // 124 //
125 // When |options.most_recent_visit_only|, any URLs found will be added to 125 // When |options.most_recent_visit_only|, any URLs found will be added to
126 // |unique_urls|. If a URL is already in the set, additional results will not 126 // |unique_urls|. If a URL is already in the set, additional results will not
127 // be added (giving the ability to uniquify URL results, with the most recent 127 // be added (giving the ability to uniquify URL results, with the most recent
128 // If |most_recent_visit_only| is not set, |unique_urls| will be untouched. 128 // If |most_recent_visit_only| is not set, |unique_urls| will be untouched.
129 // 129 //
130 // Callers must run QueryParser on the user text and pass the results of the 130 // Callers must run QueryParser on the user text and pass the results of the
131 // QueryParser to this method as the query string. 131 // QueryParser to this method as the query string.
132 void GetTextMatches(const std::string& query, 132 void GetTextMatches(const std::string& query,
133 const QueryOptions& options, 133 const QueryOptions& options,
134 std::vector<Match>* results, 134 std::vector<Match>* results,
135 URLSet* unique_urls, 135 URLSet* unique_urls,
136 Time* first_time_searched); 136 base::Time* first_time_searched);
137 137
138 // Converts the given database identifier to a filename. This does not include 138 // Converts the given database identifier to a filename. This does not include
139 // the path, just the file and extension. 139 // the path, just the file and extension.
140 static std::wstring IDToFileName(DBIdent id); 140 static std::wstring IDToFileName(DBIdent id);
141 141
142 private: 142 private:
143 // Ensures that the tables and indices are created. Returns true on success. 143 // Ensures that the tables and indices are created. Returns true on success.
144 bool CreateTables(); 144 bool CreateTables();
145 145
146 // See the constructor. 146 // See the constructor.
(...skipping 15 matching lines...) Expand all
162 162
163 MetaTableHelper meta_table_; 163 MetaTableHelper meta_table_;
164 164
165 DISALLOW_EVIL_CONSTRUCTORS(TextDatabase); 165 DISALLOW_EVIL_CONSTRUCTORS(TextDatabase);
166 }; 166 };
167 167
168 } // namespace history 168 } // namespace history
169 169
170 #endif // CHROME_BROWSER_HISTORY_TEXT_DATABASE_H__ 170 #endif // CHROME_BROWSER_HISTORY_TEXT_DATABASE_H__
171 171
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698