| 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/renderer/credential_manager_client
.h" | 5 #include "components/password_manager/content/renderer/credential_manager_client
.h" |
| 6 | 6 |
| 7 #include "components/password_manager/content/common/credential_manager_content_
utils.h" |
| 7 #include "components/password_manager/content/common/credential_manager_messages
.h" | 8 #include "components/password_manager/content/common/credential_manager_messages
.h" |
| 8 #include "components/password_manager/content/common/credential_manager_types.h" | 9 #include "components/password_manager/core/common/credential_manager_types.h" |
| 9 #include "content/public/renderer/render_view.h" | 10 #include "content/public/renderer/render_view.h" |
| 10 #include "third_party/WebKit/public/platform/WebCredential.h" | 11 #include "third_party/WebKit/public/platform/WebCredential.h" |
| 11 #include "third_party/WebKit/public/platform/WebCredentialManagerError.h" | 12 #include "third_party/WebKit/public/platform/WebCredentialManagerError.h" |
| 12 #include "third_party/WebKit/public/platform/WebFederatedCredential.h" | 13 #include "third_party/WebKit/public/platform/WebFederatedCredential.h" |
| 13 #include "third_party/WebKit/public/platform/WebLocalCredential.h" | 14 #include "third_party/WebKit/public/platform/WebLocalCredential.h" |
| 14 #include "third_party/WebKit/public/web/WebView.h" | 15 #include "third_party/WebKit/public/web/WebView.h" |
| 15 | 16 |
| 16 namespace password_manager { | 17 namespace password_manager { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 request_callbacks_.Remove(request_id); | 110 request_callbacks_.Remove(request_id); |
| 110 } | 111 } |
| 111 | 112 |
| 112 // ----------------------------------------------------------------------------- | 113 // ----------------------------------------------------------------------------- |
| 113 // Dispatch messages from the renderer to the browser. | 114 // Dispatch messages from the renderer to the browser. |
| 114 | 115 |
| 115 void CredentialManagerClient::dispatchFailedSignIn( | 116 void CredentialManagerClient::dispatchFailedSignIn( |
| 116 const blink::WebCredential& credential, | 117 const blink::WebCredential& credential, |
| 117 blink::WebCredentialManagerClient::NotificationCallbacks* callbacks) { | 118 blink::WebCredentialManagerClient::NotificationCallbacks* callbacks) { |
| 118 int request_id = failed_sign_in_callbacks_.Add(callbacks); | 119 int request_id = failed_sign_in_callbacks_.Add(callbacks); |
| 119 CredentialInfo info(credential); | 120 CredentialInfo info(WebCredentialToCredentialInfo(credential)); |
| 120 Send(new CredentialManagerHostMsg_NotifyFailedSignIn( | 121 Send(new CredentialManagerHostMsg_NotifyFailedSignIn( |
| 121 routing_id(), request_id, info)); | 122 routing_id(), request_id, info)); |
| 122 } | 123 } |
| 123 | 124 |
| 124 void CredentialManagerClient::dispatchSignedIn( | 125 void CredentialManagerClient::dispatchSignedIn( |
| 125 const blink::WebCredential& credential, | 126 const blink::WebCredential& credential, |
| 126 blink::WebCredentialManagerClient::NotificationCallbacks* callbacks) { | 127 blink::WebCredentialManagerClient::NotificationCallbacks* callbacks) { |
| 127 int request_id = signed_in_callbacks_.Add(callbacks); | 128 int request_id = signed_in_callbacks_.Add(callbacks); |
| 128 CredentialInfo info(credential); | 129 CredentialInfo info(WebCredentialToCredentialInfo(credential)); |
| 129 Send(new CredentialManagerHostMsg_NotifySignedIn( | 130 Send(new CredentialManagerHostMsg_NotifySignedIn( |
| 130 routing_id(), request_id, info)); | 131 routing_id(), request_id, info)); |
| 131 } | 132 } |
| 132 | 133 |
| 133 void CredentialManagerClient::dispatchSignedOut( | 134 void CredentialManagerClient::dispatchSignedOut( |
| 134 NotificationCallbacks* callbacks) { | 135 NotificationCallbacks* callbacks) { |
| 135 int request_id = signed_out_callbacks_.Add(callbacks); | 136 int request_id = signed_out_callbacks_.Add(callbacks); |
| 136 Send(new CredentialManagerHostMsg_NotifySignedOut(routing_id(), request_id)); | 137 Send(new CredentialManagerHostMsg_NotifySignedOut(routing_id(), request_id)); |
| 137 } | 138 } |
| 138 | 139 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 152 int request_id, | 153 int request_id, |
| 153 CredentialManagerClient::NotificationCallbacksMap* map) { | 154 CredentialManagerClient::NotificationCallbacksMap* map) { |
| 154 blink::WebCredentialManagerClient::NotificationCallbacks* callbacks = | 155 blink::WebCredentialManagerClient::NotificationCallbacks* callbacks = |
| 155 map->Lookup(request_id); | 156 map->Lookup(request_id); |
| 156 DCHECK(callbacks); | 157 DCHECK(callbacks); |
| 157 callbacks->onSuccess(); | 158 callbacks->onSuccess(); |
| 158 map->Remove(request_id); | 159 map->Remove(request_id); |
| 159 } | 160 } |
| 160 | 161 |
| 161 } // namespace password_manager | 162 } // namespace password_manager |
| OLD | NEW |