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