summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorElliott Slaughter <eds@google.com>2010-08-20 11:54:00 -0700
committerElliott Slaughter <eds@google.com>2010-08-23 09:58:28 -0700
commit5a2befd2a4d7ffeffe9693d6d256d21a0f8e24a5 (patch)
treedbafa38365f698aa0c31b98a66ec85cab527e858 /WebKit
parent217e3d0dadcea46e33b02735b77efb9736cd1f08 (diff)
downloadexternal_webkit-5a2befd2a4d7ffeffe9693d6d256d21a0f8e24a5.zip
external_webkit-5a2befd2a4d7ffeffe9693d6d256d21a0f8e24a5.tar.gz
external_webkit-5a2befd2a4d7ffeffe9693d6d256d21a0f8e24a5.tar.bz2
Fix WebView saveState and restoreState for private browsing mode.
Added a handler for browser:incognito url to simplify WebView implementation. Change-Id: Ic453bbee7436a210b3d596fb2e7fa96791cd5fc9
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/WebCoreSupport/WebRequest.cpp21
-rw-r--r--WebKit/android/WebCoreSupport/WebRequest.h1
2 files changed, 22 insertions, 0 deletions
diff --git a/WebKit/android/WebCoreSupport/WebRequest.cpp b/WebKit/android/WebCoreSupport/WebRequest.cpp
index 79e780e..8c718d8 100644
--- a/WebKit/android/WebCoreSupport/WebRequest.cpp
+++ b/WebKit/android/WebCoreSupport/WebRequest.cpp
@@ -35,6 +35,9 @@
#include <net/http/http_response_headers.h>
#include <net/url_request/url_request.h>
#include <string>
+#include <utils/AssetManager.h>
+
+extern android::AssetManager* globalAssetManager();
// TODO:
// - Get gmail log in to work
@@ -90,6 +93,9 @@ void WebRequest::start(bool isPrivateBrowsing)
if (m_request->url().SchemeIs("data"))
return handleDataURL(m_request->url());
+ if (m_request->url().SchemeIs("browser"))
+ return handleBrowserURL(m_request->url());
+
if (!isPrivateBrowsing)
m_request->set_context(WebRequestContext::GetAndroidContext());
else
@@ -134,6 +140,21 @@ void WebRequest::handleDataURL(GURL url)
finish(true);
}
+void WebRequest::handleBrowserURL(GURL url)
+{
+ std::string data("data:text/html;charset=utf-8,");
+ if (url.spec() == "browser:incognito") {
+ AssetManager* assetManager = globalAssetManager();
+ Asset* asset = assetManager->open("webkit/incognito_mode_start_page.html", Asset::ACCESS_BUFFER);
+ if (asset) {
+ data.append((const char*)asset->getBuffer(false), asset->getLength());
+ delete asset;
+ }
+ }
+ GURL dataURL(data.c_str());
+ handleDataURL(dataURL);
+}
+
// Called upon a server-initiated redirect. The delegate may call the
// request's Cancel method to prevent the redirect from being followed.
// Since there may be multiple chained redirects, there may also be more
diff --git a/WebKit/android/WebCoreSupport/WebRequest.h b/WebKit/android/WebCoreSupport/WebRequest.h
index 9c9c830..dc53ca6 100644
--- a/WebKit/android/WebCoreSupport/WebRequest.h
+++ b/WebKit/android/WebCoreSupport/WebRequest.h
@@ -61,6 +61,7 @@ private:
friend class base::RefCountedThreadSafe<WebRequest>;
virtual ~WebRequest();
void handleDataURL(GURL);
+ void handleBrowserURL(GURL);
void finish(bool success);
// Not owned