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/glue/webkit_glue.h" | 5 #include "webkit/glue/webkit_glue.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
10 #include "webkit/glue/user_agent.h" | 10 #include "webkit/glue/user_agent.h" |
11 #include "webkit/plugins/npapi/plugin_list.h" | |
12 | 11 |
13 // Functions needed by webkit_glue. | 12 // Functions needed by webkit_glue. |
14 | 13 |
15 namespace webkit_glue { | 14 namespace webkit_glue { |
16 | 15 |
17 void GetPlugins(bool refresh, | |
18 std::vector<webkit::WebPluginInfo>* plugins) { | |
19 if (refresh) | |
20 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | |
21 webkit::npapi::PluginList::Singleton()->GetPlugins(plugins); | |
22 // Don't load the forked npapi_layout_test_plugin in DRT, we only want to | |
23 // use the upstream version TestNetscapePlugIn. | |
24 const FilePath::StringType kPluginBlackList[] = { | |
25 FILE_PATH_LITERAL("npapi_layout_test_plugin.dll"), | |
26 FILE_PATH_LITERAL("WebKitTestNetscapePlugIn.plugin"), | |
27 FILE_PATH_LITERAL("libnpapi_layout_test_plugin.so"), | |
28 }; | |
29 for (int i = plugins->size() - 1; i >= 0; --i) { | |
30 webkit::WebPluginInfo plugin_info = plugins->at(i); | |
31 for (size_t j = 0; j < arraysize(kPluginBlackList); ++j) { | |
32 if (plugin_info.path.BaseName() == FilePath(kPluginBlackList[j])) { | |
33 plugins->erase(plugins->begin() + i); | |
34 } | |
35 } | |
36 } | |
37 } | |
38 | |
39 void AppendToLog(const char*, int, const char*) { | 16 void AppendToLog(const char*, int, const char*) { |
40 } | 17 } |
41 | 18 |
42 bool IsProtocolSupportedForMedia(const GURL& url) { | 19 bool IsProtocolSupportedForMedia(const GURL& url) { |
43 if (url.SchemeIsFile() || | 20 if (url.SchemeIsFile() || |
44 url.SchemeIs("http") || | 21 url.SchemeIs("http") || |
45 url.SchemeIs("https") || | 22 url.SchemeIs("https") || |
46 url.SchemeIs("data")) | 23 url.SchemeIs("data")) |
47 return true; | 24 return true; |
48 return false; | 25 return false; |
49 } | 26 } |
50 | 27 |
51 bool GetPluginFinderURL(std::string* plugin_finder_url) { | 28 bool GetPluginFinderURL(std::string* plugin_finder_url) { |
52 return false; | 29 return false; |
53 } | 30 } |
54 | 31 |
55 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
56 bool DownloadUrl(const std::string& url, HWND caller_window) { | 33 bool DownloadUrl(const std::string& url, HWND caller_window) { |
57 return false; | 34 return false; |
58 } | 35 } |
59 #endif | 36 #endif |
60 | 37 |
61 void EnableSpdy(bool enable) { | 38 void EnableSpdy(bool enable) { |
62 } | 39 } |
63 | 40 |
64 void UserMetricsRecordAction(const std::string& action) { | 41 void UserMetricsRecordAction(const std::string& action) { |
65 } | 42 } |
66 | 43 |
67 } // namespace webkit_glue | 44 } // namespace webkit_glue |
OLD | NEW |