| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 #include "base/logging.h" | 46 #include "base/logging.h" |
| 47 #include "core/cross/install_check.h" | 47 #include "core/cross/install_check.h" |
| 48 #include "plugin/cross/config.h" | 48 #include "plugin/cross/config.h" |
| 49 #include "plugin/cross/o3d_glue.h" | 49 #include "plugin/cross/o3d_glue.h" |
| 50 #include "core/cross/error.h" | 50 #include "core/cross/error.h" |
| 51 #include "third_party/nixysa/files/static_glue/npapi/common.h" | 51 #include "third_party/nixysa/files/static_glue/npapi/common.h" |
| 52 | 52 |
| 53 using glue::_o3d::GetServiceLocator; | 53 using glue::_o3d::GetServiceLocator; |
| 54 | 54 |
| 55 namespace o3d { |
| 56 |
| 55 // Gets the value of "navigator.userAgent" in the JavaScript context, which | 57 // Gets the value of "navigator.userAgent" in the JavaScript context, which |
| 56 // contains the user agent string. | 58 // contains the user agent string. |
| 57 std::string GetUserAgent(NPP npp) { | 59 std::string GetUserAgent(NPP npp) { |
| 58 GLUE_PROFILE_START(npp, "NPN_UserAgent"); | 60 GLUE_PROFILE_START(npp, "NPN_UserAgent"); |
| 59 const char* user_agent = NPN_UserAgent(npp); | 61 const char* user_agent = NPN_UserAgent(npp); |
| 60 GLUE_PROFILE_STOP(npp, "NPN_UserAgent"); | 62 GLUE_PROFILE_STOP(npp, "NPN_UserAgent"); |
| 61 std::string uagent_string; | 63 std::string uagent_string; |
| 62 if (user_agent) { | 64 if (user_agent) { |
| 63 uagent_string = std::string(user_agent); | 65 uagent_string = std::string(user_agent); |
| 64 } | 66 } |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 } | 208 } |
| 207 return false; | 209 return false; |
| 208 } | 210 } |
| 209 } | 211 } |
| 210 | 212 |
| 211 // Check User agent. Only Firefox, Chrome and IE are supported. | 213 // Check User agent. Only Firefox, Chrome and IE are supported. |
| 212 std::string user_agent = GetUserAgent(npp); | 214 std::string user_agent = GetUserAgent(npp); |
| 213 if (!CheckUserAgent(npp, user_agent)) return false; | 215 if (!CheckUserAgent(npp, user_agent)) return false; |
| 214 return true; | 216 return true; |
| 215 } | 217 } |
| 218 } // namespace o3d |
| OLD | NEW |