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/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/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 // static | 69 // static |
70 void PasswordManager::CreateForWebContentsAndDelegate( | 70 void PasswordManager::CreateForWebContentsAndDelegate( |
71 content::WebContents* contents, | 71 content::WebContents* contents, |
72 PasswordManagerDelegate* delegate) { | 72 PasswordManagerDelegate* delegate) { |
73 if (FromWebContents(contents)) { | 73 if (FromWebContents(contents)) { |
74 DCHECK_EQ(delegate, FromWebContents(contents)->delegate_); | 74 DCHECK_EQ(delegate, FromWebContents(contents)->delegate_); |
75 return; | 75 return; |
76 } | 76 } |
77 | 77 |
78 contents->SetUserData(&kLocatorKey, | 78 contents->SetUserData(UserDataKey(), |
79 new PasswordManager(contents, delegate)); | 79 new PasswordManager(contents, delegate)); |
80 } | 80 } |
81 | 81 |
82 PasswordManager::PasswordManager(WebContents* web_contents, | 82 PasswordManager::PasswordManager(WebContents* web_contents, |
83 PasswordManagerDelegate* delegate) | 83 PasswordManagerDelegate* delegate) |
84 : content::WebContentsObserver(web_contents), | 84 : content::WebContentsObserver(web_contents), |
85 delegate_(delegate), | 85 delegate_(delegate), |
86 observer_(NULL) { | 86 observer_(NULL) { |
87 DCHECK(delegate_); | 87 DCHECK(delegate_); |
88 password_manager_enabled_.Init(prefs::kPasswordManagerEnabled, | 88 password_manager_enabled_.Init(prefs::kPasswordManagerEnabled, |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 if (observer_) { | 313 if (observer_) { |
314 observer_->OnAutofillDataAvailable(preferred_match.username_value, | 314 observer_->OnAutofillDataAvailable(preferred_match.username_value, |
315 preferred_match.password_value); | 315 preferred_match.password_value); |
316 } | 316 } |
317 } | 317 } |
318 } | 318 } |
319 | 319 |
320 bool PasswordManager::IsFillingEnabled() const { | 320 bool PasswordManager::IsFillingEnabled() const { |
321 return delegate_->GetProfile() && *password_manager_enabled_; | 321 return delegate_->GetProfile() && *password_manager_enabled_; |
322 } | 322 } |
OLD | NEW |