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

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

Issue 282103003: Moved IS_EPHEMERAL flag to extension prefs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor refactoring. Added comments. 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_storage_monitor.cc
diff --git a/chrome/browser/extensions/extension_storage_monitor.cc b/chrome/browser/extensions/extension_storage_monitor.cc
index 1e3f09fa0bb35e7a976dc56a5c7bac163ba79a84..2e673988e9eea10caf0a30b547a668964f058806 100644
--- a/chrome/browser/extensions/extension_storage_monitor.cc
+++ b/chrome/browser/extensions/extension_storage_monitor.cc
@@ -211,7 +211,7 @@ void ExtensionStorageMonitor::Observe(
}
default:
NOTREACHED();
- };
+ }
}
void ExtensionStorageMonitor::OnExtensionLoaded(
@@ -324,7 +324,7 @@ void ExtensionStorageMonitor::OnNotificationButtonClick(
}
default:
NOTREACHED();
- };
+ }
}
void ExtensionStorageMonitor::DisableStorageMonitoring(
@@ -348,13 +348,15 @@ void ExtensionStorageMonitor::StartMonitoringStorage(
if (extension->location() == Manifest::COMPONENT)
return;
+ ExtensionPrefs* prefs = ExtensionPrefs::Get(context_);
+ DCHECK(prefs);
+
// First apply this feature only to experimental ephemeral apps. If it works
// well, roll it out to all extensions and apps.
- if (!extension->is_ephemeral() && !enable_for_all_extensions_)
+ bool is_ephemeral = prefs->IsEphemeralApp(extension->id());
+ if (!is_ephemeral && !enable_for_all_extensions_)
return;
- ExtensionPrefs* prefs = ExtensionPrefs::Get(context_);
- DCHECK(prefs);
if (!prefs->IsStorageNotificationEnabled(extension->id()))
return;
@@ -380,8 +382,8 @@ void ExtensionStorageMonitor::StartMonitoringStorage(
if (next_threshold == 0) {
// The next threshold is written to the prefs after the initial threshold is
// exceeded.
- next_threshold = extension->is_ephemeral() ? initial_ephemeral_threshold_
- : initial_extension_threshold_;
+ next_threshold = is_ephemeral ? initial_ephemeral_threshold_
+ : initial_extension_threshold_;
}
BrowserThread::PostTask(

Powered by Google App Engine
This is Rietveld 408576698