OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_WEBDATA_LOGINS_TABLE_H_ | 5 #ifndef CHROME_BROWSER_WEBDATA_LOGINS_TABLE_H_ |
6 #define CHROME_BROWSER_WEBDATA_LOGINS_TABLE_H_ | 6 #define CHROME_BROWSER_WEBDATA_LOGINS_TABLE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "chrome/browser/webdata/web_database_table.h" | 12 #include "chrome/browser/webdata/web_database_table.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class Time; | 15 class Time; |
16 } | 16 } |
17 | 17 |
18 namespace webkit_glue { | 18 namespace webkit { |
| 19 namespace forms { |
19 struct PasswordForm; | 20 struct PasswordForm; |
20 } | 21 } |
| 22 } |
21 | 23 |
22 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
23 struct IE7PasswordInfo; | 25 struct IE7PasswordInfo; |
24 #endif | 26 #endif |
25 | 27 |
26 // This class manages the logins table within the SQLite database passed to the | 28 // This class manages the logins table within the SQLite database passed to the |
27 // constructor. It expects the following schemas: | 29 // constructor. It expects the following schemas: |
28 // | 30 // |
29 // Note: The database stores time in seconds, UTC. | 31 // Note: The database stores time in seconds, UTC. |
30 // | 32 // |
(...skipping 17 matching lines...) Expand all Loading... |
48 // | 50 // |
49 class LoginsTable : public WebDatabaseTable { | 51 class LoginsTable : public WebDatabaseTable { |
50 public: | 52 public: |
51 LoginsTable(sql::Connection* db, sql::MetaTable* meta_table) | 53 LoginsTable(sql::Connection* db, sql::MetaTable* meta_table) |
52 : WebDatabaseTable(db, meta_table) {} | 54 : WebDatabaseTable(db, meta_table) {} |
53 virtual ~LoginsTable() {} | 55 virtual ~LoginsTable() {} |
54 virtual bool Init() OVERRIDE; | 56 virtual bool Init() OVERRIDE; |
55 virtual bool IsSyncable() OVERRIDE; | 57 virtual bool IsSyncable() OVERRIDE; |
56 | 58 |
57 // Adds |form| to the list of remembered password forms. | 59 // Adds |form| to the list of remembered password forms. |
58 bool AddLogin(const webkit_glue::PasswordForm& form); | 60 bool AddLogin(const webkit::forms::PasswordForm& form); |
59 | 61 |
60 #if defined(OS_WIN) | 62 #if defined(OS_WIN) |
61 // Adds |info| to the list of imported passwords from ie7/ie8. | 63 // Adds |info| to the list of imported passwords from ie7/ie8. |
62 bool AddIE7Login(const IE7PasswordInfo& info); | 64 bool AddIE7Login(const IE7PasswordInfo& info); |
63 | 65 |
64 // Removes |info| from the list of imported passwords from ie7/ie8. | 66 // Removes |info| from the list of imported passwords from ie7/ie8. |
65 bool RemoveIE7Login(const IE7PasswordInfo& info); | 67 bool RemoveIE7Login(const IE7PasswordInfo& info); |
66 | 68 |
67 // Return the ie7/ie8 login matching |info|. | 69 // Return the ie7/ie8 login matching |info|. |
68 bool GetIE7Login(const IE7PasswordInfo& info, IE7PasswordInfo* result); | 70 bool GetIE7Login(const IE7PasswordInfo& info, IE7PasswordInfo* result); |
69 #endif | 71 #endif |
70 | 72 |
71 // Updates remembered password form. | 73 // Updates remembered password form. |
72 bool UpdateLogin(const webkit_glue::PasswordForm& form); | 74 bool UpdateLogin(const webkit::forms::PasswordForm& form); |
73 | 75 |
74 // Removes |form| from the list of remembered password forms. | 76 // Removes |form| from the list of remembered password forms. |
75 bool RemoveLogin(const webkit_glue::PasswordForm& form); | 77 bool RemoveLogin(const webkit::forms::PasswordForm& form); |
76 | 78 |
77 // Removes all logins created from |delete_begin| onwards (inclusive) and | 79 // Removes all logins created from |delete_begin| onwards (inclusive) and |
78 // before |delete_end|. You may use a null Time value to do an unbounded | 80 // before |delete_end|. You may use a null Time value to do an unbounded |
79 // delete in either direction. | 81 // delete in either direction. |
80 bool RemoveLoginsCreatedBetween(base::Time delete_begin, | 82 bool RemoveLoginsCreatedBetween(base::Time delete_begin, |
81 base::Time delete_end); | 83 base::Time delete_end); |
82 | 84 |
83 // Loads a list of matching password forms into the specified vector |forms|. | 85 // Loads a list of matching password forms into the specified vector |forms|. |
84 // The list will contain all possibly relevant entries to the observed |form|, | 86 // The list will contain all possibly relevant entries to the observed |form|, |
85 // including blacklisted matches. | 87 // including blacklisted matches. |
86 bool GetLogins(const webkit_glue::PasswordForm& form, | 88 bool GetLogins(const webkit::forms::PasswordForm& form, |
87 std::vector<webkit_glue::PasswordForm*>* forms); | 89 std::vector<webkit::forms::PasswordForm*>* forms); |
88 | 90 |
89 // Loads the complete list of password forms into the specified vector |forms| | 91 // Loads the complete list of password forms into the specified vector |forms| |
90 // if include_blacklisted is true, otherwise only loads those which are | 92 // if include_blacklisted is true, otherwise only loads those which are |
91 // actually autofill-able; i.e haven't been blacklisted by the user selecting | 93 // actually autofill-able; i.e haven't been blacklisted by the user selecting |
92 // the 'Never for this site' button. | 94 // the 'Never for this site' button. |
93 bool GetAllLogins(std::vector<webkit_glue::PasswordForm*>* forms, | 95 bool GetAllLogins(std::vector<webkit::forms::PasswordForm*>* forms, |
94 bool include_blacklisted); | 96 bool include_blacklisted); |
95 | 97 |
96 private: | 98 private: |
97 DISALLOW_COPY_AND_ASSIGN(LoginsTable); | 99 DISALLOW_COPY_AND_ASSIGN(LoginsTable); |
98 }; | 100 }; |
99 | 101 |
100 #endif // CHROME_BROWSER_WEBDATA_LOGINS_TABLE_H_ | 102 #endif // CHROME_BROWSER_WEBDATA_LOGINS_TABLE_H_ |
OLD | NEW |