OLD | NEW |
---|---|
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 "base/message_loop.h" | 10 #include "base/message_loop.h" |
yzshen1
2012/11/20 21:01:26
No need to include this?
raymes
2012/11/20 23:40:32
Done.
| |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
14 #include "ppapi/c/dev/ppb_font_dev.h" | 14 #include "ppapi/c/dev/ppb_font_dev.h" |
15 #include "ppapi/c/private/ppb_flash.h" | 15 #include "ppapi/c/private/ppb_flash.h" |
16 #include "ppapi/shared_impl/file_path.h" | 16 #include "ppapi/shared_impl/file_path.h" |
17 #include "ppapi/shared_impl/file_type_conversion.h" | 17 #include "ppapi/shared_impl/file_type_conversion.h" |
18 #include "ppapi/shared_impl/time_conversion.h" | 18 #include "ppapi/shared_impl/time_conversion.h" |
19 #include "ppapi/shared_impl/var.h" | 19 #include "ppapi/shared_impl/var.h" |
20 #include "ppapi/thunk/enter.h" | 20 #include "ppapi/thunk/enter.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 | 183 |
184 int32_t PPB_Flash_Impl::Navigate(PP_Instance instance, | 184 int32_t PPB_Flash_Impl::Navigate(PP_Instance instance, |
185 const ::ppapi::URLRequestInfoData& data, | 185 const ::ppapi::URLRequestInfoData& data, |
186 const char* target, | 186 const char* target, |
187 PP_Bool from_user_action) { | 187 PP_Bool from_user_action) { |
188 if (!target) | 188 if (!target) |
189 return PP_ERROR_BADARGUMENT; | 189 return PP_ERROR_BADARGUMENT; |
190 return instance_->Navigate(data, target, PP_ToBool(from_user_action)); | 190 return instance_->Navigate(data, target, PP_ToBool(from_user_action)); |
191 } | 191 } |
192 | 192 |
193 void PPB_Flash_Impl::RunMessageLoop(PP_Instance instance) { | |
194 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); | |
195 MessageLoop::current()->Run(); | |
196 } | |
197 | |
198 void PPB_Flash_Impl::QuitMessageLoop(PP_Instance instance) { | |
199 MessageLoop::current()->QuitNow(); | |
200 } | |
201 | |
202 double PPB_Flash_Impl::GetLocalTimeZoneOffset(PP_Instance instance, | 193 double PPB_Flash_Impl::GetLocalTimeZoneOffset(PP_Instance instance, |
203 PP_Time t) { | 194 PP_Time t) { |
204 // Evil hack. The time code handles exact "0" values as special, and produces | 195 // Evil hack. The time code handles exact "0" values as special, and produces |
205 // a "null" Time object. This will represent some date hundreds of years ago | 196 // a "null" Time object. This will represent some date hundreds of years ago |
206 // and will give us funny results at 1970 (there are some tests where this | 197 // and will give us funny results at 1970 (there are some tests where this |
207 // comes up, but it shouldn't happen in real life). To work around this | 198 // comes up, but it shouldn't happen in real life). To work around this |
208 // special handling, we just need to give it some nonzero value. | 199 // special handling, we just need to give it some nonzero value. |
209 if (t == 0.0) | 200 if (t == 0.0) |
210 t = 0.0000000001; | 201 t = 0.0000000001; |
211 | 202 |
212 // We can't do the conversion here because on Linux, the localtime calls | 203 // We can't do the conversion here because on Linux, the localtime calls |
213 // require filesystem access prohibited by the sandbox. | 204 // require filesystem access prohibited by the sandbox. |
214 return instance_->delegate()->GetLocalTimeZoneOffset(PPTimeToTime(t)); | 205 return instance_->delegate()->GetLocalTimeZoneOffset(PPTimeToTime(t)); |
215 } | 206 } |
216 | 207 |
217 PP_Bool PPB_Flash_Impl::IsRectTopmost(PP_Instance instance, | 208 PP_Bool PPB_Flash_Impl::IsRectTopmost(PP_Instance instance, |
218 const PP_Rect* rect) { | 209 const PP_Rect* rect) { |
219 return PP_FromBool(instance_->IsRectTopmost( | 210 return PP_FromBool(instance_->IsRectTopmost( |
220 gfx::Rect(rect->point.x, rect->point.y, | 211 gfx::Rect(rect->point.x, rect->point.y, |
221 rect->size.width, rect->size.height))); | 212 rect->size.width, rect->size.height))); |
222 } | 213 } |
223 | 214 |
224 void PPB_Flash_Impl::UpdateActivity(PP_Instance pp_instance) { | 215 void PPB_Flash_Impl::UpdateActivity(PP_Instance pp_instance) { |
225 // Not supported in-process. | 216 // Not supported in-process. |
226 } | 217 } |
227 | 218 |
228 PP_Var PPB_Flash_Impl::GetDeviceID(PP_Instance pp_instance) { | |
229 std::string id = instance_->delegate()->GetDeviceID(); | |
230 return StringVar::StringToPPVar(id); | |
231 } | |
232 | |
233 int32_t PPB_Flash_Impl::GetSettingInt(PP_Instance instance, | |
234 PP_FlashSetting setting) { | |
235 // No current settings are supported in-process. | |
236 return -1; | |
237 } | |
238 | |
239 PP_Var PPB_Flash_Impl::GetSetting(PP_Instance instance, | 219 PP_Var PPB_Flash_Impl::GetSetting(PP_Instance instance, |
240 PP_FlashSetting setting) { | 220 PP_FlashSetting setting) { |
241 switch(setting) { | 221 switch(setting) { |
242 case PP_FLASHSETTING_LSORESTRICTIONS: { | 222 case PP_FLASHSETTING_LSORESTRICTIONS: { |
243 return PP_MakeInt32( | 223 return PP_MakeInt32( |
244 instance_->delegate()->GetLocalDataRestrictions( | 224 instance_->delegate()->GetLocalDataRestrictions( |
245 instance_->container()->element().document().url(), | 225 instance_->container()->element().document().url(), |
246 instance_->plugin_url())); | 226 instance_->plugin_url())); |
247 } | 227 } |
248 default: | 228 default: |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 return PP_TRUE; | 468 return PP_TRUE; |
489 } | 469 } |
490 | 470 |
491 PP_Bool PPB_Flash_Impl::FlashGetScreenSize(PP_Instance instance, | 471 PP_Bool PPB_Flash_Impl::FlashGetScreenSize(PP_Instance instance, |
492 PP_Size* size) { | 472 PP_Size* size) { |
493 return instance_->GetScreenSize(instance, size); | 473 return instance_->GetScreenSize(instance, size); |
494 } | 474 } |
495 | 475 |
496 } // namespace ppapi | 476 } // namespace ppapi |
497 } // namespace webkit | 477 } // namespace webkit |
OLD | NEW |