Expose PageImportanceSignals via WebContents
Depends on Blink side change: https://codereview.chromium.org/1345023002/
PageImportanceSignals contains Blink-tracked signals which is useful for
judging an relative importance of the web content hosted on a tab.
For example, we can know if a tab has a pending HTML form entry, etc.
This CL introduces a method WebContents::GetPageImportanceSignals(),
which allows browser process to query PageImportanceSignals for a tab.
In near future, we plan to use this information from OOMPriorityManager to
avoid unwanted tab discards.
BUG=520838
Review URL: https://codereview.chromium.org/1345873003
Cr-Commit-Position: refs/heads/master@{#350494}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 8954315..e1e3449 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -642,6 +642,8 @@
OnRegisterProtocolHandler)
IPC_MESSAGE_HANDLER(FrameHostMsg_UnregisterProtocolHandler,
OnUnregisterProtocolHandler)
+ IPC_MESSAGE_HANDLER(FrameHostMsg_UpdatePageImportanceSignals,
+ OnUpdatePageImportanceSignals)
IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply)
IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed)
IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend)
@@ -911,6 +913,10 @@
}
#endif
+const PageImportanceSignals& WebContentsImpl::GetPageImportanceSignals() const {
+ return page_importance_signals_;
+}
+
const base::string16& WebContentsImpl::GetTitle() const {
// Transient entries take precedence. They are used for interstitial pages
// that are shown on top of existing pages.
@@ -3172,6 +3178,11 @@
delegate_->UnregisterProtocolHandler(this, protocol, url, user_gesture);
}
+void WebContentsImpl::OnUpdatePageImportanceSignals(
+ const PageImportanceSignals& signals) {
+ page_importance_signals_ = signals;
+}
+
void WebContentsImpl::OnFindReply(int request_id,
int number_of_matches,
const gfx::Rect& selection_rect,