summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-21 23:07:45 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-21 23:07:45 +0000
commit4d3aec119b4617fd3b75eeffa150724985798f4e (patch)
tree9a8fa1d70e826875a4a7f01e398b6986adb3fb55 /webkit
parentcc6c5d6fab9bacf150042cc83654d9ffa86e367e (diff)
downloadchromium_src-4d3aec119b4617fd3b75eeffa150724985798f4e.zip
chromium_src-4d3aec119b4617fd3b75eeffa150724985798f4e.tar.gz
chromium_src-4d3aec119b4617fd3b75eeffa150724985798f4e.tar.bz2
Proxy time zone requests to the browser. This is because the current code
can't run in the sandbox on Linux. TEST=manual BUG=80176 Review URL: http://codereview.chromium.org/6891001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82575 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.cc4
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.h1
-rw-r--r--webkit/plugins/ppapi/plugin_delegate.h3
-rw-r--r--webkit/plugins/ppapi/ppb_flash_impl.cc23
4 files changed, 17 insertions, 14 deletions
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc
index 4ac0a00..133226b 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.cc
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc
@@ -235,5 +235,9 @@ webkit_glue::P2PTransport* MockPluginDelegate::CreateP2PTransport() {
return NULL;
}
+double MockPluginDelegate::GetLocalTimeZoneOffset(base::Time t) {
+ return 0.0;
+}
+
} // namespace ppapi
} // namespace webkit
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h
index 32b80c7..4c3d740 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.h
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.h
@@ -102,6 +102,7 @@ class MockPluginDelegate : public PluginDelegate {
virtual void SaveURLAs(const GURL& url);
virtual P2PSocketDispatcher* GetP2PSocketDispatcher();
virtual webkit_glue::P2PTransport* CreateP2PTransport();
+ virtual double GetLocalTimeZoneOffset(base::Time t);
};
} // namespace ppapi
diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h
index 9b3e3f1..3cb1fea 100644
--- a/webkit/plugins/ppapi/plugin_delegate.h
+++ b/webkit/plugins/ppapi/plugin_delegate.h
@@ -13,6 +13,7 @@
#include "base/platform_file.h"
#include "base/shared_memory.h"
#include "base/sync_socket.h"
+#include "base/time.h"
#include "googleurl/src/gurl.h"
#include "media/video/video_decode_accelerator.h"
#include "ppapi/c/pp_completion_callback.h"
@@ -387,6 +388,8 @@ class PluginDelegate {
// Creates P2PTransport object.
virtual webkit_glue::P2PTransport* CreateP2PTransport() = 0;
+
+ virtual double GetLocalTimeZoneOffset(base::Time t) = 0;
};
} // namespace ppapi
diff --git a/webkit/plugins/ppapi/ppb_flash_impl.cc b/webkit/plugins/ppapi/ppb_flash_impl.cc
index db9be46..8599d9c 100644
--- a/webkit/plugins/ppapi/ppb_flash_impl.cc
+++ b/webkit/plugins/ppapi/ppb_flash_impl.cc
@@ -73,20 +73,15 @@ void QuitMessageLoop(PP_Instance instance) {
MessageLoop::current()->QuitNow();
}
-double GetLocalTimeZoneOffset(PP_Time t) {
- // Somewhat horrible: Explode it to local time and then unexplode it as if
- // it were UTC. Also explode it to UTC and unexplode it (this avoids
- // mismatching rounding or lack thereof). The time zone offset is their
- // difference.
- //
- // TODO(brettw) this is duplicated in ppb_flash_proxy.cc, unify these!
- base::Time cur = base::Time::FromDoubleT(t);
- base::Time::Exploded exploded;
- cur.LocalExplode(&exploded);
- base::Time adj_time = base::Time::FromUTCExploded(exploded);
- cur.UTCExplode(&exploded);
- cur = base::Time::FromUTCExploded(exploded);
- return (adj_time - cur).InSecondsF();
+double GetLocalTimeZoneOffset(PP_Instance pp_instance, PP_Time t) {
+ PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
+ if (!instance)
+ return 0.0;
+
+ // We can't do the conversion here because on Linux, the localtime calls
+ // require filesystem access prohibited by the sandbox.
+ return instance->delegate()->GetLocalTimeZoneOffset(
+ base::Time::FromDoubleT(t));
}
const PPB_Flash ppb_flash = {