OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CONSUMER_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_CONSUMER_H_ |
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_CONSUMER_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_CONSUMER_H_ |
7 | 7 |
8 #include "chrome/browser/common/cancelable_request.h" | 8 #include "chrome/browser/common/cancelable_request.h" |
9 | 9 |
10 namespace webkit { | 10 namespace content { |
11 namespace forms { | |
12 struct PasswordForm; | 11 struct PasswordForm; |
13 } | 12 } |
14 } | |
15 | 13 |
16 // Reads from the PasswordStore are done asynchronously on a separate | 14 // Reads from the PasswordStore are done asynchronously on a separate |
17 // thread. PasswordStoreConsumer provides the virtual callback method, which is | 15 // thread. PasswordStoreConsumer provides the virtual callback method, which is |
18 // guaranteed to be executed on this (the UI) thread. It also provides the | 16 // guaranteed to be executed on this (the UI) thread. It also provides the |
19 // CancelableRequestConsumer member, which cancels any outstanding requests upon | 17 // CancelableRequestConsumer member, which cancels any outstanding requests upon |
20 // destruction. | 18 // destruction. |
21 class PasswordStoreConsumer { | 19 class PasswordStoreConsumer { |
22 public: | 20 public: |
23 PasswordStoreConsumer(); | 21 PasswordStoreConsumer(); |
24 | 22 |
25 // Call this when the request is finished. If there are no results, call it | 23 // Call this when the request is finished. If there are no results, call it |
26 // anyway with an empty vector. | 24 // anyway with an empty vector. |
27 virtual void OnPasswordStoreRequestDone( | 25 virtual void OnPasswordStoreRequestDone( |
28 CancelableRequestProvider::Handle handle, | 26 CancelableRequestProvider::Handle handle, |
29 const std::vector<webkit::forms::PasswordForm*>& result) = 0; | 27 const std::vector<content::PasswordForm*>& result) = 0; |
30 | 28 |
31 // The CancelableRequest framework needs both a callback (the | 29 // The CancelableRequest framework needs both a callback (the |
32 // PasswordStoreConsumer::OnPasswordStoreRequestDone) as well as a | 30 // PasswordStoreConsumer::OnPasswordStoreRequestDone) as well as a |
33 // CancelableRequestConsumer. This accessor makes the API simpler for callers | 31 // CancelableRequestConsumer. This accessor makes the API simpler for callers |
34 // as PasswordStore can get both from the PasswordStoreConsumer. | 32 // as PasswordStore can get both from the PasswordStoreConsumer. |
35 CancelableRequestConsumerBase* cancelable_consumer() { | 33 CancelableRequestConsumerBase* cancelable_consumer() { |
36 return &cancelable_consumer_; | 34 return &cancelable_consumer_; |
37 } | 35 } |
38 | 36 |
39 protected: | 37 protected: |
40 virtual ~PasswordStoreConsumer(); | 38 virtual ~PasswordStoreConsumer(); |
41 | 39 |
42 private: | 40 private: |
43 CancelableRequestConsumer cancelable_consumer_; | 41 CancelableRequestConsumer cancelable_consumer_; |
44 }; | 42 }; |
45 | 43 |
46 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_CONSUMER_H_ | 44 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_CONSUMER_H_ |
OLD | NEW |