Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4947)

Unified Diff: chrome/browser/extensions/api/preference/chrome_direct_setting_api.h

Issue 18100007: Implemented types.private.ChromeDirectSetting.onChange (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@DirectSetting
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/preference/chrome_direct_setting_api.h
diff --git a/chrome/browser/extensions/api/preference/chrome_direct_setting_api.h b/chrome/browser/extensions/api/preference/chrome_direct_setting_api.h
new file mode 100644
index 0000000000000000000000000000000000000000..4349f276891732aef6ac7bde32502f74725acb57
--- /dev/null
+++ b/chrome/browser/extensions/api/preference/chrome_direct_setting_api.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_API_H__
+#define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_API_H__
+
+#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
+#include "chrome/browser/extensions/event_router.h"
+
+class PrefChangeRegistrar;
+class Profile;
+
+namespace extensions {
+namespace chromedirectsetting {
+
+class ChromeDirectSettingAPI : public ProfileKeyedAPI,
+ public EventRouter::Observer {
+ public:
+ explicit ChromeDirectSettingAPI(Profile* profile);
+
+ virtual ~ChromeDirectSettingAPI();
+
+ // BrowserContextKeyedService implementation.
+ virtual void Shutdown() OVERRIDE;
+
+ // ProfileKeyedAPI implementation.
+ static ProfileKeyedAPIFactory<ChromeDirectSettingAPI>* GetFactoryInstance();
+
+ // EventRouter::Observer implementation.
+ virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE;
+
+ // Returns true if the preference is on the whitelist.
+ bool IsPreferenceOnWhitelist(const std::string& pref_key);
+
+ // Convenience method to get the ChromeDirectSettingAPI for a profile.
+ static ChromeDirectSettingAPI* Get(Profile* profile);
+
+ private:
+ friend class ProfileKeyedAPIFactory<ChromeDirectSettingAPI>;
+
+ // ProfileKeyedAPI implementation.
+ 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);
+};
+
+} // namespace chromedirectsetting
+} // namespace extensions
+
+#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
+

Powered by Google App Engine
This is Rietveld 408576698