OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WEBKIT_GLUE_WEBWORKERCLIENT_IMPL_H_ |
| 6 #define WEBKIT_GLUE_WEBWORKERCLIENT_IMPL_H_ |
| 7 |
| 8 #if ENABLE(WORKERS) |
| 9 |
| 10 #include "base/scoped_ptr.h" |
| 11 #include "webkit/glue/webworkerclient.h" |
| 12 |
| 13 #include "WorkerContextProxy.h" |
| 14 |
| 15 class WebWorker; |
| 16 |
| 17 // The purpose of this class is to provide a WorkerContextProxy |
| 18 // implementation that we can give to WebKit. Internally, it converts the |
| 19 // data types to Chrome compatible ones so that renderer code can use it over |
| 20 // IPC. |
| 21 class WebWorkerClientImpl : public WebCore::WorkerContextProxy, |
| 22 public WebWorkerClient { |
| 23 public: |
| 24 WebWorkerClientImpl(WebCore::Worker* worker); |
| 25 |
| 26 void set_webworker(WebWorker* webworker); |
| 27 |
| 28 // WebCore::WorkerContextProxy implementation |
| 29 void startWorkerContext(const WebCore::KURL& scriptURL, |
| 30 const WebCore::String& userAgent, |
| 31 const WebCore::String& sourceCode); |
| 32 void terminateWorkerContext(); |
| 33 void postMessageToWorkerContext(const WebCore::String& message); |
| 34 bool hasPendingActivity() const; |
| 35 void workerObjectDestroyed(); |
| 36 |
| 37 // WebWorkerClient implementation. |
| 38 void PostMessageToWorkerObject(const string16& message); |
| 39 void PostExceptionToWorkerObject(const string16& error_message, |
| 40 int line_number, |
| 41 const string16& source_url); |
| 42 void PostConsoleMessageToWorkerObject(int destination, |
| 43 int source, |
| 44 int level, |
| 45 const string16& message, |
| 46 int line_number, |
| 47 const string16& source_url); |
| 48 void ConfirmMessageFromWorkerObject(bool has_pending_activity); |
| 49 void ReportPendingActivity(bool has_pending_activity); |
| 50 void WorkerContextDestroyed(); |
| 51 |
| 52 private: |
| 53 virtual ~WebWorkerClientImpl(); |
| 54 |
| 55 WebCore::Worker* worker_; |
| 56 scoped_ptr<WebWorker> webworker_; |
| 57 }; |
| 58 |
| 59 #endif |
| 60 |
| 61 #endif // WEBKIT_GLUE_WEBWORKERCLIENT_IMPL_H_ |
OLD | NEW |