| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STATISTICS_TABLE_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STATISTICS_TABLE_H_ |
| 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STATISTICS_TABLE_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STATISTICS_TABLE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback_forward.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
| 13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 15 | 16 |
| 16 namespace sql { | 17 namespace sql { |
| 17 class Connection; | 18 class Connection; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace password_manager { | 21 namespace password_manager { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // |stats.username_value|. | 65 // |stats.username_value|. |
| 65 bool AddRow(const InteractionsStats& stats); | 66 bool AddRow(const InteractionsStats& stats); |
| 66 | 67 |
| 67 // Removes the statistics for |domain|. Returns true if the SQL completed | 68 // Removes the statistics for |domain|. Returns true if the SQL completed |
| 68 // successfully. | 69 // successfully. |
| 69 bool RemoveRow(const GURL& domain); | 70 bool RemoveRow(const GURL& domain); |
| 70 | 71 |
| 71 // Returns the statistics for |domain| if it exists. | 72 // Returns the statistics for |domain| if it exists. |
| 72 std::vector<std::unique_ptr<InteractionsStats>> GetRows(const GURL& domain); | 73 std::vector<std::unique_ptr<InteractionsStats>> GetRows(const GURL& domain); |
| 73 | 74 |
| 74 // Removes the statistics between the dates. Returns true if the SQL completed | 75 // Removes the statistics between the dates. If |origin_filter| is not null, |
| 75 // successfully. | 76 // only statistics for matching origins are removed. Returns true if the SQL |
| 76 bool RemoveStatsBetween(base::Time delete_begin, base::Time delete_end); | 77 // completed successfully. |
| 78 bool RemoveStatsByOriginAndTime( |
| 79 const base::Callback<bool(const GURL&)>& origin_filter, |
| 80 base::Time delete_begin, |
| 81 base::Time delete_end); |
| 77 | 82 |
| 78 private: | 83 private: |
| 79 sql::Connection* db_; | 84 sql::Connection* db_; |
| 80 | 85 |
| 81 DISALLOW_COPY_AND_ASSIGN(StatisticsTable); | 86 DISALLOW_COPY_AND_ASSIGN(StatisticsTable); |
| 82 }; | 87 }; |
| 83 | 88 |
| 84 } // namespace password_manager | 89 } // namespace password_manager |
| 85 | 90 |
| 86 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STATISTICS_TABLE_H_ | 91 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STATISTICS_TABLE_H_ |
| OLD | NEW |