Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: ios/chrome/browser/passwords/credential_manager.mm

Issue 2592653003: Avoid use-after-free in FormFetcherImpl (Closed)
Patch Set: Posting CMPFM method instead of the delegate method Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #import "ios/chrome/browser/passwords/credential_manager.h" 5 #import "ios/chrome/browser/passwords/credential_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #import "base/ios/weak_nsobject.h" 9 #import "base/ios/weak_nsobject.h"
10 #include "base/mac/bind_objc_block.h" 10 #include "base/mac/bind_objc_block.h"
11 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
12 #include "base/strings/sys_string_conversions.h" 12 #include "base/strings/sys_string_conversions.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "components/password_manager/core/browser/form_fetcher.h"
15 #include "components/password_manager/core/browser/form_saver.h"
vasilii 2016/12/21 11:00:49 unused?
vabr (Chromium) 2016/12/21 11:35:25 One of them. Done.
14 #include "components/password_manager/core/browser/password_store_consumer.h" 16 #include "components/password_manager/core/browser/password_store_consumer.h"
15 #include "components/password_manager/core/common/credential_manager_types.h" 17 #include "components/password_manager/core/common/credential_manager_types.h"
16 #include "components/password_manager/core/common/password_manager_pref_names.h" 18 #include "components/password_manager/core/common/password_manager_pref_names.h"
17 #import "ios/chrome/browser/passwords/js_credential_manager.h" 19 #import "ios/chrome/browser/passwords/js_credential_manager.h"
18 #import "ios/web/public/url_scheme_util.h" 20 #import "ios/web/public/url_scheme_util.h"
19 #include "ios/web/public/web_state/credential.h" 21 #include "ios/web/public/web_state/credential.h"
20 #include "ios/web/public/web_state/url_verification_constants.h" 22 #include "ios/web/public/web_state/url_verification_constants.h"
21 #include "ios/web/public/web_state/web_state.h" 23 #include "ios/web/public/web_state/web_state.h"
22 #include "url/origin.h" 24 #include "url/origin.h"
23 25
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 CredentialInfoFromWebCredential(credential), page_url)); 201 CredentialInfoFromWebCredential(credential), page_url));
200 form->skip_zero_click = !IsZeroClickAllowed(); 202 form->skip_zero_click = !IsZeroClickAllowed();
201 203
202 // TODO(mkwst): This is a stub; we should be checking the PasswordStore to 204 // TODO(mkwst): This is a stub; we should be checking the PasswordStore to
203 // determine whether or not the credential exists, and calling UpdateLogin 205 // determine whether or not the credential exists, and calling UpdateLogin
204 // accordingly. 206 // accordingly.
205 form_manager_.reset( 207 form_manager_.reset(
206 new password_manager::CredentialManagerPasswordFormManager( 208 new password_manager::CredentialManagerPasswordFormManager(
207 client_, driver_->AsWeakPtr(), 209 client_, driver_->AsWeakPtr(),
208 *password_manager::CreateObservedPasswordFormFromOrigin(page_url), 210 *password_manager::CreateObservedPasswordFormFromOrigin(page_url),
209 std::move(form), this)); 211 std::move(form), this, nullptr, nullptr));
210 } 212 }
211 213
212 void CredentialManager::SignedOut(int request_id, const GURL& source_url) { 214 void CredentialManager::SignedOut(int request_id, const GURL& source_url) {
213 // Invoked when the page invokes navigator.credentials.notifySignedOut, this 215 // Invoked when the page invokes navigator.credentials.notifySignedOut, this
214 // function notifies the PasswordStore that zero-click sign-in should be 216 // function notifies the PasswordStore that zero-click sign-in should be
215 // disabled for the current page origin. 217 // disabled for the current page origin.
216 DCHECK_GE(request_id, 0); 218 DCHECK_GE(request_id, 0);
217 219
218 // Requests from untrusted origins should be rejected. 220 // Requests from untrusted origins should be rejected.
219 GURL page_url; 221 GURL page_url;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 bool CredentialManager::GetUrlWithAbsoluteTrust(GURL* page_url) { 364 bool CredentialManager::GetUrlWithAbsoluteTrust(GURL* page_url) {
363 web::URLVerificationTrustLevel trust_level = 365 web::URLVerificationTrustLevel trust_level =
364 web::URLVerificationTrustLevel::kNone; 366 web::URLVerificationTrustLevel::kNone;
365 const GURL possibly_untrusted_url(web_state()->GetCurrentURL(&trust_level)); 367 const GURL possibly_untrusted_url(web_state()->GetCurrentURL(&trust_level));
366 if (trust_level == web::URLVerificationTrustLevel::kAbsolute) { 368 if (trust_level == web::URLVerificationTrustLevel::kAbsolute) {
367 *page_url = possibly_untrusted_url; 369 *page_url = possibly_untrusted_url;
368 return true; 370 return true;
369 } 371 }
370 return false; 372 return false;
371 } 373 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698