diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-22 15:58:42 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-22 15:58:42 +0000 |
commit | 2872d7d601be4141fd488c69f26d7718841c7462 (patch) | |
tree | 97b8f3b871671cb0c36b8a1bbe9a3f644f0886ba /webkit/plugins | |
parent | 83c0f7cc5aa3bba61e0b5cdc88635825fdef24c9 (diff) | |
download | chromium_src-2872d7d601be4141fd488c69f26d7718841c7462.zip chromium_src-2872d7d601be4141fd488c69f26d7718841c7462.tar.gz chromium_src-2872d7d601be4141fd488c69f26d7718841c7462.tar.bz2 |
Merge 82575 - Proxy time zone requests to the browser. This is because the current codecan't run in the sandbox on Linux.TEST=manualBUG=80176Review URL: http://codereview.chromium.org/6891001
TBR=brettw@chromium.org
TEST=80176
Review URL: http://codereview.chromium.org/6899026
git-svn-id: svn://svn.chromium.org/chrome/branches/742/src@82655 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r-- | webkit/plugins/ppapi/mock_plugin_delegate.cc | 4 | ||||
-rw-r--r-- | webkit/plugins/ppapi/mock_plugin_delegate.h | 1 | ||||
-rw-r--r-- | webkit/plugins/ppapi/plugin_delegate.h | 3 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_flash_impl.cc | 23 |
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 eefb1e6..761a808 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 = { |