summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/manifest_parser.cc
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-17 18:50:43 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-17 18:50:43 +0000
commit8fb8eeb9607ccd4c3d447563777beb84e24cbd0a (patch)
treecbb2c507b1db7479a58aa966ca5699c9b10c8c49 /webkit/appcache/manifest_parser.cc
parent28e0a0e1548565a7acaa7de7f246f476ec66917f (diff)
downloadchromium_src-8fb8eeb9607ccd4c3d447563777beb84e24cbd0a.zip
chromium_src-8fb8eeb9607ccd4c3d447563777beb84e24cbd0a.tar.gz
chromium_src-8fb8eeb9607ccd4c3d447563777beb84e24cbd0a.tar.bz2
AppCacheExecutableHandlers - parse manifest file and store/retrieve the 'bit' indicating executable.
BUG=101800 Review URL: https://codereview.chromium.org/13881003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194642 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/manifest_parser.cc')
-rw-r--r--webkit/appcache/manifest_parser.cc25
1 files changed, 20 insertions, 5 deletions
diff --git a/webkit/appcache/manifest_parser.cc b/webkit/appcache/manifest_parser.cc
index 3afbad7..0e76e93 100644
--- a/webkit/appcache/manifest_parser.cc
+++ b/webkit/appcache/manifest_parser.cc
@@ -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,7 +61,13 @@ enum Mode {
INTERCEPT,
FALLBACK,
ONLINE_WHITELIST,
- UNKNOWN,
+ UNKNOWN_MODE,
+};
+
+enum InterceptVerb {
+ RETURN,
+ EXECUTE,
+ UNKNOWN_VERB,
};
Manifest::Manifest() : online_whitelist_all(false) {}
@@ -165,8 +172,8 @@ bool ParseManifest(const GURL& manifest_url, const char* data, int length,
} 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 @@ bool ParseManifest(const GURL& manifest_url, const char* data, int length,
++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 ParseManifest(const GURL& manifest_url, const char* data, int length,
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();