| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/password_controller.h" | 5 #import "ios/chrome/browser/passwords/password_controller.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 - (void)webStateDidLoadPage:(web::WebState*)webState { | 332 - (void)webStateDidLoadPage:(web::WebState*)webState { |
| 333 // Clear per-page state. | 333 // Clear per-page state. |
| 334 formData_.reset(); | 334 formData_.reset(); |
| 335 | 335 |
| 336 // Retrieve the identity of the page. In case the page might be malicous, | 336 // Retrieve the identity of the page. In case the page might be malicous, |
| 337 // returns early. | 337 // returns early. |
| 338 GURL pageURL; | 338 GURL pageURL; |
| 339 if (!GetPageURLAndCheckTrustLevel(webState, &pageURL)) | 339 if (!GetPageURLAndCheckTrustLevel(webState, &pageURL)) |
| 340 return; | 340 return; |
| 341 | 341 |
| 342 if (!web::UrlHasWebScheme(pageURL) || !webState->ContentIsHTML()) | 342 if (!web::UrlHasWebScheme(pageURL)) |
| 343 return; | 343 return; |
| 344 | 344 |
| 345 // Notify the password manager that the page loaded so it can clear its own | 345 // Notify the password manager that the page loaded so it can clear its own |
| 346 // per-page state. | 346 // per-page state. |
| 347 passwordManager_->DidNavigateMainFrame(); | 347 passwordManager_->DidNavigateMainFrame(); |
| 348 | 348 |
| 349 if (!webState->ContentIsHTML()) { |
| 350 // If the current page is not HTML, it does not contain any HTML forms. |
| 351 [self |
| 352 didFinishPasswordFormExtraction:std::vector<autofill::PasswordForm>()]; |
| 353 } |
| 354 |
| 349 // Read all password forms from the page and send them to the password | 355 // Read all password forms from the page and send them to the password |
| 350 // manager. | 356 // manager. |
| 351 base::WeakNSObject<PasswordController> weakSelf(self); | 357 base::WeakNSObject<PasswordController> weakSelf(self); |
| 352 [self findPasswordFormsWithCompletionHandler:^( | 358 [self findPasswordFormsWithCompletionHandler:^( |
| 353 const std::vector<autofill::PasswordForm>& forms) { | 359 const std::vector<autofill::PasswordForm>& forms) { |
| 354 [weakSelf didFinishPasswordFormExtraction:forms]; | 360 [weakSelf didFinishPasswordFormExtraction:forms]; |
| 355 }]; | 361 }]; |
| 356 } | 362 } |
| 357 | 363 |
| 358 - (void)webState:(web::WebState*)webState | 364 - (void)webState:(web::WebState*)webState |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 | 796 |
| 791 - (PasswordManager*)passwordManager { | 797 - (PasswordManager*)passwordManager { |
| 792 return passwordManager_.get(); | 798 return passwordManager_.get(); |
| 793 } | 799 } |
| 794 | 800 |
| 795 - (JsPasswordManager*)passwordJsManager { | 801 - (JsPasswordManager*)passwordJsManager { |
| 796 return passwordJsManager_; | 802 return passwordJsManager_; |
| 797 } | 803 } |
| 798 | 804 |
| 799 @end | 805 @end |
| OLD | NEW |