| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/gfx/native_widget_types.h" | 8 #include "base/gfx/native_widget_types.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "base/string_util.h" |
| 12 #include "chrome/worker/worker_webkitclient_impl.h" | 13 #include "chrome/worker/worker_webkitclient_impl.h" |
| 13 #include "chrome/test/worker/test_webworker.h" | 14 #include "chrome/test/worker/test_webworker.h" |
| 14 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 15 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" | 16 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |
| 16 #include "webkit/glue/resource_loader_bridge.h" | 17 #include "webkit/glue/resource_loader_bridge.h" |
| 17 #include "webkit/glue/webkit_glue.h" | 18 #include "webkit/glue/webkit_glue.h" |
| 18 #include "webkit/glue/webworker.h" | 19 #include "webkit/glue/webworker.h" |
| 19 #include "webkit/glue/webworkerclient.h" | 20 #include "webkit/glue/webworkerclient.h" |
| 20 #include "webkit/tools/test_shell/test_webworker_helper.h" | 21 #include "webkit/tools/test_shell/test_webworker_helper.h" |
| 21 | 22 |
| 22 // Create a global AtExitManager so that our code can use code from base that | 23 // Create a global AtExitManager so that our code can use code from base that |
| 23 // uses Singletons, for example. We don't care about static constructors here. | 24 // uses Singletons, for example. We don't care about static constructors here. |
| 24 static base::AtExitManager global_at_exit_manager; | 25 static base::AtExitManager global_at_exit_manager; |
| 25 | 26 |
| 26 // WebKit client used in DLL. | 27 // WebKit client used in DLL. |
| 27 static scoped_ptr<WorkerWebKitClientImpl> webkit_client; | 28 static scoped_ptr<WorkerWebKitClientImpl> webkit_client; |
| 28 | 29 |
| 30 #if defined(COMPILER_GCC) |
| 31 #pragma GCC visibility push(default) |
| 32 #endif |
| 33 extern "C" { |
| 29 // DLL entry points | 34 // DLL entry points |
| 30 WebWorker* API_CALL CreateWebWorker(WebWorkerClient* webworker_client, | 35 WebWorker* API_CALL CreateWebWorker(WebWorkerClient* webworker_client, |
| 31 TestWebWorkerHelper* webworker_helper) { | 36 TestWebWorkerHelper* webworker_helper) { |
| 32 if (!WebKit::webKitClient()) { | 37 if (!WebKit::webKitClient()) { |
| 33 webkit_client.reset(new WorkerWebKitClientImpl()); | 38 webkit_client.reset(new WorkerWebKitClientImpl()); |
| 34 WebKit::initialize(webkit_client.get()); | 39 WebKit::initialize(webkit_client.get()); |
| 35 } | 40 } |
| 36 | 41 |
| 37 #if ENABLE(WORKERS) | 42 #if ENABLE(WORKERS) |
| 38 return new TestWebWorker(webworker_client, webworker_helper); | 43 return new TestWebWorker(webworker_client, webworker_helper); |
| 39 #else | 44 #else |
| 40 return NULL; | 45 return NULL; |
| 41 #endif | 46 #endif |
| 42 } | 47 } |
| 48 } // extern "C" |
| 43 | 49 |
| 44 // WebKit glue functions | 50 // WebKit glue stub functions. |
| 45 | |
| 46 namespace webkit_glue { | 51 namespace webkit_glue { |
| 47 | 52 |
| 53 #if defined(COMPILER_GCC) |
| 54 // GCC hides the class methods like this by default, even in the scope |
| 55 // of the "#pragma visibility". Need the attribute. |
| 56 __attribute__((visibility("default"))) |
| 57 #endif |
| 48 ResourceLoaderBridge* ResourceLoaderBridge::Create( | 58 ResourceLoaderBridge* ResourceLoaderBridge::Create( |
| 49 const std::string& method, | 59 const std::string& method, |
| 50 const GURL& url, | 60 const GURL& url, |
| 51 const GURL& policy_url, | 61 const GURL& policy_url, |
| 52 const GURL& referrer, | 62 const GURL& referrer, |
| 53 const std::string& frame_origin, | 63 const std::string& frame_origin, |
| 54 const std::string& main_frame_origin, | 64 const std::string& main_frame_origin, |
| 55 const std::string& headers, | 65 const std::string& headers, |
| 56 const std::string& default_mime_type, | 66 const std::string& default_mime_type, |
| 57 int load_flags, | 67 int load_flags, |
| 58 int requestor_pid, | 68 int requestor_pid, |
| 59 ResourceType::Type request_type, | 69 ResourceType::Type request_type, |
| 60 int routing_id) { | 70 int routing_id) { |
| 61 return NULL; | 71 return NULL; |
| 62 } | 72 } |
| 63 | 73 |
| 64 string16 GetLocalizedString(int message_id) { | 74 string16 GetLocalizedString(int message_id) { |
| 65 return L""; | 75 return EmptyString16(); |
| 66 } | 76 } |
| 67 | 77 |
| 68 std::string GetDataResource(int resource_id) { | 78 std::string GetDataResource(int resource_id) { |
| 69 return ""; | 79 return ""; |
| 70 } | 80 } |
| 71 | 81 |
| 72 void SetMediaPlayerAvailable(bool value) { | 82 void SetMediaPlayerAvailable(bool value) { |
| 73 } | 83 } |
| 74 | 84 |
| 75 bool IsMediaPlayerAvailable() { | 85 bool IsMediaPlayerAvailable() { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 148 |
| 139 bool EnsureFontLoaded(HFONT font) { | 149 bool EnsureFontLoaded(HFONT font) { |
| 140 return true; | 150 return true; |
| 141 } | 151 } |
| 142 | 152 |
| 143 bool DownloadUrl(const std::string& url, HWND caller_window) { | 153 bool DownloadUrl(const std::string& url, HWND caller_window) { |
| 144 return false; | 154 return false; |
| 145 } | 155 } |
| 146 #endif | 156 #endif |
| 147 | 157 |
| 148 } | 158 } // namespace webkit_glue |
| 159 |
| 160 #if defined(COMPILER_GCC) |
| 161 #pragma GCC visibility pop |
| 162 #endif |
| OLD | NEW |