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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 bool CheckOSVersion(NPP npp) { | 61 bool CheckOSVersion(NPP npp) { |
62 OSVERSIONINFOEX version = {sizeof(OSVERSIONINFOEX)}; // NOLINT | 62 OSVERSIONINFOEX version = {sizeof(OSVERSIONINFOEX)}; // NOLINT |
63 GetVersionEx(reinterpret_cast<OSVERSIONINFO *>(&version)); | 63 GetVersionEx(reinterpret_cast<OSVERSIONINFO *>(&version)); |
64 if (version.dwMajorVersion == 5 && version.dwMinorVersion == 1) { | 64 if (version.dwMajorVersion == 5 && version.dwMinorVersion == 1) { |
65 // NT 5.1 = Windows XP | 65 // NT 5.1 = Windows XP |
66 if (version.wServicePackMajor < 2) { | 66 if (version.wServicePackMajor < 2) { |
67 // TODO: internationalize messages. | 67 // TODO: internationalize messages. |
68 std::string error = std::string("Windows XP Service Pack 2 is required."); | 68 std::string error = std::string("Windows XP Service Pack 2 is required."); |
69 if (!AskUser(npp, error)) return false; | 69 if (!AskUser(npp, error)) return false; |
70 } | 70 } |
71 } else if (version.dwMajorVersion == 6 && version.dwMinorVersion == 0) { | 71 } else if (version.dwMajorVersion > 5 || |
| 72 » (version.dwMajorVersion == 5 && version.dwMinorVersion >= 2)) { |
72 // 6.0 is Vista or Server 2008; it's now worth a try. | 73 // 6.0 is Vista or Server 2008; it's now worth a try. |
73 } else { | 74 } else { |
74 std::string error = std::string("Unsupported Windows version."); | 75 std::string error = std::string("Unsupported Windows version."); |
75 if (!AskUser(npp, error)) return false; | 76 if (!AskUser(npp, error)) return false; |
76 } | 77 } |
77 return true; | 78 return true; |
78 } | 79 } |
79 | 80 |
80 // Checks user agent string. We only allow Firefox, Chrome, and IE. | 81 // Checks user agent string. We only allow Firefox, Chrome, and IE. |
81 bool CheckUserAgent(NPP npp, const std::string &user_agent) { | 82 bool CheckUserAgent(NPP npp, const std::string &user_agent) { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 o3d::metric_browser_type = o3d::BROWSER_NAME_OPERA; | 225 o3d::metric_browser_type = o3d::BROWSER_NAME_OPERA; |
225 } else if (std::string::npos != user_agent.find("Firefox")) { | 226 } else if (std::string::npos != user_agent.find("Firefox")) { |
226 o3d::metric_browser_type = o3d::BROWSER_NAME_FIREFOX; | 227 o3d::metric_browser_type = o3d::BROWSER_NAME_FIREFOX; |
227 } else if (std::string::npos != user_agent.find("MSIE")) { | 228 } else if (std::string::npos != user_agent.find("MSIE")) { |
228 o3d::metric_browser_type = o3d::BROWSER_NAME_MSIE; | 229 o3d::metric_browser_type = o3d::BROWSER_NAME_MSIE; |
229 } else { | 230 } else { |
230 o3d::metric_browser_type = o3d::BROWSER_NAME_UNKNOWN; | 231 o3d::metric_browser_type = o3d::BROWSER_NAME_UNKNOWN; |
231 } | 232 } |
232 return true; | 233 return true; |
233 } | 234 } |
OLD | NEW |