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

Side by Side Diff: components/password_manager/core/browser/statistics_table.h

Issue 1083293004: Implement the statistics table for the passwords. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address the comments Created 5 years, 8 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
OLDNEW
(Empty)
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.
4
5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STATISTICS_TABLE_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STATISTICS_TABLE_H_
7
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/time/time.h"
11 #include "url/gurl.h"
12
13 namespace sql {
14 class Connection;
15 }
16
17 namespace password_manager {
18
19 // The statistics containing user interactions with a site.
20 struct InteractionsStats {
21 // The domain of the site.
22 GURL origin_domain;
23
24 // Number of times the user clicked "Don't save the password".
25 int nopes_count;
26
27 // Number of times the user dismissed the bubble.
28 int dismissal_count;
29
30 // The beginning date of the measurements.
31 base::Time start_date;
32 };
33
34 // Represents 'stats' table in the Login Database.
35 class StatisticsTable {
36 public:
37 StatisticsTable();
38 ~StatisticsTable();
39
40 // Initializes |db_| and creates the statistics table if it doesn't exist.
41 bool Init(sql::Connection* db);
42
43 // Adds or replaces the statistics about |stats.origin_domain|.
44 bool AddRow(const InteractionsStats& stats);
45
46 // Removes the statistics for |domain|. Returns true if the SQL completed
47 // successfully.
48 bool RemoveRow(const GURL& domain);
49
50 // Returns the statistics for |domain| if it exists.
51 scoped_ptr<InteractionsStats> GetRow(const GURL& domain);
52
53 private:
54 sql::Connection* db_;
55
56 DISALLOW_COPY_AND_ASSIGN(StatisticsTable);
57 };
58
59 } // namespace password_manager
60
61 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STATISTICS_TABLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698