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

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

Issue 8680040: Group forms-related files in webkit/glue in a forms/ subdirectory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + another build fix Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_mac.h" 5 #include "chrome/browser/password_manager/password_store_mac.h"
6 #include "chrome/browser/password_manager/password_store_mac_internal.h" 6 #include "chrome/browser/password_manager/password_store_mac_internal.h"
7 7
8 #include <CoreServices/CoreServices.h> 8 #include <CoreServices/CoreServices.h>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/mac/mac_util.h" 14 #include "base/mac/mac_util.h"
15 #include "base/message_loop.h" 15 #include "base/message_loop.h"
16 #include "base/stl_util.h" 16 #include "base/stl_util.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "base/task.h" 18 #include "base/task.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "chrome/browser/keychain_mac.h" 20 #include "chrome/browser/keychain_mac.h"
21 #include "chrome/browser/password_manager/login_database.h" 21 #include "chrome/browser/password_manager/login_database.h"
22 #include "chrome/browser/password_manager/password_store_change.h" 22 #include "chrome/browser/password_manager/password_store_change.h"
23 #include "chrome/common/chrome_notification_types.h" 23 #include "chrome/common/chrome_notification_types.h"
24 #include "content/public/browser/notification_service.h" 24 #include "content/public/browser/notification_service.h"
25 25
26 using webkit_glue::PasswordForm; 26 using webkit::forms::PasswordForm;
27 27
28 // Utility class to handle the details of constructing and running a keychain 28 // Utility class to handle the details of constructing and running a keychain
29 // search from a set of attributes. 29 // search from a set of attributes.
30 class KeychainSearch { 30 class KeychainSearch {
31 public: 31 public:
32 explicit KeychainSearch(const MacKeychain& keychain); 32 explicit KeychainSearch(const MacKeychain& keychain);
33 ~KeychainSearch(); 33 ~KeychainSearch();
34 34
35 // Sets up a keycahin search based on an non "null" (NULL for char*, 35 // Sets up a keycahin search based on an non "null" (NULL for char*,
36 // The appropriate "Any" entry for other types) arguments. 36 // The appropriate "Any" entry for other types) arguments.
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 for (std::vector<SecKeychainItemRef>::iterator i = matches.begin() + 1; 634 for (std::vector<SecKeychainItemRef>::iterator i = matches.begin() + 1;
635 i != matches.end(); ++i) { 635 i != matches.end(); ++i) {
636 keychain_->Free(*i); 636 keychain_->Free(*i);
637 } 637 }
638 return matches[0]; 638 return matches[0];
639 } 639 }
640 640
641 std::vector<SecKeychainItemRef> 641 std::vector<SecKeychainItemRef>
642 MacKeychainPasswordFormAdapter::MatchingKeychainItems( 642 MacKeychainPasswordFormAdapter::MatchingKeychainItems(
643 const std::string& signon_realm, 643 const std::string& signon_realm,
644 webkit_glue::PasswordForm::Scheme scheme, 644 webkit::forms::PasswordForm::Scheme scheme,
645 const char* path, const char* username) { 645 const char* path, const char* username) {
646 std::vector<SecKeychainItemRef> matches; 646 std::vector<SecKeychainItemRef> matches;
647 647
648 std::string server; 648 std::string server;
649 std::string security_domain; 649 std::string security_domain;
650 int port; 650 int port;
651 bool is_secure; 651 bool is_secure;
652 if (!ExtractSignonRealmComponents(signon_realm, &server, &port, 652 if (!ExtractSignonRealmComponents(signon_realm, &server, &port,
653 &is_secure, &security_domain)) { 653 &is_secure, &security_domain)) {
654 // TODO(stuartmorgan): Proxies will currently fail here, since their 654 // TODO(stuartmorgan): Proxies will currently fail here, since their
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 } 880 }
881 content::NotificationService::current()->Notify( 881 content::NotificationService::current()->Notify(
882 chrome::NOTIFICATION_LOGINS_CHANGED, 882 chrome::NOTIFICATION_LOGINS_CHANGED,
883 content::Source<PasswordStore>(this), 883 content::Source<PasswordStore>(this),
884 content::Details<PasswordStoreChangeList>(&changes)); 884 content::Details<PasswordStoreChangeList>(&changes));
885 } 885 }
886 } 886 }
887 } 887 }
888 888
889 void PasswordStoreMac::GetLoginsImpl(GetLoginsRequest* request, 889 void PasswordStoreMac::GetLoginsImpl(GetLoginsRequest* request,
890 const webkit_glue::PasswordForm& form) { 890 const webkit::forms::PasswordForm& form) {
891 MacKeychainPasswordFormAdapter keychain_adapter(keychain_.get()); 891 MacKeychainPasswordFormAdapter keychain_adapter(keychain_.get());
892 std::vector<PasswordForm*> keychain_forms = 892 std::vector<PasswordForm*> keychain_forms =
893 keychain_adapter.PasswordsFillingForm(form); 893 keychain_adapter.PasswordsFillingForm(form);
894 894
895 std::vector<PasswordForm*> database_forms; 895 std::vector<PasswordForm*> database_forms;
896 login_metadata_db_->GetLogins(form, &database_forms); 896 login_metadata_db_->GetLogins(form, &database_forms);
897 897
898 std::vector<PasswordForm*>& merged_forms = request->value; 898 std::vector<PasswordForm*>& merged_forms = request->value;
899 internal_keychain_helpers::MergePasswordForms(&keychain_forms, 899 internal_keychain_helpers::MergePasswordForms(&keychain_forms,
900 &database_forms, 900 &database_forms,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 953
954 bool PasswordStoreMac::AddToKeychainIfNecessary(const PasswordForm& form) { 954 bool PasswordStoreMac::AddToKeychainIfNecessary(const PasswordForm& form) {
955 if (form.blacklisted_by_user) { 955 if (form.blacklisted_by_user) {
956 return true; 956 return true;
957 } 957 }
958 MacKeychainPasswordFormAdapter keychainAdapter(keychain_.get()); 958 MacKeychainPasswordFormAdapter keychainAdapter(keychain_.get());
959 return keychainAdapter.AddPassword(form); 959 return keychainAdapter.AddPassword(form);
960 } 960 }
961 961
962 bool PasswordStoreMac::DatabaseHasFormMatchingKeychainForm( 962 bool PasswordStoreMac::DatabaseHasFormMatchingKeychainForm(
963 const webkit_glue::PasswordForm& form) { 963 const webkit::forms::PasswordForm& form) {
964 bool has_match = false; 964 bool has_match = false;
965 std::vector<PasswordForm*> database_forms; 965 std::vector<PasswordForm*> database_forms;
966 login_metadata_db_->GetLogins(form, &database_forms); 966 login_metadata_db_->GetLogins(form, &database_forms);
967 for (std::vector<PasswordForm*>::iterator i = database_forms.begin(); 967 for (std::vector<PasswordForm*>::iterator i = database_forms.begin();
968 i != database_forms.end(); ++i) { 968 i != database_forms.end(); ++i) {
969 if (internal_keychain_helpers::FormsMatchForMerge(form, **i) && 969 if (internal_keychain_helpers::FormsMatchForMerge(form, **i) &&
970 (*i)->origin == form.origin) { 970 (*i)->origin == form.origin) {
971 has_match = true; 971 has_match = true;
972 break; 972 break;
973 } 973 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 owned_keychain_adapter.SetFindsOnlyOwnedItems(true); 1011 owned_keychain_adapter.SetFindsOnlyOwnedItems(true);
1012 for (std::vector<PasswordForm*>::const_iterator i = forms.begin(); 1012 for (std::vector<PasswordForm*>::const_iterator i = forms.begin();
1013 i != forms.end(); ++i) { 1013 i != forms.end(); ++i) {
1014 owned_keychain_adapter.RemovePassword(**i); 1014 owned_keychain_adapter.RemovePassword(**i);
1015 } 1015 }
1016 } 1016 }
1017 1017
1018 void PasswordStoreMac::CreateNotificationService() { 1018 void PasswordStoreMac::CreateNotificationService() {
1019 notification_service_.reset(content::NotificationService::Create()); 1019 notification_service_.reset(content::NotificationService::Create());
1020 } 1020 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_store_mac.h ('k') | chrome/browser/password_manager/password_store_mac_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698