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

Unified Diff: webkit/appcache/manifest_parser.cc

Issue 13881003: AppCacheExecutableHandlers - parse manifest file and store the 'bit' indicating executable. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 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: webkit/appcache/manifest_parser.cc
===================================================================
--- webkit/appcache/manifest_parser.cc (revision 194203)
+++ webkit/appcache/manifest_parser.cc (working copy)
@@ -31,6 +31,7 @@
#include "webkit/appcache/manifest_parser.h"
+#include "base/command_line.h"
#include "base/i18n/icu_string_conversions.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
@@ -60,9 +61,15 @@
INTERCEPT,
FALLBACK,
ONLINE_WHITELIST,
- UNKNOWN,
+ UNKNOWN_MODE,
};
+enum InterceptVerb {
+ RETURN,
+ EXECUTE,
+ UNKNOWN_VERB,
+};
+
Manifest::Manifest() : online_whitelist_all(false) {}
Manifest::~Manifest() {}
@@ -165,8 +172,8 @@
} else if (line == L"CHROMIUM-INTERCEPT:") {
mode = INTERCEPT;
} else if (*(line.end() - 1) == ':') {
- mode = UNKNOWN;
- } else if (mode == UNKNOWN) {
+ mode = UNKNOWN_MODE;
+ } else if (mode == UNKNOWN_MODE) {
continue;
} else if (line == L"*" && mode == ONLINE_WHITELIST) {
manifest.online_whitelist_all = true;
@@ -250,8 +257,16 @@
++line_p;
// Look for a type value we understand, otherwise skip the line.
+ InterceptVerb verb = UNKNOWN_VERB;
std::wstring type(type_start, line_p - type_start);
- if (type != L"return")
+ if (type == L"return") {
+ verb = RETURN;
+ } else if (type == L"execute" &&
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ kEnableExecutableHandlers)) {
+ verb = EXECUTE;
+ }
+ if (verb == UNKNOWN_VERB)
continue;
// Skip whitespace separating type from the target_url.
@@ -280,7 +295,7 @@
bool is_pattern = HasPatternMatchingAnnotation(line_p, line_end);
manifest.intercept_namespaces.push_back(
Namespace(INTERCEPT_NAMESPACE, namespace_url,
- target_url, is_pattern));
+ target_url, is_pattern, verb == EXECUTE));
} else if (mode == FALLBACK) {
const wchar_t* line_p = line.c_str();
const wchar_t* line_end = line_p + line.length();
« webkit/appcache/appcache_url_request_job.cc ('K') | « webkit/appcache/appcache_url_request_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698