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

Unified Diff: chrome/renderer/autofill/password_generation_manager.cc

Issue 10222017: Make password generation switched by a preference in chrome settings rather than a command line fla… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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/renderer/autofill/password_generation_manager.cc
diff --git a/chrome/renderer/autofill/password_generation_manager.cc b/chrome/renderer/autofill/password_generation_manager.cc
index 687c035e26579f2a98973b1e5195ebd12bdad4ab..19b0188341580c6f2550fb43f54965273599eb63 100644
--- a/chrome/renderer/autofill/password_generation_manager.cc
+++ b/chrome/renderer/autofill/password_generation_manager.cc
@@ -20,13 +20,14 @@ namespace autofill {
PasswordGenerationManager::PasswordGenerationManager(
content::RenderView* render_view)
: content::RenderViewObserver(render_view),
- enabled_(false) {}
+ sync_enabled_(false),
+ password_generation_enabled_(false) {}
PasswordGenerationManager::~PasswordGenerationManager() {}
void PasswordGenerationManager::DidFinishDocumentLoad(WebKit::WebFrame* frame) {
- // We don't want to generate passwords if the browser won't store or sync
- // them.
- if (!enabled_)
+ // We don't want to generate passwords if browser won't store or sync them, or
+ // password generation isn't enabled.
+ if (!sync_enabled_ || !password_generation_enabled_)
return;
if (!ShouldAnalyzeFrame(*frame))
@@ -90,8 +91,10 @@ bool PasswordGenerationManager::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(PasswordGenerationManager, message)
IPC_MESSAGE_HANDLER(AutofillMsg_GeneratedPasswordAccepted,
OnPasswordAccepted)
- IPC_MESSAGE_HANDLER(AutofillMsg_PasswordGenerationEnabled,
+ IPC_MESSAGE_HANDLER(AutofillMsg_PasswordSyncEnabled,
OnPasswordSyncEnabled)
+ IPC_MESSAGE_HANDLER(AutofillMsg_PasswordGenerationEnabled,
+ OnPasswordGenerationEnabled)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -107,7 +110,11 @@ void PasswordGenerationManager::OnPasswordAccepted(const string16& password) {
}
void PasswordGenerationManager::OnPasswordSyncEnabled(bool enabled) {
- enabled_ = enabled;
+ sync_enabled_ = enabled;
+}
+
+void PasswordGenerationManager::OnPasswordGenerationEnabled(bool enabled) {
+ password_generation_enabled_ = enabled;
}
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698