1// Copyright (c) 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_PREFS_BROWSER_UI_PREFS_MIGRATOR_H_ 6#define CHROME_BROWSER_PREFS_BROWSER_UI_PREFS_MIGRATOR_H_ 7 8#include "base/memory/scoped_ptr.h" 9#include "base/prefs/pref_store.h" 10#include "base/prefs/writeable_pref_store.h" 11 12// When prefs are loaded from disk this class migrates some previously 13// dynamically registered preferences to their new home in a statically 14// registered dictionary. It can't follow the usual migration pattern because 15// it is migrating preferences that aren't registered at migration time and has 16// to iterate over a raw DictionaryValue looking for keys to migrate. 17// 18// Objects of this class delete themselves after the migration. 19// 20// TODO(dgrogan): Delete this for m41. See http://crbug.com/167256. 21 22class BrowserUIPrefsMigrator : public PrefStore::Observer { 23 public: 24 explicit BrowserUIPrefsMigrator(WriteablePrefStore* pref_store); 25 26 // Overrides from PrefStore::Observer. 27 virtual void OnPrefValueChanged(const std::string& key) OVERRIDE {} 28 virtual void OnInitializationCompleted(bool succeeded) OVERRIDE; 29 30 private: 31 friend struct base::DefaultDeleter<BrowserUIPrefsMigrator>; 32 33 virtual ~BrowserUIPrefsMigrator(); 34 35 WriteablePrefStore* pref_store_; 36 37 DISALLOW_COPY_AND_ASSIGN(BrowserUIPrefsMigrator); 38}; 39 40#endif // CHROME_BROWSER_PREFS_BROWSER_UI_PREFS_MIGRATOR_H_ 41