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

Side by Side Diff: components/password_manager/core/browser/password_autofill_manager.cc

Issue 707173004: Refactor Autofill for out of process iframes (OOPIF). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 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/password_manager/core/browser/password_autofill_manager.h" 5 #include "components/password_manager/core/browser/password_autofill_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 } 54 }
55 55
56 } // namespace 56 } // namespace
57 57
58 //////////////////////////////////////////////////////////////////////////////// 58 ////////////////////////////////////////////////////////////////////////////////
59 // PasswordAutofillManager, public: 59 // PasswordAutofillManager, public:
60 60
61 PasswordAutofillManager::PasswordAutofillManager( 61 PasswordAutofillManager::PasswordAutofillManager(
62 PasswordManagerClient* password_manager_client, 62 PasswordManagerClient* password_manager_client,
63 PasswordManagerDriver* password_manager_driver,
63 autofill::AutofillClient* autofill_client) 64 autofill::AutofillClient* autofill_client)
64 : password_manager_client_(password_manager_client), 65 : password_manager_client_(password_manager_client),
66 password_manager_driver_(password_manager_driver),
65 autofill_client_(autofill_client), 67 autofill_client_(autofill_client),
66 weak_ptr_factory_(this) { 68 weak_ptr_factory_(this) {
67 } 69 }
68 70
69 PasswordAutofillManager::~PasswordAutofillManager() { 71 PasswordAutofillManager::~PasswordAutofillManager() {
70 } 72 }
71 73
72 bool PasswordAutofillManager::FillSuggestion(int key, 74 bool PasswordAutofillManager::FillSuggestion(int key,
73 const base::string16& username) { 75 const base::string16& username) {
74 autofill::PasswordFormFillData fill_data; 76 autofill::PasswordFormFillData fill_data;
75 base::string16 password; 77 base::string16 password;
76 if (FindLoginInfo(key, &fill_data) && 78 if (FindLoginInfo(key, &fill_data) &&
77 GetPasswordForUsername(username, fill_data, &password)) { 79 GetPasswordForUsername(username, fill_data, &password)) {
78 PasswordManagerDriver* driver = password_manager_client_->GetDriver(); 80 password_manager_driver_->FillSuggestion(username, password);
79 driver->FillSuggestion(username, password);
80 return true; 81 return true;
81 } 82 }
82 return false; 83 return false;
83 } 84 }
84 85
85 bool PasswordAutofillManager::PreviewSuggestion( 86 bool PasswordAutofillManager::PreviewSuggestion(
86 int key, 87 int key,
87 const base::string16& username) { 88 const base::string16& username) {
88 autofill::PasswordFormFillData fill_data; 89 autofill::PasswordFormFillData fill_data;
89 base::string16 password; 90 base::string16 password;
90 if (FindLoginInfo(key, &fill_data) && 91 if (FindLoginInfo(key, &fill_data) &&
91 GetPasswordForUsername(username, fill_data, &password)) { 92 GetPasswordForUsername(username, fill_data, &password)) {
92 PasswordManagerDriver* driver = password_manager_client_->GetDriver(); 93 password_manager_driver_->PreviewSuggestion(username, password);
93 driver->PreviewSuggestion(username, password);
94 return true; 94 return true;
95 } 95 }
96 return false; 96 return false;
97 } 97 }
98 98
99 void PasswordAutofillManager::OnAddPasswordFormMapping( 99 void PasswordAutofillManager::OnAddPasswordFormMapping(
100 int key, 100 int key,
101 const autofill::PasswordFormFillData& fill_data) { 101 const autofill::PasswordFormFillData& fill_data) {
102 if (!autofill::IsValidPasswordFormFillData(fill_data)) 102 if (!autofill::IsValidPasswordFormFillData(fill_data))
103 return; 103 return;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 DCHECK(success); 178 DCHECK(success);
179 autofill_client_->HideAutofillPopup(); 179 autofill_client_->HideAutofillPopup();
180 } 180 }
181 181
182 void PasswordAutofillManager::RemoveSuggestion(const base::string16& value, 182 void PasswordAutofillManager::RemoveSuggestion(const base::string16& value,
183 int identifier) { 183 int identifier) {
184 NOTREACHED(); 184 NOTREACHED();
185 } 185 }
186 186
187 void PasswordAutofillManager::ClearPreviewedForm() { 187 void PasswordAutofillManager::ClearPreviewedForm() {
188 PasswordManagerDriver* driver = password_manager_client_->GetDriver(); 188 password_manager_driver_->ClearPreviewedForm();
189 driver->ClearPreviewedForm();
190 } 189 }
191 190
192 //////////////////////////////////////////////////////////////////////////////// 191 ////////////////////////////////////////////////////////////////////////////////
193 // PasswordAutofillManager, private: 192 // PasswordAutofillManager, private:
194 193
195 bool PasswordAutofillManager::GetPasswordForUsername( 194 bool PasswordAutofillManager::GetPasswordForUsername(
196 const base::string16& current_username, 195 const base::string16& current_username,
197 const autofill::PasswordFormFillData& fill_data, 196 const autofill::PasswordFormFillData& fill_data,
198 base::string16* password) { 197 base::string16* password) {
199 // TODO(dubroy): When password access requires some kind of authentication 198 // TODO(dubroy): When password access requires some kind of authentication
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 autofill::PasswordFormFillData* found_password) { 236 autofill::PasswordFormFillData* found_password) {
238 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(key); 237 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(key);
239 if (iter == login_to_password_info_.end()) 238 if (iter == login_to_password_info_.end())
240 return false; 239 return false;
241 240
242 *found_password = iter->second; 241 *found_password = iter->second;
243 return true; 242 return true;
244 } 243 }
245 244
246 } // namespace password_manager 245 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698