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/renderer/translate/translate_helper.h" | 5 #include "chrome/renderer/translate/translate_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // TODO(toyoshim): Add |html_lang| to LanguageDetectionDetails. | 117 // TODO(toyoshim): Add |html_lang| to LanguageDetectionDetails. |
118 GURL url(document.url()); | 118 GURL url(document.url()); |
119 LanguageDetectionDetails details; | 119 LanguageDetectionDetails details; |
120 details.time = base::Time::Now(); | 120 details.time = base::Time::Now(); |
121 details.url = url; | 121 details.url = url; |
122 details.content_language = content_language; | 122 details.content_language = content_language; |
123 details.cld_language = cld_language; | 123 details.cld_language = cld_language; |
124 details.is_cld_reliable = is_cld_reliable; | 124 details.is_cld_reliable = is_cld_reliable; |
125 details.adopted_language = language; | 125 details.adopted_language = language; |
126 | 126 |
| 127 // TODO(hajimehoshi): If this affects performance, it should be set only if |
| 128 // translate-internals tab exists. |
| 129 details.contents = contents; |
| 130 |
127 Send(new ChromeViewHostMsg_TranslateLanguageDetermined( | 131 Send(new ChromeViewHostMsg_TranslateLanguageDetermined( |
128 routing_id(), | 132 routing_id(), |
129 details, | 133 details, |
130 IsTranslationAllowed(&document) && !language.empty())); | 134 IsTranslationAllowed(&document) && !language.empty())); |
131 } | 135 } |
132 | 136 |
133 void TranslateHelper::CancelPendingTranslation() { | 137 void TranslateHelper::CancelPendingTranslation() { |
134 weak_method_factory_.InvalidateWeakPtrs(); | 138 weak_method_factory_.InvalidateWeakPtrs(); |
135 translation_pending_ = false; | 139 translation_pending_ = false; |
136 page_id_ = -1; | 140 page_id_ = -1; |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 | 628 |
625 WebFrame* TranslateHelper::GetMainFrame() { | 629 WebFrame* TranslateHelper::GetMainFrame() { |
626 WebView* web_view = render_view()->GetWebView(); | 630 WebView* web_view = render_view()->GetWebView(); |
627 | 631 |
628 // When the tab is going to be closed, the web_view can be NULL. | 632 // When the tab is going to be closed, the web_view can be NULL. |
629 if (!web_view) | 633 if (!web_view) |
630 return NULL; | 634 return NULL; |
631 | 635 |
632 return web_view->mainFrame(); | 636 return web_view->mainFrame(); |
633 } | 637 } |
OLD | NEW |