| 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.h" | 5 #include "chrome/browser/extensions/api/preference/chrome_direct_setting.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 8 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 9 #include "base/values.h" | 11 #include "base/values.h" |
| 10 #include "chrome/browser/extensions/api/preference/chrome_direct_setting_api.h" | 12 #include "chrome/browser/extensions/api/preference/chrome_direct_setting_api.h" |
| 11 #include "chrome/browser/extensions/api/preference/preference_api_constants.h" | 13 #include "chrome/browser/extensions/api/preference/preference_api_constants.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 13 #include "components/prefs/pref_service.h" | 15 #include "components/prefs/pref_service.h" |
| 14 | 16 |
| 15 namespace extensions { | 17 namespace extensions { |
| 16 namespace chromedirectsetting { | 18 namespace chromedirectsetting { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 31 EXTENSION_FUNCTION_VALIDATE(ChromeDirectSettingAPI::Get(GetProfile()) | 33 EXTENSION_FUNCTION_VALIDATE(ChromeDirectSettingAPI::Get(GetProfile()) |
| 32 ->IsPreferenceOnWhitelist(pref_key)); | 34 ->IsPreferenceOnWhitelist(pref_key)); |
| 33 | 35 |
| 34 const PrefService::Preference* preference = | 36 const PrefService::Preference* preference = |
| 35 GetPrefService()->FindPreference(pref_key.c_str()); | 37 GetPrefService()->FindPreference(pref_key.c_str()); |
| 36 EXTENSION_FUNCTION_VALIDATE(preference); | 38 EXTENSION_FUNCTION_VALIDATE(preference); |
| 37 const base::Value* value = preference->GetValue(); | 39 const base::Value* value = preference->GetValue(); |
| 38 | 40 |
| 39 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue); | 41 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue); |
| 40 result->Set(preference_api_constants::kValue, value->DeepCopy()); | 42 result->Set(preference_api_constants::kValue, value->DeepCopy()); |
| 41 SetResult(result.release()); | 43 SetResult(std::move(result)); |
| 42 | 44 |
| 43 return true; | 45 return true; |
| 44 } | 46 } |
| 45 | 47 |
| 46 GetDirectSettingFunction::~GetDirectSettingFunction() {} | 48 GetDirectSettingFunction::~GetDirectSettingFunction() {} |
| 47 | 49 |
| 48 SetDirectSettingFunction::SetDirectSettingFunction() {} | 50 SetDirectSettingFunction::SetDirectSettingFunction() {} |
| 49 | 51 |
| 50 bool SetDirectSettingFunction::RunSync() { | 52 bool SetDirectSettingFunction::RunSync() { |
| 51 std::string pref_key; | 53 std::string pref_key; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 GetPrefService()->ClearPref(pref_key.c_str()); | 86 GetPrefService()->ClearPref(pref_key.c_str()); |
| 85 | 87 |
| 86 return true; | 88 return true; |
| 87 } | 89 } |
| 88 | 90 |
| 89 ClearDirectSettingFunction::~ClearDirectSettingFunction() {} | 91 ClearDirectSettingFunction::~ClearDirectSettingFunction() {} |
| 90 | 92 |
| 91 } // namespace chromedirectsetting | 93 } // namespace chromedirectsetting |
| 92 } // namespace extensions | 94 } // namespace extensions |
| 93 | 95 |
| OLD | NEW |