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

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

Issue 11516020: Refactor PPB_Flash GetLocalTimeZoneOffset to the new PPAPI resource model (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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 | « webkit/plugins/ppapi/ppb_flash_impl.h ('k') | 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 "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 #include <vector> 8 #include <vector>
9 9
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 int32_t PPB_Flash_Impl::Navigate(PP_Instance instance, 162 int32_t PPB_Flash_Impl::Navigate(PP_Instance instance,
163 const ::ppapi::URLRequestInfoData& data, 163 const ::ppapi::URLRequestInfoData& data,
164 const char* target, 164 const char* target,
165 PP_Bool from_user_action) { 165 PP_Bool from_user_action) {
166 if (!target) 166 if (!target)
167 return PP_ERROR_BADARGUMENT; 167 return PP_ERROR_BADARGUMENT;
168 return instance_->Navigate(data, target, PP_ToBool(from_user_action)); 168 return instance_->Navigate(data, target, PP_ToBool(from_user_action));
169 } 169 }
170 170
171 double PPB_Flash_Impl::GetLocalTimeZoneOffset(PP_Instance instance,
172 PP_Time t) {
173 // Evil hack. The time code handles exact "0" values as special, and produces
174 // a "null" Time object. This will represent some date hundreds of years ago
175 // and will give us funny results at 1970 (there are some tests where this
176 // comes up, but it shouldn't happen in real life). To work around this
177 // special handling, we just need to give it some nonzero value.
178 if (t == 0.0)
179 t = 0.0000000001;
180
181 // We can't do the conversion here because on Linux, the localtime calls
182 // require filesystem access prohibited by the sandbox.
183 return instance_->delegate()->GetLocalTimeZoneOffset(PPTimeToTime(t));
184 }
185
186 PP_Bool PPB_Flash_Impl::IsRectTopmost(PP_Instance instance, 171 PP_Bool PPB_Flash_Impl::IsRectTopmost(PP_Instance instance,
187 const PP_Rect* rect) { 172 const PP_Rect* rect) {
188 return PP_FromBool(instance_->IsRectTopmost( 173 return PP_FromBool(instance_->IsRectTopmost(
189 gfx::Rect(rect->point.x, rect->point.y, 174 gfx::Rect(rect->point.x, rect->point.y,
190 rect->size.width, rect->size.height))); 175 rect->size.width, rect->size.height)));
191 } 176 }
192 177
193 PP_Var PPB_Flash_Impl::GetSetting(PP_Instance instance, 178 PP_Var PPB_Flash_Impl::GetSetting(PP_Instance instance,
194 PP_FlashSetting setting) { 179 PP_FlashSetting setting) {
195 switch(setting) { 180 switch(setting) {
196 case PP_FLASHSETTING_LSORESTRICTIONS: { 181 case PP_FLASHSETTING_LSORESTRICTIONS: {
197 return PP_MakeInt32( 182 return PP_MakeInt32(
198 instance_->delegate()->GetLocalDataRestrictions( 183 instance_->delegate()->GetLocalDataRestrictions(
199 instance_->container()->element().document().url(), 184 instance_->container()->element().document().url(),
200 instance_->plugin_url())); 185 instance_->plugin_url()));
201 } 186 }
202 default: 187 default:
203 // No other settings are supported in-process. 188 // No other settings are supported in-process.
204 return PP_MakeUndefined(); 189 return PP_MakeUndefined();
205 } 190 }
206 } 191 }
207 192
208 } // namespace ppapi 193 } // namespace ppapi
209 } // namespace webkit 194 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_flash_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698