X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fchrome%2Fbrowser%2Fpassword_manager%2Fpassword_store_x.cc;h=19332fcc08759c3c875afa2059dcefaca2fdec9d;hb=ff3e2503a20db9193d323c1d19c38c68004dec4a;hp=4d1b031d8163146d554e30704ec9683ef0cabe36;hpb=d1e23c6ec4202b125fc446349b2230d4cd978d86;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/chrome/browser/password_manager/password_store_x.cc b/src/chrome/browser/password_manager/password_store_x.cc index 4d1b031..19332fc 100644 --- a/src/chrome/browser/password_manager/password_store_x.cc +++ b/src/chrome/browser/password_manager/password_store_x.cc @@ -13,8 +13,8 @@ #include "base/prefs/pref_service.h" #include "base/stl_util.h" #include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/password_manager/password_store_change.h" #include "chrome/common/pref_names.h" +#include "components/password_manager/core/browser/password_store_change.h" #include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" @@ -23,85 +23,78 @@ using autofill::PasswordForm; using content::BrowserThread; using std::vector; -PasswordStoreX::PasswordStoreX(LoginDatabase* login_db, - Profile* profile, - NativeBackend* backend) - : PasswordStoreDefault(login_db, profile), - backend_(backend), migration_checked_(!backend), allow_fallback_(false) { -} +PasswordStoreX::PasswordStoreX( + scoped_refptr main_thread_runner, + scoped_refptr db_thread_runner, + LoginDatabase* login_db, + NativeBackend* backend) + : PasswordStoreDefault(main_thread_runner, db_thread_runner, login_db), + backend_(backend), + migration_checked_(!backend), + allow_fallback_(false) {} PasswordStoreX::~PasswordStoreX() {} -void PasswordStoreX::AddLoginImpl(const PasswordForm& form) { +PasswordStoreChangeList PasswordStoreX::AddLoginImpl(const PasswordForm& form) { CheckMigration(); + PasswordStoreChangeList changes; if (use_native_backend() && backend_->AddLogin(form)) { - PasswordStoreChangeList changes; changes.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form)); - content::NotificationService::current()->Notify( - chrome::NOTIFICATION_LOGINS_CHANGED, - content::Source(this), - content::Details(&changes)); allow_fallback_ = false; } else if (allow_default_store()) { - PasswordStoreDefault::AddLoginImpl(form); + changes = PasswordStoreDefault::AddLoginImpl(form); } + return changes; } -void PasswordStoreX::UpdateLoginImpl(const PasswordForm& form) { +PasswordStoreChangeList PasswordStoreX::UpdateLoginImpl( + const PasswordForm& form) { CheckMigration(); + PasswordStoreChangeList changes; if (use_native_backend() && backend_->UpdateLogin(form)) { - PasswordStoreChangeList changes; changes.push_back(PasswordStoreChange(PasswordStoreChange::UPDATE, form)); - content::NotificationService::current()->Notify( - chrome::NOTIFICATION_LOGINS_CHANGED, - content::Source(this), - content::Details(&changes)); allow_fallback_ = false; } else if (allow_default_store()) { - PasswordStoreDefault::UpdateLoginImpl(form); + changes = PasswordStoreDefault::UpdateLoginImpl(form); } + return changes; } -void PasswordStoreX::RemoveLoginImpl(const PasswordForm& form) { +PasswordStoreChangeList PasswordStoreX::RemoveLoginImpl( + const PasswordForm& form) { CheckMigration(); + PasswordStoreChangeList changes; if (use_native_backend() && backend_->RemoveLogin(form)) { - PasswordStoreChangeList changes; changes.push_back(PasswordStoreChange(PasswordStoreChange::REMOVE, form)); - content::NotificationService::current()->Notify( - chrome::NOTIFICATION_LOGINS_CHANGED, - content::Source(this), - content::Details(&changes)); allow_fallback_ = false; } else if (allow_default_store()) { - PasswordStoreDefault::RemoveLoginImpl(form); + changes = PasswordStoreDefault::RemoveLoginImpl(form); } + return changes; } -void PasswordStoreX::RemoveLoginsCreatedBetweenImpl( +PasswordStoreChangeList PasswordStoreX::RemoveLoginsCreatedBetweenImpl( const base::Time& delete_begin, const base::Time& delete_end) { CheckMigration(); vector forms; + PasswordStoreChangeList changes; if (use_native_backend() && backend_->GetLoginsCreatedBetween(delete_begin, delete_end, &forms) && backend_->RemoveLoginsCreatedBetween(delete_begin, delete_end)) { - PasswordStoreChangeList changes; for (vector::const_iterator it = forms.begin(); it != forms.end(); ++it) { changes.push_back(PasswordStoreChange(PasswordStoreChange::REMOVE, **it)); } LogStatsForBulkDeletion(changes.size()); - content::NotificationService::current()->Notify( - chrome::NOTIFICATION_LOGINS_CHANGED, - content::Source(this), - content::Details(&changes)); allow_fallback_ = false; } else if (allow_default_store()) { - PasswordStoreDefault::RemoveLoginsCreatedBetweenImpl(delete_begin, - delete_end); + changes = PasswordStoreDefault::RemoveLoginsCreatedBetweenImpl(delete_begin, + delete_end); } STLDeleteElements(&forms); + return changes; } namespace {