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/content_credential_manager
_dispatcher.h" | 5 #include "components/password_manager/content/browser/content_credential_manager
_dispatcher.h" |
6 | 6 |
7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/autofill/core/common/password_form.h" | 9 #include "components/autofill/core/common/password_form.h" |
10 #include "components/password_manager/content/common/credential_manager_messages
.h" | 10 #include "components/password_manager/content/common/credential_manager_messages
.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id)); | 70 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id)); |
71 } | 71 } |
72 | 72 |
73 void ContentCredentialManagerDispatcher::OnRequestCredential( | 73 void ContentCredentialManagerDispatcher::OnRequestCredential( |
74 int request_id, | 74 int request_id, |
75 bool /* zero_click_only */, | 75 bool /* zero_click_only */, |
76 const std::vector<GURL>& federations) { | 76 const std::vector<GURL>& federations) { |
77 DCHECK(request_id); | 77 DCHECK(request_id); |
78 PasswordStore* store = GetPasswordStore(); | 78 PasswordStore* store = GetPasswordStore(); |
79 if (pending_request_id_ || !store) { | 79 if (pending_request_id_ || !store) { |
80 // TODO(mkwst): Reject the promise if we can't get to the password store, or | 80 web_contents()->GetRenderViewHost()->Send( |
81 // if we're already requesting credentials. | 81 new CredentialManagerMsg_RejectCredentialRequest( |
| 82 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id)); |
| 83 return; |
82 } | 84 } |
83 | 85 |
84 pending_request_id_ = request_id; | 86 pending_request_id_ = request_id; |
85 | 87 |
86 autofill::PasswordForm form; | 88 autofill::PasswordForm form; |
87 form.scheme = autofill::PasswordForm::SCHEME_HTML; | 89 form.scheme = autofill::PasswordForm::SCHEME_HTML; |
88 form.origin = web_contents()->GetLastCommittedURL().GetOrigin(); | 90 form.origin = web_contents()->GetLastCommittedURL().GetOrigin(); |
89 form.signon_realm = form.origin.spec(); | 91 form.signon_realm = form.origin.spec(); |
90 | 92 |
91 store->GetLogins(form, PasswordStore::DISALLOW_PROMPT, this); | 93 store->GetLogins(form, PasswordStore::DISALLOW_PROMPT, this); |
(...skipping 14 matching lines...) Expand all Loading... |
106 pending_request_id_, | 108 pending_request_id_, |
107 info)); | 109 info)); |
108 pending_request_id_ = 0; | 110 pending_request_id_ = 0; |
109 } | 111 } |
110 | 112 |
111 PasswordStore* ContentCredentialManagerDispatcher::GetPasswordStore() { | 113 PasswordStore* ContentCredentialManagerDispatcher::GetPasswordStore() { |
112 return client_ ? client_->GetPasswordStore() : nullptr; | 114 return client_ ? client_->GetPasswordStore() : nullptr; |
113 } | 115 } |
114 | 116 |
115 } // namespace password_manager | 117 } // namespace password_manager |
OLD | NEW |