summaryrefslogtreecommitdiffstats
path: root/webkit/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/plugins')
-rw-r--r--webkit/plugins/ppapi/ppb_flash_impl.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/webkit/plugins/ppapi/ppb_flash_impl.cc b/webkit/plugins/ppapi/ppb_flash_impl.cc
index 27415e5..db9be46 100644
--- a/webkit/plugins/ppapi/ppb_flash_impl.cc
+++ b/webkit/plugins/ppapi/ppb_flash_impl.cc
@@ -7,6 +7,7 @@
#include <string>
#include "base/message_loop.h"
+#include "base/time.h"
#include "googleurl/src/gurl.h"
#include "ppapi/c/private/ppb_flash.h"
#include "webkit/plugins/ppapi/common.h"
@@ -72,6 +73,22 @@ 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();
+}
+
const PPB_Flash ppb_flash = {
&SetInstanceAlwaysOnTop,
&PPB_Flash_Impl::DrawGlyphs,
@@ -79,6 +96,7 @@ const PPB_Flash ppb_flash = {
&Navigate,
&RunMessageLoop,
&QuitMessageLoop,
+ &GetLocalTimeZoneOffset
};
} // namespace