OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // Pops up a dialog box using JavaScript showing the error and gives the user a | 68 // Pops up a dialog box using JavaScript showing the error and gives the user a |
69 // chance to continue anyway. | 69 // chance to continue anyway. |
70 bool AskUser(NPP npp, const std::string &error) { | 70 bool AskUser(NPP npp, const std::string &error) { |
71 NPObject *global_object; | 71 NPObject *global_object; |
72 GLUE_PROFILE_START(npp, "NPN_GetValue"); | 72 GLUE_PROFILE_START(npp, "NPN_GetValue"); |
73 NPN_GetValue(npp, NPNVWindowNPObject, &global_object); | 73 NPN_GetValue(npp, NPNVWindowNPObject, &global_object); |
74 GLUE_PROFILE_STOP(npp, "NPN_GetValue"); | 74 GLUE_PROFILE_STOP(npp, "NPN_GetValue"); |
75 GLUE_PROFILE_START(npp, "NPN_GetStringIdentifier"); | 75 GLUE_PROFILE_START(npp, "NPN_GetStringIdentifier"); |
76 NPIdentifier alert_id = NPN_GetStringIdentifier("confirm"); | 76 NPIdentifier alert_id = NPN_GetStringIdentifier("confirm"); |
77 GLUE_PROFILE_STOP(npp, "NPN_GetStringIdentifier"); | 77 GLUE_PROFILE_STOP(npp, "NPN_GetStringIdentifier"); |
78 std::string message = error; | 78 std::string message = std::string("O3D: ") + error; |
79 // TODO: internationalize message. | 79 // TODO: internationalize message. |
80 // TODO: Should this change to call some hardcoded javascript function | 80 // TODO: Should this change to call some hardcoded javascript function |
81 // like "o3djs.util.confirmContinuation" or even a global name like | 81 // like "o3djs.util.confirmContinuation" or even a global name like |
82 // o3djs_confirmContinuation. This would move localization outside | 82 // o3djs_confirmContinuation. This would move localization outside |
83 // C++ and give the developer a chance to handle it his own way. | 83 // C++ and give the developer a chance to handle it his own way. |
84 message += "\nPress OK to continue anyway."; | 84 message += "\nPress OK to continue anyway."; |
85 | 85 |
86 NPVariant args[1]; | 86 NPVariant args[1]; |
87 NPVariant result; | 87 NPVariant result; |
88 STRINGN_TO_NPVARIANT(message.c_str(), message.length(), args[0]); | 88 STRINGN_TO_NPVARIANT(message.c_str(), message.length(), args[0]); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 206 } |
207 return false; | 207 return false; |
208 } | 208 } |
209 } | 209 } |
210 | 210 |
211 // Check User agent. Only Firefox, Chrome and IE are supported. | 211 // Check User agent. Only Firefox, Chrome and IE are supported. |
212 std::string user_agent = GetUserAgent(npp); | 212 std::string user_agent = GetUserAgent(npp); |
213 if (!CheckUserAgent(npp, user_agent)) return false; | 213 if (!CheckUserAgent(npp, user_agent)) return false; |
214 return true; | 214 return true; |
215 } | 215 } |
OLD | NEW |