| 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/extension_preference_api.h" | 5 #include "chrome/browser/extensions/extension_preference_api.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 OnPrefChanged(content::Source<PrefService>(source).ptr(), *pref_key); | 259 OnPrefChanged(content::Source<PrefService>(source).ptr(), *pref_key); |
| 260 } else { | 260 } else { |
| 261 NOTREACHED(); | 261 NOTREACHED(); |
| 262 } | 262 } |
| 263 } | 263 } |
| 264 | 264 |
| 265 void ExtensionPreferenceEventRouter::OnPrefChanged( | 265 void ExtensionPreferenceEventRouter::OnPrefChanged( |
| 266 PrefService* pref_service, | 266 PrefService* pref_service, |
| 267 const std::string& browser_pref) { | 267 const std::string& browser_pref) { |
| 268 bool incognito = (pref_service != profile_->GetPrefs()); | 268 bool incognito = (pref_service != profile_->GetPrefs()); |
| 269 | |
| 270 std::string event_name; | 269 std::string event_name; |
| 271 ExtensionAPIPermission::ID permission = ExtensionAPIPermission::kInvalid; | 270 ExtensionAPIPermission::ID permission = ExtensionAPIPermission::kInvalid; |
| 272 bool rv = PrefMapping::GetInstance()->FindEventForBrowserPref( | 271 bool rv = PrefMapping::GetInstance()->FindEventForBrowserPref( |
| 273 browser_pref, &event_name, &permission); | 272 browser_pref, &event_name, &permission); |
| 274 DCHECK(rv); | 273 DCHECK(rv); |
| 275 | 274 |
| 276 ListValue args; | 275 ListValue args; |
| 277 DictionaryValue* dict = new DictionaryValue(); | 276 DictionaryValue* dict = new DictionaryValue(); |
| 278 args.Append(dict); | 277 args.Append(dict); |
| 279 const PrefService::Preference* pref = | 278 const PrefService::Preference* pref = |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 } | 475 } |
| 477 | 476 |
| 478 std::string browser_pref; | 477 std::string browser_pref; |
| 479 if (!ValidateBrowserPref(pref_key, &browser_pref)) | 478 if (!ValidateBrowserPref(pref_key, &browser_pref)) |
| 480 return false; | 479 return false; |
| 481 | 480 |
| 482 ExtensionPrefs* prefs = profile_->GetExtensionService()->extension_prefs(); | 481 ExtensionPrefs* prefs = profile_->GetExtensionService()->extension_prefs(); |
| 483 prefs->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); | 482 prefs->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); |
| 484 return true; | 483 return true; |
| 485 } | 484 } |
| OLD | NEW |