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

Unified Diff: content/browser/tab_contents/tab_contents.cc

Issue 7036019: Enabling page visibility api in the chrome browser. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 7 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: content/browser/tab_contents/tab_contents.cc
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index b4aee7c962069e04e147b0f2dde59dcc90f04a92..62f98826a4358ddd1990e9b095ad0f1786282cf9 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -180,6 +180,7 @@ ViewMsg_Navigate_Type::Value GetNavigationType(
void MakeNavigateParams(const NavigationEntry& entry,
const NavigationController& controller,
NavigationController::ReloadType reload_type,
+ bool is_hidden,
ViewMsg_Navigate_Params* params) {
params->page_id = entry.page_id();
params->pending_history_list_offset = controller.GetIndexOfEntry(&entry);
@@ -191,6 +192,7 @@ void MakeNavigateParams(const NavigationEntry& entry,
params->state = entry.content_state();
params->navigation_type =
GetNavigationType(controller.profile(), entry, reload_type);
+ params->is_hidden = is_hidden;
params->request_time = base::Time::Now();
}
@@ -236,7 +238,8 @@ TabContents::TabContents(Profile* profile,
maximum_zoom_percent_(
static_cast<int>(WebKit::WebView::maxTextSizeMultiplier * 100)),
temporary_zoom_settings_(false),
- content_restrictions_(0) {
+ content_restrictions_(0),
+ is_initially_hidden_(false) {
renderer_preferences_util::UpdateFromSystemSettings(
&renderer_preferences_, profile);
@@ -508,6 +511,8 @@ void TabContents::DidBecomeSelected() {
}
void TabContents::WasHidden() {
+ is_initially_hidden_ = true;
+
if (!capturing_contents()) {
// |render_view_host()| can be NULL if the user middle clicks a link to open
// a tab in then background, then closes the tab before selecting it. This
@@ -608,7 +613,8 @@ bool TabContents::NavigateToEntry(
// Navigate in the desired RenderViewHost.
ViewMsg_Navigate_Params navigate_params;
- MakeNavigateParams(entry, controller_, reload_type, &navigate_params);
+ MakeNavigateParams(entry, controller_, reload_type,
+ IsHidden(), &navigate_params);
if (delegate_) {
navigate_params.extra_headers =
delegate_->GetNavigationHeaders(navigate_params.url);
@@ -2040,6 +2046,12 @@ void TabContents::RequestDesktopNotificationPermission(
render_view_host()->routing_id(), callback_context, this);
}
+bool TabContents::IsHidden() const {
+ if (delegate())
+ return delegate()->IsHidden(this);
+ return is_initially_hidden_;
+}
+
void TabContents::BeforeUnloadFiredFromRenderManager(
bool proceed,
bool* proceed_to_fire_unload) {

Powered by Google App Engine
This is Rietveld 408576698