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 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 const std::string& install_parameter) { | 1230 const std::string& install_parameter) { |
1231 ScopedExtensionPrefUpdate update(prefs_, extension->id()); | 1231 ScopedExtensionPrefUpdate update(prefs_, extension->id()); |
1232 base::DictionaryValue* extension_dict = update.Get(); | 1232 base::DictionaryValue* extension_dict = update.Get(); |
1233 const base::Time install_time = time_provider_->GetCurrentTime(); | 1233 const base::Time install_time = time_provider_->GetCurrentTime(); |
1234 PopulateExtensionInfoPrefs(extension, | 1234 PopulateExtensionInfoPrefs(extension, |
1235 install_time, | 1235 install_time, |
1236 initial_state, | 1236 initial_state, |
1237 install_flags, | 1237 install_flags, |
1238 install_parameter, | 1238 install_parameter, |
1239 extension_dict); | 1239 extension_dict); |
1240 FinishExtensionInfoPrefs(extension->id(), install_time, | 1240 |
1241 extension->RequiresSortOrdinal(), | 1241 bool requires_sort_ordinal = extension->RequiresSortOrdinal() && |
1242 page_ordinal, extension_dict); | 1242 (install_flags & kInstallFlagIsEphemeral) == 0; |
| 1243 FinishExtensionInfoPrefs(extension->id(), |
| 1244 install_time, |
| 1245 requires_sort_ordinal, |
| 1246 page_ordinal, |
| 1247 extension_dict); |
1243 } | 1248 } |
1244 | 1249 |
1245 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, | 1250 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, |
1246 const Manifest::Location& location, | 1251 const Manifest::Location& location, |
1247 bool external_uninstall) { | 1252 bool external_uninstall) { |
1248 app_sorting_->ClearOrdinals(extension_id); | 1253 app_sorting_->ClearOrdinals(extension_id); |
1249 | 1254 |
1250 // For external extensions, we save a preference reminding ourself not to try | 1255 // For external extensions, we save a preference reminding ourself not to try |
1251 // and install the extension anymore (except when |external_uninstall| is | 1256 // and install the extension anymore (except when |external_uninstall| is |
1252 // true, which signifies that the registry key was deleted or the pref file | 1257 // true, which signifies that the registry key was deleted or the pref file |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1445 PopulateExtensionInfoPrefs(extension, | 1450 PopulateExtensionInfoPrefs(extension, |
1446 time_provider_->GetCurrentTime(), | 1451 time_provider_->GetCurrentTime(), |
1447 initial_state, | 1452 initial_state, |
1448 install_flags, | 1453 install_flags, |
1449 install_parameter, | 1454 install_parameter, |
1450 extension_dict); | 1455 extension_dict); |
1451 | 1456 |
1452 // Add transient data that is needed by FinishDelayedInstallInfo(), but | 1457 // Add transient data that is needed by FinishDelayedInstallInfo(), but |
1453 // should not be in the final extension prefs. All entries here should have | 1458 // should not be in the final extension prefs. All entries here should have |
1454 // a corresponding Remove() call in FinishDelayedInstallInfo(). | 1459 // a corresponding Remove() call in FinishDelayedInstallInfo(). |
1455 if (extension->RequiresSortOrdinal()) { | 1460 if (extension->RequiresSortOrdinal() && |
| 1461 (install_flags & kInstallFlagIsEphemeral) == 0) { |
1456 extension_dict->SetString( | 1462 extension_dict->SetString( |
1457 kPrefSuggestedPageOrdinal, | 1463 kPrefSuggestedPageOrdinal, |
1458 page_ordinal.IsValid() ? page_ordinal.ToInternalValue() | 1464 page_ordinal.IsValid() ? page_ordinal.ToInternalValue() |
1459 : std::string()); | 1465 : std::string()); |
1460 } | 1466 } |
1461 extension_dict->SetInteger(kDelayedInstallReason, | 1467 extension_dict->SetInteger(kDelayedInstallReason, |
1462 static_cast<int>(delay_reason)); | 1468 static_cast<int>(delay_reason)); |
1463 | 1469 |
1464 UpdateExtensionPref(extension->id(), kDelayedInstallInfo, extension_dict); | 1470 UpdateExtensionPref(extension->id(), kDelayedInstallInfo, extension_dict); |
1465 } | 1471 } |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2185 extension_pref_value_map_->RegisterExtension( | 2191 extension_pref_value_map_->RegisterExtension( |
2186 extension_id, install_time, is_enabled, is_incognito_enabled); | 2192 extension_id, install_time, is_enabled, is_incognito_enabled); |
2187 | 2193 |
2188 FOR_EACH_OBSERVER( | 2194 FOR_EACH_OBSERVER( |
2189 ExtensionPrefsObserver, | 2195 ExtensionPrefsObserver, |
2190 observer_list_, | 2196 observer_list_, |
2191 OnExtensionRegistered(extension_id, install_time, is_enabled)); | 2197 OnExtensionRegistered(extension_id, install_time, is_enabled)); |
2192 } | 2198 } |
2193 | 2199 |
2194 } // namespace extensions | 2200 } // namespace extensions |
OLD | NEW |