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