diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-31 18:08:40 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-31 18:08:40 +0000 |
commit | 4f999134a2e270792abc8b5ac6ad70aa500dcef4 (patch) | |
tree | e90d972ee2f29d10d6e22220d54cd142925bb2bb /chrome/common/render_messages.h | |
parent | b5cd43eb964e452d7a0245b9e14bd9a9d1e89b4a (diff) | |
download | chromium_src-4f999134a2e270792abc8b5ac6ad70aa500dcef4.zip chromium_src-4f999134a2e270792abc8b5ac6ad70aa500dcef4.tar.gz chromium_src-4f999134a2e270792abc8b5ac6ad70aa500dcef4.tar.bz2 |
Use WebScriptSource and WebFindInPageRequest from the WebKit API.
This change introduces some helper functions in glue_util.cc for efficient
conversion between WebString and WebCore::String when inside the implementation
of webkit/glue. This is a temporary change since eventually all code in glue
that uses WebCore will be moved into the WebKit API implementation.
Instead of making the Chrome automation use WebFindInPageRequest, I decided to
introduce AutomationMsg_Find_Params as a copy of the old FindInPageRequest
structure. That preserves the IPC protocol and avoids making the automation
library depend on WebKit.
R=dglazkov
Review URL: http://codereview.chromium.org/57060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12881 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/render_messages.h')
-rw-r--r-- | chrome/common/render_messages.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 284ac51..e144a3a 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -25,6 +25,7 @@ #include "net/http/http_response_headers.h" #include "net/url_request/url_request_status.h" #include "third_party/WebKit/WebKit/chromium/public/WebCache.h" +#include "third_party/WebKit/WebKit/chromium/public/WebFindInPageRequest.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" #include "webkit/glue/autofill_form.h" #include "webkit/glue/context_menu.h" @@ -370,6 +371,27 @@ struct ViewHostMsg_Audio_CreateStream { namespace IPC { template <> +struct ParamTraits<WebKit::WebString> { + typedef WebKit::WebString param_type; + static void Write(Message* m, const param_type& p) { + m->WriteData(reinterpret_cast<const char*>(p.data()), + static_cast<int>(p.length())); + } + static bool Read(const Message* m, void** iter, param_type* p) { + const char* data; + int length; + if (!m->ReadData(iter, &data, &length)) + return false; + p->assign(reinterpret_cast<const WebKit::WebUChar*>(data), + static_cast<size_t>(length)); + return true; + } + static void Log(const param_type& p, std::wstring* l) { + l->append(UTF16ToWideHack(p)); + } +}; + +template <> struct ParamTraits<ResourceType::Type> { typedef ResourceType::Type param_type; static void Write(Message* m, const param_type& p) { @@ -1923,6 +1945,29 @@ struct ParamTraits<AudioOutputStream::State> { } }; +template <> +struct ParamTraits<WebKit::WebFindInPageRequest> { + typedef WebKit::WebFindInPageRequest param_type; + static void Write(Message* m, const param_type& p) { + WriteParam(m, p.identifier); + WriteParam(m, p.text); + WriteParam(m, p.forward); + WriteParam(m, p.matchCase); + WriteParam(m, p.findNext); + } + static bool Read(const Message* m, void** iter, param_type* p) { + return + ReadParam(m, iter, &p->identifier) && + ReadParam(m, iter, &p->text) && + ReadParam(m, iter, &p->forward) && + ReadParam(m, iter, &p->matchCase) && + ReadParam(m, iter, &p->findNext); + } + static void Log(const param_type& p, std::wstring* l) { + l->append(L"<FindInPageRequest>"); + } +}; + } // namespace IPC |