Chromium Code Reviews| Index: chrome/browser/ui/gtk/password_generation_bubble_gtk.cc |
| diff --git a/chrome/browser/ui/gtk/password_generation_bubble_gtk.cc b/chrome/browser/ui/gtk/password_generation_bubble_gtk.cc |
| index 0f99f895a06879507e120c2fef5c7fda802f40a0..74d1621438c2317a5442f8819889a5149c12ead4 100644 |
| --- a/chrome/browser/ui/gtk/password_generation_bubble_gtk.cc |
| +++ b/chrome/browser/ui/gtk/password_generation_bubble_gtk.cc |
| @@ -4,7 +4,7 @@ |
| #include "chrome/browser/ui/gtk/password_generation_bubble_gtk.h" |
| -#include "base/utf_string_conversions.h" |
| +#include "base/metrics/histogram.h" |
| #include "chrome/browser/autofill/password_generator.h" |
| #include "chrome/browser/password_manager/password_manager.h" |
| #include "chrome/browser/ui/browser.h" |
| @@ -93,7 +93,7 @@ PasswordGenerationBubbleGtk::PasswordGenerationBubbleGtk( |
| BubbleGtk::POPUP_WINDOW | |
| BubbleGtk::GRAB_INPUT, |
| GtkThemeService::GetFrom(tab_->profile()), |
| - NULL); // delegate |
| + this); // delegate |
| g_signal_connect(content, "destroy", |
| G_CALLBACK(&OnDestroyThunk), this); |
| @@ -101,12 +101,23 @@ PasswordGenerationBubbleGtk::PasswordGenerationBubbleGtk( |
| G_CALLBACK(&OnAcceptClickedThunk), this); |
| g_signal_connect(text_field_, "icon-press", |
| G_CALLBACK(&OnRegenerateClickedThunk), this); |
| + g_signal_connect(text_field_, "changed", |
| + G_CALLBACK(&OnPasswordEditedThunk), this); |
| g_signal_connect(learn_more_link, "clicked", |
| G_CALLBACK(OnLearnMoreLinkClickedThunk), this); |
| } |
| PasswordGenerationBubbleGtk::~PasswordGenerationBubbleGtk() {} |
| +void PasswordGenerationBubbleGtk::BubbleClosing( |
| + BubbleGtk* bubble, bool closed_by_escape) { |
| + // Send the password generation status to the renderer. |
| + RenderViewHost* render_view_host = tab_->web_contents()->GetRenderViewHost(); |
| + render_view_host->Send(new AutofillMsg_PasswordGenerationBubbleClosed( |
| + render_view_host->GetRoutingID(), |
| + password_generation_status_)); |
|
Ilya Sherman
2012/07/18 05:36:15
What's the advantage of sending the status to the
Ilya Sherman
2012/07/18 05:38:14
Reading back through the comments on this CL, I th
Garrett Casto
2012/07/18 17:20:03
Yeah, I just meant that for those particular stats
zysxqn
2012/07/18 19:16:46
Done.
|
| +} |
| + |
| void PasswordGenerationBubbleGtk::OnDestroy(GtkWidget* widget) { |
| // We are self deleting, we have a destroy signal setup to catch when we are |
| // destroyed (via the BubbleGtk being destroyed), and delete ourself. |
| @@ -114,10 +125,9 @@ void PasswordGenerationBubbleGtk::OnDestroy(GtkWidget* widget) { |
| } |
| void PasswordGenerationBubbleGtk::OnAcceptClicked(GtkWidget* widget) { |
| - RenderViewHost* render_view_host = tab_->web_contents()->GetRenderViewHost(); |
| - render_view_host->Send(new AutofillMsg_GeneratedPasswordAccepted( |
| - render_view_host->GetRoutingID(), |
| - UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(text_field_))))); |
| + password_generation_status_.password_accepted = true; |
| + password_generation_status_.generated_password = |
| + gtk_entry_get_text(GTK_ENTRY(text_field_)); |
| tab_->password_manager()->SetFormHasGeneratedPassword(form_); |
| bubble_->Close(); |
| } |
| @@ -128,9 +138,15 @@ void PasswordGenerationBubbleGtk::OnRegenerateClicked( |
| GdkEvent* event) { |
| gtk_entry_set_text(GTK_ENTRY(text_field_), |
| password_generator_->Generate().c_str()); |
| + password_generation_status_.password_regenerated = true; |
| +} |
| + |
| +void PasswordGenerationBubbleGtk::OnPasswordEdited(GtkWidget* widget) { |
| + password_generation_status_.password_edited = true; |
| } |
| void PasswordGenerationBubbleGtk::OnLearnMoreLinkClicked(GtkButton* button) { |
| + password_generation_status_.learn_more_visited = true; |
| Browser* browser = browser::FindBrowserWithWebContents(tab_->web_contents()); |
| content::OpenURLParams params( |
| GURL(chrome::kAutoPasswordGenerationLearnMoreURL), content::Referrer(), |