| 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 | 8 |
| 9 #include "DedicatedWorkerContext.h" | 9 #include "DedicatedWorkerContext.h" |
| 10 #include "DedicatedWorkerThread.h" | 10 #include "DedicatedWorkerThread.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include <wtf/Threading.h> | 21 #include <wtf/Threading.h> |
| 22 | 22 |
| 23 #undef LOG | 23 #undef LOG |
| 24 | 24 |
| 25 #include "base/logging.h" | 25 #include "base/logging.h" |
| 26 #include "webkit/api/public/WebFrameClient.h" | 26 #include "webkit/api/public/WebFrameClient.h" |
| 27 #include "webkit/api/public/WebMessagePortChannel.h" | 27 #include "webkit/api/public/WebMessagePortChannel.h" |
| 28 #include "webkit/api/public/WebScreenInfo.h" | 28 #include "webkit/api/public/WebScreenInfo.h" |
| 29 #include "webkit/api/public/WebString.h" | 29 #include "webkit/api/public/WebString.h" |
| 30 #include "webkit/api/public/WebURL.h" | 30 #include "webkit/api/public/WebURL.h" |
| 31 #include "webkit/api/public/WebView.h" |
| 31 #include "webkit/api/public/WebWorkerClient.h" | 32 #include "webkit/api/public/WebWorkerClient.h" |
| 32 #include "webkit/api/src/PlatformMessagePortChannel.h" | 33 #include "webkit/api/src/PlatformMessagePortChannel.h" |
| 33 #include "webkit/api/src/WebDataSourceImpl.h" | 34 #include "webkit/api/src/WebDataSourceImpl.h" |
| 34 #include "webkit/glue/empty_webframeclient.h" | 35 #include "webkit/glue/empty_webframeclient.h" |
| 35 #include "webkit/glue/glue_util.h" | 36 #include "webkit/glue/glue_util.h" |
| 36 #include "webkit/glue/webframe_impl.h" | 37 #include "webkit/glue/webframe_impl.h" |
| 37 #include "webkit/glue/webpreferences.h" | 38 #include "webkit/glue/webpreferences.h" |
| 38 #include "webkit/glue/webview.h" | |
| 39 #include "webkit/glue/webview_delegate.h" | |
| 40 #include "webkit/glue/webworker_impl.h" | 39 #include "webkit/glue/webworker_impl.h" |
| 41 | 40 |
| 42 using WebKit::WebCursorInfo; | 41 using WebKit::WebCursorInfo; |
| 43 using WebKit::WebDataSource; | 42 using WebKit::WebDataSource; |
| 44 using WebKit::WebDataSourceImpl; | 43 using WebKit::WebDataSourceImpl; |
| 45 using WebKit::WebFrame; | 44 using WebKit::WebFrame; |
| 46 using WebKit::WebFrameClient; | 45 using WebKit::WebFrameClient; |
| 47 using WebKit::WebMessagePortChannel; | 46 using WebKit::WebMessagePortChannel; |
| 48 using WebKit::WebMessagePortChannelArray; | 47 using WebKit::WebMessagePortChannelArray; |
| 49 using WebKit::WebNavigationPolicy; | 48 using WebKit::WebNavigationPolicy; |
| 50 using WebKit::WebRect; | 49 using WebKit::WebRect; |
| 51 using WebKit::WebScreenInfo; | 50 using WebKit::WebScreenInfo; |
| 52 using WebKit::WebString; | 51 using WebKit::WebString; |
| 53 using WebKit::WebURL; | 52 using WebKit::WebURL; |
| 54 using WebKit::WebWorker; | 53 using WebKit::WebWorker; |
| 55 using WebKit::WebWorkerClient; | 54 using WebKit::WebWorkerClient; |
| 55 using WebKit::WebView; |
| 56 | 56 |
| 57 #if ENABLE(WORKERS) | 57 #if ENABLE(WORKERS) |
| 58 | 58 |
| 59 // Dummy WebViewDelegate - we only need it in Worker process to load a | 59 // Dummy WebViewDelegate - we only need it in Worker process to load a |
| 60 // 'shadow page' which will initialize WebCore loader. | 60 // 'shadow page' which will initialize WebCore loader. |
| 61 class WorkerWebFrameClient : public webkit_glue::EmptyWebFrameClient { | 61 class WorkerWebFrameClient : public webkit_glue::EmptyWebFrameClient { |
| 62 public: | 62 public: |
| 63 // Tell the loader to load the data into the 'shadow page' synchronously, | 63 // Tell the loader to load the data into the 'shadow page' synchronously, |
| 64 // so we can grab the resulting Document right after load. | 64 // so we can grab the resulting Document right after load. |
| 65 virtual void didCreateDataSource(WebFrame* frame, WebDataSource* ds) { | 65 virtual void didCreateDataSource(WebFrame* frame, WebDataSource* ds) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 // WebWorker ------------------------------------------------------------------- | 137 // WebWorker ------------------------------------------------------------------- |
| 138 | 138 |
| 139 void WebWorkerImpl::startWorkerContext(const WebURL& script_url, | 139 void WebWorkerImpl::startWorkerContext(const WebURL& script_url, |
| 140 const WebString& user_agent, | 140 const WebString& user_agent, |
| 141 const WebString& source_code) { | 141 const WebString& source_code) { |
| 142 // Create 'shadow page'. This page is never displayed, it is used to proxy the | 142 // Create 'shadow page'. This page is never displayed, it is used to proxy the |
| 143 // loading requests from the worker context to the rest of WebKit and Chromium | 143 // loading requests from the worker context to the rest of WebKit and Chromium |
| 144 // infrastructure. | 144 // infrastructure. |
| 145 DCHECK(!web_view_); | 145 DCHECK(!web_view_); |
| 146 web_view_ = WebView::Create(NULL); | 146 web_view_ = WebView::create(NULL); |
| 147 WebPreferences().Apply(web_view_); | 147 WebPreferences().Apply(web_view_); |
| 148 web_view_->initializeMainFrame(WorkerWebFrameClient::GetSharedInstance()); | 148 web_view_->initializeMainFrame(WorkerWebFrameClient::GetSharedInstance()); |
| 149 | 149 |
| 150 WebFrameImpl* web_frame = static_cast<WebFrameImpl*>(web_view_->mainFrame()); | 150 WebFrameImpl* web_frame = static_cast<WebFrameImpl*>(web_view_->mainFrame()); |
| 151 | 151 |
| 152 // Construct substitute data source for the 'shadow page'. We only need it | 152 // Construct substitute data source for the 'shadow page'. We only need it |
| 153 // to have same origin as the worker so the loading checks work correctly. | 153 // to have same origin as the worker so the loading checks work correctly. |
| 154 WebCore::CString content(""); | 154 WebCore::CString content(""); |
| 155 int len = static_cast<int>(content.length()); | 155 int len = static_cast<int>(content.length()); |
| 156 RefPtr<WebCore::SharedBuffer> buf( | 156 RefPtr<WebCore::SharedBuffer> buf( |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 | 403 |
| 404 namespace WebKit { | 404 namespace WebKit { |
| 405 | 405 |
| 406 WebWorker* WebWorker::create(WebWorkerClient* client) { | 406 WebWorker* WebWorker::create(WebWorkerClient* client) { |
| 407 return NULL; | 407 return NULL; |
| 408 } | 408 } |
| 409 | 409 |
| 410 } | 410 } |
| 411 | 411 |
| 412 #endif | 412 #endif |
| OLD | NEW |