summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser.cc4
-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.cc11
-rw-r--r--chrome/browser/renderer_host/render_view_host.h14
-rw-r--r--chrome/browser/renderer_host/render_view_host_delegate.h6
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc20
-rw-r--r--chrome/browser/tab_contents/tab_contents.h4
-rw-r--r--chrome/common/notification_type.h5
-rw-r--r--chrome/common/render_messages_internal.h14
-rw-r--r--chrome/renderer/render_view.cc2
11 files changed, 63 insertions, 32 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index bcf74d1..7ccdaf5 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1209,8 +1209,8 @@ void Browser::OpenCreateShortcutsDialog() {
DCHECK(pending_web_app_action_ == NONE);
pending_web_app_action_ = CREATE_SHORTCUT;
- // Start fetching web app info for CreateApplicatoinShortcut dialog and
- // show the dialog when the data is available in OnDidGetApplicationInfo.
+ // Start fetching web app info for CreateApplicationShortcut dialog and show
+ // the dialog when the data is available in OnDidGetApplicationInfo.
current_tab->render_view_host()->GetApplicationInfo(entry->page_id());
#else
NOTIMPLEMENTED();
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..d210ffe 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -854,6 +854,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()
@@ -1810,3 +1811,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, process()->id(), page_id, contents);
+}
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 8dcec74..e56c406 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -428,22 +428,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:
@@ -599,7 +599,9 @@ 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);
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..013b913 100644
--- a/chrome/browser/renderer_host/render_view_host_delegate.h
+++ b/chrome/browser/renderer_host/render_view_host_delegate.h
@@ -217,6 +217,12 @@ 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) = 0;
};
// Resource ------------------------------------------------------------------
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index fdfa5ab..4474458 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -1760,6 +1760,26 @@ void TabContents::OnDidGetApplicationInfo(
delegate()->OnDidGetApplicationInfo(this, page_id);
}
+void TabContents::OnPageContents(const GURL& url,
+ int renderer_process_id,
+ int32 page_id,
+ const std::wstring& contents) {
+ // Don't index any https pages. People generally don't want their bank
+ // accounts, etc. indexed on their computer, especially since some of these
+ // things are not marked cachable.
+ // TODO(brettw) we may want to consider more elaborate heuristics such as
+ // the cachability of the page. We may also want to consider subframes (this
+ // test will still index subframes if the subframe is SSL).
+ if (!url.SchemeIsSecure()) {
+ Profile* p = profile();
+ if (p && !p->IsOffTheRecord()) {
+ HistoryService* hs = p->GetHistoryService(Profile::IMPLICIT_ACCESS);
+ if (hs)
+ hs->SetPageContents(url, contents);
+ }
+ }
+}
+
void TabContents::DidStartProvisionalLoadForFrame(
RenderViewHost* render_view_host,
bool is_main_frame,
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index de1e3ab..fb8597e 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -814,6 +814,10 @@ class TabContents : public PageNavigator,
virtual void OnDidGetApplicationInfo(
int32 page_id,
const webkit_glue::WebApplicationInfo& info);
+ virtual void OnPageContents(const GURL& url,
+ int renderer_process_id,
+ int32 page_id,
+ const std::wstring& contents);
// RenderViewHostDelegate::Resource implementation.
virtual void DidStartProvisionalLoadForFrame(RenderViewHost* render_view_host,
diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h
index d021059..d3f5640 100644
--- a/chrome/common/notification_type.h
+++ b/chrome/common/notification_type.h
@@ -223,8 +223,9 @@ class NotificationType {
// is the InfoBubble.
INFO_BUBBLE_CREATED,
- // Sent after a call to RenderViewHost::DeterminePageLanguage. The details
- // are Details<std::string> and the source is Source<RenderViewHost>.
+ // Sent when the language (English, French...) for a page has been detected.
+ // The details Details<std::string> contain the ISO 639-1 language code and
+ // the source is Source<RenderViewHost>.
TAB_LANGUAGE_DETERMINED,
// Sent after the renderer returns a snapshot of tab contents.
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 1b984fe..2129da5 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -1128,7 +1128,7 @@ IPC_BEGIN_MESSAGES(ViewHost)
IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateSpellingPanelWithMisspelledWord,
string16 /* the word to update the panel with */)
- // Initiate a download based on user actions like 'ALT+click'.
+ // Initiates a download based on user actions like 'ALT+click'.
IPC_MESSAGE_ROUTED2(ViewHostMsg_DownloadUrl,
GURL /* url */,
GURL /* referrer */)
@@ -1146,9 +1146,11 @@ IPC_BEGIN_MESSAGES(ViewHost)
bool /* out - success */,
std::wstring /* out - prompt field */)
- // Sets the contents for the given page (URL and page ID are the first two
- // arguments) given the contents that is the 3rd.
- IPC_MESSAGE_CONTROL3(ViewHostMsg_PageContents, GURL, int32, std::wstring)
+ // Provides the contents for the given page that was loaded recently.
+ IPC_MESSAGE_ROUTED3(ViewHostMsg_PageContents,
+ GURL /* URL of the page */,
+ int32 /* page id */,
+ std::wstring /* page contents */)
// Used to get the extension message bundle.
IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetExtensionMessageBundle,
@@ -1177,13 +1179,13 @@ IPC_BEGIN_MESSAGES(ViewHost)
// user right clicked.
IPC_MESSAGE_ROUTED1(ViewHostMsg_ContextMenu, ContextMenuParams)
- // Request that the given URL be opened in the specified manner.
+ // Requests that the given URL be opened in the specified manner.
IPC_MESSAGE_ROUTED3(ViewHostMsg_OpenURL,
GURL /* url */,
GURL /* referrer */,
WindowOpenDisposition /* disposition */)
- // Notify that the preferred size of the content changed.
+ // Notifies that the preferred size of the content changed.
IPC_MESSAGE_ROUTED1(ViewHostMsg_DidContentsPreferredSizeChange,
gfx::Size /* pref_size */)
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 649542f..5b1ee82 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -676,7 +676,7 @@ void RenderView::CapturePageInfo(int load_id, bool preliminary_capture) {
CaptureText(main_frame, &contents);
if (contents.size()) {
// Send the text to the browser for indexing.
- Send(new ViewHostMsg_PageContents(url, load_id, contents));
+ Send(new ViewHostMsg_PageContents(routing_id_, url, load_id, contents));
}
// Now that we have the contents, we can determine the language if necessary.