| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_RENDERER_RENDERER_WEBKITCLIENT_IMPL_H_ | 5 #ifndef CHROME_RENDERER_RENDERER_WEBKITCLIENT_IMPL_H_ |
| 6 #define CHROME_RENDERER_RENDERER_WEBKITCLIENT_IMPL_H_ | 6 #define CHROME_RENDERER_RENDERER_WEBKITCLIENT_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/platform_file.h" | 9 #include "base/platform_file.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "chrome/renderer/websharedworkerrepository_impl.h" | |
| 12 #include "webkit/glue/simple_webmimeregistry_impl.h" | |
| 13 #include "webkit/glue/webclipboard_impl.h" | |
| 14 #include "webkit/glue/webfilesystem_impl.h" | |
| 15 #include "webkit/glue/webkitclient_impl.h" | 11 #include "webkit/glue/webkitclient_impl.h" |
| 16 | 12 |
| 17 #if defined(OS_WIN) | 13 class WebSharedWorkerRepositoryImpl; |
| 18 #include "third_party/WebKit/WebKit/chromium/public/win/WebSandboxSupport.h" | |
| 19 #elif defined(OS_LINUX) | |
| 20 #include <string> | |
| 21 #include <map> | |
| 22 #include "base/lock.h" | |
| 23 #include "third_party/WebKit/WebKit/chromium/public/linux/WebSandboxSupport.h" | |
| 24 #elif defined(OS_MACOSX) | |
| 25 #include "third_party/WebKit/WebKit/chromium/public/mac/WebSandboxSupport.h" | |
| 26 #endif | |
| 27 | 14 |
| 28 namespace IPC { | 15 namespace IPC { |
| 29 class SyncMessage; | 16 class SyncMessage; |
| 30 } | 17 } |
| 31 | 18 |
| 19 namespace webkit_glue { |
| 20 class WebClipboardImpl; |
| 21 } |
| 22 |
| 32 class RendererWebKitClientImpl : public webkit_glue::WebKitClientImpl { | 23 class RendererWebKitClientImpl : public webkit_glue::WebKitClientImpl { |
| 33 public: | 24 public: |
| 34 RendererWebKitClientImpl(); | 25 RendererWebKitClientImpl(); |
| 35 virtual ~RendererWebKitClientImpl(); | 26 virtual ~RendererWebKitClientImpl(); |
| 36 | 27 |
| 37 // WebKitClient methods: | 28 // WebKitClient methods: |
| 38 virtual WebKit::WebClipboard* clipboard(); | 29 virtual WebKit::WebClipboard* clipboard(); |
| 39 virtual WebKit::WebMimeRegistry* mimeRegistry(); | 30 virtual WebKit::WebMimeRegistry* mimeRegistry(); |
| 40 virtual WebKit::WebFileSystem* fileSystem(); | 31 virtual WebKit::WebFileSystem* fileSystem(); |
| 41 virtual WebKit::WebSandboxSupport* sandboxSupport(); | 32 virtual WebKit::WebSandboxSupport* sandboxSupport(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 69 unsigned key_size_index, | 60 unsigned key_size_index, |
| 70 const WebKit::WebString& challenge, | 61 const WebKit::WebString& challenge, |
| 71 const WebKit::WebURL& url); | 62 const WebKit::WebURL& url); |
| 72 virtual WebKit::WebIndexedDatabase* indexedDatabase(); | 63 virtual WebKit::WebIndexedDatabase* indexedDatabase(); |
| 73 | 64 |
| 74 virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository(); | 65 virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository(); |
| 75 virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(); | 66 virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(); |
| 76 virtual WebKit::WebGLES2Context* createGLES2Context(); | 67 virtual WebKit::WebGLES2Context* createGLES2Context(); |
| 77 | 68 |
| 78 private: | 69 private: |
| 79 class MimeRegistry : public webkit_glue::SimpleWebMimeRegistryImpl { | |
| 80 public: | |
| 81 virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString&); | |
| 82 virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&); | |
| 83 virtual WebKit::WebString preferredExtensionForMIMEType( | |
| 84 const WebKit::WebString&); | |
| 85 }; | |
| 86 | |
| 87 class FileSystem : public webkit_glue::WebFileSystemImpl { | |
| 88 public: | |
| 89 virtual bool getFileSize(const WebKit::WebString& path, long long& result); | |
| 90 virtual bool getFileModificationTime(const WebKit::WebString& path, | |
| 91 double& result); | |
| 92 virtual base::PlatformFile openFile(const WebKit::WebString& path, | |
| 93 int mode); | |
| 94 }; | |
| 95 | |
| 96 bool CheckPreparsedJsCachingEnabled() const; | 70 bool CheckPreparsedJsCachingEnabled() const; |
| 97 | 71 |
| 98 #if defined(OS_WIN) | |
| 99 class SandboxSupport : public WebKit::WebSandboxSupport { | |
| 100 public: | |
| 101 virtual bool ensureFontLoaded(HFONT); | |
| 102 }; | |
| 103 #elif defined(OS_LINUX) | |
| 104 class SandboxSupport : public WebKit::WebSandboxSupport { | |
| 105 public: | |
| 106 virtual WebKit::WebString getFontFamilyForCharacters( | |
| 107 const WebKit::WebUChar* characters, size_t numCharacters); | |
| 108 virtual void getRenderStyleForStrike( | |
| 109 const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out); | |
| 110 | |
| 111 private: | |
| 112 // WebKit likes to ask us for the correct font family to use for a set of | |
| 113 // unicode code points. It needs this information frequently so we cache it | |
| 114 // here. The key in this map is an array of 16-bit UTF16 values from WebKit. | |
| 115 // The value is a string containing the correct font family. | |
| 116 Lock unicode_font_families_mutex_; | |
| 117 std::map<std::string, std::string> unicode_font_families_; | |
| 118 }; | |
| 119 #elif defined(OS_MACOSX) | |
| 120 class SandboxSupport : public WebKit::WebSandboxSupport { | |
| 121 public: | |
| 122 virtual bool loadFont(NSFont* srcFont, ATSFontContainerRef* out); | |
| 123 }; | |
| 124 #endif | |
| 125 | |
| 126 // Helper function to send synchronous message from any thread. | 72 // Helper function to send synchronous message from any thread. |
| 127 static bool SendSyncMessageFromAnyThread(IPC::SyncMessage* msg); | 73 static bool SendSyncMessageFromAnyThread(IPC::SyncMessage* msg); |
| 128 | 74 |
| 129 webkit_glue::WebClipboardImpl clipboard_; | 75 scoped_ptr<webkit_glue::WebClipboardImpl> clipboard_; |
| 130 | 76 |
| 131 FileSystem file_system_; | 77 class FileSystem; |
| 78 scoped_ptr<FileSystem> file_system_; |
| 132 | 79 |
| 133 MimeRegistry mime_registry_; | 80 class MimeRegistry; |
| 81 scoped_ptr<MimeRegistry> mime_registry_; |
| 134 | 82 |
| 135 SandboxSupport sandbox_support_; | 83 class SandboxSupport; |
| 84 scoped_ptr<SandboxSupport> sandbox_support_; |
| 136 | 85 |
| 137 // This counter keeps track of the number of times sudden termination is | 86 // This counter keeps track of the number of times sudden termination is |
| 138 // enabled or disabled. It starts at 0 (enabled) and for every disable | 87 // enabled or disabled. It starts at 0 (enabled) and for every disable |
| 139 // increments by 1, for every enable decrements by 1. When it reaches 0, | 88 // increments by 1, for every enable decrements by 1. When it reaches 0, |
| 140 // we tell the browser to enable fast termination. | 89 // we tell the browser to enable fast termination. |
| 141 int sudden_termination_disables_; | 90 int sudden_termination_disables_; |
| 142 | 91 |
| 143 // Implementation of the WebSharedWorkerRepository APIs (provides an interface | 92 // Implementation of the WebSharedWorkerRepository APIs (provides an interface |
| 144 // to WorkerService on the browser thread. | 93 // to WorkerService on the browser thread. |
| 145 WebSharedWorkerRepositoryImpl shared_worker_repository_; | 94 scoped_ptr<WebSharedWorkerRepositoryImpl> shared_worker_repository_; |
| 146 | 95 |
| 147 scoped_ptr<WebKit::WebIndexedDatabase> web_indexed_database_; | 96 scoped_ptr<WebKit::WebIndexedDatabase> web_indexed_database_; |
| 148 }; | 97 }; |
| 149 | 98 |
| 150 #endif // CHROME_RENDERER_RENDERER_WEBKITCLIENT_IMPL_H_ | 99 #endif // CHROME_RENDERER_RENDERER_WEBKITCLIENT_IMPL_H_ |
| OLD | NEW |