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 e43e81a48135251020a8bfdd4ad5d95aabbc2dbf..b7e1c6842287025871ff00a2b587bc7e3ca65161 100644 |
| --- a/chrome/browser/ui/gtk/password_generation_bubble_gtk.cc |
| +++ b/chrome/browser/ui/gtk/password_generation_bubble_gtk.cc |
| @@ -5,11 +5,19 @@ |
| #include "chrome/browser/ui/gtk/password_generation_bubble_gtk.h" |
| #include "base/utf_string_conversions.h" |
| +#include "chrome/browser/platform_util.h" |
|
Garrett Casto
2012/04/26 21:45:15
Why did you add this?
zysxqn
2012/04/26 23:46:25
Forgot to remove this after I decided not to use s
|
| +#include "chrome/browser/ui/browser.h" |
| +#include "chrome/browser/ui/browser_window.h" |
| #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" |
| +#include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
| +#include "chrome/browser/ui/gtk/gtk_util.h" |
| #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| #include "chrome/common/autofill_messages.h" |
| +#include "chrome/common/url_constants.h" |
| #include "content/public/browser/render_view_host.h" |
| +#include "grit/generated_resources.h" |
| #include "ui/base/gtk/gtk_hig_constants.h" |
| +#include "ui/base/l10n/l10n_util.h" |
| const int kContentBorder = 4; |
| const int kHorizontalSpacing = 4; |
| @@ -19,15 +27,23 @@ PasswordGenerationBubbleGtk::PasswordGenerationBubbleGtk( |
| GtkWidget* anchor_widget, |
| Profile* profile, |
| content::RenderViewHost* render_view_host) |
| - : render_view_host_(render_view_host) { |
| + : profile_(profile), render_view_host_(render_view_host) { |
| // TODO(gcasto): Localize text after we have finalized the UI. |
| // crbug.com/118062 |
| GtkWidget* content = gtk_vbox_new(FALSE, 5); |
| - // We have two lines of content. The first is just the title, |
| + // We have two lines of content. The first is the title and learn more link. |
| GtkWidget* title_line = gtk_hbox_new(FALSE, 0); |
| GtkWidget* title = gtk_label_new("Password Suggestion"); |
| gtk_box_pack_start(GTK_BOX(title_line), title, FALSE, FALSE, 0); |
| + GtkWidget* learn_more_link = gtk_chrome_link_button_new( |
| + l10n_util::GetStringUTF8(IDS_LEARN_MORE).c_str()); |
| + gtk_button_set_alignment(GTK_BUTTON(learn_more_link), 0.0, 0.5); |
| + gtk_box_pack_start(GTK_BOX(title_line), |
| + gtk_util::IndentWidget(learn_more_link), |
| + FALSE, FALSE, 0); |
| + g_signal_connect(learn_more_link, "clicked", |
|
Garrett Casto
2012/04/26 21:45:15
nit: I would put all the callback registrations to
zysxqn
2012/04/26 23:46:25
Done.
|
| + G_CALLBACK(OnLearnMoreLinkClickedThunk), this); |
| // The second contains the password in a text field and an accept button. |
| GtkWidget* password_line = gtk_hbox_new(FALSE, kHorizontalSpacing); |
| @@ -49,7 +65,7 @@ PasswordGenerationBubbleGtk::PasswordGenerationBubbleGtk( |
| BubbleGtk::ARROW_LOCATION_TOP_LEFT, |
| true, // match_system_theme |
| true, // grab_input |
| - ThemeServiceGtk::GetFrom(profile), |
| + ThemeServiceGtk::GetFrom(profile_), |
| NULL); // delegate |
| g_signal_connect(content, "destroy", |
| @@ -72,3 +88,13 @@ void PasswordGenerationBubbleGtk::OnAcceptClicked(GtkWidget* widget) { |
| UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(text_field_))))); |
| bubble_->Close(); |
| } |
| + |
| +void PasswordGenerationBubbleGtk::OnLearnMoreLinkClicked(GtkButton* button) { |
| + // We open a new browser window so the Options dialog doesn't get lost behind |
| + // other windows. |
| + Browser* browser = Browser::Create(profile_); |
|
Garrett Casto
2012/04/26 21:45:15
Don't open a new window, open a new tab in the cur
zysxqn
2012/04/26 23:46:25
Changed to open a new tab in the same window.
My
|
| + browser->AddSelectedTabWithURL( |
| + GURL(chrome::kAutoPasswordGenerationLearnMoreURL), |
| + content::PAGE_TRANSITION_LINK); |
| + browser->window()->Show(); |
| +} |