Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: extensions/browser/extension_prefs.cc

Issue 397903002: Do not assign launch ordinals to ephemeral apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ephemapp_unload_review
Patch Set: Minor clean up Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/browser/app_sorting.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 const std::string& install_parameter) { 1231 const std::string& install_parameter) {
1232 ScopedExtensionPrefUpdate update(prefs_, extension->id()); 1232 ScopedExtensionPrefUpdate update(prefs_, extension->id());
1233 base::DictionaryValue* extension_dict = update.Get(); 1233 base::DictionaryValue* extension_dict = update.Get();
1234 const base::Time install_time = time_provider_->GetCurrentTime(); 1234 const base::Time install_time = time_provider_->GetCurrentTime();
1235 PopulateExtensionInfoPrefs(extension, 1235 PopulateExtensionInfoPrefs(extension,
1236 install_time, 1236 install_time,
1237 initial_state, 1237 initial_state,
1238 install_flags, 1238 install_flags,
1239 install_parameter, 1239 install_parameter,
1240 extension_dict); 1240 extension_dict);
1241 FinishExtensionInfoPrefs(extension->id(), install_time, 1241
1242 extension->RequiresSortOrdinal(), 1242 bool requires_sort_ordinal = extension->RequiresSortOrdinal() &&
1243 page_ordinal, extension_dict); 1243 (install_flags & kInstallFlagIsEphemeral) == 0;
1244 FinishExtensionInfoPrefs(extension->id(),
1245 install_time,
1246 requires_sort_ordinal,
1247 page_ordinal,
1248 extension_dict);
1244 } 1249 }
1245 1250
1246 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, 1251 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id,
1247 const Manifest::Location& location, 1252 const Manifest::Location& location,
1248 bool external_uninstall) { 1253 bool external_uninstall) {
1249 app_sorting_->ClearOrdinals(extension_id); 1254 app_sorting_->ClearOrdinals(extension_id);
1250 1255
1251 // For external extensions, we save a preference reminding ourself not to try 1256 // For external extensions, we save a preference reminding ourself not to try
1252 // and install the extension anymore (except when |external_uninstall| is 1257 // and install the extension anymore (except when |external_uninstall| is
1253 // true, which signifies that the registry key was deleted or the pref file 1258 // 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
1446 PopulateExtensionInfoPrefs(extension, 1451 PopulateExtensionInfoPrefs(extension,
1447 time_provider_->GetCurrentTime(), 1452 time_provider_->GetCurrentTime(),
1448 initial_state, 1453 initial_state,
1449 install_flags, 1454 install_flags,
1450 install_parameter, 1455 install_parameter,
1451 extension_dict); 1456 extension_dict);
1452 1457
1453 // Add transient data that is needed by FinishDelayedInstallInfo(), but 1458 // Add transient data that is needed by FinishDelayedInstallInfo(), but
1454 // should not be in the final extension prefs. All entries here should have 1459 // should not be in the final extension prefs. All entries here should have
1455 // a corresponding Remove() call in FinishDelayedInstallInfo(). 1460 // a corresponding Remove() call in FinishDelayedInstallInfo().
1456 if (extension->RequiresSortOrdinal()) { 1461 if (extension->RequiresSortOrdinal() &&
1462 (install_flags & kInstallFlagIsEphemeral) == 0) {
1457 extension_dict->SetString( 1463 extension_dict->SetString(
1458 kPrefSuggestedPageOrdinal, 1464 kPrefSuggestedPageOrdinal,
1459 page_ordinal.IsValid() ? page_ordinal.ToInternalValue() 1465 page_ordinal.IsValid() ? page_ordinal.ToInternalValue()
1460 : std::string()); 1466 : std::string());
1461 } 1467 }
1462 extension_dict->SetInteger(kDelayedInstallReason, 1468 extension_dict->SetInteger(kDelayedInstallReason,
1463 static_cast<int>(delay_reason)); 1469 static_cast<int>(delay_reason));
1464 1470
1465 UpdateExtensionPref(extension->id(), kDelayedInstallInfo, extension_dict); 1471 UpdateExtensionPref(extension->id(), kDelayedInstallInfo, extension_dict);
1466 } 1472 }
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 extension_pref_value_map_->RegisterExtension( 2192 extension_pref_value_map_->RegisterExtension(
2187 extension_id, install_time, is_enabled, is_incognito_enabled); 2193 extension_id, install_time, is_enabled, is_incognito_enabled);
2188 2194
2189 FOR_EACH_OBSERVER( 2195 FOR_EACH_OBSERVER(
2190 ExtensionPrefsObserver, 2196 ExtensionPrefsObserver,
2191 observer_list_, 2197 observer_list_,
2192 OnExtensionRegistered(extension_id, install_time, is_enabled)); 2198 OnExtensionRegistered(extension_id, install_time, is_enabled));
2193 } 2199 }
2194 2200
2195 } // namespace extensions 2201 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/app_sorting.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698