Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: webkit/glue/webworker_impl.cc

Issue 149620: Use WebWidget from the WebKit API. This change also makes... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/webwidget_impl.cc ('k') | webkit/glue/window_open_disposition.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GenericWorkerTask.h" 9 #include "GenericWorkerTask.h"
10 #include "KURL.h" 10 #include "KURL.h"
(...skipping 16 matching lines...) Expand all
27 #include "webkit/api/public/WebWorkerClient.h" 27 #include "webkit/api/public/WebWorkerClient.h"
28 #include "webkit/glue/glue_util.h" 28 #include "webkit/glue/glue_util.h"
29 #include "webkit/glue/webdatasource_impl.h" 29 #include "webkit/glue/webdatasource_impl.h"
30 #include "webkit/glue/webframe_impl.h" 30 #include "webkit/glue/webframe_impl.h"
31 #include "webkit/glue/webpreferences.h" 31 #include "webkit/glue/webpreferences.h"
32 #include "webkit/glue/webview.h" 32 #include "webkit/glue/webview.h"
33 #include "webkit/glue/webview_delegate.h" 33 #include "webkit/glue/webview_delegate.h"
34 #include "webkit/glue/webworker_impl.h" 34 #include "webkit/glue/webworker_impl.h"
35 35
36 using WebKit::WebCursorInfo; 36 using WebKit::WebCursorInfo;
37 using WebKit::WebNavigationPolicy;
38 using WebKit::WebRect;
39 using WebKit::WebScreenInfo;
37 using WebKit::WebString; 40 using WebKit::WebString;
38 using WebKit::WebURL; 41 using WebKit::WebURL;
39 using WebKit::WebWorker; 42 using WebKit::WebWorker;
40 using WebKit::WebWorkerClient; 43 using WebKit::WebWorkerClient;
41 44
42 #if ENABLE(WORKERS) 45 #if ENABLE(WORKERS)
43 46
44 // Dummy WebViewDelegate - we only need it in Worker process to load a 47 // Dummy WebViewDelegate - we only need it in Worker process to load a
45 // 'shadow page' which will initialize WebCore loader. 48 // 'shadow page' which will initialize WebCore loader.
46 class WorkerWebViewDelegate : public WebViewDelegate { 49 class WorkerWebViewDelegate : public WebViewDelegate {
47 public: 50 public:
48 WorkerWebViewDelegate() {} 51 WorkerWebViewDelegate() {}
49 virtual void Blur(WebWidget *webwidget) { } 52
50 virtual void CloseWidgetSoon(WebWidget *webwidget) { } 53 virtual void didInvalidateRect(const WebRect&) {}
51 virtual void DidInvalidateRect(WebWidget *webwidget, 54 virtual void didScrollRect(int dx, int dy, const WebRect& clipRect) {}
52 const WebKit::WebRect &rect) { } 55 virtual void didFocus() {}
53 virtual void DidMove(WebWidget *webwidget, const WebPluginGeometry &move) { } 56 virtual void didBlur() {}
54 virtual void DidScrollRect(WebWidget *webwidget, int dx, int dy, 57 virtual void didChangeCursor(const WebCursorInfo&) {}
55 const WebKit::WebRect &clip_rect) { } 58 virtual void closeWidgetSoon() {}
56 virtual void Focus(WebWidget *webwidget) { } 59 virtual void show(WebNavigationPolicy) {}
57 virtual void GetRootWindowRect(WebWidget *webwidget, 60 virtual void runModal() {}
58 WebKit::WebRect *rect) { } 61 virtual WebRect windowRect() { return WebRect(); }
59 virtual void GetRootWindowResizerRect(WebWidget *webwidget, 62 virtual void setWindowRect(const WebRect&) {}
60 WebKit::WebRect *rect) { } 63 virtual WebRect windowResizerRect() { return WebRect(); }
61 virtual WebKit::WebScreenInfo GetScreenInfo(WebWidget *webwidget) { 64 virtual WebRect rootWindowRect() { return WebRect(); }
62 WebKit::WebScreenInfo info; 65 virtual WebScreenInfo screenInfo() { return WebScreenInfo(); }
63 return info; 66
64 }
65 virtual void GetWindowRect(WebWidget *webwidget, WebKit::WebRect *rect) { }
66 virtual bool IsHidden(WebWidget *webwidget) { return true; }
67 virtual void RunModal(WebWidget *webwidget) { }
68 virtual void SetCursor(WebWidget *webwidget, const WebCursorInfo &cursor) { }
69 virtual void SetWindowRect(WebWidget *webwidget,
70 const WebKit::WebRect &rect) { }
71 virtual void Show(WebWidget *webwidget, WindowOpenDisposition disposition) { }
72 // Tell the loader to load the data into the 'shadow page' synchronously, 67 // Tell the loader to load the data into the 'shadow page' synchronously,
73 // so we can grab the resulting Document right after load. 68 // so we can grab the resulting Document right after load.
74 virtual void DidCreateDataSource(WebFrame* frame, WebKit::WebDataSource* ds) { 69 virtual void DidCreateDataSource(WebFrame* frame, WebKit::WebDataSource* ds) {
75 static_cast<WebDataSourceImpl*>(ds)->setDeferMainResourceDataLoad(false); 70 static_cast<WebDataSourceImpl*>(ds)->setDeferMainResourceDataLoad(false);
76 } 71 }
72
77 // Lazy allocate and leak this instance. 73 // Lazy allocate and leak this instance.
78 static WorkerWebViewDelegate* worker_delegate() { 74 static WorkerWebViewDelegate* worker_delegate() {
79 static WorkerWebViewDelegate* worker_delegate = new WorkerWebViewDelegate(); 75 static WorkerWebViewDelegate* worker_delegate = new WorkerWebViewDelegate();
80 return worker_delegate; 76 return worker_delegate;
81 } 77 }
78
82 private: 79 private:
83 DISALLOW_COPY_AND_ASSIGN(WorkerWebViewDelegate); 80 DISALLOW_COPY_AND_ASSIGN(WorkerWebViewDelegate);
84 }; 81 };
85 82
86 namespace WebKit { 83 namespace WebKit {
87 84
88 WebWorker* WebWorker::create(WebWorkerClient* client) { 85 WebWorker* WebWorker::create(WebWorkerClient* client) {
89 return new WebWorkerImpl(client); 86 return new WebWorkerImpl(client);
90 } 87 }
91 88
(...skipping 17 matching lines...) Expand all
109 } 106 }
110 107
111 WebWorkerImpl::WebWorkerImpl(WebWorkerClient* client) 108 WebWorkerImpl::WebWorkerImpl(WebWorkerClient* client)
112 : client_(client), 109 : client_(client),
113 web_view_(NULL), 110 web_view_(NULL),
114 asked_to_terminate_(false) { 111 asked_to_terminate_(false) {
115 InitializeWebKitStaticValues(); 112 InitializeWebKitStaticValues();
116 } 113 }
117 114
118 WebWorkerImpl::~WebWorkerImpl() { 115 WebWorkerImpl::~WebWorkerImpl() {
119 web_view_->Close(); 116 web_view_->close();
120 } 117 }
121 118
122 void WebWorkerImpl::PostMessageToWorkerContextTask( 119 void WebWorkerImpl::PostMessageToWorkerContextTask(
123 WebCore::ScriptExecutionContext* context, 120 WebCore::ScriptExecutionContext* context,
124 WebWorkerImpl* this_ptr, 121 WebWorkerImpl* this_ptr,
125 const WebCore::String& message, 122 const WebCore::String& message,
126 WTF::PassOwnPtr<WebCore::MessagePortChannel> channel) { 123 WTF::PassOwnPtr<WebCore::MessagePortChannel> channel) {
127 DCHECK(context->isWorkerContext()); 124 DCHECK(context->isWorkerContext());
128 WebCore::WorkerContext* worker_context = 125 WebCore::WorkerContext* worker_context =
129 static_cast<WebCore::WorkerContext*>(context); 126 static_cast<WebCore::WorkerContext*>(context);
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 367
371 namespace WebKit { 368 namespace WebKit {
372 369
373 WebWorker* WebWorker::create(WebWorkerClient* client) { 370 WebWorker* WebWorker::create(WebWorkerClient* client) {
374 return NULL; 371 return NULL;
375 } 372 }
376 373
377 } 374 }
378 375
379 #endif 376 #endif
OLDNEW
« no previous file with comments | « webkit/glue/webwidget_impl.cc ('k') | webkit/glue/window_open_disposition.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698