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

Unified Diff: chrome/browser/extensions/extension_service.cc

Issue 282103003: Moved IS_EPHEMERAL flag to extension prefs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 037abdbbdbe63e221bd4e4d1888fafcbb310cb18..794fa738316a60d44c36dc18c39da868f3480d89 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -27,6 +27,7 @@
#include "chrome/browser/extensions/extension_install_ui.h"
#include "chrome/browser/extensions/extension_special_storage_policy.h"
#include "chrome/browser/extensions/extension_sync_service.h"
+#include "chrome/browser/extensions/extension_ui_util.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/external_install_ui.h"
#include "chrome/browser/extensions/external_provider_impl.h"
@@ -575,10 +576,9 @@ bool ExtensionService::UpdateExtension(const std::string& id,
if (extension && extension->was_installed_by_oem())
creation_flags |= Extension::WAS_INSTALLED_BY_OEM;
- if (extension && extension->is_ephemeral())
- creation_flags |= Extension::IS_EPHEMERAL;
-
installer->set_creation_flags(creation_flags);
+ installer->set_is_ephemeral(
+ extension_prefs_->IsEphemeralApp(extension->id()));
installer->set_delete_source(file_ownership_passed);
installer->set_install_cause(extension_misc::INSTALL_CAUSE_UPDATE);
@@ -733,7 +733,7 @@ bool ExtensionService::UninstallExtension(const std::string& extension_id,
// Do not remove the data of ephemeral apps. They will be garbage collected by
// EphemeralAppService.
- if (!extension->is_ephemeral())
+ if (!extension_prefs_->IsEphemeralApp(extension_id))
extensions::DataDeleter::StartDeleting(profile_, extension.get());
UntrackTerminatedExtension(extension_id);
@@ -1506,7 +1506,8 @@ void ExtensionService::AddExtension(const Extension* extension) {
// All apps that are displayed in the launcher are ordered by their ordinals
// so we must ensure they have valid ordinals.
if (extension->RequiresSortOrdinal()) {
- if (!extension->ShouldDisplayInNewTabPage()) {
+ if (!extensions::ui_util::ShouldDisplayInNewTabPage(
+ extension, profile_)) {
extension_prefs_->app_sorting()->MarkExtensionAsHidden(extension->id());
}
extension_prefs_->app_sorting()->EnsureValidOrdinals(
@@ -1535,6 +1536,7 @@ void ExtensionService::AddComponentExtension(const Extension* extension) {
AddNewOrUpdatedExtension(extension,
Extension::ENABLED_COMPONENT,
extensions::NOT_BLACKLISTED,
+ false,
syncer::StringOrdinal(),
std::string());
return;
@@ -1696,6 +1698,7 @@ void ExtensionService::OnExtensionInstalled(
const syncer::StringOrdinal& page_ordinal,
bool has_requirement_errors,
extensions::BlacklistState blacklist_state,
+ bool is_ephemeral,
bool wait_for_idle) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -1790,6 +1793,7 @@ void ExtensionService::OnExtensionInstalled(
extension,
initial_state,
blacklisted_for_malware,
+ is_ephemeral,
extensions::ExtensionPrefs::DELAY_REASON_WAIT_FOR_IDLE,
page_ordinal,
install_parameter);
@@ -1810,6 +1814,7 @@ void ExtensionService::OnExtensionInstalled(
extension,
initial_state,
blacklisted_for_malware,
+ is_ephemeral,
extensions::ExtensionPrefs::DELAY_REASON_GC,
page_ordinal,
install_parameter);
@@ -1820,6 +1825,7 @@ void ExtensionService::OnExtensionInstalled(
extension,
initial_state,
blacklisted_for_malware,
+ is_ephemeral,
extensions::ExtensionPrefs::DELAY_REASON_WAIT_FOR_IMPORTS,
page_ordinal,
install_parameter);
@@ -1829,6 +1835,7 @@ void ExtensionService::OnExtensionInstalled(
AddNewOrUpdatedExtension(extension,
initial_state,
blacklist_state,
+ is_ephemeral,
page_ordinal,
install_parameter);
}
@@ -1838,6 +1845,7 @@ void ExtensionService::AddNewOrUpdatedExtension(
const Extension* extension,
Extension::State initial_state,
extensions::BlacklistState blacklist_state,
+ bool is_ephemeral,
const syncer::StringOrdinal& page_ordinal,
const std::string& install_parameter) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -1846,6 +1854,7 @@ void ExtensionService::AddNewOrUpdatedExtension(
extension_prefs_->OnExtensionInstalled(extension,
initial_state,
blacklisted_for_malware,
+ is_ephemeral,
page_ordinal,
install_parameter);
delayed_installs_.Remove(extension->id());

Powered by Google App Engine
This is Rietveld 408576698