blob: 5cd3080c1a27dce236b065425e68e58cc4ec0f46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
// Copyright (c) 2010 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_DOM_UI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_
#define CHROME_BROWSER_DOM_UI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_
#include <string>
#include <vector>
#include "chrome/browser/dom_ui/options/options_ui.h"
#include "chrome/browser/password_manager/password_store.h"
class PasswordManagerHandler : public OptionsPageUIHandler {
public:
PasswordManagerHandler();
virtual ~PasswordManagerHandler();
// OptionsUIHandler implementation.
virtual void GetLocalizedValues(DictionaryValue* localized_strings);
virtual void Initialize();
virtual void RegisterMessages();
private:
// The password store associated with the currently active profile.
PasswordStore* GetPasswordStore();
// Called when the JS PasswordManager object is initialized.
void UpdatePasswordLists(const ListValue* args);
// Remove an entry.
// @param value the entry index to be removed.
void RemoveSavedPassword(const ListValue* args);
// Remove an password exception.
// @param value the entry index to be removed.
void RemovePasswordException(const ListValue* args);
// Remove all saved passwords
void RemoveAllSavedPasswords(const ListValue* args);
// Remove All password exceptions
void RemoveAllPasswordExceptions(const ListValue* args);
// Get password value for the selected entry.
// @param value the selected entry index.
void ShowSelectedPassword(const ListValue* args);
// Sets the password and exception list contents to the given data.
// We take ownership of the PasswordForms in the vector.
void SetPasswordList();
void SetPasswordExceptionList();
// A short class to mediate requests to the password store.
class ListPopulater : public PasswordStoreConsumer {
public:
explicit ListPopulater(PasswordManagerHandler* page)
: page_(page),
pending_login_query_(0) {
}
// Send a query to the password store to populate a list.
virtual void Populate() = 0;
// Send the password store's reply back to the handler.
virtual void OnPasswordStoreRequestDone(
int handle, const std::vector<webkit_glue::PasswordForm*>& result) = 0;
protected:
PasswordManagerHandler* page_;
int pending_login_query_;
};
// A short class to mediate requests to the password store for passwordlist.
class PasswordListPopulater : public ListPopulater {
public:
explicit PasswordListPopulater(PasswordManagerHandler* page)
: ListPopulater(page) {
}
// Send a query to the password store to populate a password list.
virtual void Populate();
// Send the password store's reply back to the handler.
virtual void OnPasswordStoreRequestDone(
int handle, const std::vector<webkit_glue::PasswordForm*>& result);
};
// A short class to mediate requests to the password store for exceptions.
class PasswordExceptionListPopulater : public ListPopulater {
public:
explicit PasswordExceptionListPopulater(
PasswordManagerHandler* page) : ListPopulater(page) {
}
// Send a query to the password store to populate a passwordException list.
virtual void Populate();
// Send the password store's reply back to the handler.
virtual void OnPasswordStoreRequestDone(
int handle, const std::vector<webkit_glue::PasswordForm*>& result);
};
// Password store consumer for populating the password list and exceptions.
PasswordListPopulater populater_;
PasswordExceptionListPopulater exception_populater_;
std::vector<webkit_glue::PasswordForm*> password_list_;
std::vector<webkit_glue::PasswordForm*> password_exception_list_;
// User's pref
std::string languages_;
DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler);
};
#endif // CHROME_BROWSER_DOM_UI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_
|