| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/support/webkit_support.h" | 5 #include "webkit/support/webkit_support.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "ui/gl/gl_surface.h" | 48 #include "ui/gl/gl_surface.h" |
| 49 #include "webkit/browser/fileapi/isolated_context.h" | 49 #include "webkit/browser/fileapi/isolated_context.h" |
| 50 #include "webkit/child/webthread_impl.h" | 50 #include "webkit/child/webthread_impl.h" |
| 51 #include "webkit/common/gpu/test_context_provider_factory.h" | 51 #include "webkit/common/gpu/test_context_provider_factory.h" |
| 52 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | 52 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
| 53 #include "webkit/common/user_agent/user_agent.h" | 53 #include "webkit/common/user_agent/user_agent.h" |
| 54 #include "webkit/common/user_agent/user_agent_util.h" | 54 #include "webkit/common/user_agent/user_agent_util.h" |
| 55 #include "webkit/glue/webkit_glue.h" | 55 #include "webkit/glue/webkit_glue.h" |
| 56 #include "webkit/glue/webkitplatformsupport_impl.h" | 56 #include "webkit/glue/webkitplatformsupport_impl.h" |
| 57 #include "webkit/glue/weburlrequest_extradata_impl.h" | 57 #include "webkit/glue/weburlrequest_extradata_impl.h" |
| 58 #include "webkit/plugins/npapi/plugin_list.h" | |
| 59 #include "webkit/plugins/npapi/webplugin_impl.h" | |
| 60 #include "webkit/plugins/npapi/webplugin_page_delegate.h" | 58 #include "webkit/plugins/npapi/webplugin_page_delegate.h" |
| 61 #include "webkit/plugins/webplugininfo.h" | 59 #include "webkit/plugins/webplugininfo.h" |
| 62 #include "webkit/renderer/appcache/web_application_cache_host_impl.h" | 60 #include "webkit/renderer/appcache/web_application_cache_host_impl.h" |
| 63 #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h" | 61 #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h" |
| 64 #include "webkit/support/platform_support.h" | 62 #include "webkit/support/platform_support.h" |
| 65 #include "webkit/support/test_webkit_platform_support.h" | 63 #include "webkit/support/test_webkit_platform_support.h" |
| 66 #include "webkit/support/test_webplugin_page_delegate.h" | |
| 67 #include "webkit/support/web_layer_tree_view_impl_for_testing.h" | 64 #include "webkit/support/web_layer_tree_view_impl_for_testing.h" |
| 68 | 65 |
| 69 #if defined(OS_ANDROID) | 66 #if defined(OS_ANDROID) |
| 70 #include "base/test/test_support_android.h" | 67 #include "base/test/test_support_android.h" |
| 71 #endif | 68 #endif |
| 72 | 69 |
| 73 using WebKit::WebCString; | 70 using WebKit::WebCString; |
| 74 using WebKit::WebDevToolsAgentClient; | 71 using WebKit::WebDevToolsAgentClient; |
| 75 using WebKit::WebFileSystem; | 72 using WebKit::WebFileSystem; |
| 76 using WebKit::WebFileSystemCallbacks; | 73 using WebKit::WebFileSystemCallbacks; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 173 |
| 177 private: | 174 private: |
| 178 scoped_ptr<MessageLoopType> main_message_loop_; | 175 scoped_ptr<MessageLoopType> main_message_loop_; |
| 179 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_; | 176 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_; |
| 180 | 177 |
| 181 #if defined(OS_ANDROID) | 178 #if defined(OS_ANDROID) |
| 182 base::FilePath mock_current_directory_; | 179 base::FilePath mock_current_directory_; |
| 183 #endif | 180 #endif |
| 184 }; | 181 }; |
| 185 | 182 |
| 186 class WebPluginImplWithPageDelegate | |
| 187 : public webkit_support::TestWebPluginPageDelegate, | |
| 188 public base::SupportsWeakPtr<WebPluginImplWithPageDelegate>, | |
| 189 public webkit::npapi::WebPluginImpl { | |
| 190 public: | |
| 191 WebPluginImplWithPageDelegate(WebFrame* frame, | |
| 192 const WebPluginParams& params, | |
| 193 const base::FilePath& path) | |
| 194 : webkit_support::TestWebPluginPageDelegate(), | |
| 195 webkit::npapi::WebPluginImpl(frame, params, path, AsWeakPtr()) {} | |
| 196 virtual ~WebPluginImplWithPageDelegate() {} | |
| 197 private: | |
| 198 DISALLOW_COPY_AND_ASSIGN(WebPluginImplWithPageDelegate); | |
| 199 }; | |
| 200 | |
| 201 base::FilePath GetWebKitRootDirFilePath() { | 183 base::FilePath GetWebKitRootDirFilePath() { |
| 202 base::FilePath basePath; | 184 base::FilePath basePath; |
| 203 PathService::Get(base::DIR_SOURCE_ROOT, &basePath); | 185 PathService::Get(base::DIR_SOURCE_ROOT, &basePath); |
| 204 if (base::PathExists( | 186 if (base::PathExists( |
| 205 basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { | 187 basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { |
| 206 // We're in a WebKit-in-chrome checkout. | 188 // We're in a WebKit-in-chrome checkout. |
| 207 basePath = basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")); | 189 basePath = basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")); |
| 208 } else if (base::PathExists( | 190 } else if (base::PathExists( |
| 209 basePath.Append(FILE_PATH_LITERAL("chromium")))) { | 191 basePath.Append(FILE_PATH_LITERAL("chromium")))) { |
| 210 // We're in a WebKit-only checkout on Windows. | 192 // We're in a WebKit-only checkout on Windows. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 test_environment = NULL; | 279 test_environment = NULL; |
| 298 AfterShutdown(); | 280 AfterShutdown(); |
| 299 logging::CloseLogFile(); | 281 logging::CloseLogFile(); |
| 300 } | 282 } |
| 301 | 283 |
| 302 WebKit::Platform* GetWebKitPlatformSupport() { | 284 WebKit::Platform* GetWebKitPlatformSupport() { |
| 303 DCHECK(test_environment); | 285 DCHECK(test_environment); |
| 304 return test_environment->webkit_platform_support(); | 286 return test_environment->webkit_platform_support(); |
| 305 } | 287 } |
| 306 | 288 |
| 307 WebPlugin* CreateWebPlugin(WebFrame* frame, | |
| 308 const WebPluginParams& params) { | |
| 309 const bool kAllowWildcard = true; | |
| 310 std::vector<webkit::WebPluginInfo> plugins; | |
| 311 std::vector<std::string> mime_types; | |
| 312 webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( | |
| 313 params.url, params.mimeType.utf8(), kAllowWildcard, | |
| 314 NULL, &plugins, &mime_types); | |
| 315 if (plugins.empty()) | |
| 316 return NULL; | |
| 317 | |
| 318 WebPluginParams new_params = params; | |
| 319 new_params.mimeType = WebString::fromUTF8(mime_types.front()); | |
| 320 return new WebPluginImplWithPageDelegate( | |
| 321 frame, new_params, plugins.front().path); | |
| 322 } | |
| 323 | |
| 324 WebKit::WebString GetWebKitRootDir() { | 289 WebKit::WebString GetWebKitRootDir() { |
| 325 base::FilePath path = GetWebKitRootDirFilePath(); | 290 base::FilePath path = GetWebKitRootDirFilePath(); |
| 326 std::string path_ascii = path.MaybeAsASCII(); | 291 std::string path_ascii = path.MaybeAsASCII(); |
| 327 CHECK(!path_ascii.empty()); | 292 CHECK(!path_ascii.empty()); |
| 328 return WebKit::WebString::fromUTF8(path_ascii.c_str()); | 293 return WebKit::WebString::fromUTF8(path_ascii.c_str()); |
| 329 } | 294 } |
| 330 | 295 |
| 331 void SetUpGLBindings(GLBindingPreferences bindingPref) { | 296 void SetUpGLBindings(GLBindingPreferences bindingPref) { |
| 332 switch (bindingPref) { | 297 switch (bindingPref) { |
| 333 case GL_BINDING_DEFAULT: | 298 case GL_BINDING_DEFAULT: |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 // Logging | 654 // Logging |
| 690 void EnableWebCoreLogChannels(const std::string& channels) { | 655 void EnableWebCoreLogChannels(const std::string& channels) { |
| 691 webkit_glue::EnableWebCoreLogChannels(channels); | 656 webkit_glue::EnableWebCoreLogChannels(channels); |
| 692 } | 657 } |
| 693 | 658 |
| 694 void SetGamepadData(const WebKit::WebGamepads& pads) { | 659 void SetGamepadData(const WebKit::WebGamepads& pads) { |
| 695 test_environment->webkit_platform_support()->setGamepadData(pads); | 660 test_environment->webkit_platform_support()->setGamepadData(pads); |
| 696 } | 661 } |
| 697 | 662 |
| 698 } // namespace webkit_support | 663 } // namespace webkit_support |
| OLD | NEW |