From d4a00a73c0349128e4ad9d5f30704ba2ec1d79d8 Mon Sep 17 00:00:00 2001 From: "jcampan@chromium.org" <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> Date: Fri, 29 Jan 2010 01:44:42 +0000 Subject: This CL makes the TranslationService class send the text to be translated to the translation server. It groups requests as to limit the number of requests sent to the server. Also this CL adds a flag to automatically turn on translation on pages that are not in the language Chrome is configured in. BUG=None TEST=Run the unit-tests. Add the --auto-translate flag then navigate to pages in a language which is not the language Chrome is configured. They should get translated. Review URL: http://codereview.chromium.org/552216 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37479 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/render_messages.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'chrome/common/render_messages.h') diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index ebc7af4..b50b0d1 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -581,6 +581,9 @@ struct ViewHostMsg_TranslateTextParam { // An id used to identify that specific translation. int work_id; + // The id of the page this translation originated from. + int page_id; + // The text chunks that need to be translated. std::vector<string16> text_chunks; @@ -2457,6 +2460,7 @@ struct ParamTraits<ViewHostMsg_TranslateTextParam> { static void Write(Message* m, const param_type& p) { WriteParam(m, p.routing_id); WriteParam(m, p.work_id); + WriteParam(m, p.page_id); WriteParam(m, p.text_chunks); WriteParam(m, p.from_language); WriteParam(m, p.to_language); @@ -2467,6 +2471,7 @@ struct ParamTraits<ViewHostMsg_TranslateTextParam> { return ReadParam(m, iter, &p->routing_id) && ReadParam(m, iter, &p->work_id) && + ReadParam(m, iter, &p->page_id) && ReadParam(m, iter, &p->text_chunks) && ReadParam(m, iter, &p->from_language) && ReadParam(m, iter, &p->to_language) && @@ -2478,6 +2483,8 @@ struct ParamTraits<ViewHostMsg_TranslateTextParam> { l->append(L", "); LogParam(p.work_id, l); l->append(L", "); + LogParam(p.page_id, l); + l->append(L", "); LogParam(p.text_chunks, l); l->append(L", "); LogParam(p.from_language, l); -- cgit v1.1