Skip to content

Commit

Permalink
Revert "Cache protected password entry and password on focus ping sep…
Browse files Browse the repository at this point in the history
…arately."

This reverts commit dd1e509.

BUG=727942
TBR=isherman@chromium.org,raymes@chromium.org

Review-Url: https://codereview.chromium.org/2937853002 .
Cr-Commit-Position: refs/heads/master@{#479265}
  • Loading branch information
Jialiu Lin committed Jun 14, 2017
1 parent 4a043e4 commit d46c1c6
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 476 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,8 @@ ChromePasswordProtectionService::~ChromePasswordProtectionService() {
if (content_settings()) {
CleanUpExpiredVerdicts();
UMA_HISTOGRAM_COUNTS_1000(
"PasswordProtection.NumberOfCachedVerdictBeforeShutdown."
"PasswordOnFocus",
GetStoredVerdictCount(
LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE));
UMA_HISTOGRAM_COUNTS_1000(
"PasswordProtection.NumberOfCachedVerdictBeforeShutdown."
"ProtectedPasswordEntry",
GetStoredVerdictCount(
LoginReputationClientRequest::PASSWORD_REUSE_EVENT));
"PasswordProtection.NumberOfCachedVerdictBeforeShutdown",
GetStoredVerdictCount());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class MockChromePasswordProtectionService
}

void CacheVerdict(const GURL& url,
LoginReputationClientRequest::TriggerType trigger_type,
LoginReputationClientResponse* verdict,
const base::Time& receive_time) override {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ HistogramValue kHistogramValue[] = {
{CONTENT_SETTINGS_TYPE_PERMISSION_AUTOBLOCKER_DATA, 31},
{CONTENT_SETTINGS_TYPE_ADS, 32},
{CONTENT_SETTINGS_TYPE_ADS_DATA, 33},
{CONTENT_SETTINGS_TYPE_PASSWORD_PROTECTION, 34},
};

int ContentSettingTypeToHistogramValue(ContentSettingsType content_setting,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@ PasswordProtectionRequest::PasswordProtectionRequest(
password_form_action_(password_form_action),
password_form_frame_url_(password_form_frame_url),
saved_domain_(saved_domain),
trigger_type_(type),
request_type_(type),
password_field_exists_(password_field_exists),
password_protection_service_(pps),
request_timeout_in_ms_(request_timeout_in_ms),
weakptr_factory_(this) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(trigger_type_ == LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE ||
trigger_type_ == LoginReputationClientRequest::PASSWORD_REUSE_EVENT);
}

PasswordProtectionRequest::~PasswordProtectionRequest() {
Expand Down Expand Up @@ -87,7 +85,7 @@ void PasswordProtectionRequest::CheckCachedVerdicts() {
std::unique_ptr<LoginReputationClientResponse> cached_response =
base::MakeUnique<LoginReputationClientResponse>();
auto verdict = password_protection_service_->GetCachedVerdict(
main_frame_url_, trigger_type_, cached_response.get());
main_frame_url_, cached_response.get());
if (verdict != LoginReputationClientResponse::VERDICT_TYPE_UNSPECIFIED)
Finish(PasswordProtectionService::RESPONSE_ALREADY_CACHED,
std::move(cached_response));
Expand All @@ -98,19 +96,19 @@ void PasswordProtectionRequest::CheckCachedVerdicts() {
void PasswordProtectionRequest::FillRequestProto() {
request_proto_ = base::MakeUnique<LoginReputationClientRequest>();
request_proto_->set_page_url(main_frame_url_.spec());
request_proto_->set_trigger_type(trigger_type_);
password_protection_service_->FillUserPopulation(trigger_type_,
request_proto_->set_trigger_type(request_type_);
password_protection_service_->FillUserPopulation(request_type_,
request_proto_.get());
request_proto_->set_stored_verdict_cnt(
password_protection_service_->GetStoredVerdictCount(trigger_type_));
password_protection_service_->GetStoredVerdictCount());
LoginReputationClientRequest::Frame* main_frame =
request_proto_->add_frames();
main_frame->set_url(main_frame_url_.spec());
main_frame->set_frame_index(0 /* main frame */);
password_protection_service_->FillReferrerChain(
main_frame_url_, -1 /* tab id not available */, main_frame);

switch (trigger_type_) {
switch (request_type_) {
case LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE: {
LoginReputationClientRequest::Frame::Form* password_form;
if (password_form_frame_url_ == main_frame_url_) {
Expand Down Expand Up @@ -249,7 +247,7 @@ void PasswordProtectionRequest::Finish(
DCHECK_CURRENTLY_ON(BrowserThread::UI);
tracker_.TryCancelAll();

if (trigger_type_ == LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE) {
if (request_type_ == LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE) {
UMA_HISTOGRAM_ENUMERATION(kPasswordOnFocusRequestOutcomeHistogramName,
outcome, PasswordProtectionService::MAX_OUTCOME);
} else {
Expand All @@ -258,7 +256,7 @@ void PasswordProtectionRequest::Finish(
}

if (outcome == PasswordProtectionService::SUCCEEDED && response) {
switch (trigger_type_) {
switch (request_type_) {
case LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE:
UMA_HISTOGRAM_ENUMERATION(
"PasswordProtection.Verdict.PasswordFieldOnFocus",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class PasswordProtectionRequest : public base::RefCountedThreadSafe<

content::WebContents* web_contents() const { return web_contents_; }

LoginReputationClientRequest::TriggerType trigger_type() const {
return trigger_type_;
LoginReputationClientRequest::TriggerType request_type() const {
return request_type_;
}

private:
Expand Down Expand Up @@ -129,7 +129,7 @@ class PasswordProtectionRequest : public base::RefCountedThreadSafe<
const std::string saved_domain_;

// If this request is for unfamiliar login page or for a password reuse event.
const LoginReputationClientRequest::TriggerType trigger_type_;
const LoginReputationClientRequest::TriggerType request_type_;

// If there is a password field on the page.
const bool password_field_exists_;
Expand Down
Loading

0 comments on commit d46c1c6

Please sign in to comment.