Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: ppapi/proxy/ppb_flash_proxy.cc

Issue 10991007: [OSX] Forward Flapper GetLocalTimeZoneOffset() to browser on OSX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/proxy/ppb_flash_proxy.h" 5 #include "ppapi/proxy/ppb_flash_proxy.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // Cache the local offset for ten seconds, since it's slow on XP and Linux. 236 // Cache the local offset for ten seconds, since it's slow on XP and Linux.
237 const int64 kMaxCachedLocalOffsetAgeInSeconds = 10; 237 const int64 kMaxCachedLocalOffsetAgeInSeconds = 10;
238 base::TimeTicks now = base::TimeTicks::Now(); 238 base::TimeTicks now = base::TimeTicks::Now();
239 base::TimeTicks expiration = 239 base::TimeTicks expiration =
240 base::TimeTicks::FromInternalValue(s_last_updated) + 240 base::TimeTicks::FromInternalValue(s_last_updated) +
241 base::TimeDelta::FromSeconds(kMaxCachedLocalOffsetAgeInSeconds); 241 base::TimeDelta::FromSeconds(kMaxCachedLocalOffsetAgeInSeconds);
242 if (now < expiration) 242 if (now < expiration)
243 return s_local_offset; 243 return s_local_offset;
244 244
245 s_last_updated = now.ToInternalValue(); 245 s_last_updated = now.ToInternalValue();
246 #if defined(OS_LINUX) 246 // TODO(shess): Figure out why OSX needs the access, the sandbox
247 // warmup should handle it. http://crbug.com/149006
248 #if defined(OS_LINUX) || defined(OS_MACOSX)
247 // On Linux localtime needs access to the filesystem, which is prohibited 249 // On Linux localtime needs access to the filesystem, which is prohibited
248 // by the sandbox. It would be better to go directly to the browser process 250 // by the sandbox. It would be better to go directly to the browser process
249 // for this message rather than proxy it through some instance in a renderer. 251 // for this message rather than proxy it through some instance in a renderer.
250 dispatcher()->Send(new PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset( 252 dispatcher()->Send(new PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset(
viettrungluu 2012/09/25 00:19:35 I assume this IPC is actually handled correctly on
251 API_ID_PPB_FLASH, instance, t, &s_local_offset)); 253 API_ID_PPB_FLASH, instance, t, &s_local_offset));
252 #else 254 #else
253 base::Time cur = PPTimeToTime(t); 255 base::Time cur = PPTimeToTime(t);
254 base::Time::Exploded exploded = { 0 }; 256 base::Time::Exploded exploded = { 0 };
255 base::Time::Exploded utc_exploded = { 0 }; 257 base::Time::Exploded utc_exploded = { 0 };
256 cur.LocalExplode(&exploded); 258 cur.LocalExplode(&exploded);
257 cur.UTCExplode(&utc_exploded); 259 cur.UTCExplode(&utc_exploded);
258 if (exploded.HasValidValues() && utc_exploded.HasValidValues()) { 260 if (exploded.HasValidValues() && utc_exploded.HasValidValues()) {
259 base::Time adj_time = base::Time::FromUTCExploded(exploded); 261 base::Time adj_time = base::Time::FromUTCExploded(exploded);
260 base::Time cur = base::Time::FromUTCExploded(utc_exploded); 262 base::Time cur = base::Time::FromUTCExploded(utc_exploded);
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 // It's rarely used enough that we just request this interface when needed. 877 // It's rarely used enough that we just request this interface when needed.
876 const PPB_Flash_Print_1_0* print_interface = 878 const PPB_Flash_Print_1_0* print_interface =
877 static_cast<const PPB_Flash_Print_1_0*>( 879 static_cast<const PPB_Flash_Print_1_0*>(
878 dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0)); 880 dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0));
879 if (print_interface) 881 if (print_interface)
880 print_interface->InvokePrinting(instance); 882 print_interface->InvokePrinting(instance);
881 } 883 }
882 884
883 } // namespace proxy 885 } // namespace proxy
884 } // namespace ppapi 886 } // namespace ppapi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698