OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_POLICY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_POLICY_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_POLICY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_POLICY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 static base::Time AddDays(const base::Time& base_date, int days); | 113 static base::Time AddDays(const base::Time& base_date, int days); |
114 | 114 |
115 // Compute the time bounds that should be used for a database query to | 115 // Compute the time bounds that should be used for a database query to |
116 // cover a time range days_ago days in the past, relative to the specified | 116 // cover a time range days_ago days in the past, relative to the specified |
117 // time. | 117 // time. |
118 static void ComputeDatabaseTimeBounds(const base::Time& now, | 118 static void ComputeDatabaseTimeBounds(const base::Time& now, |
119 int days_ago, | 119 int days_ago, |
120 int64_t* early_bound, | 120 int64_t* early_bound, |
121 int64_t* late_bound); | 121 int64_t* late_bound); |
122 | 122 |
123 // Deletes obsolete database tables from an activity log database. This | |
124 // can be used in InitDatabase() methods of ActivityLogDatabasePolicy | |
125 // subclasses to clean up data from old versions of the activity logging | |
126 // code. Returns true on success, false on database error. | |
127 static bool DropObsoleteTables(sql::Connection* db); | |
128 | |
129 private: | 123 private: |
130 DISALLOW_IMPLICIT_CONSTRUCTORS(Util); | 124 DISALLOW_IMPLICIT_CONSTRUCTORS(Util); |
131 }; | 125 }; |
132 | 126 |
133 protected: | 127 protected: |
134 // An ActivityLogPolicy is not directly destroyed. Instead, call Close() | 128 // An ActivityLogPolicy is not directly destroyed. Instead, call Close() |
135 // which will cause the object to be deleted when it is safe. | 129 // which will cause the object to be deleted when it is safe. |
136 virtual ~ActivityLogPolicy(); | 130 virtual ~ActivityLogPolicy(); |
137 | 131 |
138 // Returns Time::Now() unless a mock clock has been installed with | 132 // Returns Time::Now() unless a mock clock has been installed with |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 private: | 226 private: |
233 // See the comments for the ActivityDatabase class for a discussion of how | 227 // See the comments for the ActivityDatabase class for a discussion of how |
234 // database cleanup runs. | 228 // database cleanup runs. |
235 ActivityDatabase* db_; | 229 ActivityDatabase* db_; |
236 base::FilePath database_path_; | 230 base::FilePath database_path_; |
237 }; | 231 }; |
238 | 232 |
239 } // namespace extensions | 233 } // namespace extensions |
240 | 234 |
241 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_POLICY_H_ | 235 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_POLICY_H_ |
OLD | NEW |