OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/preference_api.h" | 5 #include "chrome/browser/extensions/api/preference/preference_api.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 return; | 373 return; |
374 } | 374 } |
375 | 375 |
376 dict->Set(keys::kValue, transformed_value); | 376 dict->Set(keys::kValue, transformed_value); |
377 if (incognito) { | 377 if (incognito) { |
378 ExtensionPrefs* ep = ExtensionPrefs::Get(profile_); | 378 ExtensionPrefs* ep = ExtensionPrefs::Get(profile_); |
379 dict->SetBoolean(keys::kIncognitoSpecific, | 379 dict->SetBoolean(keys::kIncognitoSpecific, |
380 ep->HasIncognitoPrefValue(browser_pref)); | 380 ep->HasIncognitoPrefValue(browser_pref)); |
381 } | 381 } |
382 | 382 |
383 helpers::DispatchEventToExtensions(profile_, | 383 // TODO(kalman): Have a histogram value for each pref type. |
384 event_name, | 384 // This isn't so important for the current use case of these |
385 &args, | 385 // histograms, which is to track which event types are waking up event |
386 permission, | 386 // pages, or which are delivered to persistent background pages. Simply |
387 incognito, | 387 // "a setting changed" is enough detail for that. However if we try to |
| 388 // use these histograms for any fine-grained logic (like removing the |
| 389 // string event name altogether), or if we discover this event is |
| 390 // firing a lot and want to understand that better, then this will need |
| 391 // to change. |
| 392 events::HistogramValue histogram_value = |
| 393 events::TYPES_CHROME_SETTING_ON_CHANGE; |
| 394 helpers::DispatchEventToExtensions(profile_, histogram_value, event_name, |
| 395 &args, permission, incognito, |
388 browser_pref); | 396 browser_pref); |
389 } | 397 } |
390 | 398 |
391 void PreferenceAPIBase::SetExtensionControlledPref( | 399 void PreferenceAPIBase::SetExtensionControlledPref( |
392 const std::string& extension_id, | 400 const std::string& extension_id, |
393 const std::string& pref_key, | 401 const std::string& pref_key, |
394 ExtensionPrefsScope scope, | 402 ExtensionPrefsScope scope, |
395 base::Value* value) { | 403 base::Value* value) { |
396 #ifndef NDEBUG | 404 #ifndef NDEBUG |
397 const PrefService::Preference* pref = | 405 const PrefService::Preference* pref = |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 pref_key, PreferenceFunction::PERMISSION_TYPE_WRITE, &browser_pref)) { | 773 pref_key, PreferenceFunction::PERMISSION_TYPE_WRITE, &browser_pref)) { |
766 return false; | 774 return false; |
767 } | 775 } |
768 | 776 |
769 PreferenceAPI::Get(GetProfile()) | 777 PreferenceAPI::Get(GetProfile()) |
770 ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); | 778 ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); |
771 return true; | 779 return true; |
772 } | 780 } |
773 | 781 |
774 } // namespace extensions | 782 } // namespace extensions |
OLD | NEW |