WebProcessCreationParameters.cpp 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. /*
  2. * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. *
  13. * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
  14. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  15. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
  17. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  18. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  19. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  20. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  21. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  22. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  23. * THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. #include "config.h"
  26. #include "WebProcessCreationParameters.h"
  27. #include "ArgumentCoders.h"
  28. namespace WebKit {
  29. WebProcessCreationParameters::WebProcessCreationParameters()
  30. : shouldTrackVisitedLinks(false)
  31. , shouldAlwaysUseComplexTextCodePath(false)
  32. , shouldUseFontSmoothing(true)
  33. , defaultRequestTimeoutInterval(INT_MAX)
  34. #if PLATFORM(MAC)
  35. , nsURLCacheMemoryCapacity(0)
  36. , nsURLCacheDiskCapacity(0)
  37. , shouldForceScreenFontSubstitution(false)
  38. , shouldEnableKerningAndLigaturesByDefault(false)
  39. #endif
  40. #if ENABLE(NETWORK_PROCESS)
  41. , usesNetworkProcess(false)
  42. #endif
  43. {
  44. }
  45. void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder& encoder) const
  46. {
  47. encoder << injectedBundlePath;
  48. encoder << injectedBundlePathExtensionHandle;
  49. encoder << applicationCacheDirectory;
  50. encoder << applicationCacheDirectoryExtensionHandle;
  51. encoder << databaseDirectory;
  52. encoder << databaseDirectoryExtensionHandle;
  53. encoder << localStorageDirectory;
  54. encoder << localStorageDirectoryExtensionHandle;
  55. encoder << diskCacheDirectory;
  56. encoder << diskCacheDirectoryExtensionHandle;
  57. encoder << cookieStorageDirectory;
  58. encoder << cookieStorageDirectoryExtensionHandle;
  59. encoder << urlSchemesRegistererdAsEmptyDocument;
  60. encoder << urlSchemesRegisteredAsSecure;
  61. encoder << urlSchemesForWhichDomainRelaxationIsForbidden;
  62. encoder << urlSchemesRegisteredAsLocal;
  63. encoder << urlSchemesRegisteredAsNoAccess;
  64. encoder << urlSchemesRegisteredAsDisplayIsolated;
  65. encoder << urlSchemesRegisteredAsCORSEnabled;
  66. #if ENABLE(CUSTOM_PROTOCOLS)
  67. encoder << urlSchemesRegisteredForCustomProtocols;
  68. #endif
  69. #if USE(SOUP)
  70. encoder << urlSchemesRegistered;
  71. encoder << cookiePersistentStoragePath;
  72. encoder << cookiePersistentStorageType;
  73. encoder.encodeEnum(cookieAcceptPolicy);
  74. encoder << ignoreTLSErrors;
  75. #endif
  76. encoder.encodeEnum(cacheModel);
  77. encoder << shouldTrackVisitedLinks;
  78. encoder << shouldAlwaysUseComplexTextCodePath;
  79. encoder << shouldUseFontSmoothing;
  80. encoder << iconDatabaseEnabled;
  81. encoder << terminationTimeout;
  82. encoder << languages;
  83. encoder << textCheckerState;
  84. encoder << fullKeyboardAccessEnabled;
  85. encoder << defaultRequestTimeoutInterval;
  86. #if PLATFORM(MAC) || USE(CFNETWORK)
  87. encoder << uiProcessBundleIdentifier;
  88. #endif
  89. #if PLATFORM(MAC)
  90. encoder << presenterApplicationPid;
  91. encoder << accessibilityEnhancedUserInterfaceEnabled;
  92. encoder << nsURLCacheMemoryCapacity;
  93. encoder << nsURLCacheDiskCapacity;
  94. encoder << acceleratedCompositingPort;
  95. encoder << uiProcessBundleResourcePath;
  96. encoder << uiProcessBundleResourcePathExtensionHandle;
  97. encoder << shouldForceScreenFontSubstitution;
  98. encoder << shouldEnableKerningAndLigaturesByDefault;
  99. #elif PLATFORM(MANX)
  100. encoder << userID;
  101. #endif
  102. #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
  103. encoder << notificationPermissions;
  104. #endif
  105. #if ENABLE(NETWORK_PROCESS)
  106. encoder << usesNetworkProcess;
  107. #endif
  108. encoder << plugInAutoStartOriginHashes;
  109. encoder << plugInAutoStartOrigins;
  110. }
  111. bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder& decoder, WebProcessCreationParameters& parameters)
  112. {
  113. if (!decoder.decode(parameters.injectedBundlePath))
  114. return false;
  115. if (!decoder.decode(parameters.injectedBundlePathExtensionHandle))
  116. return false;
  117. if (!decoder.decode(parameters.applicationCacheDirectory))
  118. return false;
  119. if (!decoder.decode(parameters.applicationCacheDirectoryExtensionHandle))
  120. return false;
  121. if (!decoder.decode(parameters.databaseDirectory))
  122. return false;
  123. if (!decoder.decode(parameters.databaseDirectoryExtensionHandle))
  124. return false;
  125. if (!decoder.decode(parameters.localStorageDirectory))
  126. return false;
  127. if (!decoder.decode(parameters.localStorageDirectoryExtensionHandle))
  128. return false;
  129. if (!decoder.decode(parameters.diskCacheDirectory))
  130. return false;
  131. if (!decoder.decode(parameters.diskCacheDirectoryExtensionHandle))
  132. return false;
  133. if (!decoder.decode(parameters.cookieStorageDirectory))
  134. return false;
  135. if (!decoder.decode(parameters.cookieStorageDirectoryExtensionHandle))
  136. return false;
  137. if (!decoder.decode(parameters.urlSchemesRegistererdAsEmptyDocument))
  138. return false;
  139. if (!decoder.decode(parameters.urlSchemesRegisteredAsSecure))
  140. return false;
  141. if (!decoder.decode(parameters.urlSchemesForWhichDomainRelaxationIsForbidden))
  142. return false;
  143. if (!decoder.decode(parameters.urlSchemesRegisteredAsLocal))
  144. return false;
  145. if (!decoder.decode(parameters.urlSchemesRegisteredAsNoAccess))
  146. return false;
  147. if (!decoder.decode(parameters.urlSchemesRegisteredAsDisplayIsolated))
  148. return false;
  149. if (!decoder.decode(parameters.urlSchemesRegisteredAsCORSEnabled))
  150. return false;
  151. #if ENABLE(CUSTOM_PROTOCOLS)
  152. if (!decoder.decode(parameters.urlSchemesRegisteredForCustomProtocols))
  153. return false;
  154. #endif
  155. #if USE(SOUP)
  156. if (!decoder.decode(parameters.urlSchemesRegistered))
  157. return false;
  158. if (!decoder.decode(parameters.cookiePersistentStoragePath))
  159. return false;
  160. if (!decoder.decode(parameters.cookiePersistentStorageType))
  161. return false;
  162. if (!decoder.decodeEnum(parameters.cookieAcceptPolicy))
  163. return false;
  164. if (!decoder.decode(parameters.ignoreTLSErrors))
  165. return false;
  166. #endif
  167. if (!decoder.decodeEnum(parameters.cacheModel))
  168. return false;
  169. if (!decoder.decode(parameters.shouldTrackVisitedLinks))
  170. return false;
  171. if (!decoder.decode(parameters.shouldAlwaysUseComplexTextCodePath))
  172. return false;
  173. if (!decoder.decode(parameters.shouldUseFontSmoothing))
  174. return false;
  175. if (!decoder.decode(parameters.iconDatabaseEnabled))
  176. return false;
  177. if (!decoder.decode(parameters.terminationTimeout))
  178. return false;
  179. if (!decoder.decode(parameters.languages))
  180. return false;
  181. if (!decoder.decode(parameters.textCheckerState))
  182. return false;
  183. if (!decoder.decode(parameters.fullKeyboardAccessEnabled))
  184. return false;
  185. if (!decoder.decode(parameters.defaultRequestTimeoutInterval))
  186. return false;
  187. #if PLATFORM(MAC) || USE(CFNETWORK)
  188. if (!decoder.decode(parameters.uiProcessBundleIdentifier))
  189. return false;
  190. #elif PLATFORM(MANX)
  191. if (!decoder.decode(parameters.userID))
  192. return false;
  193. #endif
  194. #if PLATFORM(MAC)
  195. if (!decoder.decode(parameters.presenterApplicationPid))
  196. return false;
  197. if (!decoder.decode(parameters.accessibilityEnhancedUserInterfaceEnabled))
  198. return false;
  199. if (!decoder.decode(parameters.nsURLCacheMemoryCapacity))
  200. return false;
  201. if (!decoder.decode(parameters.nsURLCacheDiskCapacity))
  202. return false;
  203. if (!decoder.decode(parameters.acceleratedCompositingPort))
  204. return false;
  205. if (!decoder.decode(parameters.uiProcessBundleResourcePath))
  206. return false;
  207. if (!decoder.decode(parameters.uiProcessBundleResourcePathExtensionHandle))
  208. return false;
  209. if (!decoder.decode(parameters.shouldForceScreenFontSubstitution))
  210. return false;
  211. if (!decoder.decode(parameters.shouldEnableKerningAndLigaturesByDefault))
  212. return false;
  213. #endif
  214. #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
  215. if (!decoder.decode(parameters.notificationPermissions))
  216. return false;
  217. #endif
  218. #if ENABLE(NETWORK_PROCESS)
  219. if (!decoder.decode(parameters.usesNetworkProcess))
  220. return false;
  221. #endif
  222. if (!decoder.decode(parameters.plugInAutoStartOriginHashes))
  223. return false;
  224. if (!decoder.decode(parameters.plugInAutoStartOrigins))
  225. return false;
  226. return true;
  227. }
  228. } // namespace WebKit