summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-16 01:30:48 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-16 01:30:48 +0000
commit214be467093e9455fb23dafb862cc1476daa5426 (patch)
tree352b4de0381c97720c64f52f17f376e39e885473 /chrome/browser/renderer_host
parentdefda2819e4bc8311597273f5f98addd9d7a01c0 (diff)
downloadchromium_src-214be467093e9455fb23dafb862cc1476daa5426.zip
chromium_src-214be467093e9455fb23dafb862cc1476daa5426.tar.gz
chromium_src-214be467093e9455fb23dafb862cc1476daa5426.tar.bz2
4th attempt at landing this.
It caused several tests to fails previously. Cannot repro any of the failure. I am suspecting a clobber would have probably fixed it. (there is a change in one of the IPC messages that probably messed up the build somehow). No code change. Enabling language detection on page load. A memory error has been fixed in the CLD library in the meantime. This should hopefully fixes the crashers in the reliability tests. Note that this version is actually simpler than the original review since the detection is now performed in the renderer. (So the CLD code runs sandboxed.) Original review: http://codereview.chromium.org/492024/show BUG=30662 TEST=Run the unit-tests. TBR=brettw Review URL: http://codereview.chromium.org/548057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36442 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc13
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.h2
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc27
-rw-r--r--chrome/browser/renderer_host/render_view_host.h21
-rw-r--r--chrome/browser/renderer_host/render_view_host_delegate.h7
5 files changed, 29 insertions, 41 deletions
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 32c141c..dadeb53 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -738,7 +738,6 @@ void BrowserRenderProcessHost::OnMessageReceived(const IPC::Message& msg) {
// Dispatch control messages.
bool msg_is_ok = true;
IPC_BEGIN_MESSAGE_MAP_EX(BrowserRenderProcessHost, msg, msg_is_ok)
- IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdatedCacheStats,
OnUpdatedCacheStats)
IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged,
@@ -836,18 +835,6 @@ void BrowserRenderProcessHost::OnChannelError() {
// TODO(darin): clean this up
}
-void BrowserRenderProcessHost::OnPageContents(const GURL& url,
- int32 page_id,
- const std::wstring& contents) {
- Profile* p = profile();
- if (!p || p->IsOffTheRecord())
- return;
-
- HistoryService* hs = p->GetHistoryService(Profile::IMPLICIT_ACCESS);
- if (hs)
- hs->SetPageContents(url, contents);
-}
-
void BrowserRenderProcessHost::OnUpdatedCacheStats(
const WebCache::UsageStats& stats) {
WebCacheManager::GetInstance()->ObserveStats(id(), stats);
diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h
index 3a6e83b..0fd51ea 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.h
+++ b/chrome/browser/renderer_host/browser_render_process_host.h
@@ -104,8 +104,6 @@ class BrowserRenderProcessHost : public RenderProcessHost,
friend class VisitRelayingRenderProcessHost;
// Control message handlers.
- void OnPageContents(const GURL& url, int32 page_id,
- const std::wstring& contents);
void OnUpdatedCacheStats(const WebKit::WebCache::UsageStats& stats);
void SuddenTerminationChanged(bool enabled);
void OnExtensionAddListener(const std::string& event_name);
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 9a6c128..3d705cb 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -428,10 +428,6 @@ void RenderViewHost::StopFinding(bool clear_selection) {
Send(new ViewMsg_StopFinding(routing_id(), clear_selection));
}
-void RenderViewHost::GetPageLanguage() {
- Send(new ViewMsg_DeterminePageLanguage(routing_id()));
-}
-
void RenderViewHost::Zoom(PageZoom::Function function) {
Send(new ViewMsg_Zoom(routing_id(), function));
}
@@ -769,8 +765,6 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailProvisionalLoadWithError,
OnMsgDidFailProvisionalLoadWithError)
IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnMsgFindReply)
- IPC_MESSAGE_HANDLER(ViewHostMsg_PageLanguageDetermined,
- OnPageLanguageDetermined)
IPC_MESSAGE_HANDLER(ViewMsg_ExecuteCodeFinished,
OnExecuteCodeFinished)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFavIconURL, OnMsgUpdateFavIconURL)
@@ -854,6 +848,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()
@@ -1167,14 +1162,6 @@ void RenderViewHost::OnMsgFindReply(int request_id,
Send(new ViewMsg_FindReplyACK(routing_id()));
}
-void RenderViewHost::OnPageLanguageDetermined(const std::string& language) {
- std::string lang(language);
- NotificationService::current()->Notify(
- NotificationType::TAB_LANGUAGE_DETERMINED,
- Source<RenderViewHost>(this),
- Details<std::string>(&lang));
-}
-
void RenderViewHost::OnExecuteCodeFinished(int request_id, bool success) {
std::pair<int, bool> result_details(request_id, success);
NotificationService::current()->Notify(
@@ -1810,3 +1797,15 @@ 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,
+ const std::string& language) {
+ RenderViewHostDelegate::BrowserIntegration* integration_delegate =
+ delegate_->GetBrowserIntegrationDelegate();
+ if (!integration_delegate)
+ return;
+ integration_delegate->OnPageContents(url, process()->id(), page_id, contents,
+ language);
+}
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 8dcec74..b09cf7c 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -213,12 +213,6 @@ class RenderViewHost : public RenderWidgetHost,
// clear the selection on the focused frame.
void StopFinding(bool clear_selection);
- // Gets the most probable language of the text content in the tab. (This sends
- // a message to the render view.) The caller gets the language via the
- // NotificationService by registering to the
- // NotificationType TAB_LANGUAGE_DETERMINED.
- void GetPageLanguage();
-
// Change the zoom level of a page.
void Zoom(PageZoom::Function function);
@@ -428,22 +422,22 @@ class RenderViewHost : public RenderWidgetHost,
// Creates a new RenderWidget with the given route id.
void CreateNewWidget(int route_id, bool activatable);
- // Send the response to an extension api call.
+ // Sends the response to an extension api call.
void SendExtensionResponse(int request_id, bool success,
const std::string& response,
const std::string& error);
- // Send a response to an extension api call that it was blocked for lack of
+ // Sends a response to an extension api call that it was blocked for lack of
// permission.
void BlockExtensionRequest(int request_id);
- // Notify the renderer that its view type has changed.
+ // Notifies the renderer that its view type has changed.
void ViewTypeChanged(ViewType::Type type);
- // Tell renderer which browser window it is being attached to.
+ // Tells the renderer which browser window it is being attached to.
void UpdateBrowserWindowId(int window_id);
- // Tell render view that custom context action has been selected.
+ // Tells the render view that a custom context action has been selected.
void PerformCustomContextMenuAction(unsigned action);
protected:
@@ -501,7 +495,6 @@ class RenderViewHost : public RenderWidgetHost,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update);
- void OnPageLanguageDetermined(const std::string& language);
void OnExecuteCodeFinished(int request_id, bool success);
void OnMsgUpdateFavIconURL(int32 page_id, const GURL& icon_url);
void OnMsgDidDownloadFavIcon(int id,
@@ -599,6 +592,10 @@ class RenderViewHost : public RenderWidgetHost,
void OnExtensionPostMessage(int port_id, const std::string& message);
void OnAccessibilityFocusChange(int acc_obj_id);
void OnCSSInserted();
+ void OnPageContents(const GURL& url,
+ int32 page_id,
+ const std::wstring& contents,
+ const std::string& language);
private:
friend class TestRenderViewHost;
diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h
index 411840a..205c2d0 100644
--- a/chrome/browser/renderer_host/render_view_host_delegate.h
+++ b/chrome/browser/renderer_host/render_view_host_delegate.h
@@ -217,6 +217,13 @@ class RenderViewHostDelegate {
virtual void OnDidGetApplicationInfo(
int32 page_id,
const webkit_glue::WebApplicationInfo& app_info) = 0;
+
+ // Notification that the contents of the page has been loaded.
+ virtual void OnPageContents(const GURL& url,
+ int renderer_process_id,
+ int32 page_id,
+ const std::wstring& contents,
+ const std::string& language) = 0;
};
// Resource ------------------------------------------------------------------