diff options
author | vabr <vabr@chromium.org> | 2014-11-26 03:14:35 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-26 11:15:25 +0000 |
commit | 571c0900d12308700ca1f0bb9e62b087788d00ae (patch) | |
tree | d81e230dde87a45125a18332ce74c277b4c74f8a | |
parent | 6f5d6498cbbb0a3730b0552de4be8a249f84a73d (diff) | |
download | chromium_src-571c0900d12308700ca1f0bb9e62b087788d00ae.zip chromium_src-571c0900d12308700ca1f0bb9e62b087788d00ae.tar.gz chromium_src-571c0900d12308700ca1f0bb9e62b087788d00ae.tar.bz2 |
More logs for proxy auth in chrome://password-manager-internals/
This CL adds some more information about password manager, in particular the case of a HTTP authentication, to the logs gathered in chrome://password-manager-internals/. This should help investigate the associated bug, which so far was not reproduced by the developer.
BUG=423327
Review URL: https://codereview.chromium.org/756143002
Cr-Commit-Position: refs/heads/master@{#305799}
5 files changed, 100 insertions, 2 deletions
diff --git a/chrome/browser/ui/login/login_prompt.cc b/chrome/browser/ui/login/login_prompt.cc index 8200bb2..99cc885 100644 --- a/chrome/browser/ui/login/login_prompt.cc +++ b/chrome/browser/ui/login/login_prompt.cc @@ -468,6 +468,13 @@ void ShowLoginPrompt(const GURL& request_url, return; } + if (password_manager && password_manager->client()->IsLoggingActive()) { + password_manager::BrowserSavePasswordProgressLogger logger( + password_manager->client()); + logger.LogMessage( + autofill::SavePasswordProgressLogger::STRING_SHOW_LOGIN_PROMPT_METHOD); + } + // Tell the password manager to look for saved passwords. std::vector<PasswordForm> v; MakeInputForPasswordManager(request_url, auth_info, handler, &v); diff --git a/components/autofill/core/common/save_password_progress_logger.cc b/components/autofill/core/common/save_password_progress_logger.cc index 7c7be97..d74997a 100644 --- a/components/autofill/core/common/save_password_progress_logger.cc +++ b/components/autofill/core/common/save_password_progress_logger.cc @@ -179,6 +179,30 @@ std::string GetStringFromID(SavePasswordProgressLogger::StringID id) { case SavePasswordProgressLogger::STRING_PROVISIONALLY_SAVED_FORM_IS_NOT_HTML: return "Provisionally saved form is not HTML"; + case SavePasswordProgressLogger::STRING_ON_REQUEST_DONE_METHOD: + return "PasswordFormManager::OnRequestDone"; + case SavePasswordProgressLogger::STRING_BEST_SCORE: + return "best_score"; + case SavePasswordProgressLogger::STRING_ON_GET_STORE_RESULTS_METHOD: + return "PasswordFormManager::OnGetPasswordStoreResults"; + case SavePasswordProgressLogger::STRING_NUMBER_RESULTS: + return "Number of results from the password store"; + case SavePasswordProgressLogger::STRING_FETCH_LOGINS_METHOD: + return "PasswordFormManager::FetchMatchingLoginsFromPasswordStore"; + case SavePasswordProgressLogger::STRING_NO_STORE: + return "PasswordStore is not available"; + case SavePasswordProgressLogger::STRING_CREATE_LOGIN_MANAGERS_METHOD: + return "PasswordManager::CreatePendingLoginManagers"; + case SavePasswordProgressLogger::STRING_OLD_NUMBER_LOGIN_MANAGERS: + return "Number of pending login managers (before)"; + case SavePasswordProgressLogger::STRING_NEW_NUMBER_LOGIN_MANAGERS: + return "Number of pending login managers (after)"; + case SavePasswordProgressLogger::STRING_ENABLED_FOR_CURRENT_PAGE_METHOD: + return "PasswordManager::IsEnabledForCurrentPage"; + case SavePasswordProgressLogger::STRING_CLIENT_CHECK_PRESENT: + return "IsPasswordManagerEnabledForCurrentPage"; + case SavePasswordProgressLogger::STRING_SHOW_LOGIN_PROMPT_METHOD: + return "ShowLoginPrompt"; case SavePasswordProgressLogger::STRING_INVALID: return "INVALID"; // Intentionally no default: clause here -- all IDs need to get covered. diff --git a/components/autofill/core/common/save_password_progress_logger.h b/components/autofill/core/common/save_password_progress_logger.h index dd2d2b9..c6c61d3 100644 --- a/components/autofill/core/common/save_password_progress_logger.h +++ b/components/autofill/core/common/save_password_progress_logger.h @@ -106,6 +106,18 @@ class SavePasswordProgressLogger { STRING_WAS_LAST_NAVIGATION_HTTP_ERROR_METHOD, STRING_HTTP_STATUS_CODE, STRING_PROVISIONALLY_SAVED_FORM_IS_NOT_HTML, + STRING_ON_REQUEST_DONE_METHOD, + STRING_BEST_SCORE, + STRING_ON_GET_STORE_RESULTS_METHOD, + STRING_NUMBER_RESULTS, + STRING_FETCH_LOGINS_METHOD, + STRING_NO_STORE, + STRING_CREATE_LOGIN_MANAGERS_METHOD, + STRING_OLD_NUMBER_LOGIN_MANAGERS, + STRING_NEW_NUMBER_LOGIN_MANAGERS, + STRING_ENABLED_FOR_CURRENT_PAGE_METHOD, + STRING_CLIENT_CHECK_PRESENT, + STRING_SHOW_LOGIN_PROMPT_METHOD, STRING_INVALID, // Represents a string returned in a case of an error. STRING_MAX = STRING_INVALID }; diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc index 4dd75b5..e3962a7 100644 --- a/components/password_manager/core/browser/password_form_manager.cc +++ b/components/password_manager/core/browser/password_form_manager.cc @@ -16,6 +16,7 @@ #include "components/autofill/core/browser/form_structure.h" #include "components/autofill/core/browser/validation.h" #include "components/autofill/core/common/password_form.h" +#include "components/password_manager/core/browser/browser_save_password_progress_logger.h" #include "components/password_manager/core/browser/password_manager.h" #include "components/password_manager/core/browser/password_manager_client.h" #include "components/password_manager/core/browser/password_manager_driver.h" @@ -26,6 +27,10 @@ using autofill::PasswordForm; using autofill::PasswordFormMap; using base::Time; +// Shorten the name to spare line breaks. The code provides enough context +// already. +typedef autofill::SavePasswordProgressLogger Logger; + namespace password_manager { namespace { @@ -351,8 +356,17 @@ void PasswordFormManager::FetchMatchingLoginsFromPasswordStore( PasswordStore::AuthorizationPromptPolicy prompt_policy) { DCHECK_EQ(state_, PRE_MATCHING_PHASE); state_ = MATCHING_PHASE; + + scoped_ptr<BrowserSavePasswordProgressLogger> logger; + if (client_->IsLoggingActive()) { + logger.reset(new BrowserSavePasswordProgressLogger(client_)); + logger->LogMessage(Logger::STRING_FETCH_LOGINS_METHOD); + } + PasswordStore* password_store = client_->GetPasswordStore(); if (!password_store) { + if (logger) + logger->LogMessage(Logger::STRING_NO_STORE); NOTREACHED(); return; } @@ -369,6 +383,12 @@ void PasswordFormManager::OnRequestDone( // the PasswordForm objects pointed to by the result vector, thus we keep // copies to a minimum here. + scoped_ptr<BrowserSavePasswordProgressLogger> logger; + if (client_->IsLoggingActive()) { + logger.reset(new BrowserSavePasswordProgressLogger(client_)); + logger->LogMessage(Logger::STRING_ON_REQUEST_DONE_METHOD); + } + int best_score = 0; // These credentials will be in the final result regardless of score. std::vector<PasswordForm> credentials_to_keep; @@ -442,6 +462,8 @@ void PasswordFormManager::OnRequestDone( // If no saved forms can be used, then it isn't blacklisted and generation // should be allowed. driver_->AllowPasswordGenerationForForm(observed_form_); + if (logger) + logger->LogNumber(Logger::STRING_BEST_SCORE, best_score); return; } @@ -498,6 +520,13 @@ void PasswordFormManager::OnGetPasswordStoreResults( const std::vector<autofill::PasswordForm*>& results) { DCHECK_EQ(state_, MATCHING_PHASE); + scoped_ptr<BrowserSavePasswordProgressLogger> logger; + if (client_->IsLoggingActive()) { + logger.reset(new BrowserSavePasswordProgressLogger(client_)); + logger->LogMessage(Logger::STRING_ON_GET_STORE_RESULTS_METHOD); + logger->LogNumber(Logger::STRING_NUMBER_RESULTS, results.size()); + } + if (results.empty()) { state_ = POST_MATCHING_PHASE; // No result means that we visit this site the first time so we don't need diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc index 26baf90..0db0b4b 100644 --- a/components/password_manager/core/browser/password_manager.cc +++ b/components/password_manager/core/browser/password_manager.cc @@ -164,8 +164,18 @@ void PasswordManager::SetFormHasGeneratedPassword(const PasswordForm& form) { } bool PasswordManager::IsEnabledForCurrentPage() const { - return !driver_->DidLastPageLoadEncounterSSLErrors() && - client_->IsPasswordManagerEnabledForCurrentPage(); + bool ssl_errors = driver_->DidLastPageLoadEncounterSSLErrors(); + bool client_check = client_->IsPasswordManagerEnabledForCurrentPage(); + + scoped_ptr<BrowserSavePasswordProgressLogger> logger; + if (client_->IsLoggingActive()) { + logger.reset(new BrowserSavePasswordProgressLogger(client_)); + logger->LogMessage(Logger::STRING_ENABLED_FOR_CURRENT_PAGE_METHOD); + logger->LogBoolean(Logger::STRING_SSL_ERRORS_PRESENT, ssl_errors); + logger->LogBoolean(Logger::STRING_CLIENT_CHECK_PRESENT, client_check); + } + + return !ssl_errors && client_check; } bool PasswordManager::IsSavingEnabledForCurrentPage() const { @@ -387,9 +397,20 @@ void PasswordManager::OnPasswordFormsParsed( void PasswordManager::CreatePendingLoginManagers( const std::vector<PasswordForm>& forms) { + scoped_ptr<BrowserSavePasswordProgressLogger> logger; + if (client_->IsLoggingActive()) { + logger.reset(new BrowserSavePasswordProgressLogger(client_)); + logger->LogMessage(Logger::STRING_CREATE_LOGIN_MANAGERS_METHOD); + } + if (!IsEnabledForCurrentPage()) return; + if (logger) { + logger->LogNumber(Logger::STRING_OLD_NUMBER_LOGIN_MANAGERS, + pending_login_managers_.size()); + } + // Copy the weak pointers to the currently known login managers for comparison // against the newly added. std::vector<PasswordFormManager*> old_login_managers( @@ -422,6 +443,11 @@ void PasswordManager::CreatePendingLoginManagers( manager->FetchMatchingLoginsFromPasswordStore(prompt_policy); } + + if (logger) { + logger->LogNumber(Logger::STRING_NEW_NUMBER_LOGIN_MANAGERS, + pending_login_managers_.size()); + } } bool PasswordManager::ShouldPromptUserToSavePassword() const { |