Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: chrome/browser/password_manager/password_store_consumer.h

Issue 6646051: Fix DCHECK, memory leak, and refactor PasswordStore to use CancelableRequest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use non-zero tests until http://crbug.com/77650 is addressed. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/password_manager/password_store_consumer.h
diff --git a/chrome/browser/password_manager/password_store_consumer.h b/chrome/browser/password_manager/password_store_consumer.h
new file mode 100644
index 0000000000000000000000000000000000000000..ad399d78c0a10e522e8af5488624a0bb211de9f1
--- /dev/null
+++ b/chrome/browser/password_manager/password_store_consumer.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_CONSUMER_H_
+#define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_CONSUMER_H_
+#pragma once
+
+#include "content/browser/cancelable_request.h"
+
+namespace webkit_glue {
+struct PasswordForm;
+};
+
+// Reads from the PasswordStore are done asynchrously on a separate
+// thread. PasswordStoreConsumer provides the virtual callback method, which is
+// guaranteed to be executed on this (the UI) thread. It also provides the
+// CancelableRequestConsumer member, which cancels any outstanding requests upon
+// destruction.
+class PasswordStoreConsumer {
+ public:
+ // Call this when the request is finished. If there are no results, call it
+ // anyway with an empty vector.
+ virtual void OnPasswordStoreRequestDone(
+ CancelableRequestProvider::Handle handle,
+ const std::vector<webkit_glue::PasswordForm*>& result) = 0;
+
+ // The CancelableRequest framework needs both a callback (the
+ // PasswordStoreConsumer::OnPasswordStoreRequestDone) as well as a
+ // CancelableRequestConsumer. This accessor makes the API simpler for callers
+ // as PasswordStore can get both from the PasswordStoreConsumer.
+ CancelableRequestConsumerBase* cancelable_consumer() {
+ return &cancelable_consumer_;
+ }
+
+ protected:
+ virtual ~PasswordStoreConsumer();
+
+ private:
+ CancelableRequestConsumer cancelable_consumer_;
+};
+
+#endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_CONSUMER_H_
« no previous file with comments | « chrome/browser/password_manager/password_store.cc ('k') | chrome/browser/password_manager/password_store_consumer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698