• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2010 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_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_
6 #define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_
7 #pragma once
8 
9 #include "base/basictypes.h"
10 #include "base/time.h"
11 #include "chrome/browser/password_manager/password_store_x.h"
12 
13 namespace webkit_glue {
14 struct PasswordForm;
15 }
16 
17 // NativeBackend implementation using GNOME Keyring.
18 class NativeBackendGnome : public PasswordStoreX::NativeBackend {
19  public:
20   NativeBackendGnome();
21 
22   virtual ~NativeBackendGnome();
23 
24   virtual bool Init();
25 
26   // Implements NativeBackend interface.
27   virtual bool AddLogin(const webkit_glue::PasswordForm& form);
28   virtual bool UpdateLogin(const webkit_glue::PasswordForm& form);
29   virtual bool RemoveLogin(const webkit_glue::PasswordForm& form);
30   virtual bool RemoveLoginsCreatedBetween(const base::Time& delete_begin,
31                                           const base::Time& delete_end);
32   virtual bool GetLogins(const webkit_glue::PasswordForm& form,
33                          PasswordFormList* forms);
34   virtual bool GetLoginsCreatedBetween(const base::Time& get_begin,
35                                        const base::Time& get_end,
36                                        PasswordFormList* forms);
37   virtual bool GetAutofillableLogins(PasswordFormList* forms);
38   virtual bool GetBlacklistLogins(PasswordFormList* forms);
39 
40  private:
41   // Adds a login form without checking for one to replace first.
42   bool RawAddLogin(const webkit_glue::PasswordForm& form);
43 
44   // Reads PasswordForms from the keyring with the given autofillability state.
45   bool GetLoginsList(PasswordFormList* forms, bool autofillable);
46 
47   // Helper for GetLoginsCreatedBetween().
48   bool GetAllLogins(PasswordFormList* forms);
49 
50   DISALLOW_COPY_AND_ASSIGN(NativeBackendGnome);
51 };
52 
53 #endif  // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_
54