• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2012 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 CHROME_BROWSER_WEBDATA_LOGINS_TABLE_H_
6 #define CHROME_BROWSER_WEBDATA_LOGINS_TABLE_H_
7 
8 #include <vector>
9 
10 #include "base/compiler_specific.h"
11 #include "components/webdata/common/web_database_table.h"
12 
13 #if defined(OS_WIN)
14 struct IE7PasswordInfo;
15 #endif
16 
17 class WebDatabase;
18 
19 // This class manages the logins table within the SQLite database passed to the
20 // constructor. We no longer store passwords here except for imported IE
21 // passwords, so this class is now mostly responsible for deleting the table if
22 // it is found to exist. (The data was migrated out long ago.)
23 class LoginsTable : public WebDatabaseTable {
24  public:
LoginsTable()25   LoginsTable() {}
~LoginsTable()26   virtual ~LoginsTable() {}
27 
28   // Retrieves the LoginsTable* owned by |database|.
29   static LoginsTable* FromWebDatabase(WebDatabase* db);
30 
31   virtual WebDatabaseTable::TypeKey GetTypeKey() const OVERRIDE;
32   virtual bool Init(sql::Connection* db, sql::MetaTable* meta_table) OVERRIDE;
33   virtual bool IsSyncable() OVERRIDE;
34   virtual bool MigrateToVersion(int version,
35                                 bool* update_compatible_version) OVERRIDE;
36 
37 #if defined(OS_WIN)
38   // Adds |info| to the list of imported passwords from ie7/ie8.
39   bool AddIE7Login(const IE7PasswordInfo& info);
40 
41   // Removes |info| from the list of imported passwords from ie7/ie8.
42   bool RemoveIE7Login(const IE7PasswordInfo& info);
43 
44   // Return the ie7/ie8 login matching |info|.
45   bool GetIE7Login(const IE7PasswordInfo& info, IE7PasswordInfo* result);
46 #endif
47 
48  private:
49   DISALLOW_COPY_AND_ASSIGN(LoginsTable);
50 };
51 
52 #endif  // CHROME_BROWSER_WEBDATA_LOGINS_TABLE_H_
53