diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-09 10:32:54 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-09 10:32:54 +0000 |
commit | 5ee200b423be84efa02659b972093fed44d987a2 (patch) | |
tree | 563c7368e382f697b2a87f0be6537133238faf52 /chrome/browser/autofill | |
parent | 0aa4047c7625056708bc6cd9de6ff9573961ae28 (diff) | |
download | chromium_src-5ee200b423be84efa02659b972093fed44d987a2.zip chromium_src-5ee200b423be84efa02659b972093fed44d987a2.tar.gz chromium_src-5ee200b423be84efa02659b972093fed44d987a2.tar.bz2 |
Revert 166704 - Convert PrefChangeRegistrar usages, batch 1.
TBR=mmenke@chromium.org,rickcam@chromium.org,dhollowa@chromium.org
BUG=155525,160177
Review URL: https://chromiumcodereview.appspot.com/11376003
Speculative revert to check if memory usage increase was caused by
this change and its parent change.
TBR=joi@chromium.org
Review URL: https://codereview.chromium.org/11366170
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166885 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill')
-rw-r--r-- | chrome/browser/autofill/autofill_manager.cc | 9 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_manager.h | 7 |
2 files changed, 9 insertions, 7 deletions
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index ef88b40..5e04f35 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -212,10 +212,7 @@ AutofillManager::AutofillManager(content::WebContents* web_contents, delegate->GetOriginalProfile()); RegisterWithSyncService(); registrar_.Init(manager_delegate_->GetPrefs()); - registrar_.Add( - prefs::kPasswordGenerationEnabled, - base::Bind(&AutofillManager::OnPasswordGenerationEnabledChanged, - base::Unretained(this))); + registrar_.Add(prefs::kPasswordGenerationEnabled, this); } AutofillManager::~AutofillManager() { @@ -294,8 +291,10 @@ void AutofillManager::RenderViewCreated(content::RenderViewHost* host) { UpdatePasswordGenerationState(host, true); } -void AutofillManager::OnPasswordGenerationEnabledChanged() { +void AutofillManager::OnPreferenceChanged(PrefServiceBase* service, + const std::string& pref_name) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK(prefs::kPasswordGenerationEnabled == pref_name); UpdatePasswordGenerationState(web_contents()->GetRenderViewHost(), false); } diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h index 16e17d8..9261af2 100644 --- a/chrome/browser/autofill/autofill_manager.h +++ b/chrome/browser/autofill/autofill_manager.h @@ -18,6 +18,7 @@ #include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" #include "base/prefs/public/pref_change_registrar.h" +#include "base/prefs/public/pref_observer.h" #include "base/string16.h" #include "base/time.h" #include "chrome/browser/api/sync/profile_sync_service_observer.h" @@ -66,6 +67,7 @@ class Message; class AutofillManager : public content::WebContentsObserver, public AutofillDownloadManager::Observer, public ProfileSyncServiceObserver, + public PrefObserver, public base::RefCounted<AutofillManager> { public: static void CreateForWebContentsAndDelegate( @@ -189,8 +191,9 @@ class AutofillManager : public content::WebContentsObserver, // Register as an observer with the sync service. void RegisterWithSyncService(); - // Called when password generation preference state changes. - void OnPasswordGenerationEnabledChanged(); + // PrefObserver. + virtual void OnPreferenceChanged(PrefServiceBase* service, + const std::string& pref_name) OVERRIDE; // Determines what the current state of password generation is, and if it has // changed from |password_generation_enabled_|. If it has changed or if |