| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/api/preference/chrome_direct_setting_api.h" | 5 #include "chrome/browser/extensions/api/preference/chrome_direct_setting_api.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "chrome/browser/extensions/api/preference/preference_api_constants.h" | 13 #include "chrome/browser/extensions/api/preference/preference_api_constants.h" |
| 14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "extensions/browser/extension_system.h" | 16 #include "extensions/browser/extension_system.h" |
| 17 | 17 |
| 18 namespace extensions { | 18 namespace extensions { |
| 19 namespace chromedirectsetting { | 19 namespace chromedirectsetting { |
| 20 | 20 |
| 21 const char kOnPrefChangeFormat[] = | 21 const char kOnPrefChangeFormat[] = |
| 22 "types.private.ChromeDirectSetting.%s.onChange"; | 22 "types.private.ChromeDirectSetting.%s.onChange"; |
| 23 | 23 |
| 24 class PreferenceWhitelist { | 24 class PreferenceWhitelist { |
| 25 public: | 25 public: |
| 26 PreferenceWhitelist() { | 26 PreferenceWhitelist() { |
| 27 whitelist_.insert("googlegeolocationaccess.enabled"); | 27 whitelist_.insert("googlegeolocationaccess.enabled"); |
| 28 whitelist_.insert("spdy_proxy.enabled"); | 28 whitelist_.insert("spdy_proxy.enabled"); |
| 29 whitelist_.insert("data_reduction.daily_original_length"); |
| 30 whitelist_.insert("data_reduction.daily_received_length"); |
| 31 whitelist_.insert("data_reduction.update_daily_lengths"); |
| 29 } | 32 } |
| 30 | 33 |
| 31 ~PreferenceWhitelist() {} | 34 ~PreferenceWhitelist() {} |
| 32 | 35 |
| 33 bool IsPreferenceOnWhitelist(const std::string& pref_key){ | 36 bool IsPreferenceOnWhitelist(const std::string& pref_key){ |
| 34 return whitelist_.find(pref_key) != whitelist_.end(); | 37 return whitelist_.find(pref_key) != whitelist_.end(); |
| 35 } | 38 } |
| 36 | 39 |
| 37 void RegisterEventListeners( | 40 void RegisterEventListeners( |
| 38 Profile* profile, | 41 Profile* profile, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 scoped_ptr<base::ListValue> args_copy(args.DeepCopy()); | 146 scoped_ptr<base::ListValue> args_copy(args.DeepCopy()); |
| 144 scoped_ptr<Event> event(new Event(event_name, args_copy.Pass())); | 147 scoped_ptr<Event> event(new Event(event_name, args_copy.Pass())); |
| 145 router->DispatchEventToExtension(extension_id, event.Pass()); | 148 router->DispatchEventToExtension(extension_id, event.Pass()); |
| 146 } | 149 } |
| 147 } | 150 } |
| 148 } | 151 } |
| 149 } | 152 } |
| 150 | 153 |
| 151 } // namespace chromedirectsetting | 154 } // namespace chromedirectsetting |
| 152 } // namespace extensions | 155 } // namespace extensions |
| OLD | NEW |