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

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

Issue 11000016: Move forms/ out of webkit/. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Mostly cosmetic fixup Created 8 years, 2 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
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/password_manager/password_manager.h" 5 #include "chrome/browser/password_manager/password_manager.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/threading/platform_thread.h" 8 #include "base/threading/platform_thread.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/password_manager/password_form_manager.h" 10 #include "chrome/browser/password_manager/password_form_manager.h"
11 #include "chrome/browser/password_manager/password_manager_delegate.h" 11 #include "chrome/browser/password_manager/password_manager_delegate.h"
12 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/common/autofill_messages.h" 14 #include "chrome/common/autofill_messages.h"
15 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
16 #include "content/public/browser/user_metrics.h" 16 #include "content/public/browser/user_metrics.h"
17 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "content/public/common/frame_navigate_params.h" 18 #include "content/public/common/frame_navigate_params.h"
19 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
20 20
21 using content::UserMetricsAction; 21 using content::UserMetricsAction;
22 using content::WebContents; 22 using content::WebContents;
23 using webkit::forms::PasswordForm; 23 using content::PasswordForm;
24 using webkit::forms::PasswordFormMap; 24 using content::PasswordFormMap;
25 25
26 namespace { 26 namespace {
27 27
28 // This routine is called when PasswordManagers are constructed. 28 // This routine is called when PasswordManagers are constructed.
29 // 29 //
30 // Currently we report metrics only once at startup. We require 30 // Currently we report metrics only once at startup. We require
31 // that this is only ever called from a single thread in order to 31 // that this is only ever called from a single thread in order to
32 // avoid needing to lock (a static boolean flag is then sufficient to 32 // avoid needing to lock (a static boolean flag is then sufficient to
33 // guarantee running only once). 33 // guarantee running only once).
34 void ReportMetrics(bool password_manager_enabled) { 34 void ReportMetrics(bool password_manager_enabled) {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 void PasswordManager::Autofill( 271 void PasswordManager::Autofill(
272 const PasswordForm& form_for_autofill, 272 const PasswordForm& form_for_autofill,
273 const PasswordFormMap& best_matches, 273 const PasswordFormMap& best_matches,
274 const PasswordForm& preferred_match, 274 const PasswordForm& preferred_match,
275 bool wait_for_username) const { 275 bool wait_for_username) const {
276 switch (form_for_autofill.scheme) { 276 switch (form_for_autofill.scheme) {
277 case PasswordForm::SCHEME_HTML: { 277 case PasswordForm::SCHEME_HTML: {
278 // Note the check above is required because the observer_ for a non-HTML 278 // Note the check above is required because the observer_ for a non-HTML
279 // schemed password form may have been freed, so we need to distinguish. 279 // schemed password form may have been freed, so we need to distinguish.
280 webkit::forms::PasswordFormFillData fill_data; 280 content::PasswordFormFillData fill_data;
281 webkit::forms::PasswordFormDomManager::InitFillData(form_for_autofill, 281 content::initPasswordFormFillData(form_for_autofill,
282 best_matches, 282 best_matches,
283 &preferred_match, 283 &preferred_match,
284 wait_for_username, 284 wait_for_username,
285 &fill_data); 285 &fill_data);
286 delegate_->FillPasswordForm(fill_data); 286 delegate_->FillPasswordForm(fill_data);
287 return; 287 return;
288 } 288 }
289 default: 289 default:
290 if (observer_) { 290 if (observer_) {
291 observer_->OnAutofillDataAvailable(preferred_match.username_value, 291 observer_->OnAutofillDataAvailable(preferred_match.username_value,
292 preferred_match.password_value); 292 preferred_match.password_value);
293 } 293 }
294 } 294 }
295 } 295 }
296 296
297 bool PasswordManager::IsFillingEnabled() const { 297 bool PasswordManager::IsFillingEnabled() const {
298 return delegate_->GetProfile() && *password_manager_enabled_; 298 return delegate_->GetProfile() && *password_manager_enabled_;
299 } 299 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698