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

Side by Side Diff: chrome/browser/password_manager/password_manager.cc

Issue 39206: NO CODE CHANGE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « chrome/browser/page_state.cc ('k') | chrome/browser/plugin_process_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/password_manager/password_manager.h" 5 #include "chrome/browser/password_manager/password_manager.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/profile.h" 8 #include "chrome/browser/profile.h"
9 #include "chrome/browser/tab_contents/web_contents.h" 9 #include "chrome/browser/tab_contents/web_contents.h"
10 #include "chrome/common/l10n_util.h" 10 #include "chrome/common/l10n_util.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 new SavePasswordInfoBarDelegate(web_contents_, 174 new SavePasswordInfoBarDelegate(web_contents_,
175 provisional_save_manager_.release())); 175 provisional_save_manager_.release()));
176 } else { 176 } else {
177 // If the save is not a new username entry, then we just want to save this 177 // If the save is not a new username entry, then we just want to save this
178 // data (since the user already has related data saved), so don't prompt. 178 // data (since the user already has related data saved), so don't prompt.
179 provisional_save_manager_->Save(); 179 provisional_save_manager_->Save();
180 provisional_save_manager_.reset(); 180 provisional_save_manager_.reset();
181 } 181 }
182 } 182 }
183 183
184 void PasswordManager::PasswordFormsSeen(const std::vector<PasswordForm>& forms) { 184 void PasswordManager::PasswordFormsSeen(
185 const std::vector<PasswordForm>& forms) {
185 if (!web_contents_->profile() || 186 if (!web_contents_->profile() ||
186 !web_contents_->profile()->GetWebDataService(Profile::EXPLICIT_ACCESS)) 187 !web_contents_->profile()->GetWebDataService(Profile::EXPLICIT_ACCESS))
187 return; 188 return;
188 if (!web_contents_->controller()) 189 if (!web_contents_->controller())
189 return; 190 return;
190 if (!*password_manager_enabled_) 191 if (!*password_manager_enabled_)
191 return; 192 return;
192 193
193 // Ask the SSLManager for current security. 194 // Ask the SSLManager for current security.
194 bool had_ssl_error = web_contents_->controller()->ssl_manager()-> 195 bool had_ssl_error = web_contents_->controller()->ssl_manager()->
(...skipping 14 matching lines...) Expand all
209 bool ssl_valid = iter->origin.SchemeIsSecure() && !had_ssl_error; 210 bool ssl_valid = iter->origin.SchemeIsSecure() && !had_ssl_error;
210 PasswordFormManager* manager = 211 PasswordFormManager* manager =
211 new PasswordFormManager(web_contents_->profile(), 212 new PasswordFormManager(web_contents_->profile(),
212 this, *iter, ssl_valid); 213 this, *iter, ssl_valid);
213 pending_login_managers_.push_back(manager); 214 pending_login_managers_.push_back(manager);
214 manager->FetchMatchingLoginsFromWebDatabase(); 215 manager->FetchMatchingLoginsFromWebDatabase();
215 } 216 }
216 } 217 }
217 } 218 }
218 219
219 void PasswordManager::Autofill(const PasswordForm& form_for_autofill, 220 void PasswordManager::Autofill(
220 const PasswordFormMap& best_matches, 221 const PasswordForm& form_for_autofill,
221 const PasswordForm* const preferred_match) const { 222 const PasswordFormMap& best_matches,
223 const PasswordForm* const preferred_match) const {
222 DCHECK(web_contents_); 224 DCHECK(web_contents_);
223 DCHECK(preferred_match); 225 DCHECK(preferred_match);
224 switch (form_for_autofill.scheme) { 226 switch (form_for_autofill.scheme) {
225 case PasswordForm::SCHEME_HTML: { 227 case PasswordForm::SCHEME_HTML: {
226 // Note the check above is required because the observer_ for a non-HTML 228 // Note the check above is required because the observer_ for a non-HTML
227 // schemed password form may have been freed, so we need to distinguish. 229 // schemed password form may have been freed, so we need to distinguish.
228 bool action_mismatch = form_for_autofill.action.GetWithEmptyPath() != 230 bool action_mismatch = form_for_autofill.action.GetWithEmptyPath() !=
229 preferred_match->action.GetWithEmptyPath(); 231 preferred_match->action.GetWithEmptyPath();
230 PasswordFormDomManager::FillData fill_data; 232 PasswordFormDomManager::FillData fill_data;
231 PasswordFormDomManager::InitFillData(form_for_autofill, 233 PasswordFormDomManager::InitFillData(form_for_autofill,
232 best_matches, preferred_match, 234 best_matches, preferred_match,
233 action_mismatch, 235 action_mismatch,
234 &fill_data); 236 &fill_data);
235 web_contents_->render_view_host()->FillPasswordForm(fill_data); 237 web_contents_->render_view_host()->FillPasswordForm(fill_data);
236 return; 238 return;
237 } 239 }
238 default: 240 default:
239 if (observer_) 241 if (observer_)
240 observer_->OnAutofillDataAvailable(preferred_match->username_value, 242 observer_->OnAutofillDataAvailable(preferred_match->username_value,
241 preferred_match->password_value); 243 preferred_match->password_value);
242 } 244 }
243 } 245 }
244 246
OLDNEW
« no previous file with comments | « chrome/browser/page_state.cc ('k') | chrome/browser/plugin_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698