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

Unified Diff: chrome/browser/renderer_host/render_view_host.cc

Issue 523149: Revert 35735 - Relanding the language detection code.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/render_view_host.cc
===================================================================
--- chrome/browser/renderer_host/render_view_host.cc (revision 35751)
+++ chrome/browser/renderer_host/render_view_host.cc (working copy)
@@ -46,6 +46,8 @@
#if defined(OS_WIN)
// TODO(port): accessibility not yet implemented. See http://crbug.com/8288.
#include "chrome/browser/browser_accessibility_manager.h"
+// TODO(port): The compact language detection library works only for Windows.
+#include "third_party/cld/bar/toolbar/cld/i18n/encodings/compact_lang_det/win/cld_unicodetext.h"
#endif
using base::TimeDelta;
@@ -421,6 +423,10 @@
Send(new ViewMsg_StopFinding(routing_id(), clear_selection));
}
+void RenderViewHost::GetPageLanguage() {
+ Send(new ViewMsg_DeterminePageText(routing_id()));
+}
+
void RenderViewHost::Zoom(PageZoom::Function function) {
Send(new ViewMsg_Zoom(routing_id(), function));
}
@@ -753,6 +759,8 @@
IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailProvisionalLoadWithError,
OnMsgDidFailProvisionalLoadWithError)
IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnMsgFindReply)
+ IPC_MESSAGE_HANDLER(ViewMsg_DeterminePageText_Reply,
+ OnDeterminePageTextReply)
IPC_MESSAGE_HANDLER(ViewMsg_ExecuteCodeFinished,
OnExecuteCodeFinished)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFavIconURL, OnMsgUpdateFavIconURL)
@@ -836,7 +844,6 @@
IPC_MESSAGE_HANDLER(ViewHostMsg_AccessibilityFocusChange,
OnAccessibilityFocusChange)
IPC_MESSAGE_HANDLER(ViewHostMsg_OnCSSInserted, OnCSSInserted)
- IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents)
// Have the super handle all other messages.
IPC_MESSAGE_UNHANDLED(RenderWidgetHost::OnMessageReceived(msg))
IPC_END_MESSAGE_MAP_EX()
@@ -1140,6 +1147,22 @@
Send(new ViewMsg_FindReplyACK(routing_id()));
}
+void RenderViewHost::OnDeterminePageTextReply(
+ const std::wstring& page_text) {
+#if defined(OS_WIN) // Only for windows.
+ int num_languages = 0;
+ bool is_reliable = false;
+ const char* language_iso_code = LanguageCodeISO639_1(
+ DetectLanguageOfUnicodeText(NULL, page_text.c_str(), true, &is_reliable,
+ &num_languages, NULL));
+ std::string language(language_iso_code);
+ NotificationService::current()->Notify(
+ NotificationType::TAB_LANGUAGE_DETERMINED,
+ Source<RenderViewHost>(this),
+ Details<std::string>(&language));
+#endif
+}
+
void RenderViewHost::OnExecuteCodeFinished(int request_id, bool success) {
std::pair<int, bool> result_details(request_id, success);
NotificationService::current()->Notify(
@@ -1760,13 +1783,3 @@
void RenderViewHost::OnCSSInserted() {
delegate_->DidInsertCSS();
}
-
-void RenderViewHost::OnPageContents(const GURL& url,
- int32 page_id,
- const std::wstring& contents) {
- RenderViewHostDelegate::BrowserIntegration* integration_delegate =
- delegate_->GetBrowserIntegrationDelegate();
- if (!integration_delegate)
- return;
- integration_delegate->OnPageContents(url, process()->id(), page_id, contents);
-}
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.h ('k') | chrome/browser/renderer_host/render_view_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698