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

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

Issue 8205001: (Owner approval for) Delay network requests on startup if any webRequest ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Updated checkout Created 9 years, 2 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
« no previous file with comments | « chrome/browser/extensions/extension_prefs.h ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_prefs.cc
===================================================================
--- chrome/browser/extensions/extension_prefs.cc (revision 105566)
+++ chrome/browser/extensions/extension_prefs.cc (working copy)
@@ -89,6 +89,12 @@
// the old flag and possibly go back to that name.
// const char kPrefAllowFileAccessOld[] = "allowFileAccess";
+// A preference indicating that the extension wants to delay network requests
+// on browser launch until it indicates it's ready. For example, an extension
+// using the webRequest API might want to ensure that no requests are sent
+// before it has registered its event handlers.
+const char kPrefDelayNetworkRequests[] = "delayNetworkRequests";
+
// A preference set by the web store to indicate login information for
// purchased apps.
const char kWebStoreLogin[] = "extensions.webstore_login";
@@ -877,6 +883,21 @@
return ext && ext->HasKey(kPrefAllowFileAccess);
}
+void ExtensionPrefs::SetDelaysNetworkRequests(const std::string& extension_id,
+ bool does_delay) {
+ if (does_delay) {
+ UpdateExtensionPref(extension_id, kPrefDelayNetworkRequests,
+ Value::CreateBooleanValue(true));
+ } else {
+ // Remove the pref.
+ UpdateExtensionPref(extension_id, kPrefDelayNetworkRequests, NULL);
+ }
+}
+
+bool ExtensionPrefs::DelaysNetworkRequests(const std::string& extension_id) {
+ return ReadExtensionPrefBoolean(extension_id, kPrefDelayNetworkRequests);
+}
+
ExtensionPrefs::LaunchType ExtensionPrefs::GetLaunchType(
const std::string& extension_id,
ExtensionPrefs::LaunchType default_pref_value) {
@@ -1641,6 +1662,7 @@
value->DeepCopy());
}
+ // Set content settings.
const DictionaryValue* extension_prefs = GetExtensionPref(*ext_id);
DCHECK(extension_prefs);
ListValue* content_settings = NULL;
« no previous file with comments | « chrome/browser/extensions/extension_prefs.h ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698