| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 virtual Value* BrowserToExtensionPref(const Value* browser_pref) OVERRIDE { | 133 virtual Value* BrowserToExtensionPref(const Value* browser_pref) OVERRIDE { |
| 134 return InvertBooleanValue(browser_pref); | 134 return InvertBooleanValue(browser_pref); |
| 135 } | 135 } |
| 136 | 136 |
| 137 private: | 137 private: |
| 138 static Value* InvertBooleanValue(const Value* value) { | 138 static Value* InvertBooleanValue(const Value* value) { |
| 139 bool bool_value = false; | 139 bool bool_value = false; |
| 140 bool result = value->GetAsBoolean(&bool_value); | 140 bool result = value->GetAsBoolean(&bool_value); |
| 141 DCHECK(result); | 141 DCHECK(result); |
| 142 return Value::CreateBooleanValue(!bool_value); | 142 return new base::FundamentalValue(!bool_value); |
| 143 } | 143 } |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 class PrefMapping { | 146 class PrefMapping { |
| 147 public: | 147 public: |
| 148 static PrefMapping* GetInstance() { | 148 static PrefMapping* GetInstance() { |
| 149 return Singleton<PrefMapping>::get(); | 149 return Singleton<PrefMapping>::get(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 bool FindBrowserPrefForExtensionPref(const std::string& extension_pref, | 152 bool FindBrowserPrefForExtensionPref(const std::string& extension_pref, |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 std::string browser_pref; | 732 std::string browser_pref; |
| 733 if (!ValidateBrowserPref(pref_key, &browser_pref)) | 733 if (!ValidateBrowserPref(pref_key, &browser_pref)) |
| 734 return false; | 734 return false; |
| 735 | 735 |
| 736 PreferenceAPI::Get(profile())->RemoveExtensionControlledPref( | 736 PreferenceAPI::Get(profile())->RemoveExtensionControlledPref( |
| 737 extension_id(), browser_pref, scope); | 737 extension_id(), browser_pref, scope); |
| 738 return true; | 738 return true; |
| 739 } | 739 } |
| 740 | 740 |
| 741 } // namespace extensions | 741 } // namespace extensions |
| OLD | NEW |