Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 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_API_PREFERENCE_CHROME_DIRECT_SETTING_API_H__ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_API_H__ | |
| 7 | |
| 8 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | |
| 9 #include "chrome/browser/extensions/event_router.h" | |
| 10 | |
| 11 class PrefChangeRegistrar; | |
| 12 class Profile; | |
| 13 | |
| 14 namespace extensions { | |
| 15 namespace chromedirectsetting { | |
| 16 | |
| 17 class ChromeDirectSettingAPI : public ProfileKeyedAPI, | |
| 18 public EventRouter::Observer { | |
| 19 public: | |
| 20 explicit ChromeDirectSettingAPI(Profile* profile); | |
| 21 | |
| 22 virtual ~ChromeDirectSettingAPI(); | |
| 23 | |
| 24 // BrowserContextKeyedService implementation. | |
| 25 virtual void Shutdown() OVERRIDE; | |
| 26 | |
| 27 // ProfileKeyedAPI implementation. | |
| 28 static ProfileKeyedAPIFactory<ChromeDirectSettingAPI>* GetFactoryInstance(); | |
| 29 | |
| 30 // EventRouter::Observer implementation. | |
| 31 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; | |
| 32 | |
| 33 // Returns true if the preference is on the whitelist. | |
| 34 bool IsPreferenceOnWhitelist(const std::string& pref_key); | |
| 35 | |
| 36 // Convenience method to get the ChromeDirectSettingAPI for a profile. | |
| 37 static ChromeDirectSettingAPI* Get(Profile* profile); | |
| 38 | |
| 39 private: | |
| 40 friend class ProfileKeyedAPIFactory<ChromeDirectSettingAPI>; | |
| 41 | |
| 42 // ProfileKeyedAPI implementation. | |
| 43 static const char* service_name(); | |
| 44 | |
| 45 void OnPrefChanged(PrefService* pref_service, const std::string& pref_key); | |
| 46 | |
| 47 static const bool kServiceIsNULLWhileTesting = true; | |
| 48 static const bool kServiceRedirectedInIncognito = false; | |
| 49 | |
| 50 PrefChangeRegistrar registrar_; | |
| 51 Profile* profile_; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(ChromeDirectSettingAPI); | |
| 54 }; | |
| 55 | |
| 56 } // namespace chromedirectsetting | |
| 57 } // namespace extensions | |
| 58 | |
| 59 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_API_H_ _ | |
|
robliao
2013/07/13 00:33:35
This line will fail presubmit (81 characters). Any
vadimt
2013/07/13 00:40:09
You can try to find another file with a long name
robliao
2013/07/15 17:14:41
Existing files appear to be directly submitted or
| |
| 60 | |
| OLD | NEW |