Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/password_manager/content/browser/content_password_manager_d river_factory.h" | |
| 6 | |
| 7 #include "components/autofill/content/browser/content_autofill_driver.h" | |
| 8 #include "components/autofill/content/browser/content_autofill_driver_factory.h" | |
| 9 #include "components/autofill/content/common/autofill_messages.h" | |
| 10 #include "components/autofill/core/common/form_data.h" | |
| 11 #include "components/autofill/core/common/password_form.h" | |
| 12 #include "components/password_manager/content/browser/content_password_manager_d river.h" | |
| 13 #include "components/password_manager/core/browser/password_manager_client.h" | |
| 14 #include "content/public/browser/browser_context.h" | |
| 15 #include "content/public/browser/navigation_details.h" | |
| 16 #include "content/public/browser/navigation_entry.h" | |
| 17 #include "content/public/browser/render_frame_host.h" | |
| 18 #include "content/public/browser/render_view_host.h" | |
| 19 #include "content/public/browser/web_contents.h" | |
| 20 #include "content/public/common/ssl_status.h" | |
| 21 #include "ipc/ipc_message_macros.h" | |
| 22 #include "net/cert/cert_status_flags.h" | |
| 23 | |
| 24 namespace password_manager { | |
| 25 | |
| 26 namespace { | |
| 27 | |
| 28 const char kContentPasswordManagerDriverFactoryWebContentsUserDataKey[] = | |
| 29 "web_contents_password_manager_driver_factory"; | |
| 30 | |
| 31 } // namespace | |
| 32 | |
| 33 ContentPasswordManagerDriverFactory::ContentPasswordManagerDriverFactory( | |
| 34 content::WebContents* web_contents, | |
| 35 PasswordManagerClient* password_client, | |
| 36 autofill::AutofillClient* autofill_client) | |
| 37 : content::WebContentsObserver(web_contents), | |
| 38 password_client_(password_client), | |
| 39 autofill_client_(autofill_client) { | |
| 40 web_contents->SetUserData( | |
| 41 kContentPasswordManagerDriverFactoryWebContentsUserDataKey, this); | |
| 42 if (web_contents->GetMainFrame()) | |
| 43 RenderFrameCreated(web_contents->GetMainFrame()); | |
| 44 } | |
| 45 | |
| 46 ContentPasswordManagerDriverFactory::~ContentPasswordManagerDriverFactory() { | |
| 47 } | |
| 48 | |
| 49 // static | |
| 50 ContentPasswordManagerDriverFactory* | |
| 51 ContentPasswordManagerDriverFactory::FromWebContents( | |
| 52 content::WebContents* contents) { | |
| 53 return static_cast<ContentPasswordManagerDriverFactory*>( | |
| 54 contents->GetUserData( | |
| 55 kContentPasswordManagerDriverFactoryWebContentsUserDataKey)); | |
| 56 } | |
| 57 | |
| 58 ContentPasswordManagerDriver* | |
| 59 ContentPasswordManagerDriverFactory::GetDriverForFrame( | |
| 60 content::RenderFrameHost* render_frame_host) { | |
| 61 return frame_driver_map_[render_frame_host]; | |
|
vabr (Chromium)
2014/11/10 14:34:40
As in the case of ContentAutofillDriverFactory, pl
Evan Stade
2014/11/14 23:25:50
like with ContentAutofillDriverFactory, lookup sho
| |
| 62 } | |
| 63 | |
| 64 void ContentPasswordManagerDriverFactory::RenderFrameCreated( | |
| 65 content::RenderFrameHost* render_frame_host) { | |
| 66 frame_driver_map_[render_frame_host] = new ContentPasswordManagerDriver( | |
| 67 render_frame_host, password_client_, autofill_client_); | |
| 68 } | |
| 69 | |
| 70 void ContentPasswordManagerDriverFactory::RenderFrameDeleted( | |
| 71 content::RenderFrameHost* render_frame_host) { | |
| 72 ContentPasswordManagerDriver* driver = frame_driver_map_[render_frame_host]; | |
| 73 DCHECK(driver); | |
| 74 delete driver; | |
| 75 frame_driver_map_.erase(render_frame_host); | |
| 76 } | |
| 77 | |
| 78 bool ContentPasswordManagerDriverFactory::OnMessageReceived( | |
| 79 const IPC::Message& message, | |
| 80 content::RenderFrameHost* render_frame_host) { | |
| 81 ContentPasswordManagerDriver* driver = frame_driver_map_[render_frame_host]; | |
| 82 DCHECK(driver); | |
| 83 return driver->HandleMessage(message); | |
| 84 } | |
| 85 | |
| 86 void ContentPasswordManagerDriverFactory::DidNavigateAnyFrame( | |
| 87 content::RenderFrameHost* render_frame_host, | |
| 88 const content::LoadCommittedDetails& details, | |
| 89 const content::FrameNavigateParams& params) { | |
| 90 ContentPasswordManagerDriver* driver = frame_driver_map_[render_frame_host]; | |
| 91 DCHECK(driver); | |
| 92 driver->DidNavigateFrame(details, params); | |
| 93 } | |
| 94 | |
| 95 } // namespace password_manager | |
| OLD | NEW |