OLD | NEW |
| (Empty) |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 // | |
5 // Thes file contains stuff that should be shared among projects that do some | |
6 // special handling with ActiveX. | |
7 | |
8 #ifndef WEBKIT_ACTIVEX_SHIM_ACTIVEX_SHARED_H__ | |
9 #define WEBKIT_ACTIVEX_SHIM_ACTIVEX_SHARED_H__ | |
10 | |
11 #include <string> | |
12 | |
13 class GURL; | |
14 | |
15 namespace activex_shim { | |
16 | |
17 // Well known ActiveX control types that we may need to do special processing | |
18 // to support them better. | |
19 enum ActiveXTypes { | |
20 ACTIVEX_GENERIC, | |
21 ACTIVEX_FLASH, | |
22 ACTIVEX_WMP, | |
23 ACTIVEX_REALPLAYER, | |
24 ACTIVEX_QUICKTIME, | |
25 ACTIVEX_SHOCKWAVE, | |
26 ACTIVEX_TESTCONTROL, // Internal test control. | |
27 }; | |
28 | |
29 // Given a clsid, map it to ActiveXTypes. The given clsid must be in format | |
30 // as: d27cdb6e-ae6d-11cf-96b8-444553540000. i.e. no {} at both ends, | |
31 // no spaces, case insensitive. | |
32 ActiveXTypes MapClassIdToType(const std::string& clsid); | |
33 | |
34 // Parse out the real clsid given from a classid attribute of an object tag. | |
35 // the classid string should be in format as: | |
36 // clsid:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX | |
37 bool GetClsidFromClassidAttribute(const std::string& classid, | |
38 std::string* clsid); | |
39 | |
40 // Get version string from codebase attribute of an object tag. e.g.: | |
41 // codebase="https://site.cmbchina.com/download/CMBEdit.cab#version=1,2,0,1", | |
42 // then we will return "1,2,0,1". if the version part doesn't exist, | |
43 // returns empty string. | |
44 std::string GetVersionFromCodebaseAttribute(const std::string& codebase); | |
45 | |
46 // Look up the registry to see if ActiveX is installed. Here clsid could be just | |
47 // clsid, e.g. "0CA54D3F-CEAE-48AF-9A2B-31909CB9515D". Or it could be combined | |
48 // with a version string comes from the codebase: | |
49 // "0CA54D3F-CEAE-48AF-9A2B-31909CB9515D#1,2,0,1". In the latter case, we need | |
50 // to look up the version info of the dll to see if it meets the version | |
51 // requirement. | |
52 bool IsActiveXInstalled(const std::string& combined_clsid); | |
53 | |
54 // If an ActiveX control is allowed to run from a specific URL. | |
55 bool IsActiveXAllowed(const std::string& clsid, const GURL& url); | |
56 | |
57 // If an ActiveX control's codebase comes from allowed websites. | |
58 bool IsCodebaseAllowed(const std::string& clsid, const std::string& codebase); | |
59 | |
60 // Check If a given mimetype is of "application/x-oleobject" or | |
61 // "application/oleobject" | |
62 bool IsMimeTypeActiveX(const std::string& mimetype); | |
63 | |
64 // Returns the NPAPI mime type for the CLSID passed in. On failure | |
65 // return false | |
66 bool GetMimeTypeForClsid(const std::string& clsid, std::string* mime_type); | |
67 | |
68 } // namespace activex_shim | |
69 | |
70 #endif // #ifndef WEBKIT_ACTIVEX_SHIM_ACTIVEX_SHARED_H__ | |
OLD | NEW |