Chromium Code Reviews| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 language_determined_time_ = base::TimeTicks::Now(); | 106 language_determined_time_ = base::TimeTicks::Now(); |
| 107 | 107 |
| 108 GURL url(document.url()); | 108 GURL url(document.url()); |
| 109 LanguageDetectionDetails details; | 109 LanguageDetectionDetails details; |
| 110 details.time = base::Time::Now(); | 110 details.time = base::Time::Now(); |
| 111 details.url = url; | 111 details.url = url; |
| 112 details.content_language = content_language; | 112 details.content_language = content_language; |
| 113 details.cld_language = cld_language; | 113 details.cld_language = cld_language; |
| 114 details.is_cld_reliable = is_cld_reliable; | 114 details.is_cld_reliable = is_cld_reliable; |
| 115 details.adopted_language = language; | 115 details.adopted_language = language; |
| 116 // TODO(hajimehoshi): this parameter should be set only if | |
|
Takashi Toyoshima
2013/05/23 06:54:53
this -> This.
Probably, we can say,
"If this affe
hajimehoshi
2013/05/23 06:59:18
Done.
| |
| 117 // translate-internals tab exists. | |
| 118 details.contents = contents; | |
| 116 | 119 |
| 117 Send(new ChromeViewHostMsg_TranslateLanguageDetermined( | 120 Send(new ChromeViewHostMsg_TranslateLanguageDetermined( |
| 118 routing_id(), | 121 routing_id(), |
| 119 details, | 122 details, |
| 120 IsTranslationAllowed(&document) && !language.empty())); | 123 IsTranslationAllowed(&document) && !language.empty())); |
| 121 } | 124 } |
| 122 | 125 |
| 123 void TranslateHelper::CancelPendingTranslation() { | 126 void TranslateHelper::CancelPendingTranslation() { |
| 124 weak_method_factory_.InvalidateWeakPtrs(); | 127 weak_method_factory_.InvalidateWeakPtrs(); |
| 125 translation_pending_ = false; | 128 translation_pending_ = false; |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 589 WebView* web_view = render_view()->GetWebView(); | 592 WebView* web_view = render_view()->GetWebView(); |
| 590 if (!web_view) { | 593 if (!web_view) { |
| 591 // When the WebView is going away, the render view should have called | 594 // When the WebView is going away, the render view should have called |
| 592 // CancelPendingTranslation() which should have stopped any pending work, so | 595 // CancelPendingTranslation() which should have stopped any pending work, so |
| 593 // that case should not happen. | 596 // that case should not happen. |
| 594 NOTREACHED(); | 597 NOTREACHED(); |
| 595 return NULL; | 598 return NULL; |
| 596 } | 599 } |
| 597 return web_view->mainFrame(); | 600 return web_view->mainFrame(); |
| 598 } | 601 } |
| OLD | NEW |