Home | History | Annotate | Download | only in extensions
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PREF_STORE_H_
      6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREF_STORE_H_
      7 #pragma once
      8 
      9 #include <string>
     10 
     11 #include "base/time.h"
     12 #include "chrome/browser/extensions/extension_pref_value_map.h"
     13 #include "chrome/browser/prefs/value_map_pref_store.h"
     14 
     15 // A (non-persistent) PrefStore implementation that holds effective preferences
     16 // set by extensions. These preferences are managed by and fetched from an
     17 // ExtensionPrefValueMap.
     18 class ExtensionPrefStore : public ValueMapPrefStore,
     19                            public ExtensionPrefValueMap::Observer {
     20  public:
     21   // Constructs an ExtensionPrefStore for a regular or an incognito profile.
     22   explicit ExtensionPrefStore(ExtensionPrefValueMap* extension_pref_value_map,
     23                               bool incognito_pref_store);
     24   virtual ~ExtensionPrefStore();
     25 
     26  private:
     27   // Overrides for ExtensionPrefValueMap::Observer:
     28   virtual void OnInitializationCompleted();
     29   virtual void OnPrefValueChanged(const std::string& key);
     30   virtual void OnExtensionPrefValueMapDestruction();
     31 
     32   ExtensionPrefValueMap* extension_pref_value_map_;  // Weak pointer.
     33   bool incognito_pref_store_;
     34 
     35   DISALLOW_COPY_AND_ASSIGN(ExtensionPrefStore);
     36 };
     37 
     38 #endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREF_STORE_H_
     39