OLD | NEW |
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_PASSWORD_STORE_MAC_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ |
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
13 #include "chrome/browser/password_manager/login_database.h" | 13 #include "chrome/browser/password_manager/login_database.h" |
14 #include "chrome/browser/password_manager/password_store.h" | 14 #include "chrome/browser/password_manager/password_store.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 class NotificationService; | 17 class NotificationService; |
18 } | 18 } |
19 | 19 |
20 namespace crypto { | 20 namespace crypto { |
21 class MacKeychain; | 21 class AppleKeychain; |
22 } | 22 } |
23 | 23 |
24 // Implements PasswordStore on top of the OS X Keychain, with an internal | 24 // Implements PasswordStore on top of the OS X Keychain, with an internal |
25 // database for extra metadata. For an overview of the interactions with the | 25 // database for extra metadata. For an overview of the interactions with the |
26 // Keychain, as well as the rationale for some of the behaviors, see the | 26 // Keychain, as well as the rationale for some of the behaviors, see the |
27 // Keychain integration design doc: | 27 // Keychain integration design doc: |
28 // http://dev.chromium.org/developers/design-documents/os-x-password-manager-key
chain-integration | 28 // http://dev.chromium.org/developers/design-documents/os-x-password-manager-key
chain-integration |
29 class PasswordStoreMac : public PasswordStore { | 29 class PasswordStoreMac : public PasswordStore { |
30 public: | 30 public: |
31 // Takes ownership of |keychain| and |login_db|, both of which must be | 31 // Takes ownership of |keychain| and |login_db|, both of which must be |
32 // non-NULL. | 32 // non-NULL. |
33 PasswordStoreMac(crypto::MacKeychain* keychain, LoginDatabase* login_db); | 33 PasswordStoreMac(crypto::AppleKeychain* keychain, LoginDatabase* login_db); |
34 | 34 |
35 // Initializes |thread_| and |notification_service_|. | 35 // Initializes |thread_| and |notification_service_|. |
36 virtual bool Init() OVERRIDE; | 36 virtual bool Init() OVERRIDE; |
37 | 37 |
38 virtual void ShutdownOnUIThread() OVERRIDE; | 38 virtual void ShutdownOnUIThread() OVERRIDE; |
39 | 39 |
40 protected: | 40 protected: |
41 virtual ~PasswordStoreMac(); | 41 virtual ~PasswordStoreMac(); |
42 | 42 |
43 virtual bool ScheduleTask(const base::Closure& task) OVERRIDE; | 43 virtual bool ScheduleTask(const base::Closure& task) OVERRIDE; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 const std::vector<webkit::forms::PasswordForm*>& forms); | 80 const std::vector<webkit::forms::PasswordForm*>& forms); |
81 | 81 |
82 // Removes the given forms from the Keychain. | 82 // Removes the given forms from the Keychain. |
83 void RemoveKeychainForms( | 83 void RemoveKeychainForms( |
84 const std::vector<webkit::forms::PasswordForm*>& forms); | 84 const std::vector<webkit::forms::PasswordForm*>& forms); |
85 | 85 |
86 // Allows the creation of |notification_service_| to be scheduled on the right | 86 // Allows the creation of |notification_service_| to be scheduled on the right |
87 // thread. | 87 // thread. |
88 void CreateNotificationService(); | 88 void CreateNotificationService(); |
89 | 89 |
90 scoped_ptr<crypto::MacKeychain> keychain_; | 90 scoped_ptr<crypto::AppleKeychain> keychain_; |
91 scoped_ptr<LoginDatabase> login_metadata_db_; | 91 scoped_ptr<LoginDatabase> login_metadata_db_; |
92 | 92 |
93 // Thread that the synchronous methods are run on. | 93 // Thread that the synchronous methods are run on. |
94 scoped_ptr<base::Thread> thread_; | 94 scoped_ptr<base::Thread> thread_; |
95 | 95 |
96 // Since we aren't running on a well-known thread but still want to send out | 96 // Since we aren't running on a well-known thread but still want to send out |
97 // notifications, we need to run our own service. | 97 // notifications, we need to run our own service. |
98 scoped_ptr<content::NotificationService> notification_service_; | 98 scoped_ptr<content::NotificationService> notification_service_; |
99 | 99 |
100 DISALLOW_COPY_AND_ASSIGN(PasswordStoreMac); | 100 DISALLOW_COPY_AND_ASSIGN(PasswordStoreMac); |
101 }; | 101 }; |
102 | 102 |
103 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ | 103 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ |
OLD | NEW |