| OLD | NEW |
| 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/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_finder.h" | 12 #include "chrome/browser/ui/browser_finder.h" |
| 13 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" | 13 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" |
| 14 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 14 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
| 15 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 15 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 16 #include "chrome/browser/ui/gtk/gtk_util.h" | 16 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 17 #include "chrome/common/autofill_messages.h" | 17 #include "chrome/common/autofill_messages.h" |
| 18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 19 #include "content/public/browser/render_view_host.h" | 19 #include "content/public/browser/render_view_host.h" |
| 20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 21 #include "content/public/browser/web_contents_view.h" |
| 21 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
| 22 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
| 23 #include "ui/base/gtk/gtk_hig_constants.h" | 24 #include "ui/base/gtk/gtk_hig_constants.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 25 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
| 26 | 27 |
| 27 using content::RenderViewHost; | 28 using content::RenderViewHost; |
| 28 | 29 |
| 29 namespace { | 30 namespace { |
| 30 | 31 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 ui::kContentAreaBorder); | 82 ui::kContentAreaBorder); |
| 82 gtk_box_pack_start(GTK_BOX(content), title_line, TRUE, TRUE, 0); | 83 gtk_box_pack_start(GTK_BOX(content), title_line, TRUE, TRUE, 0); |
| 83 gtk_box_pack_start(GTK_BOX(content), password_line, TRUE, TRUE, 0); | 84 gtk_box_pack_start(GTK_BOX(content), password_line, TRUE, TRUE, 0); |
| 84 | 85 |
| 85 // Set initial focus to the text field containing the generated password. | 86 // Set initial focus to the text field containing the generated password. |
| 86 gtk_widget_grab_focus(text_field_); | 87 gtk_widget_grab_focus(text_field_); |
| 87 | 88 |
| 88 GtkThemeService* theme_service = GtkThemeService::GetFrom( | 89 GtkThemeService* theme_service = GtkThemeService::GetFrom( |
| 89 Profile::FromBrowserContext(web_contents->GetBrowserContext())); | 90 Profile::FromBrowserContext(web_contents->GetBrowserContext())); |
| 90 | 91 |
| 91 bubble_ = BubbleGtk::Show(web_contents->GetContentNativeView(), | 92 bubble_ = BubbleGtk::Show(web_contents->GetView()->GetContentNativeView(), |
| 92 &anchor_rect, | 93 &anchor_rect, |
| 93 content, | 94 content, |
| 94 BubbleGtk::ANCHOR_TOP_LEFT, | 95 BubbleGtk::ANCHOR_TOP_LEFT, |
| 95 BubbleGtk::MATCH_SYSTEM_THEME | | 96 BubbleGtk::MATCH_SYSTEM_THEME | |
| 96 BubbleGtk::POPUP_WINDOW | | 97 BubbleGtk::POPUP_WINDOW | |
| 97 BubbleGtk::GRAB_INPUT, | 98 BubbleGtk::GRAB_INPUT, |
| 98 theme_service, | 99 theme_service, |
| 99 this); // delegate | 100 this); // delegate |
| 100 | 101 |
| 101 g_signal_connect(content, "destroy", | 102 g_signal_connect(content, "destroy", |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 150 |
| 150 void PasswordGenerationBubbleGtk::OnLearnMoreLinkClicked(GtkButton* button) { | 151 void PasswordGenerationBubbleGtk::OnLearnMoreLinkClicked(GtkButton* button) { |
| 151 actions_.learn_more_visited = true; | 152 actions_.learn_more_visited = true; |
| 152 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); | 153 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); |
| 153 content::OpenURLParams params( | 154 content::OpenURLParams params( |
| 154 GURL(chrome::kAutoPasswordGenerationLearnMoreURL), content::Referrer(), | 155 GURL(chrome::kAutoPasswordGenerationLearnMoreURL), content::Referrer(), |
| 155 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false); | 156 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false); |
| 156 browser->OpenURL(params); | 157 browser->OpenURL(params); |
| 157 bubble_->Close(); | 158 bubble_->Close(); |
| 158 } | 159 } |
| OLD | NEW |