summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorvictorw@chromium.org <victorw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-03 00:24:57 +0000
committervictorw@chromium.org <victorw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-03 00:24:57 +0000
commite0d8cbdb23b9a8446ffb1b8355652f2b167238f1 (patch)
treed7acb45db42060eed51b4ece5955ad3d042922ea /webkit
parenta0181609ceca468ce66eca453dcce4283a7bdcec (diff)
downloadchromium_src-e0d8cbdb23b9a8446ffb1b8355652f2b167238f1.zip
chromium_src-e0d8cbdb23b9a8446ffb1b8355652f2b167238f1.tar.gz
chromium_src-e0d8cbdb23b9a8446ffb1b8355652f2b167238f1.tar.bz2
Add getFileSize support to chromium
The current implementation only allows getting file size if the child process has been granted permission to upload file. May need to update the policy checking code if getFileSize is needed in other cases. Here is the webkit implementation to support this: https://bugs.webkit.org/show_bug.cgi?id=26521 TEST=none BUG=9102 Review URL: http://codereview.chromium.org/131082 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19866 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/api/public/WebKitClient.h4
-rw-r--r--webkit/api/src/ChromiumBridge.cpp7
-rw-r--r--webkit/tools/test_shell/test_shell_webkit_init.h6
-rw-r--r--webkit/tools/test_shell/test_worker/test_worker_main.cc5
4 files changed, 22 insertions, 0 deletions
diff --git a/webkit/api/public/WebKitClient.h b/webkit/api/public/WebKitClient.h
index 4ebbb25..4de58c3 100644
--- a/webkit/api/public/WebKitClient.h
+++ b/webkit/api/public/WebKitClient.h
@@ -82,6 +82,10 @@ namespace WebKit {
// A suggestion to prefetch IP information for the given hostname.
virtual void prefetchHostName(const WebString&) = 0;
+ // File ----------------------------------------------------------------
+
+ virtual bool getFileSize(const WebString& path, long long& result) = 0;
+
// Returns a new WebURLLoader instance.
virtual WebURLLoader* createURLLoader() = 0;
diff --git a/webkit/api/src/ChromiumBridge.cpp b/webkit/api/src/ChromiumBridge.cpp
index 3fdef0a..4d05a2e 100644
--- a/webkit/api/src/ChromiumBridge.cpp
+++ b/webkit/api/src/ChromiumBridge.cpp
@@ -148,6 +148,13 @@ void ChromiumBridge::prefetchDNS(const String& hostname)
webKitClient()->prefetchHostName(hostname);
}
+// File ------------------------------------------------------------------------
+
+bool ChromiumBridge::getFileSize(const String& path, long long& result)
+{
+ return webKitClient()->getFileSize(path, result);
+}
+
// Font -----------------------------------------------------------------------
#if PLATFORM(WIN_OS)
diff --git a/webkit/tools/test_shell/test_shell_webkit_init.h b/webkit/tools/test_shell/test_shell_webkit_init.h
index c5b419b..8b832ae 100644
--- a/webkit/tools/test_shell/test_shell_webkit_init.h
+++ b/webkit/tools/test_shell/test_shell_webkit_init.h
@@ -5,6 +5,7 @@
#ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_WEBKIT_INIT_H_
#define WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_WEBKIT_INIT_H_
+#include "base/file_util.h"
#include "base/path_service.h"
#include "base/stats_counters.h"
#include "base/string_util.h"
@@ -96,6 +97,11 @@ class TestShellWebKitInit : public webkit_glue::WebKitClientImpl {
virtual void prefetchHostName(const WebKit::WebString&) {
}
+ virtual bool getFileSize(const WebKit::WebString& path, long long& result) {
+ return file_util::GetFileSize(
+ FilePath(webkit_glue::WebStringToFilePathString(path)), &result);
+ }
+
virtual WebKit::WebData loadResource(const char* name) {
if (!strcmp(name, "deleteButton")) {
// Create a red 30x30 square.
diff --git a/webkit/tools/test_shell/test_worker/test_worker_main.cc b/webkit/tools/test_shell/test_worker/test_worker_main.cc
index 366b217..29f739a 100644
--- a/webkit/tools/test_shell/test_worker/test_worker_main.cc
+++ b/webkit/tools/test_shell/test_worker/test_worker_main.cc
@@ -76,6 +76,11 @@ class WorkerWebKitClientImpl : public webkit_glue::WebKitClientImpl {
NOTREACHED();
}
+ virtual bool getFileSize(const WebKit::WebString& path, long long& result) {
+ NOTREACHED();
+ return false;
+ }
+
virtual WebKit::WebString defaultLocale() {
NOTREACHED();
return WebKit::WebString();