diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-16 18:35:52 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-16 18:35:52 +0000 |
commit | 47c5103a4c932bd88ed0a623d30cd6ff5cab0b44 (patch) | |
tree | b1cc5329401dfb157f977dc68a7b0844836cabef /chrome/browser/renderer_host/render_view_host.cc | |
parent | e6dd571eecc5b3bbcf1151a805ff2fadcf02f979 (diff) | |
download | chromium_src-47c5103a4c932bd88ed0a623d30cd6ff5cab0b44.zip chromium_src-47c5103a4c932bd88ed0a623d30cd6ff5cab0b44.tar.gz chromium_src-47c5103a4c932bd88ed0a623d30cd6ff5cab0b44.tar.bz2 |
Makes the language detection happen with every page load
as we do with the page indexing. (The language detection was
previously done on demand when the extension related API was querying it.)
Once detected the language is stored on the navigation entry.
It'll be used for the upcoming translation feature.
Also I moved the existing language detection from the UI to
the file thread.
The change required few changes for the
chrome.tabs.detectLanguage extension API to still work.
BUG=None
TEST=Run the browser tests and unit-tests.
Review URL: http://codereview.chromium.org/492024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34728 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host/render_view_host.cc')
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.cc | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index d67fda3..136ad7a 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -46,8 +46,6 @@ #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; @@ -423,10 +421,6 @@ void RenderViewHost::StopFinding(bool clear_selection) { 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)); } @@ -759,8 +753,6 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) { 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) @@ -844,6 +836,7 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) { 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() @@ -1147,22 +1140,6 @@ void RenderViewHost::OnMsgFindReply(int request_id, 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(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( @@ -1783,3 +1760,13 @@ void RenderViewHost::OnAccessibilityFocusChange(int acc_obj_id) { 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, page_id, contents); +} |