Chromium Code Reviews| Index: chrome/browser/password_manager/chrome_password_manager_client.cc |
| diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc |
| index ab2f0d809b36cca89f7ca3ab0c5df4836e784696..6b471e1380aa937362d7d6ca7cbf9b5c955b115a 100644 |
| --- a/chrome/browser/password_manager/chrome_password_manager_client.cc |
| +++ b/chrome/browser/password_manager/chrome_password_manager_client.cc |
| @@ -29,6 +29,7 @@ |
| #include "components/password_manager/content/browser/password_manager_internals_service_factory.h" |
| #include "components/password_manager/content/common/credential_manager_messages.h" |
| #include "components/password_manager/content/common/credential_manager_types.h" |
| +#include "components/password_manager/core/browser/browser_save_password_progress_logger.h" |
| #include "components/password_manager/core/browser/log_receiver.h" |
| #include "components/password_manager/core/browser/password_form_manager.h" |
| #include "components/password_manager/core/browser/password_manager.h" |
| @@ -51,6 +52,10 @@ using password_manager::PasswordManagerInternalsServiceFactory; |
| DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); |
| +// Shorten the name to spare line breaks. The code provides enough context |
| +// already. |
| +typedef autofill::SavePasswordProgressLogger Logger; |
| + |
| // static |
| void ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient( |
| content::WebContents* contents, |
| @@ -290,6 +295,32 @@ bool ChromePasswordManagerClient::IsLoggingActive() const { |
| return can_use_log_router_ && !web_contents()->GetWebUI(); |
| } |
| +bool ChromePasswordManagerClient::WasLastNavigationHTTPError() const { |
| + DCHECK(web_contents()); |
| + |
| + scoped_ptr<password_manager::BrowserSavePasswordProgressLogger> logger; |
| + if (IsLoggingActive()) { |
| + ChromePasswordManagerClient* client = |
|
vabr (Chromium)
2014/11/18 10:10:11
Don't retrieve the |client| and use |this| instead
Sunil Ratnu
2014/11/18 12:58:39
The function had const in its signature. Hence, I
vabr (Chromium)
2014/11/18 14:22:49
This should be fixed by https://codereview.chromiu
|
| + ChromePasswordManagerClient::FromWebContents(web_contents()); |
| + logger.reset( |
| + new password_manager::BrowserSavePasswordProgressLogger(client)); |
| + logger->LogMessage(Logger::STRING_WAS_LAST_NAVIGATION_HTTP_ERROR); |
| + } |
| + |
| + content::NavigationEntry* entry = |
| + web_contents()->GetController().GetVisibleEntry(); |
| + if (!entry) |
| + return false; |
| + int http_status_code = entry->GetHttpStatusCode(); |
| + |
| + if (logger) |
| + logger->LogNumber(Logger::STRING_HTTP_STATUS_CODE, http_status_code); |
| + |
| + if (http_status_code >= 400 && http_status_code < 600) |
| + return true; |
| + return false; |
| +} |
| + |
| // static |
| password_manager::PasswordGenerationManager* |
| ChromePasswordManagerClient::GetGenerationManagerFromWebContents( |