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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STATISTICS_TABLE_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STATISTICS_TABLE_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/time/time.h"
17 namespace password_manager
{
19 // The statistics containing user interactions with a site.
20 struct InteractionsStats
{
21 // The domain of the site.
24 // Number of times the user clicked "Don't save the password".
27 // Number of times the user dismissed the bubble.
30 // The beginning date of the measurements.
31 base::Time start_date
;
34 // Represents 'stats' table in the Login Database.
35 class StatisticsTable
{
40 // Initializes |db_| and creates the statistics table if it doesn't exist.
41 bool Init(sql::Connection
* db
);
43 // Adds or replaces the statistics about |stats.origin_domain|.
44 bool AddRow(const InteractionsStats
& stats
);
46 // Removes the statistics for |domain|. Returns true if the SQL completed
48 bool RemoveRow(const GURL
& domain
);
50 // Returns the statistics for |domain| if it exists.
51 scoped_ptr
<InteractionsStats
> GetRow(const GURL
& domain
);
56 DISALLOW_COPY_AND_ASSIGN(StatisticsTable
);
59 } // namespace password_manager
61 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STATISTICS_TABLE_H_