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_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_DRI VER_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_DRI VER_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_DRI VER_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_DRI VER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "components/password_manager/core/browser/password_autofill_manager.h" | 10 #include "components/password_manager/core/browser/password_autofill_manager.h" |
11 #include "components/password_manager/core/browser/password_generation_manager.h " | 11 #include "components/password_manager/core/browser/password_generation_manager.h " |
12 #include "components/password_manager/core/browser/password_manager.h" | 12 #include "components/password_manager/core/browser/password_manager.h" |
13 #include "components/password_manager/core/browser/password_manager_driver.h" | 13 #include "components/password_manager/core/browser/password_manager_driver.h" |
14 #include "content/public/browser/web_contents_observer.h" | |
15 | 14 |
16 namespace autofill { | 15 namespace autofill { |
17 class AutofillManager; | 16 class AutofillManager; |
18 struct PasswordForm; | 17 struct PasswordForm; |
19 } | 18 } |
20 | 19 |
21 namespace content { | 20 namespace content { |
21 struct FrameNavigateParams; | |
22 struct LoadCommittedDetails; | |
23 class RenderFrameHost; | |
22 class WebContents; | 24 class WebContents; |
23 } | 25 } |
24 | 26 |
27 namespace IPC { | |
28 class Message; | |
29 } | |
30 | |
25 namespace password_manager { | 31 namespace password_manager { |
26 | 32 |
27 class ContentPasswordManagerDriver : public PasswordManagerDriver, | 33 // There is one ContentPasswordManagerDriver per RenderFrameHost. |
28 public content::WebContentsObserver { | 34 // The lifetime is managed by the ContentPasswordManagerDriverFactory. |
35 class ContentPasswordManagerDriver : public PasswordManagerDriver { | |
29 public: | 36 public: |
30 ContentPasswordManagerDriver(content::WebContents* web_contents, | 37 ContentPasswordManagerDriver(content::RenderFrameHost* render_frame_host, |
31 PasswordManagerClient* client, | 38 PasswordManagerClient* client, |
32 autofill::AutofillClient* autofill_client); | 39 autofill::AutofillClient* autofill_client); |
33 ~ContentPasswordManagerDriver() override; | 40 ~ContentPasswordManagerDriver() override; |
34 | 41 |
42 // Gets the driver for |render_frame_host|. | |
43 static ContentPasswordManagerDriver* GetForRenderFrameHost( | |
44 content::RenderFrameHost* render_frame_host); | |
45 | |
35 // PasswordManagerDriver implementation. | 46 // PasswordManagerDriver implementation. |
36 void FillPasswordForm( | 47 void FillPasswordForm( |
37 const autofill::PasswordFormFillData& form_data) override; | 48 const autofill::PasswordFormFillData& form_data) override; |
38 bool DidLastPageLoadEncounterSSLErrors() override; | 49 bool DidLastPageLoadEncounterSSLErrors() override; |
vabr (Chromium)
2014/11/13 14:20:28
This information relates to the whole WebContents,
Evan Stade
2014/11/13 22:24:55
Done.
| |
39 bool IsOffTheRecord() override; | 50 bool IsOffTheRecord() override; |
vabr (Chromium)
2014/11/13 14:20:28
ditto here: should be moved to the client
Evan Stade
2014/11/13 22:24:55
Done.
| |
40 void AllowPasswordGenerationForForm( | 51 void AllowPasswordGenerationForForm( |
41 const autofill::PasswordForm& form) override; | 52 const autofill::PasswordForm& form) override; |
42 void AccountCreationFormsFound( | 53 void AccountCreationFormsFound( |
43 const std::vector<autofill::FormData>& forms) override; | 54 const std::vector<autofill::FormData>& forms) override; |
44 void FillSuggestion(const base::string16& username, | 55 void FillSuggestion(const base::string16& username, |
45 const base::string16& password) override; | 56 const base::string16& password) override; |
46 void PreviewSuggestion(const base::string16& username, | 57 void PreviewSuggestion(const base::string16& username, |
47 const base::string16& password) override; | 58 const base::string16& password) override; |
48 void ClearPreviewedForm() override; | 59 void ClearPreviewedForm() override; |
49 | 60 |
50 PasswordGenerationManager* GetPasswordGenerationManager() override; | 61 PasswordGenerationManager* GetPasswordGenerationManager() override; |
51 PasswordManager* GetPasswordManager() override; | 62 PasswordManager* GetPasswordManager() override; |
52 autofill::AutofillManager* GetAutofillManager() override; | 63 autofill::AutofillManager* GetAutofillManager() override; |
53 PasswordAutofillManager* GetPasswordAutofillManager() override; | 64 PasswordAutofillManager* GetPasswordAutofillManager() override; |
54 | 65 |
55 // content::WebContentsObserver overrides. | 66 bool HandleMessage(const IPC::Message& message); |
56 bool OnMessageReceived(const IPC::Message& message) override; | 67 void DidNavigateFrame(const content::LoadCommittedDetails& details, |
57 void DidNavigateMainFrame( | 68 const content::FrameNavigateParams& params); |
58 const content::LoadCommittedDetails& details, | |
59 const content::FrameNavigateParams& params) override; | |
60 | 69 |
61 private: | 70 private: |
71 content::RenderFrameHost* render_frame_host_; | |
62 PasswordManager password_manager_; | 72 PasswordManager password_manager_; |
63 PasswordGenerationManager password_generation_manager_; | 73 PasswordGenerationManager password_generation_manager_; |
64 PasswordAutofillManager password_autofill_manager_; | 74 PasswordAutofillManager password_autofill_manager_; |
65 | 75 |
66 // Every instance of PasswordFormFillData created by |*this| and sent to | 76 // Every instance of PasswordFormFillData created by |*this| and sent to |
67 // PasswordAutofillManager and PasswordAutofillAgent is given an ID, so that | 77 // PasswordAutofillManager and PasswordAutofillAgent is given an ID, so that |
68 // the latter two classes can reference to the same instance without sending | 78 // the latter two classes can reference to the same instance without sending |
69 // it to each other over IPC. The counter below is used to generate new IDs. | 79 // it to each other over IPC. The counter below is used to generate new IDs. |
70 int next_free_key_; | 80 int next_free_key_; |
71 | 81 |
72 DISALLOW_COPY_AND_ASSIGN(ContentPasswordManagerDriver); | 82 DISALLOW_COPY_AND_ASSIGN(ContentPasswordManagerDriver); |
73 }; | 83 }; |
74 | 84 |
75 } // namespace password_manager | 85 } // namespace password_manager |
76 | 86 |
77 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_ DRIVER_H_ | 87 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_ DRIVER_H_ |
OLD | NEW |