| 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 #include "components/password_manager/content/browser/credential_manager_dispatc
her.h" | 5 #include "components/password_manager/content/browser/credential_manager_dispatc
her.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 client_->GetPrefs()); | 33 client_->GetPrefs()); |
| 34 } | 34 } |
| 35 | 35 |
| 36 CredentialManagerDispatcher::~CredentialManagerDispatcher() { | 36 CredentialManagerDispatcher::~CredentialManagerDispatcher() { |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool CredentialManagerDispatcher::OnMessageReceived( | 39 bool CredentialManagerDispatcher::OnMessageReceived( |
| 40 const IPC::Message& message) { | 40 const IPC::Message& message) { |
| 41 bool handled = true; | 41 bool handled = true; |
| 42 IPC_BEGIN_MESSAGE_MAP(CredentialManagerDispatcher, message) | 42 IPC_BEGIN_MESSAGE_MAP(CredentialManagerDispatcher, message) |
| 43 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_NotifyFailedSignIn, | |
| 44 OnNotifyFailedSignIn); | |
| 45 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_NotifySignedIn, | 43 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_NotifySignedIn, |
| 46 OnNotifySignedIn); | 44 OnNotifySignedIn); |
| 47 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_RequireUserMediation, | 45 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_RequireUserMediation, |
| 48 OnRequireUserMediation); | 46 OnRequireUserMediation); |
| 49 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_RequestCredential, | 47 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_RequestCredential, |
| 50 OnRequestCredential); | 48 OnRequestCredential); |
| 51 IPC_MESSAGE_UNHANDLED(handled = false) | 49 IPC_MESSAGE_UNHANDLED(handled = false) |
| 52 IPC_END_MESSAGE_MAP() | 50 IPC_END_MESSAGE_MAP() |
| 53 return handled; | 51 return handled; |
| 54 } | 52 } |
| 55 | 53 |
| 56 void CredentialManagerDispatcher::OnNotifyFailedSignIn(int request_id, | |
| 57 const CredentialInfo&) { | |
| 58 DCHECK(request_id); | |
| 59 // TODO(mkwst): This is a stub. | |
| 60 web_contents()->GetRenderViewHost()->Send( | |
| 61 new CredentialManagerMsg_AcknowledgeFailedSignIn( | |
| 62 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id)); | |
| 63 } | |
| 64 | |
| 65 void CredentialManagerDispatcher::OnNotifySignedIn( | 54 void CredentialManagerDispatcher::OnNotifySignedIn( |
| 66 int request_id, | 55 int request_id, |
| 67 const password_manager::CredentialInfo& credential) { | 56 const password_manager::CredentialInfo& credential) { |
| 68 DCHECK(credential.type != CredentialType::CREDENTIAL_TYPE_EMPTY); | 57 DCHECK(credential.type != CredentialType::CREDENTIAL_TYPE_EMPTY); |
| 69 DCHECK(request_id); | 58 DCHECK(request_id); |
| 70 web_contents()->GetRenderViewHost()->Send( | 59 web_contents()->GetRenderViewHost()->Send( |
| 71 new CredentialManagerMsg_AcknowledgeSignedIn( | 60 new CredentialManagerMsg_AcknowledgeSignedIn( |
| 72 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id)); | 61 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id)); |
| 73 | 62 |
| 74 if (!client_->IsSavingEnabledForCurrentPage()) | 63 if (!client_->IsSavingEnabledForCurrentPage()) |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 PasswordManagerClient* CredentialManagerDispatcher::client() const { | 188 PasswordManagerClient* CredentialManagerDispatcher::client() const { |
| 200 return client_; | 189 return client_; |
| 201 } | 190 } |
| 202 | 191 |
| 203 void CredentialManagerDispatcher::DoneRequiringUserMediation() { | 192 void CredentialManagerDispatcher::DoneRequiringUserMediation() { |
| 204 DCHECK(pending_require_user_mediation_); | 193 DCHECK(pending_require_user_mediation_); |
| 205 pending_require_user_mediation_.reset(); | 194 pending_require_user_mediation_.reset(); |
| 206 } | 195 } |
| 207 | 196 |
| 208 } // namespace password_manager | 197 } // namespace password_manager |
| OLD | NEW |