OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/extension_prefs.h" | 5 #include "extensions/browser/extension_prefs.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/prefs/pref_notifier.h" | 10 #include "base/prefs/pref_notifier.h" |
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 } | 1029 } |
1030 | 1030 |
1031 bool ExtensionPrefs::IsIncognitoEnabled(const std::string& extension_id) const { | 1031 bool ExtensionPrefs::IsIncognitoEnabled(const std::string& extension_id) const { |
1032 return ReadPrefAsBooleanAndReturn(extension_id, kPrefIncognitoEnabled); | 1032 return ReadPrefAsBooleanAndReturn(extension_id, kPrefIncognitoEnabled); |
1033 } | 1033 } |
1034 | 1034 |
1035 void ExtensionPrefs::SetIsIncognitoEnabled(const std::string& extension_id, | 1035 void ExtensionPrefs::SetIsIncognitoEnabled(const std::string& extension_id, |
1036 bool enabled) { | 1036 bool enabled) { |
1037 UpdateExtensionPref(extension_id, kPrefIncognitoEnabled, | 1037 UpdateExtensionPref(extension_id, kPrefIncognitoEnabled, |
1038 new base::FundamentalValue(enabled)); | 1038 new base::FundamentalValue(enabled)); |
| 1039 extension_pref_value_map_->SetExtensionIncognitoState(extension_id, enabled); |
1039 } | 1040 } |
1040 | 1041 |
1041 bool ExtensionPrefs::AllowFileAccess(const std::string& extension_id) const { | 1042 bool ExtensionPrefs::AllowFileAccess(const std::string& extension_id) const { |
1042 return ReadPrefAsBooleanAndReturn(extension_id, kPrefAllowFileAccess); | 1043 return ReadPrefAsBooleanAndReturn(extension_id, kPrefAllowFileAccess); |
1043 } | 1044 } |
1044 | 1045 |
1045 void ExtensionPrefs::SetAllowFileAccess(const std::string& extension_id, | 1046 void ExtensionPrefs::SetAllowFileAccess(const std::string& extension_id, |
1046 bool allow) { | 1047 bool allow) { |
1047 UpdateExtensionPref(extension_id, kPrefAllowFileAccess, | 1048 UpdateExtensionPref(extension_id, kPrefAllowFileAccess, |
1048 new base::FundamentalValue(allow)); | 1049 new base::FundamentalValue(allow)); |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 // are updated non-transactionally. This is probably not fixable without | 1895 // are updated non-transactionally. This is probably not fixable without |
1895 // nested transactional updates to pref dictionaries. | 1896 // nested transactional updates to pref dictionaries. |
1896 if (needs_sort_ordinal) | 1897 if (needs_sort_ordinal) |
1897 app_sorting_->EnsureValidOrdinals(extension_id, suggested_page_ordinal); | 1898 app_sorting_->EnsureValidOrdinals(extension_id, suggested_page_ordinal); |
1898 | 1899 |
1899 bool is_enabled = false; | 1900 bool is_enabled = false; |
1900 int initial_state; | 1901 int initial_state; |
1901 if (extension_dict->GetInteger(kPrefState, &initial_state)) { | 1902 if (extension_dict->GetInteger(kPrefState, &initial_state)) { |
1902 is_enabled = initial_state == Extension::ENABLED; | 1903 is_enabled = initial_state == Extension::ENABLED; |
1903 } | 1904 } |
| 1905 bool is_incognito_enabled = IsIncognitoEnabled(extension_id); |
1904 | 1906 |
1905 extension_pref_value_map_->RegisterExtension(extension_id, install_time, | 1907 extension_pref_value_map_->RegisterExtension( |
1906 is_enabled); | 1908 extension_id, install_time, is_enabled, is_incognito_enabled); |
1907 content_settings_store_->RegisterExtension(extension_id, install_time, | 1909 content_settings_store_->RegisterExtension(extension_id, install_time, |
1908 is_enabled); | 1910 is_enabled); |
1909 } | 1911 } |
1910 | 1912 |
1911 } // namespace extensions | 1913 } // namespace extensions |
OLD | NEW |