Commit 12f71c60 authored by jhawkins@chromium.org's avatar jhawkins@chromium.org

DOMUI: Cancel pending queries to the PasswordStore on destruction to avoid

being notified after the object has been destroyed.

BUG=69441
TEST=none

Review URL: http://codereview.chromium.org/6299014

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72092 0039d316-1c4b-4281-b951-d872f2087c98
parent 37aee1c3
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -153,6 +153,19 @@ void PasswordManagerHandler::SetPasswordExceptionList() { ...@@ -153,6 +153,19 @@ void PasswordManagerHandler::SetPasswordExceptionList() {
L"PasswordManager.setPasswordExceptionsList", entries); L"PasswordManager.setPasswordExceptionsList", entries);
} }
PasswordManagerHandler::ListPopulater::ListPopulater(
PasswordManagerHandler* page) : page_(page),
pending_login_query_(0) {
}
PasswordManagerHandler::ListPopulater::~ListPopulater() {
page_->GetPasswordStore()->CancelLoginsQuery(pending_login_query_);
}
PasswordManagerHandler::PasswordListPopulater::PasswordListPopulater(
PasswordManagerHandler* page) : ListPopulater(page) {
}
void PasswordManagerHandler::PasswordListPopulater::Populate() { void PasswordManagerHandler::PasswordListPopulater::Populate() {
DCHECK(!pending_login_query_); DCHECK(!pending_login_query_);
PasswordStore* store = page_->GetPasswordStore(); PasswordStore* store = page_->GetPasswordStore();
...@@ -171,6 +184,11 @@ void PasswordManagerHandler::PasswordListPopulater:: ...@@ -171,6 +184,11 @@ void PasswordManagerHandler::PasswordListPopulater::
page_->SetPasswordList(); page_->SetPasswordList();
} }
PasswordManagerHandler::PasswordExceptionListPopulater::
PasswordExceptionListPopulater(PasswordManagerHandler* page)
: ListPopulater(page) {
}
void PasswordManagerHandler::PasswordExceptionListPopulater::Populate() { void PasswordManagerHandler::PasswordExceptionListPopulater::Populate() {
DCHECK(!pending_login_query_); DCHECK(!pending_login_query_);
PasswordStore* store = page_->GetPasswordStore(); PasswordStore* store = page_->GetPasswordStore();
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -56,10 +56,8 @@ class PasswordManagerHandler : public OptionsPageUIHandler { ...@@ -56,10 +56,8 @@ class PasswordManagerHandler : public OptionsPageUIHandler {
// A short class to mediate requests to the password store. // A short class to mediate requests to the password store.
class ListPopulater : public PasswordStoreConsumer { class ListPopulater : public PasswordStoreConsumer {
public: public:
explicit ListPopulater(PasswordManagerHandler* page) explicit ListPopulater(PasswordManagerHandler* page);
: page_(page), virtual ~ListPopulater();
pending_login_query_(0) {
}
// Send a query to the password store to populate a list. // Send a query to the password store to populate a list.
virtual void Populate() = 0; virtual void Populate() = 0;
...@@ -76,9 +74,7 @@ class PasswordManagerHandler : public OptionsPageUIHandler { ...@@ -76,9 +74,7 @@ class PasswordManagerHandler : public OptionsPageUIHandler {
// A short class to mediate requests to the password store for passwordlist. // A short class to mediate requests to the password store for passwordlist.
class PasswordListPopulater : public ListPopulater { class PasswordListPopulater : public ListPopulater {
public: public:
explicit PasswordListPopulater(PasswordManagerHandler* page) explicit PasswordListPopulater(PasswordManagerHandler* page);
: ListPopulater(page) {
}
// Send a query to the password store to populate a password list. // Send a query to the password store to populate a password list.
virtual void Populate(); virtual void Populate();
...@@ -91,9 +87,7 @@ class PasswordManagerHandler : public OptionsPageUIHandler { ...@@ -91,9 +87,7 @@ class PasswordManagerHandler : public OptionsPageUIHandler {
// A short class to mediate requests to the password store for exceptions. // A short class to mediate requests to the password store for exceptions.
class PasswordExceptionListPopulater : public ListPopulater { class PasswordExceptionListPopulater : public ListPopulater {
public: public:
explicit PasswordExceptionListPopulater( explicit PasswordExceptionListPopulater(PasswordManagerHandler* page);
PasswordManagerHandler* page) : ListPopulater(page) {
}
// Send a query to the password store to populate a passwordException list. // Send a query to the password store to populate a passwordException list.
virtual void Populate(); virtual void Populate();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment