Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1590 if (parent) | 1590 if (parent) |
| 1591 UpdateWebContentsVisibility(window->IsVisible()); | 1591 UpdateWebContentsVisibility(window->IsVisible()); |
| 1592 } | 1592 } |
| 1593 | 1593 |
| 1594 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window, | 1594 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window, |
| 1595 bool visible) { | 1595 bool visible) { |
| 1596 // Ignore any visibility changes in the hierarchy below. | 1596 // Ignore any visibility changes in the hierarchy below. |
| 1597 if (window != window_.get() && window_->Contains(window)) | 1597 if (window != window_.get() && window_->Contains(window)) |
| 1598 return; | 1598 return; |
| 1599 | 1599 |
| 1600 UpdateWebContentsVisibility(visible); | 1600 UpdateWebContentsVisibility(visible); |
|
oshima
2014/09/04 16:39:23
If we use window_->IsVisible() here, instead of
vi
Mr4D (OOO till 08-26)
2014/09/04 19:10:57
Very complicated at this place.
a. Window_->IsVis
oshima
2014/09/04 22:11:01
Yes, I believe that's what we want in UpdateWebCon
Mr4D (OOO till 08-26)
2014/09/04 22:36:52
Acknowledged.
| |
| 1601 } | 1601 } |
| 1602 | 1602 |
| 1603 void WebContentsViewAura::UpdateWebContentsVisibility(bool visible) { | 1603 void WebContentsViewAura::UpdateWebContentsVisibility(bool visible) { |
| 1604 #if defined(USE_ATHENA) | |
| 1605 // In Athena the resources/visibility get controlled by Activities and the | |
| 1606 // ResourceManager and not the window visibility. | |
|
oshima
2014/09/03 23:15:00
have you consult this approach (if def) with conte
Mr4D (OOO till 08-26)
2014/09/04 19:10:57
We don't do this. I have to come up with a differe
| |
| 1607 #else | |
| 1604 if (!is_or_was_visible_) { | 1608 if (!is_or_was_visible_) { |
| 1605 // We should not hide the web contents before it was shown the first time, | 1609 // We should not hide the web contents before it was shown the first time, |
| 1606 // since resources would immediately be destroyed and only re-created after | 1610 // since resources would immediately be destroyed and only re-created after |
| 1607 // content got loaded. In this state the window content is undefined and can | 1611 // content got loaded. In this state the window content is undefined and can |
| 1608 // show garbage. | 1612 // show garbage. |
| 1609 // However - the page load mechanism requires an activation call through a | 1613 // However - the page load mechanism requires an activation call through a |
| 1610 // visibility call to (re)load. | 1614 // visibility call to (re)load. |
| 1611 if (visible) { | 1615 if (visible) { |
| 1612 is_or_was_visible_ = true; | 1616 is_or_was_visible_ = true; |
| 1613 web_contents_->WasShown(); | 1617 web_contents_->WasShown(); |
| 1614 } | 1618 } |
| 1615 return; | 1619 return; |
| 1616 } | 1620 } |
| 1617 if (visible) { | 1621 if (visible) { |
| 1618 if (!web_contents_->should_normally_be_visible()) | 1622 if (!web_contents_->should_normally_be_visible()) |
| 1619 web_contents_->WasShown(); | 1623 web_contents_->WasShown(); |
| 1620 } else { | 1624 } else { |
| 1621 if (web_contents_->should_normally_be_visible()) | 1625 if (web_contents_->should_normally_be_visible()) |
| 1622 web_contents_->WasHidden(); | 1626 web_contents_->WasHidden(); |
| 1623 } | 1627 } |
| 1628 #endif | |
| 1624 } | 1629 } |
| 1625 | 1630 |
| 1626 } // namespace content | 1631 } // namespace content |
| OLD | NEW |