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

Side by Side Diff: chrome/common/render_messages.h

Issue 552216: This CL makes the TranslationService class send the text to be translated to ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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
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 #ifndef CHROME_COMMON_RENDER_MESSAGES_H_ 5 #ifndef CHROME_COMMON_RENDER_MESSAGES_H_
6 #define CHROME_COMMON_RENDER_MESSAGES_H_ 6 #define CHROME_COMMON_RENDER_MESSAGES_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 #include <map> 10 #include <map>
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 // another. 574 // another.
575 struct ViewHostMsg_TranslateTextParam { 575 struct ViewHostMsg_TranslateTextParam {
576 // The routing id. Even though ViewHostMsg_TranslateText is a control message 576 // The routing id. Even though ViewHostMsg_TranslateText is a control message
577 // (sent to the browser, not to a specific RenderViewHost), the browser needs 577 // (sent to the browser, not to a specific RenderViewHost), the browser needs
578 // the routing id in order to send the response back to the right RenderView. 578 // the routing id in order to send the response back to the right RenderView.
579 int routing_id; 579 int routing_id;
580 580
581 // An id used to identify that specific translation. 581 // An id used to identify that specific translation.
582 int work_id; 582 int work_id;
583 583
584 // The id of the page this translation originated from.
585 int page_id;
586
584 // The text chunks that need to be translated. 587 // The text chunks that need to be translated.
585 std::vector<string16> text_chunks; 588 std::vector<string16> text_chunks;
586 589
587 // The ISO code of the language the text to translate is in. 590 // The ISO code of the language the text to translate is in.
588 std::string from_language; 591 std::string from_language;
589 592
590 // The ISO code of the language the text should be translated to. 593 // The ISO code of the language the text should be translated to.
591 std::string to_language; 594 std::string to_language;
592 595
593 // Whether a secure connection should be used when transmitting the text for 596 // Whether a secure connection should be used when transmitting the text for
(...skipping 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after
2450 l->append(L")"); 2453 l->append(L")");
2451 } 2454 }
2452 }; 2455 };
2453 2456
2454 template<> 2457 template<>
2455 struct ParamTraits<ViewHostMsg_TranslateTextParam> { 2458 struct ParamTraits<ViewHostMsg_TranslateTextParam> {
2456 typedef ViewHostMsg_TranslateTextParam param_type; 2459 typedef ViewHostMsg_TranslateTextParam param_type;
2457 static void Write(Message* m, const param_type& p) { 2460 static void Write(Message* m, const param_type& p) {
2458 WriteParam(m, p.routing_id); 2461 WriteParam(m, p.routing_id);
2459 WriteParam(m, p.work_id); 2462 WriteParam(m, p.work_id);
2463 WriteParam(m, p.page_id);
2460 WriteParam(m, p.text_chunks); 2464 WriteParam(m, p.text_chunks);
2461 WriteParam(m, p.from_language); 2465 WriteParam(m, p.from_language);
2462 WriteParam(m, p.to_language); 2466 WriteParam(m, p.to_language);
2463 WriteParam(m, p.secure); 2467 WriteParam(m, p.secure);
2464 } 2468 }
2465 2469
2466 static bool Read(const Message* m, void** iter, param_type* p) { 2470 static bool Read(const Message* m, void** iter, param_type* p) {
2467 return 2471 return
2468 ReadParam(m, iter, &p->routing_id) && 2472 ReadParam(m, iter, &p->routing_id) &&
2469 ReadParam(m, iter, &p->work_id) && 2473 ReadParam(m, iter, &p->work_id) &&
2474 ReadParam(m, iter, &p->page_id) &&
2470 ReadParam(m, iter, &p->text_chunks) && 2475 ReadParam(m, iter, &p->text_chunks) &&
2471 ReadParam(m, iter, &p->from_language) && 2476 ReadParam(m, iter, &p->from_language) &&
2472 ReadParam(m, iter, &p->to_language) && 2477 ReadParam(m, iter, &p->to_language) &&
2473 ReadParam(m, iter, &p->secure); 2478 ReadParam(m, iter, &p->secure);
2474 } 2479 }
2475 static void Log(const param_type& p, std::wstring* l) { 2480 static void Log(const param_type& p, std::wstring* l) {
2476 l->append(L"("); 2481 l->append(L"(");
2477 LogParam(p.routing_id, l); 2482 LogParam(p.routing_id, l);
2478 l->append(L", "); 2483 l->append(L", ");
2479 LogParam(p.work_id, l); 2484 LogParam(p.work_id, l);
2480 l->append(L", "); 2485 l->append(L", ");
2486 LogParam(p.page_id, l);
2487 l->append(L", ");
2481 LogParam(p.text_chunks, l); 2488 LogParam(p.text_chunks, l);
2482 l->append(L", "); 2489 l->append(L", ");
2483 LogParam(p.from_language, l); 2490 LogParam(p.from_language, l);
2484 l->append(L", "); 2491 l->append(L", ");
2485 LogParam(p.to_language, l); 2492 LogParam(p.to_language, l);
2486 l->append(L", "); 2493 l->append(L", ");
2487 LogParam(p.secure, l); 2494 LogParam(p.secure, l);
2488 l->append(L")"); 2495 l->append(L")");
2489 } 2496 }
2490 }; 2497 };
2491 2498
2492 } // namespace IPC 2499 } // namespace IPC
2493 2500
2494 2501
2495 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" 2502 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h"
2496 #include "ipc/ipc_message_macros.h" 2503 #include "ipc/ipc_message_macros.h"
2497 2504
2498 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ 2505 #endif // CHROME_COMMON_RENDER_MESSAGES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698