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

Side by Side Diff: webkit/plugins/ppapi/ppb_flash_impl.cc

Issue 7344009: Move the time conversion code to the PPAPI shared_impl directory and use it in (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 5 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppb_flash_impl.h" 5 #include "webkit/plugins/ppapi/ppb_flash_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
12 #include "ppapi/c/private/ppb_flash.h" 12 #include "ppapi/c/private/ppb_flash.h"
13 #include "ppapi/shared_impl/time_conversion.h"
13 #include "ppapi/thunk/enter.h" 14 #include "ppapi/thunk/enter.h"
14 #include "webkit/plugins/ppapi/common.h" 15 #include "webkit/plugins/ppapi/common.h"
15 #include "webkit/plugins/ppapi/plugin_delegate.h" 16 #include "webkit/plugins/ppapi/plugin_delegate.h"
16 #include "webkit/plugins/ppapi/plugin_module.h" 17 #include "webkit/plugins/ppapi/plugin_module.h"
17 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 18 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
18 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" 19 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h"
19 #include "webkit/plugins/ppapi/resource_tracker.h" 20 #include "webkit/plugins/ppapi/resource_tracker.h"
20 #include "webkit/plugins/ppapi/time_conversion.h"
21 #include "webkit/plugins/ppapi/var.h" 21 #include "webkit/plugins/ppapi/var.h"
22 22
23 using ppapi::PPTimeToTime;
23 using ppapi::thunk::EnterResource; 24 using ppapi::thunk::EnterResource;
24 using ppapi::thunk::PPB_URLRequestInfo_API; 25 using ppapi::thunk::PPB_URLRequestInfo_API;
25 26
26 namespace webkit { 27 namespace webkit {
27 namespace ppapi { 28 namespace ppapi {
28 29
29 namespace { 30 namespace {
30 31
31 void SetInstanceAlwaysOnTop(PP_Instance pp_instance, PP_Bool on_top) { 32 void SetInstanceAlwaysOnTop(PP_Instance pp_instance, PP_Bool on_top) {
32 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); 33 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // Evil hack. The time code handles exact "0" values as special, and produces 89 // Evil hack. The time code handles exact "0" values as special, and produces
89 // a "null" Time object. This will represent some date hundreds of years ago 90 // a "null" Time object. This will represent some date hundreds of years ago
90 // and will give us funny results at 1970 (there are some tests where this 91 // and will give us funny results at 1970 (there are some tests where this
91 // comes up, but it shouldn't happen in real life). To work around this 92 // comes up, but it shouldn't happen in real life). To work around this
92 // special handling, we just need to give it some nonzero value. 93 // special handling, we just need to give it some nonzero value.
93 if (t == 0.0) 94 if (t == 0.0)
94 t = 0.0000000001; 95 t = 0.0000000001;
95 96
96 // We can't do the conversion here because on Linux, the localtime calls 97 // We can't do the conversion here because on Linux, the localtime calls
97 // require filesystem access prohibited by the sandbox. 98 // require filesystem access prohibited by the sandbox.
98 return instance->delegate()->GetLocalTimeZoneOffset( 99 return instance->delegate()->GetLocalTimeZoneOffset(PPTimeToTime(t));
99 PPTimeToTime(t));
100 } 100 }
101 101
102 PP_Var GetCommandLineArgs(PP_Module pp_module) { 102 PP_Var GetCommandLineArgs(PP_Module pp_module) {
103 PluginModule* module = ResourceTracker::Get()->GetModule(pp_module); 103 PluginModule* module = ResourceTracker::Get()->GetModule(pp_module);
104 if (!module) 104 if (!module)
105 return PP_MakeUndefined(); 105 return PP_MakeUndefined();
106 106
107 PluginInstance* instance = module->GetSomeInstance(); 107 PluginInstance* instance = module->GetSomeInstance();
108 if (!instance) 108 if (!instance)
109 return PP_MakeUndefined(); 109 return PP_MakeUndefined();
(...skipping 15 matching lines...) Expand all
125 125
126 } // namespace 126 } // namespace
127 127
128 // static 128 // static
129 const PPB_Flash* PPB_Flash_Impl::GetInterface() { 129 const PPB_Flash* PPB_Flash_Impl::GetInterface() {
130 return &ppb_flash; 130 return &ppb_flash;
131 } 131 }
132 132
133 } // namespace ppapi 133 } // namespace ppapi
134 } // namespace webkit 134 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_flash_file_impl.cc ('k') | webkit/plugins/ppapi/ppb_graphics_2d_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698