| 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_prefs.h" | 5 #include "chrome/browser/extensions/extension_prefs.h" |
| 6 | 6 |
| 7 #include <iterator> | 7 #include <iterator> |
| 8 | 8 |
| 9 #include "base/prefs/pref_notifier.h" | 9 #include "base/prefs/pref_notifier.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 | 994 |
| 995 bool ExtensionPrefs::IsActive(const std::string& extension_id) { | 995 bool ExtensionPrefs::IsActive(const std::string& extension_id) { |
| 996 const DictionaryValue* extension = GetExtensionPref(extension_id); | 996 const DictionaryValue* extension = GetExtensionPref(extension_id); |
| 997 if (!extension) | 997 if (!extension) |
| 998 return false; | 998 return false; |
| 999 bool is_active = false; | 999 bool is_active = false; |
| 1000 extension->GetBoolean(kIsActive, &is_active); | 1000 extension->GetBoolean(kIsActive, &is_active); |
| 1001 return is_active; | 1001 return is_active; |
| 1002 } | 1002 } |
| 1003 | 1003 |
| 1004 bool ExtensionPrefs::IsIncognitoEnabled(const std::string& extension_id) { | 1004 bool ExtensionPrefs::IsIncognitoEnabled(const std::string& extension_id) const { |
| 1005 return ReadPrefAsBooleanAndReturn(extension_id, kPrefIncognitoEnabled); | 1005 return ReadPrefAsBooleanAndReturn(extension_id, kPrefIncognitoEnabled); |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 void ExtensionPrefs::SetIsIncognitoEnabled(const std::string& extension_id, | 1008 void ExtensionPrefs::SetIsIncognitoEnabled(const std::string& extension_id, |
| 1009 bool enabled) { | 1009 bool enabled) { |
| 1010 UpdateExtensionPref(extension_id, kPrefIncognitoEnabled, | 1010 UpdateExtensionPref(extension_id, kPrefIncognitoEnabled, |
| 1011 new base::FundamentalValue(enabled)); | 1011 new base::FundamentalValue(enabled)); |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 bool ExtensionPrefs::AllowFileAccess(const std::string& extension_id) { | 1014 bool ExtensionPrefs::AllowFileAccess(const std::string& extension_id) const { |
| 1015 return ReadPrefAsBooleanAndReturn(extension_id, kPrefAllowFileAccess); | 1015 return ReadPrefAsBooleanAndReturn(extension_id, kPrefAllowFileAccess); |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 void ExtensionPrefs::SetAllowFileAccess(const std::string& extension_id, | 1018 void ExtensionPrefs::SetAllowFileAccess(const std::string& extension_id, |
| 1019 bool allow) { | 1019 bool allow) { |
| 1020 UpdateExtensionPref(extension_id, kPrefAllowFileAccess, | 1020 UpdateExtensionPref(extension_id, kPrefAllowFileAccess, |
| 1021 new base::FundamentalValue(allow)); | 1021 new base::FundamentalValue(allow)); |
| 1022 } | 1022 } |
| 1023 | 1023 |
| 1024 bool ExtensionPrefs::HasAllowFileAccessSetting( | 1024 bool ExtensionPrefs::HasAllowFileAccessSetting( |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1917 is_enabled = initial_state == Extension::ENABLED; | 1917 is_enabled = initial_state == Extension::ENABLED; |
| 1918 } | 1918 } |
| 1919 | 1919 |
| 1920 extension_pref_value_map_->RegisterExtension(extension_id, install_time, | 1920 extension_pref_value_map_->RegisterExtension(extension_id, install_time, |
| 1921 is_enabled); | 1921 is_enabled); |
| 1922 content_settings_store_->RegisterExtension(extension_id, install_time, | 1922 content_settings_store_->RegisterExtension(extension_id, install_time, |
| 1923 is_enabled); | 1923 is_enabled); |
| 1924 } | 1924 } |
| 1925 | 1925 |
| 1926 } // namespace extensions | 1926 } // namespace extensions |
| OLD | NEW |