| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/npapi/plugin_utils.h" | 5 #include "webkit/plugins/npapi/plugin_utils.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| 11 #include "base/version.h" | 11 #include "base/version.h" |
| 12 | 12 |
| 13 namespace webkit { | 13 namespace webkit { |
| 14 namespace npapi { | 14 namespace npapi { |
| 15 | 15 |
| 16 // Global variable used by the plugin quirk "die after unload". |
| 17 bool g_forcefully_terminate_plugin_process = false; |
| 18 |
| 16 void CreateVersionFromString(const base::string16& version_string, | 19 void CreateVersionFromString(const base::string16& version_string, |
| 17 Version* parsed_version) { | 20 Version* parsed_version) { |
| 18 // Remove spaces and ')' from the version string, | 21 // Remove spaces and ')' from the version string, |
| 19 // Replace any instances of 'r', ',' or '(' with a dot. | 22 // Replace any instances of 'r', ',' or '(' with a dot. |
| 20 std::string version = UTF16ToASCII(version_string); | 23 std::string version = UTF16ToASCII(version_string); |
| 21 RemoveChars(version, ") ", &version); | 24 RemoveChars(version, ") ", &version); |
| 22 std::replace(version.begin(), version.end(), 'd', '.'); | 25 std::replace(version.begin(), version.end(), 'd', '.'); |
| 23 std::replace(version.begin(), version.end(), 'r', '.'); | 26 std::replace(version.begin(), version.end(), 'r', '.'); |
| 24 std::replace(version.begin(), version.end(), ',', '.'); | 27 std::replace(version.begin(), version.end(), ',', '.'); |
| 25 std::replace(version.begin(), version.end(), '(', '.'); | 28 std::replace(version.begin(), version.end(), '(', '.'); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 45 } | 48 } |
| 46 | 49 |
| 47 bool NPAPIPluginsSupported() { | 50 bool NPAPIPluginsSupported() { |
| 48 #if defined(OS_WIN) || defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(USE_
AURA)) | 51 #if defined(OS_WIN) || defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(USE_
AURA)) |
| 49 return true; | 52 return true; |
| 50 #else | 53 #else |
| 51 return false; | 54 return false; |
| 52 #endif | 55 #endif |
| 53 } | 56 } |
| 54 | 57 |
| 58 void SetForcefullyTerminatePluginProcess(bool value) { |
| 59 g_forcefully_terminate_plugin_process = value; |
| 60 } |
| 61 |
| 62 bool ShouldForcefullyTerminatePluginProcess() { |
| 63 return g_forcefully_terminate_plugin_process; |
| 64 } |
| 65 |
| 55 } // namespace npapi | 66 } // namespace npapi |
| 56 } // namespace webkit | 67 } // namespace webkit |
| OLD | NEW |