| 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 "ppapi/proxy/flash_resource.h" | 5 #include "ppapi/proxy/flash_resource.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/containers/mru_cache.h" | 9 #include "base/containers/mru_cache.h" |
| 10 #include "base/debug/crash_logging.h" |
| 10 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 11 #include "base/time.h" | 12 #include "base/time.h" |
| 12 #include "ppapi/c/pp_errors.h" | 13 #include "ppapi/c/pp_errors.h" |
| 13 #include "ppapi/c/private/ppb_flash.h" | 14 #include "ppapi/c/private/ppb_flash.h" |
| 14 #include "ppapi/c/trusted/ppb_browser_font_trusted.h" | 15 #include "ppapi/c/trusted/ppb_browser_font_trusted.h" |
| 15 #include "ppapi/proxy/plugin_dispatcher.h" | 16 #include "ppapi/proxy/plugin_dispatcher.h" |
| 16 #include "ppapi/proxy/plugin_globals.h" | 17 #include "ppapi/proxy/plugin_globals.h" |
| 17 #include "ppapi/proxy/ppapi_messages.h" | 18 #include "ppapi/proxy/ppapi_messages.h" |
| 18 #include "ppapi/proxy/serialized_structs.h" | 19 #include "ppapi/proxy/serialized_structs.h" |
| 19 #include "ppapi/shared_impl/ppapi_preferences.h" | 20 #include "ppapi/shared_impl/ppapi_preferences.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 return PP_MakeUndefined(); | 77 return PP_MakeUndefined(); |
| 77 } | 78 } |
| 78 | 79 |
| 79 void FlashResource::UpdateActivity(PP_Instance instance) { | 80 void FlashResource::UpdateActivity(PP_Instance instance) { |
| 80 Post(BROWSER, PpapiHostMsg_Flash_UpdateActivity()); | 81 Post(BROWSER, PpapiHostMsg_Flash_UpdateActivity()); |
| 81 } | 82 } |
| 82 | 83 |
| 83 PP_Bool FlashResource::SetCrashData(PP_Instance instance, | 84 PP_Bool FlashResource::SetCrashData(PP_Instance instance, |
| 84 PP_FlashCrashKey key, | 85 PP_FlashCrashKey key, |
| 85 PP_Var value) { | 86 PP_Var value) { |
| 87 StringVar* url_string_var(StringVar::FromPPVar(value)); |
| 88 if (!url_string_var) |
| 89 return PP_FALSE; |
| 86 switch (key) { | 90 switch (key) { |
| 87 case PP_FLASHCRASHKEY_URL: { | 91 case PP_FLASHCRASHKEY_URL: { |
| 88 StringVar* url_string_var(StringVar::FromPPVar(value)); | |
| 89 if (!url_string_var) | |
| 90 return PP_FALSE; | |
| 91 PluginGlobals::Get()->SetActiveURL(url_string_var->value()); | 92 PluginGlobals::Get()->SetActiveURL(url_string_var->value()); |
| 92 return PP_TRUE; | 93 return PP_TRUE; |
| 93 } | 94 } |
| 95 case PP_FLASHCRASHKEY_RESOURCE_URL: { |
| 96 base::debug::SetCrashKeyValue("subresource_url", url_string_var->value()); |
| 97 return PP_TRUE; |
| 98 } |
| 94 } | 99 } |
| 95 return PP_FALSE; | 100 return PP_FALSE; |
| 96 } | 101 } |
| 97 | 102 |
| 98 double FlashResource::GetLocalTimeZoneOffset(PP_Instance instance, | 103 double FlashResource::GetLocalTimeZoneOffset(PP_Instance instance, |
| 99 PP_Time t) { | 104 PP_Time t) { |
| 100 LocalTimeZoneOffsetCache& cache = g_local_time_zone_offset_cache.Get(); | 105 LocalTimeZoneOffsetCache& cache = g_local_time_zone_offset_cache.Get(); |
| 101 | 106 |
| 102 // Get the minimum PP_Time value that shares the same minute as |t|. | 107 // Get the minimum PP_Time value that shares the same minute as |t|. |
| 103 // Use cached offset if cache hasn't expired and |t| is in the same minute as | 108 // Use cached offset if cache hasn't expired and |t| is in the same minute as |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 PpapiHostMsg_Flash_IsRectTopmost(*rect)); | 247 PpapiHostMsg_Flash_IsRectTopmost(*rect)); |
| 243 return PP_FromBool(result == PP_OK); | 248 return PP_FromBool(result == PP_OK); |
| 244 } | 249 } |
| 245 | 250 |
| 246 void FlashResource::InvokePrinting(PP_Instance instance) { | 251 void FlashResource::InvokePrinting(PP_Instance instance) { |
| 247 Post(RENDERER, PpapiHostMsg_Flash_InvokePrinting()); | 252 Post(RENDERER, PpapiHostMsg_Flash_InvokePrinting()); |
| 248 } | 253 } |
| 249 | 254 |
| 250 } // namespace proxy | 255 } // namespace proxy |
| 251 } // namespace ppapi | 256 } // namespace ppapi |
| OLD | NEW |