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

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

Issue 151413008: Move ownership of Password(Generation)Manager to ContentPasswordDriver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Handle WebContents having no PasswordManagerDelegateImpl attached Created 6 years, 10 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/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/password_manager/password_manager.h" 8 #include "chrome/browser/password_manager/password_manager.h"
9 #include "chrome/browser/password_manager/password_manager_delegate_impl.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_finder.h" 12 #include "chrome/browser/ui/browser_finder.h"
12 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" 13 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
13 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" 14 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h"
14 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 15 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
15 #include "chrome/browser/ui/gtk/gtk_util.h" 16 #include "chrome/browser/ui/gtk/gtk_util.h"
16 #include "chrome/common/url_constants.h" 17 #include "chrome/common/url_constants.h"
17 #include "components/autofill/content/common/autofill_messages.h" 18 #include "components/autofill/content/common/autofill_messages.h"
18 #include "components/autofill/core/browser/password_generator.h" 19 #include "components/autofill/core/browser/password_generator.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // destroyed (via the BubbleGtk being destroyed), and delete ourself. 124 // destroyed (via the BubbleGtk being destroyed), and delete ourself.
124 delete this; 125 delete this;
125 } 126 }
126 127
127 void PasswordGenerationBubbleGtk::OnAcceptClicked(GtkWidget* widget) { 128 void PasswordGenerationBubbleGtk::OnAcceptClicked(GtkWidget* widget) {
128 actions_.password_accepted = true; 129 actions_.password_accepted = true;
129 RenderViewHost* render_view_host = web_contents_->GetRenderViewHost(); 130 RenderViewHost* render_view_host = web_contents_->GetRenderViewHost();
130 render_view_host->Send(new AutofillMsg_GeneratedPasswordAccepted( 131 render_view_host->Send(new AutofillMsg_GeneratedPasswordAccepted(
131 render_view_host->GetRoutingID(), 132 render_view_host->GetRoutingID(),
132 base::UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(text_field_))))); 133 base::UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(text_field_)))));
133 PasswordManager::FromWebContents(web_contents_)-> 134 PasswordManagerDelegateImpl::GetManagerFromWebContents(web_contents_)
134 SetFormHasGeneratedPassword(form_); 135 ->SetFormHasGeneratedPassword(form_);
135 bubble_->Close(); 136 bubble_->Close();
136 } 137 }
137 138
138 void PasswordGenerationBubbleGtk::OnRegenerateClicked( 139 void PasswordGenerationBubbleGtk::OnRegenerateClicked(
139 GtkWidget* widget, 140 GtkWidget* widget,
140 GtkEntryIconPosition icon_pos, 141 GtkEntryIconPosition icon_pos,
141 GdkEvent* event) { 142 GdkEvent* event) {
142 gtk_entry_set_text(GTK_ENTRY(text_field_), 143 gtk_entry_set_text(GTK_ENTRY(text_field_),
143 password_generator_->Generate().c_str()); 144 password_generator_->Generate().c_str());
144 actions_.password_regenerated = true; 145 actions_.password_regenerated = true;
145 } 146 }
146 147
147 void PasswordGenerationBubbleGtk::OnPasswordEdited(GtkWidget* widget) { 148 void PasswordGenerationBubbleGtk::OnPasswordEdited(GtkWidget* widget) {
148 actions_.password_edited = true; 149 actions_.password_edited = true;
149 } 150 }
150 151
151 void PasswordGenerationBubbleGtk::OnLearnMoreLinkClicked(GtkButton* button) { 152 void PasswordGenerationBubbleGtk::OnLearnMoreLinkClicked(GtkButton* button) {
152 actions_.learn_more_visited = true; 153 actions_.learn_more_visited = true;
153 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); 154 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
154 content::OpenURLParams params( 155 content::OpenURLParams params(
155 GURL(chrome::kAutoPasswordGenerationLearnMoreURL), content::Referrer(), 156 GURL(chrome::kAutoPasswordGenerationLearnMoreURL), content::Referrer(),
156 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false); 157 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false);
157 browser->OpenURL(params); 158 browser->OpenURL(params);
158 bubble_->Close(); 159 bubble_->Close();
159 } 160 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.mm ('k') | chrome/browser/ui/login/login_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698