| 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_content_
utils.h" |
| 8 #include "components/password_manager/content/common/credential_manager_messages
.h" | 8 #include "components/password_manager/content/common/credential_manager_messages
.h" |
| 9 #include "components/password_manager/core/common/credential_manager_types.h" | 9 #include "components/password_manager/core/common/credential_manager_types.h" |
| 10 #include "content/public/renderer/render_view.h" | 10 #include "content/public/renderer/render_view.h" |
| 11 #include "third_party/WebKit/public/platform/WebCredential.h" | 11 #include "third_party/WebKit/public/platform/WebCredential.h" |
| 12 #include "third_party/WebKit/public/platform/WebCredentialManagerError.h" | 12 #include "third_party/WebKit/public/platform/WebCredentialManagerError.h" |
| 13 #include "third_party/WebKit/public/platform/WebFederatedCredential.h" | 13 #include "third_party/WebKit/public/platform/WebFederatedCredential.h" |
| 14 #include "third_party/WebKit/public/platform/WebLocalCredential.h" | 14 #include "third_party/WebKit/public/platform/WebPasswordCredential.h" |
| 15 #include "third_party/WebKit/public/web/WebView.h" | 15 #include "third_party/WebKit/public/web/WebView.h" |
| 16 | 16 |
| 17 namespace password_manager { | 17 namespace password_manager { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 template <typename T> | 21 template <typename T> |
| 22 void ClearCallbacksMapWithErrors(T* callbacks_map) { | 22 void ClearCallbacksMapWithErrors(T* callbacks_map) { |
| 23 typename T::iterator iter(callbacks_map); | 23 typename T::iterator iter(callbacks_map); |
| 24 while (!iter.IsAtEnd()) { | 24 while (!iter.IsAtEnd()) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 void CredentialManagerClient::OnSendCredential(int request_id, | 80 void CredentialManagerClient::OnSendCredential(int request_id, |
| 81 const CredentialInfo& info) { | 81 const CredentialInfo& info) { |
| 82 RequestCallbacks* callbacks = request_callbacks_.Lookup(request_id); | 82 RequestCallbacks* callbacks = request_callbacks_.Lookup(request_id); |
| 83 DCHECK(callbacks); | 83 DCHECK(callbacks); |
| 84 scoped_ptr<blink::WebCredential> credential = nullptr; | 84 scoped_ptr<blink::WebCredential> credential = nullptr; |
| 85 switch (info.type) { | 85 switch (info.type) { |
| 86 case CredentialType::CREDENTIAL_TYPE_FEDERATED: | 86 case CredentialType::CREDENTIAL_TYPE_FEDERATED: |
| 87 credential.reset(new blink::WebFederatedCredential( | 87 credential.reset(new blink::WebFederatedCredential( |
| 88 info.id, info.federation, info.name, info.avatar)); | 88 info.id, info.federation, info.name, info.avatar)); |
| 89 break; | 89 break; |
| 90 case CredentialType::CREDENTIAL_TYPE_LOCAL: | 90 case CredentialType::CREDENTIAL_TYPE_PASSWORD: |
| 91 credential.reset(new blink::WebLocalCredential( | 91 credential.reset(new blink::WebPasswordCredential( |
| 92 info.id, info.password, info.name, info.avatar)); | 92 info.id, info.password, info.name, info.avatar)); |
| 93 break; | 93 break; |
| 94 case CredentialType::CREDENTIAL_TYPE_EMPTY: | 94 case CredentialType::CREDENTIAL_TYPE_EMPTY: |
| 95 // Intentionally empty; we'll send nullptr to the onSuccess call below. | 95 // Intentionally empty; we'll send nullptr to the onSuccess call below. |
| 96 break; | 96 break; |
| 97 } | 97 } |
| 98 callbacks->onSuccess(credential.get()); | 98 callbacks->onSuccess(credential.get()); |
| 99 request_callbacks_.Remove(request_id); | 99 request_callbacks_.Remove(request_id); |
| 100 } | 100 } |
| 101 | 101 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 int request_id, | 153 int request_id, |
| 154 CredentialManagerClient::NotificationCallbacksMap* map) { | 154 CredentialManagerClient::NotificationCallbacksMap* map) { |
| 155 blink::WebCredentialManagerClient::NotificationCallbacks* callbacks = | 155 blink::WebCredentialManagerClient::NotificationCallbacks* callbacks = |
| 156 map->Lookup(request_id); | 156 map->Lookup(request_id); |
| 157 DCHECK(callbacks); | 157 DCHECK(callbacks); |
| 158 callbacks->onSuccess(); | 158 callbacks->onSuccess(); |
| 159 map->Remove(request_id); | 159 map->Remove(request_id); |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace password_manager | 162 } // namespace password_manager |
| OLD | NEW |