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

Unified Diff: chrome/renderer/render_view.cc

Issue 150062: [chromium-reviews] Add getLanguage function to tabs extension (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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/renderer/render_view.cc
===================================================================
--- chrome/renderer/render_view.cc (revision 20334)
+++ chrome/renderer/render_view.cc (working copy)
@@ -192,7 +192,8 @@
popup_notification_visible_(false),
delay_seconds_for_form_state_sync_(kDefaultDelaySecondsForFormStateSync),
preferred_width_(0),
- send_preferred_width_changes_(false) {
+ send_preferred_width_changes_(false),
+ determine_page_text_after_loading_stops_(false) {
}
RenderView::~RenderView() {
@@ -355,6 +356,7 @@
IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt)
IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand)
IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind)
+ IPC_MESSAGE_HANDLER(ViewMsg_DeterminePageText, OnDeterminePageText)
IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom)
IPC_MESSAGE_HANDLER(ViewMsg_InsertText, OnInsertText)
IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding)
@@ -497,6 +499,12 @@
Send(new ViewHostMsg_PageContents(url, load_id, contents));
}
+ // Send over text content of this page to the browser.
+ if (determine_page_text_after_loading_stops_) {
+ determine_page_text_after_loading_stops_ = false;
+ Send(new ViewMsg_DeterminePageText_Reply(routing_id_, contents));
+ }
+
// thumbnail
SendThumbnail();
}
@@ -2199,6 +2207,23 @@
}
}
+void RenderView::OnDeterminePageText() {
+ if (!is_loading_) {
+ if (!webview())
+ return;
+ WebFrame* main_frame = webview()->GetMainFrame();
+ std::wstring contents;
+ CaptureText(main_frame, &contents);
+ Send(new ViewMsg_DeterminePageText_Reply(routing_id_, contents));
+ determine_page_text_after_loading_stops_ = false;
+ return;
+ }
+
+ // We set |determine_page_text_after_loading_stops_| true here so that,
+ // after page has been loaded completely, the text in the page is captured.
+ determine_page_text_after_loading_stops_ = true;
+}
+
void RenderView::ReportFindInPageMatchCount(int count, int request_id,
bool final_update) {
// If we have a message that has been queued up, then we should just replace

Powered by Google App Engine
This is Rietveld 408576698