OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_DRIVER_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_DRIVER_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_DRIVER_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_DRIVER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | |
11 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
12 | 13 |
13 namespace autofill { | 14 namespace autofill { |
14 class AutofillManager; | 15 class AutofillManager; |
15 struct FormData; | 16 struct FormData; |
16 struct PasswordForm; | 17 struct PasswordForm; |
17 struct PasswordFormFillData; | 18 struct PasswordFormFillData; |
18 } // namespace autofill | 19 } // namespace autofill |
19 | 20 |
20 namespace password_manager { | 21 namespace password_manager { |
21 | 22 |
22 class PasswordAutofillManager; | 23 class PasswordAutofillManager; |
23 class PasswordGenerationManager; | 24 class PasswordGenerationManager; |
24 class PasswordManager; | 25 class PasswordManager; |
25 | 26 |
26 // Interface that allows PasswordManager core code to interact with its driver | 27 // Interface that allows PasswordManager core code to interact with its driver |
27 // (i.e., obtain information from it and give information to it). | 28 // (i.e., obtain information from it and give information to it). |
28 class PasswordManagerDriver { | 29 class PasswordManagerDriver { |
29 public: | 30 public: |
30 PasswordManagerDriver() {} | 31 PasswordManagerDriver(); |
31 virtual ~PasswordManagerDriver() {} | 32 virtual ~PasswordManagerDriver(); |
32 | 33 |
33 // Fills forms matching |form_data|. | 34 // Fills forms matching |form_data|. |
34 virtual void FillPasswordForm( | 35 virtual void FillPasswordForm( |
35 const autofill::PasswordFormFillData& form_data) = 0; | 36 const autofill::PasswordFormFillData& form_data) = 0; |
36 | 37 |
37 // Informs the driver that |form| can be used for password generation. | 38 // Informs the driver that |form| can be used for password generation. |
38 virtual void AllowPasswordGenerationForForm( | 39 virtual void AllowPasswordGenerationForForm( |
39 const autofill::PasswordForm& form) = 0; | 40 const autofill::PasswordForm& form) = 0; |
40 | 41 |
41 // Notifies the driver that account creation |forms| were found. | 42 // Notifies the driver that account creation |forms| were found. |
(...skipping 14 matching lines...) Expand all Loading... | |
56 | 57 |
57 // Returns the PasswordGenerationManager associated with this instance. | 58 // Returns the PasswordGenerationManager associated with this instance. |
58 virtual PasswordGenerationManager* GetPasswordGenerationManager() = 0; | 59 virtual PasswordGenerationManager* GetPasswordGenerationManager() = 0; |
59 | 60 |
60 // Returns the PasswordManager associated with this instance. | 61 // Returns the PasswordManager associated with this instance. |
61 virtual PasswordManager* GetPasswordManager() = 0; | 62 virtual PasswordManager* GetPasswordManager() = 0; |
62 | 63 |
63 // Returns the PasswordAutofillManager associated with this instance. | 64 // Returns the PasswordAutofillManager associated with this instance. |
64 virtual PasswordAutofillManager* GetPasswordAutofillManager() = 0; | 65 virtual PasswordAutofillManager* GetPasswordAutofillManager() = 0; |
65 | 66 |
67 // Returns a weak pointer to |this|. | |
68 base::WeakPtr<PasswordManagerDriver> GetWeakPtr(); | |
Evan Stade
2014/12/08 20:02:50
is there a reason not to use SupportsWeakPtr/AsWea
vabr (Chromium)
2014/12/09 12:55:46
Done. Thanks for pointing this out.
There is not r
| |
69 | |
66 private: | 70 private: |
71 base::WeakPtrFactory<PasswordManagerDriver> weak_ptr_factory_; | |
72 | |
67 DISALLOW_COPY_AND_ASSIGN(PasswordManagerDriver); | 73 DISALLOW_COPY_AND_ASSIGN(PasswordManagerDriver); |
68 }; | 74 }; |
69 | 75 |
70 } // namespace password_manager | 76 } // namespace password_manager |
71 | 77 |
72 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_DRIVER_H_ | 78 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_DRIVER_H_ |
OLD | NEW |