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

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

Issue 1874001: Migrate web data service logins to the login database correctly on win. (Closed)
Patch Set: Fix PSW::OnWeb Created 10 years, 7 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/password_manager/ie7_password.h" 9 #include "chrome/browser/password_manager/ie7_password.h"
10 #include "chrome/browser/password_manager/password_manager.h" 10 #include "chrome/browser/password_manager/password_manager.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 std::wstring url = ASCIIToWide(it->second.origin.spec()); 48 std::wstring url = ASCIIToWide(it->second.origin.spec());
49 info.url_hash = ie7_password::GetUrlHash(url); 49 info.url_hash = ie7_password::GetUrlHash(url);
50 WebDataService::Handle handle = web_data_service_->GetIE7Login(info, 50 WebDataService::Handle handle = web_data_service_->GetIE7Login(info,
51 this); 51 this);
52 TrackRequest(handle, request); 52 TrackRequest(handle, request);
53 } 53 }
54 } 54 }
55 } 55 }
56 56
57 void PasswordStoreWin::OnWebDataServiceRequestDone( 57 void PasswordStoreWin::OnWebDataServiceRequestDone(
58 WebDataService::Handle handle, const WDTypedResult *result) { 58 WebDataService::Handle handle, const WDTypedResult* result) {
59 scoped_ptr<GetLoginsRequest> request(TakeRequestWithHandle(handle));
60 // If the request was cancelled, we are done.
61 if (!request.get())
62 return;
63
64 if (!result) 59 if (!result)
65 return; // The WDS returns NULL if it is shutting down. 60 return; // The WDS returns NULL if it is shutting down.
66 61
67 if (PASSWORD_IE7_RESULT == result->GetType()) { 62 if (PASSWORD_IE7_RESULT == result->GetType()) {
63 scoped_ptr<GetLoginsRequest> request(TakeRequestWithHandle(handle));
64
65 // If the request was cancelled, we are done.
66 if (!request.get())
67 return;
68
68 // This is a response from WebDataService::GetIE7Login. 69 // This is a response from WebDataService::GetIE7Login.
69 PendingRequestFormMap::iterator it(pending_request_forms_.find( 70 PendingRequestFormMap::iterator it(pending_request_forms_.find(
70 request->handle)); 71 request->handle));
71 DCHECK(pending_request_forms_.end() != it); 72 DCHECK(pending_request_forms_.end() != it);
72 PasswordForm* ie7_form = GetIE7Result(result, it->second); 73 PasswordForm* ie7_form = GetIE7Result(result, it->second);
73 74
74 std::vector<PasswordForm*> forms; 75 std::vector<PasswordForm*> forms;
75 if (ie7_form) 76 if (ie7_form)
76 forms.push_back(ie7_form); 77 forms.push_back(ie7_form);
77 78
78 pending_request_forms_.erase(it); 79 pending_request_forms_.erase(it);
79 PasswordStore::NotifyConsumer(request.release(), forms); 80 PasswordStore::NotifyConsumer(request.release(), forms);
80 } else { 81 } else {
81 NOTREACHED(); 82 PasswordStoreDefault::OnWebDataServiceRequestDone(handle, result);
82 } 83 }
83 } 84 }
84 85
85 void PasswordStoreWin::TrackRequest(WebDataService::Handle handle, 86 void PasswordStoreWin::TrackRequest(WebDataService::Handle handle,
86 GetLoginsRequest* request) { 87 GetLoginsRequest* request) {
87 pending_requests_.insert(PendingRequestMap::value_type(handle, request)); 88 pending_requests_.insert(PendingRequestMap::value_type(handle, request));
88 } 89 }
89 90
90 PasswordStoreDefault::GetLoginsRequest* 91 PasswordStoreDefault::GetLoginsRequest*
91 PasswordStoreWin::TakeRequestWithHandle(WebDataService::Handle handle) { 92 PasswordStoreWin::TakeRequestWithHandle(WebDataService::Handle handle) {
(...skipping 30 matching lines...) Expand all
122 auto_fill->password_value = password; 123 auto_fill->password_value = password;
123 auto_fill->preferred = true; 124 auto_fill->preferred = true;
124 auto_fill->ssl_valid = form.origin.SchemeIsSecure(); 125 auto_fill->ssl_valid = form.origin.SchemeIsSecure();
125 auto_fill->date_created = info.date_created; 126 auto_fill->date_created = info.date_created;
126 // Add this PasswordForm to the saved password table. 127 // Add this PasswordForm to the saved password table.
127 AddLogin(*auto_fill); 128 AddLogin(*auto_fill);
128 return auto_fill; 129 return auto_fill;
129 } 130 }
130 return NULL; 131 return NULL;
131 } 132 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698