| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/translate/translate_manager.h" | 5 #include "chrome/browser/translate/translate_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 TranslateInfoBarDelegate::TRANSLATING, infobar_helper, | 610 TranslateInfoBarDelegate::TRANSLATING, infobar_helper, |
| 611 wrapper->profile()->GetPrefs(), source_lang, target_lang)); | 611 wrapper->profile()->GetPrefs(), source_lang, target_lang)); |
| 612 | 612 |
| 613 if (!translate_script_.empty()) { | 613 if (!translate_script_.empty()) { |
| 614 DoTranslatePage(web_contents, translate_script_, source_lang, target_lang); | 614 DoTranslatePage(web_contents, translate_script_, source_lang, target_lang); |
| 615 return; | 615 return; |
| 616 } | 616 } |
| 617 | 617 |
| 618 // The script is not available yet. Queue that request and query for the | 618 // The script is not available yet. Queue that request and query for the |
| 619 // script. Once it is downloaded we'll do the translate. | 619 // script. Once it is downloaded we'll do the translate. |
| 620 RenderViewHost* rvh = web_contents->GetRenderViewHost(); | 620 content::RenderViewHost* rvh = web_contents->GetRenderViewHost(); |
| 621 PendingRequest request; | 621 PendingRequest request; |
| 622 request.render_process_id = rvh->GetProcess()->GetID(); | 622 request.render_process_id = rvh->GetProcess()->GetID(); |
| 623 request.render_view_id = rvh->GetRoutingID(); | 623 request.render_view_id = rvh->GetRoutingID(); |
| 624 request.page_id = entry->GetPageID(); | 624 request.page_id = entry->GetPageID(); |
| 625 request.source_lang = source_lang; | 625 request.source_lang = source_lang; |
| 626 request.target_lang = target_lang; | 626 request.target_lang = target_lang; |
| 627 pending_requests_.push_back(request); | 627 pending_requests_.push_back(request); |
| 628 RequestTranslateScript(); | 628 RequestTranslateScript(); |
| 629 } | 629 } |
| 630 | 630 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); | 875 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); |
| 876 | 876 |
| 877 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { | 877 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { |
| 878 TranslateInfoBarDelegate* delegate = | 878 TranslateInfoBarDelegate* delegate = |
| 879 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); | 879 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); |
| 880 if (delegate) | 880 if (delegate) |
| 881 return delegate; | 881 return delegate; |
| 882 } | 882 } |
| 883 return NULL; | 883 return NULL; |
| 884 } | 884 } |
| OLD | NEW |