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

Side by Side Diff: chrome/browser/password_manager/native_backend_gnome_x.h

Issue 11000016: Move forms/ out of webkit/. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Response to review Created 8 years, 2 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_ 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_
6 #define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_ 6 #define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_
7 7
8 #include <gnome-keyring.h> 8 #include <gnome-keyring.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "chrome/browser/password_manager/password_store_factory.h" 14 #include "chrome/browser/password_manager/password_store_factory.h"
15 #include "chrome/browser/password_manager/password_store_x.h" 15 #include "chrome/browser/password_manager/password_store_x.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 17
18 class PrefService; 18 class PrefService;
19 19
20 namespace webkit { 20 namespace content {
21 namespace forms {
22 struct PasswordForm; 21 struct PasswordForm;
23 } 22 }
24 }
25 23
26 // Many of the gnome_keyring_* functions use variable arguments, which makes 24 // Many of the gnome_keyring_* functions use variable arguments, which makes
27 // them difficult if not impossible to truly wrap in C. Therefore, we use 25 // them difficult if not impossible to truly wrap in C. Therefore, we use
28 // appropriately-typed function pointers and scoping to make the fact that we 26 // appropriately-typed function pointers and scoping to make the fact that we
29 // might be dynamically loading the library almost invisible. As a bonus, we 27 // might be dynamically loading the library almost invisible. As a bonus, we
30 // also get a simple way to mock the library for testing. Classes that inherit 28 // also get a simple way to mock the library for testing. Classes that inherit
31 // from GnomeKeyringLoader will use its versions of the gnome_keyring_* 29 // from GnomeKeyringLoader will use its versions of the gnome_keyring_*
32 // functions. Note that it has only static fields. 30 // functions. Note that it has only static fields.
33 class GnomeKeyringLoader { 31 class GnomeKeyringLoader {
34 protected: 32 protected:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 class NativeBackendGnome : public PasswordStoreX::NativeBackend, 66 class NativeBackendGnome : public PasswordStoreX::NativeBackend,
69 public GnomeKeyringLoader { 67 public GnomeKeyringLoader {
70 public: 68 public:
71 NativeBackendGnome(LocalProfileId id, PrefService* prefs); 69 NativeBackendGnome(LocalProfileId id, PrefService* prefs);
72 70
73 virtual ~NativeBackendGnome(); 71 virtual ~NativeBackendGnome();
74 72
75 virtual bool Init() OVERRIDE; 73 virtual bool Init() OVERRIDE;
76 74
77 // Implements NativeBackend interface. 75 // Implements NativeBackend interface.
78 virtual bool AddLogin(const webkit::forms::PasswordForm& form) OVERRIDE; 76 virtual bool AddLogin(const content::PasswordForm& form) OVERRIDE;
79 virtual bool UpdateLogin(const webkit::forms::PasswordForm& form) OVERRIDE; 77 virtual bool UpdateLogin(const content::PasswordForm& form) OVERRIDE;
80 virtual bool RemoveLogin(const webkit::forms::PasswordForm& form) OVERRIDE; 78 virtual bool RemoveLogin(const content::PasswordForm& form) OVERRIDE;
81 virtual bool RemoveLoginsCreatedBetween( 79 virtual bool RemoveLoginsCreatedBetween(
82 const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; 80 const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE;
83 virtual bool GetLogins(const webkit::forms::PasswordForm& form, 81 virtual bool GetLogins(const content::PasswordForm& form,
84 PasswordFormList* forms) OVERRIDE; 82 PasswordFormList* forms) OVERRIDE;
85 virtual bool GetLoginsCreatedBetween(const base::Time& get_begin, 83 virtual bool GetLoginsCreatedBetween(const base::Time& get_begin,
86 const base::Time& get_end, 84 const base::Time& get_end,
87 PasswordFormList* forms) OVERRIDE; 85 PasswordFormList* forms) OVERRIDE;
88 virtual bool GetAutofillableLogins(PasswordFormList* forms) OVERRIDE; 86 virtual bool GetAutofillableLogins(PasswordFormList* forms) OVERRIDE;
89 virtual bool GetBlacklistLogins(PasswordFormList* forms) OVERRIDE; 87 virtual bool GetBlacklistLogins(PasswordFormList* forms) OVERRIDE;
90 88
91 private: 89 private:
92 // Adds a login form without checking for one to replace first. 90 // Adds a login form without checking for one to replace first.
93 bool RawAddLogin(const webkit::forms::PasswordForm& form); 91 bool RawAddLogin(const content::PasswordForm& form);
94 92
95 // Reads PasswordForms from the keyring with the given autofillability state. 93 // Reads PasswordForms from the keyring with the given autofillability state.
96 bool GetLoginsList(PasswordFormList* forms, bool autofillable); 94 bool GetLoginsList(PasswordFormList* forms, bool autofillable);
97 95
98 // Helper for GetLoginsCreatedBetween(). 96 // Helper for GetLoginsCreatedBetween().
99 bool GetAllLogins(PasswordFormList* forms); 97 bool GetAllLogins(PasswordFormList* forms);
100 98
101 // Generates a profile-specific app string based on profile_id_. 99 // Generates a profile-specific app string based on profile_id_.
102 std::string GetProfileSpecificAppString() const; 100 std::string GetProfileSpecificAppString() const;
103 101
104 // Migrates non-profile-specific logins to be profile-specific. 102 // Migrates non-profile-specific logins to be profile-specific.
105 void MigrateToProfileSpecificLogins(); 103 void MigrateToProfileSpecificLogins();
106 104
107 // The local profile id, used to generate the app string. 105 // The local profile id, used to generate the app string.
108 const LocalProfileId profile_id_; 106 const LocalProfileId profile_id_;
109 107
110 // The pref service to use for persistent migration settings. 108 // The pref service to use for persistent migration settings.
111 PrefService* prefs_; 109 PrefService* prefs_;
112 110
113 // The app string, possibly based on the local profile id. 111 // The app string, possibly based on the local profile id.
114 std::string app_string_; 112 std::string app_string_;
115 113
116 // True once MigrateToProfileSpecificLogins() has been attempted. 114 // True once MigrateToProfileSpecificLogins() has been attempted.
117 bool migrate_tried_; 115 bool migrate_tried_;
118 116
119 DISALLOW_COPY_AND_ASSIGN(NativeBackendGnome); 117 DISALLOW_COPY_AND_ASSIGN(NativeBackendGnome);
120 }; 118 };
121 119
122 #endif // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_ 120 #endif // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/mock_password_store.h ('k') | chrome/browser/password_manager/native_backend_gnome_x.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698