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

Side by Side Diff: components/autofill/content/browser/autofill_driver_impl.cc

Issue 184103016: Autofill: Refactoring to support fetching password after a username is selected (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address gcasto's comments. Created 6 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/autofill/content/browser/autofill_driver_impl.h" 5 #include "components/autofill/content/browser/autofill_driver_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/threading/sequenced_worker_pool.h" 8 #include "base/threading/sequenced_worker_pool.h"
9 #include "components/autofill/content/common/autofill_messages.h" 9 #include "components/autofill/content/common/autofill_messages.h"
10 #include "components/autofill/core/browser/autofill_external_delegate.h" 10 #include "components/autofill/core/browser/autofill_external_delegate.h"
(...skipping 16 matching lines...) Expand all
27 27
28 const char kAutofillDriverImplWebContentsUserDataKey[] = 28 const char kAutofillDriverImplWebContentsUserDataKey[] =
29 "web_contents_autofill_driver_impl"; 29 "web_contents_autofill_driver_impl";
30 30
31 } // namespace 31 } // namespace
32 32
33 // static 33 // static
34 void AutofillDriverImpl::CreateForWebContentsAndDelegate( 34 void AutofillDriverImpl::CreateForWebContentsAndDelegate(
35 content::WebContents* contents, 35 content::WebContents* contents,
36 autofill::AutofillManagerDelegate* delegate, 36 autofill::AutofillManagerDelegate* delegate,
37 PasswordManagerClient* password_manager_client,
37 const std::string& app_locale, 38 const std::string& app_locale,
38 AutofillManager::AutofillDownloadManagerState enable_download_manager) { 39 AutofillManager::AutofillDownloadManagerState enable_download_manager) {
39 if (FromWebContents(contents)) 40 if (FromWebContents(contents))
40 return; 41 return;
41 42
42 contents->SetUserData(kAutofillDriverImplWebContentsUserDataKey, 43 contents->SetUserData(kAutofillDriverImplWebContentsUserDataKey,
43 new AutofillDriverImpl(contents, 44 new AutofillDriverImpl(contents,
44 delegate, 45 delegate,
46 password_manager_client,
45 app_locale, 47 app_locale,
46 enable_download_manager)); 48 enable_download_manager));
47 } 49 }
48 50
49 // static 51 // static
50 AutofillDriverImpl* AutofillDriverImpl::FromWebContents( 52 AutofillDriverImpl* AutofillDriverImpl::FromWebContents(
51 content::WebContents* contents) { 53 content::WebContents* contents) {
52 return static_cast<AutofillDriverImpl*>( 54 return static_cast<AutofillDriverImpl*>(
53 contents->GetUserData(kAutofillDriverImplWebContentsUserDataKey)); 55 contents->GetUserData(kAutofillDriverImplWebContentsUserDataKey));
54 } 56 }
55 57
56 AutofillDriverImpl::AutofillDriverImpl( 58 AutofillDriverImpl::AutofillDriverImpl(
57 content::WebContents* web_contents, 59 content::WebContents* web_contents,
58 autofill::AutofillManagerDelegate* delegate, 60 autofill::AutofillManagerDelegate* delegate,
61 PasswordManagerClient* password_manager_client,
59 const std::string& app_locale, 62 const std::string& app_locale,
60 AutofillManager::AutofillDownloadManagerState enable_download_manager) 63 AutofillManager::AutofillDownloadManagerState enable_download_manager)
61 : content::WebContentsObserver(web_contents), 64 : content::WebContentsObserver(web_contents),
62 autofill_manager_(new AutofillManager( 65 autofill_manager_(new AutofillManager(
63 this, delegate, app_locale, enable_download_manager)), 66 this, delegate, app_locale, enable_download_manager)),
64 autofill_external_delegate_(autofill_manager_.get(), this), 67 autofill_external_delegate_(
68 autofill_manager_.get(),
69 this,
70 new PasswordAutofillManager(password_manager_client, this)),
65 request_autocomplete_manager_(this) { 71 request_autocomplete_manager_(this) {
66 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_); 72 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_);
67 } 73 }
68 74
69 AutofillDriverImpl::~AutofillDriverImpl() {} 75 AutofillDriverImpl::~AutofillDriverImpl() {}
70 76
71 bool AutofillDriverImpl::IsOffTheRecord() const { 77 bool AutofillDriverImpl::IsOffTheRecord() const {
72 return web_contents()->GetBrowserContext()->IsOffTheRecord(); 78 return web_contents()->GetBrowserContext()->IsOffTheRecord();
73 } 79 }
74 80
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 139
134 void AutofillDriverImpl::RendererShouldAcceptDataListSuggestion( 140 void AutofillDriverImpl::RendererShouldAcceptDataListSuggestion(
135 const base::string16& value) { 141 const base::string16& value) {
136 if (!RendererIsAvailable()) 142 if (!RendererIsAvailable())
137 return; 143 return;
138 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); 144 content::RenderViewHost* host = web_contents()->GetRenderViewHost();
139 host->Send(new AutofillMsg_AcceptDataListSuggestion(host->GetRoutingID(), 145 host->Send(new AutofillMsg_AcceptDataListSuggestion(host->GetRoutingID(),
140 value)); 146 value));
141 } 147 }
142 148
143 void AutofillDriverImpl::RendererShouldAcceptPasswordAutofillSuggestion( 149 void
144 const base::string16& username) { 150 AutofillDriverImpl::RendererShouldAcceptPasswordAutofillSuggestion(
151 const base::string16& username,
152 const base::string16& password) {
145 if (!RendererIsAvailable()) 153 if (!RendererIsAvailable())
146 return; 154 return;
147 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); 155 content::RenderViewHost* host = web_contents()->GetRenderViewHost();
148 host->Send( 156 host->Send(
149 new AutofillMsg_AcceptPasswordAutofillSuggestion(host->GetRoutingID(), 157 new AutofillMsg_AcceptPasswordAutofillSuggestion(host->GetRoutingID(),
150 username)); 158 username,
159 password));
151 } 160 }
152 161
153 void AutofillDriverImpl::RendererShouldClearFilledForm() { 162 void AutofillDriverImpl::RendererShouldClearFilledForm() {
154 if (!RendererIsAvailable()) 163 if (!RendererIsAvailable())
155 return; 164 return;
156 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); 165 content::RenderViewHost* host = web_contents()->GetRenderViewHost();
157 host->Send(new AutofillMsg_ClearForm(host->GetRoutingID())); 166 host->Send(new AutofillMsg_ClearForm(host->GetRoutingID()));
158 } 167 }
159 168
160 void AutofillDriverImpl::RendererShouldClearPreviewedForm() { 169 void AutofillDriverImpl::RendererShouldClearPreviewedForm() {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 void AutofillDriverImpl::NavigationEntryCommitted( 240 void AutofillDriverImpl::NavigationEntryCommitted(
232 const content::LoadCommittedDetails& load_details) { 241 const content::LoadCommittedDetails& load_details) {
233 autofill_manager_->delegate()->HideAutofillPopup(); 242 autofill_manager_->delegate()->HideAutofillPopup();
234 } 243 }
235 244
236 void AutofillDriverImpl::WasHidden() { 245 void AutofillDriverImpl::WasHidden() {
237 autofill_manager_->delegate()->HideAutofillPopup(); 246 autofill_manager_->delegate()->HideAutofillPopup();
238 } 247 }
239 248
240 } // namespace autofill 249 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698