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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 {"virtualKeyboard", prefs::kAccessibilityVirtualKeyboardEnabled, | 118 {"virtualKeyboard", prefs::kAccessibilityVirtualKeyboardEnabled, |
119 APIPermission::kAccessibilityFeaturesRead, | 119 APIPermission::kAccessibilityFeaturesRead, |
120 APIPermission::kAccessibilityFeaturesModify}, | 120 APIPermission::kAccessibilityFeaturesModify}, |
121 #endif | 121 #endif |
122 }; | 122 }; |
123 | 123 |
124 class IdentityPrefTransformer : public PrefTransformerInterface { | 124 class IdentityPrefTransformer : public PrefTransformerInterface { |
125 public: | 125 public: |
126 virtual base::Value* ExtensionToBrowserPref(const base::Value* extension_pref, | 126 virtual base::Value* ExtensionToBrowserPref(const base::Value* extension_pref, |
127 std::string* error, | 127 std::string* error, |
128 bool* bad_message) OVERRIDE { | 128 bool* bad_message) override { |
129 return extension_pref->DeepCopy(); | 129 return extension_pref->DeepCopy(); |
130 } | 130 } |
131 | 131 |
132 virtual base::Value* BrowserToExtensionPref( | 132 virtual base::Value* BrowserToExtensionPref( |
133 const base::Value* browser_pref) OVERRIDE { | 133 const base::Value* browser_pref) override { |
134 return browser_pref->DeepCopy(); | 134 return browser_pref->DeepCopy(); |
135 } | 135 } |
136 }; | 136 }; |
137 | 137 |
138 class InvertBooleanTransformer : public PrefTransformerInterface { | 138 class InvertBooleanTransformer : public PrefTransformerInterface { |
139 public: | 139 public: |
140 virtual base::Value* ExtensionToBrowserPref(const base::Value* extension_pref, | 140 virtual base::Value* ExtensionToBrowserPref(const base::Value* extension_pref, |
141 std::string* error, | 141 std::string* error, |
142 bool* bad_message) OVERRIDE { | 142 bool* bad_message) override { |
143 return InvertBooleanValue(extension_pref); | 143 return InvertBooleanValue(extension_pref); |
144 } | 144 } |
145 | 145 |
146 virtual base::Value* BrowserToExtensionPref( | 146 virtual base::Value* BrowserToExtensionPref( |
147 const base::Value* browser_pref) OVERRIDE { | 147 const base::Value* browser_pref) override { |
148 return InvertBooleanValue(browser_pref); | 148 return InvertBooleanValue(browser_pref); |
149 } | 149 } |
150 | 150 |
151 private: | 151 private: |
152 static base::Value* InvertBooleanValue(const base::Value* value) { | 152 static base::Value* InvertBooleanValue(const base::Value* value) { |
153 bool bool_value = false; | 153 bool bool_value = false; |
154 bool result = value->GetAsBoolean(&bool_value); | 154 bool result = value->GetAsBoolean(&bool_value); |
155 DCHECK(result); | 155 DCHECK(result); |
156 return new base::FundamentalValue(!bool_value); | 156 return new base::FundamentalValue(!bool_value); |
157 } | 157 } |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 pref_key, PreferenceFunction::PERMISSION_TYPE_WRITE, &browser_pref)) { | 712 pref_key, PreferenceFunction::PERMISSION_TYPE_WRITE, &browser_pref)) { |
713 return false; | 713 return false; |
714 } | 714 } |
715 | 715 |
716 PreferenceAPI::Get(GetProfile()) | 716 PreferenceAPI::Get(GetProfile()) |
717 ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); | 717 ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); |
718 return true; | 718 return true; |
719 } | 719 } |
720 | 720 |
721 } // namespace extensions | 721 } // namespace extensions |
OLD | NEW |