| 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_store_win.h" | 5 #include "chrome/browser/password_manager/password_store_win.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/profiler/scoped_tracker.h" | 12 #include "base/profiler/scoped_tracker.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "components/os_crypt/ie7_password_win.h" | 15 #include "components/os_crypt/ie7_password_win.h" |
| 16 #include "components/password_manager/core/browser/password_manager.h" | 16 #include "components/password_manager/core/browser/password_manager.h" |
| 17 #include "components/password_manager/core/browser/webdata/password_web_data_ser
vice_win.h" | 17 #include "components/password_manager/core/browser/webdata/password_web_data_ser
vice_win.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 19 | 19 |
| 20 using autofill::PasswordForm; | 20 using autofill::PasswordForm; |
| 21 using content::BrowserThread; | 21 using content::BrowserThread; |
| 22 using password_manager::PasswordStoreDefault; | 22 using password_manager::PasswordStoreDefault; |
| 23 | 23 |
| 24 // Handles requests to PasswordWebDataService. | 24 // Handles requests to PasswordWebDataService. |
| 25 class PasswordStoreWin::DBHandler : public WebDataServiceConsumer { | 25 class PasswordStoreWin::DBHandler : public WebDataServiceConsumer { |
| 26 public: | 26 public: |
| 27 DBHandler(PasswordWebDataService* web_data_service, | 27 DBHandler(const scoped_refptr<PasswordWebDataService>& web_data_service, |
| 28 PasswordStoreWin* password_store) | 28 PasswordStoreWin* password_store) |
| 29 : web_data_service_(web_data_service), | 29 : web_data_service_(web_data_service), password_store_(password_store) {} |
| 30 password_store_(password_store) { | |
| 31 } | |
| 32 | 30 |
| 33 ~DBHandler(); | 31 ~DBHandler(); |
| 34 | 32 |
| 35 // Requests the IE7 login for |form|. This is async. |callback_runner| will be | 33 // Requests the IE7 login for |form|. This is async. |callback_runner| will be |
| 36 // run when complete. | 34 // run when complete. |
| 37 void GetIE7Login( | 35 void GetIE7Login( |
| 38 const PasswordForm& form, | 36 const PasswordForm& form, |
| 39 const PasswordStoreWin::ConsumerCallbackRunner& callback_runner); | 37 const PasswordStoreWin::ConsumerCallbackRunner& callback_runner); |
| 40 | 38 |
| 41 private: | 39 private: |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 std::vector<autofill::PasswordForm*> matched_forms = | 167 std::vector<autofill::PasswordForm*> matched_forms = |
| 170 GetIE7Results(result, *form); | 168 GetIE7Results(result, *form); |
| 171 | 169 |
| 172 callback_runner.Run(matched_forms); | 170 callback_runner.Run(matched_forms); |
| 173 } | 171 } |
| 174 | 172 |
| 175 PasswordStoreWin::PasswordStoreWin( | 173 PasswordStoreWin::PasswordStoreWin( |
| 176 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, | 174 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, |
| 177 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, | 175 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, |
| 178 password_manager::LoginDatabase* login_database, | 176 password_manager::LoginDatabase* login_database, |
| 179 PasswordWebDataService* web_data_service) | 177 const scoped_refptr<PasswordWebDataService>& web_data_service) |
| 180 : PasswordStoreDefault(main_thread_runner, | 178 : PasswordStoreDefault(main_thread_runner, |
| 181 db_thread_runner, | 179 db_thread_runner, |
| 182 login_database) { | 180 login_database) { |
| 183 db_handler_.reset(new DBHandler(web_data_service, this)); | 181 db_handler_.reset(new DBHandler(web_data_service, this)); |
| 184 } | 182 } |
| 185 | 183 |
| 186 PasswordStoreWin::~PasswordStoreWin() { | 184 PasswordStoreWin::~PasswordStoreWin() { |
| 187 } | 185 } |
| 188 | 186 |
| 189 void PasswordStoreWin::ShutdownOnDBThread() { | 187 void PasswordStoreWin::ShutdownOnDBThread() { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 213 | 211 |
| 214 void PasswordStoreWin::GetLoginsImpl( | 212 void PasswordStoreWin::GetLoginsImpl( |
| 215 const PasswordForm& form, | 213 const PasswordForm& form, |
| 216 AuthorizationPromptPolicy prompt_policy, | 214 AuthorizationPromptPolicy prompt_policy, |
| 217 const ConsumerCallbackRunner& callback_runner) { | 215 const ConsumerCallbackRunner& callback_runner) { |
| 218 ConsumerCallbackRunner get_ie7_login = | 216 ConsumerCallbackRunner get_ie7_login = |
| 219 base::Bind(&PasswordStoreWin::GetIE7LoginIfNecessary, | 217 base::Bind(&PasswordStoreWin::GetIE7LoginIfNecessary, |
| 220 this, form, callback_runner); | 218 this, form, callback_runner); |
| 221 PasswordStoreDefault::GetLoginsImpl(form, prompt_policy, get_ie7_login); | 219 PasswordStoreDefault::GetLoginsImpl(form, prompt_policy, get_ie7_login); |
| 222 } | 220 } |
| OLD | NEW |