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

Side by Side Diff: chrome/browser/ui/gtk/password_generation_bubble_gtk.cc

Issue 10787023: Adding UMA stats. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More comments. Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/gtk/password_generation_bubble_gtk.h" 5 #include "chrome/browser/ui/gtk/password_generation_bubble_gtk.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/autofill/password_generator.h" 8 #include "chrome/browser/autofill/password_generator.h"
9 #include "chrome/browser/password_manager/password_manager.h" 9 #include "chrome/browser/password_manager/password_manager.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 gtk_widget_grab_focus(text_field_); 86 gtk_widget_grab_focus(text_field_);
87 87
88 bubble_ = BubbleGtk::Show(tab->web_contents()->GetContentNativeView(), 88 bubble_ = BubbleGtk::Show(tab->web_contents()->GetContentNativeView(),
89 &anchor_rect, 89 &anchor_rect,
90 content, 90 content,
91 BubbleGtk::ARROW_LOCATION_TOP_LEFT, 91 BubbleGtk::ARROW_LOCATION_TOP_LEFT,
92 BubbleGtk::MATCH_SYSTEM_THEME | 92 BubbleGtk::MATCH_SYSTEM_THEME |
93 BubbleGtk::POPUP_WINDOW | 93 BubbleGtk::POPUP_WINDOW |
94 BubbleGtk::GRAB_INPUT, 94 BubbleGtk::GRAB_INPUT,
95 GtkThemeService::GetFrom(tab_->profile()), 95 GtkThemeService::GetFrom(tab_->profile()),
96 NULL); // delegate 96 this); // delegate
97 97
98 g_signal_connect(content, "destroy", 98 g_signal_connect(content, "destroy",
99 G_CALLBACK(&OnDestroyThunk), this); 99 G_CALLBACK(&OnDestroyThunk), this);
100 g_signal_connect(accept_button, "clicked", 100 g_signal_connect(accept_button, "clicked",
101 G_CALLBACK(&OnAcceptClickedThunk), this); 101 G_CALLBACK(&OnAcceptClickedThunk), this);
102 g_signal_connect(text_field_, "icon-press", 102 g_signal_connect(text_field_, "icon-press",
103 G_CALLBACK(&OnRegenerateClickedThunk), this); 103 G_CALLBACK(&OnRegenerateClickedThunk), this);
104 g_signal_connect(text_field_, "changed",
105 G_CALLBACK(&OnPasswordEditedThunk), this);
104 g_signal_connect(learn_more_link, "clicked", 106 g_signal_connect(learn_more_link, "clicked",
105 G_CALLBACK(OnLearnMoreLinkClickedThunk), this); 107 G_CALLBACK(OnLearnMoreLinkClickedThunk), this);
106 } 108 }
107 109
108 PasswordGenerationBubbleGtk::~PasswordGenerationBubbleGtk() {} 110 PasswordGenerationBubbleGtk::~PasswordGenerationBubbleGtk() {}
109 111
112 void PasswordGenerationBubbleGtk::BubbleClosing(
113 BubbleGtk* bubble, bool closed_by_escape) {
jar (doing other things) 2012/07/19 00:05:41 nit: all parameters should be aligned, once you de
zysxqn 2012/07/19 18:49:29 Done.
114 password_generation::LogUserActions(actions_);
115 }
116
110 void PasswordGenerationBubbleGtk::OnDestroy(GtkWidget* widget) { 117 void PasswordGenerationBubbleGtk::OnDestroy(GtkWidget* widget) {
111 // We are self deleting, we have a destroy signal setup to catch when we are 118 // We are self deleting, we have a destroy signal setup to catch when we are
112 // destroyed (via the BubbleGtk being destroyed), and delete ourself. 119 // destroyed (via the BubbleGtk being destroyed), and delete ourself.
113 delete this; 120 delete this;
114 } 121 }
115 122
116 void PasswordGenerationBubbleGtk::OnAcceptClicked(GtkWidget* widget) { 123 void PasswordGenerationBubbleGtk::OnAcceptClicked(GtkWidget* widget) {
124 actions_.password_accepted = true;
117 RenderViewHost* render_view_host = tab_->web_contents()->GetRenderViewHost(); 125 RenderViewHost* render_view_host = tab_->web_contents()->GetRenderViewHost();
118 render_view_host->Send(new AutofillMsg_GeneratedPasswordAccepted( 126 render_view_host->Send(new AutofillMsg_GeneratedPasswordAccepted(
119 render_view_host->GetRoutingID(), 127 render_view_host->GetRoutingID(),
120 UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(text_field_))))); 128 UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(text_field_)))));
121 tab_->password_manager()->SetFormHasGeneratedPassword(form_); 129 tab_->password_manager()->SetFormHasGeneratedPassword(form_);
122 bubble_->Close(); 130 bubble_->Close();
123 } 131 }
124 132
125 void PasswordGenerationBubbleGtk::OnRegenerateClicked( 133 void PasswordGenerationBubbleGtk::OnRegenerateClicked(
126 GtkWidget* widget, 134 GtkWidget* widget,
127 GtkEntryIconPosition icon_pos, 135 GtkEntryIconPosition icon_pos,
128 GdkEvent* event) { 136 GdkEvent* event) {
129 gtk_entry_set_text(GTK_ENTRY(text_field_), 137 gtk_entry_set_text(GTK_ENTRY(text_field_),
130 password_generator_->Generate().c_str()); 138 password_generator_->Generate().c_str());
139 actions_.password_regenerated = true;
140 }
141
142 void PasswordGenerationBubbleGtk::OnPasswordEdited(GtkWidget* widget) {
143 actions_.password_edited = true;
131 } 144 }
132 145
133 void PasswordGenerationBubbleGtk::OnLearnMoreLinkClicked(GtkButton* button) { 146 void PasswordGenerationBubbleGtk::OnLearnMoreLinkClicked(GtkButton* button) {
147 actions_.learn_more_visited = true;
134 Browser* browser = browser::FindBrowserWithWebContents(tab_->web_contents()); 148 Browser* browser = browser::FindBrowserWithWebContents(tab_->web_contents());
135 content::OpenURLParams params( 149 content::OpenURLParams params(
136 GURL(chrome::kAutoPasswordGenerationLearnMoreURL), content::Referrer(), 150 GURL(chrome::kAutoPasswordGenerationLearnMoreURL), content::Referrer(),
137 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false); 151 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false);
138 browser->OpenURL(params); 152 browser->OpenURL(params);
139 bubble_->Close(); 153 bubble_->Close();
140 } 154 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698