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

Side by Side Diff: chrome/renderer/translate/translate_helper.cc

Issue 15728008: Add the 'content' column to see what text is used to detect a language (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modified the comment Created 7 years, 7 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
OLDNEW
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 116
117 // TODO(hajimehoshi): If this affects performance, it should be set only if
118 // translate-internals tab exists.
119 details.contents = contents;
120
117 Send(new ChromeViewHostMsg_TranslateLanguageDetermined( 121 Send(new ChromeViewHostMsg_TranslateLanguageDetermined(
118 routing_id(), 122 routing_id(),
119 details, 123 details,
120 IsTranslationAllowed(&document) && !language.empty())); 124 IsTranslationAllowed(&document) && !language.empty()));
121 } 125 }
122 126
123 void TranslateHelper::CancelPendingTranslation() { 127 void TranslateHelper::CancelPendingTranslation() {
124 weak_method_factory_.InvalidateWeakPtrs(); 128 weak_method_factory_.InvalidateWeakPtrs();
125 translation_pending_ = false; 129 translation_pending_ = false;
126 page_id_ = -1; 130 page_id_ = -1;
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 WebView* web_view = render_view()->GetWebView(); 593 WebView* web_view = render_view()->GetWebView();
590 if (!web_view) { 594 if (!web_view) {
591 // When the WebView is going away, the render view should have called 595 // When the WebView is going away, the render view should have called
592 // CancelPendingTranslation() which should have stopped any pending work, so 596 // CancelPendingTranslation() which should have stopped any pending work, so
593 // that case should not happen. 597 // that case should not happen.
594 NOTREACHED(); 598 NOTREACHED();
595 return NULL; 599 return NULL;
596 } 600 }
597 return web_view->mainFrame(); 601 return web_view->mainFrame();
598 } 602 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698