#ifndef CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_API_H__
#define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_API_H__
#include "base/prefs/pref_change_registrar.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/event_router.h"
class Profile;
namespace content {
class BrowserContext;
}
namespace extensions {
namespace chromedirectsetting {
class ChromeDirectSettingAPI : public BrowserContextKeyedAPI,
public EventRouter::Observer {
public:
explicit ChromeDirectSettingAPI(content::BrowserContext* context);
virtual ~ChromeDirectSettingAPI();
virtual void Shutdown() OVERRIDE;
static BrowserContextKeyedAPIFactory<ChromeDirectSettingAPI>*
GetFactoryInstance();
virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE;
bool IsPreferenceOnWhitelist(const std::string& pref_key);
static ChromeDirectSettingAPI* Get(content::BrowserContext* context);
private:
friend class BrowserContextKeyedAPIFactory<ChromeDirectSettingAPI>;
static const char* service_name();
void OnPrefChanged(PrefService* pref_service, const std::string& pref_key);
static const bool kServiceIsNULLWhileTesting = true;
static const bool kServiceRedirectedInIncognito = false;
PrefChangeRegistrar registrar_;
Profile* profile_;
DISALLOW_COPY_AND_ASSIGN(ChromeDirectSettingAPI);
};
}
}
#endif