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

Unified Diff: chrome/browser/ui/views/frame/contents_container.cc

Issue 12386019: Instant: Use only one hidden WebContents per profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 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/browser/ui/views/frame/contents_container.cc
diff --git a/chrome/browser/ui/views/frame/contents_container.cc b/chrome/browser/ui/views/frame/contents_container.cc
index 4603f9ad3e48af8d39346db592288a6423291ba2..1124219419786a5e4fa82f9d0ec38d3ae79a84c1 100644
--- a/chrome/browser/ui/views/frame/contents_container.cc
+++ b/chrome/browser/ui/views/frame/contents_container.cc
@@ -84,8 +84,8 @@ ContentsContainer::ContentsContainer(views::WebView* active)
overlay_web_contents_(NULL),
draw_drop_shadow_(false),
active_top_margin_(0),
- overlay_height_(100),
- overlay_height_units_(INSTANT_SIZE_PERCENT) {
+ overlay_height_(0),
+ overlay_height_units_(INSTANT_SIZE_PIXELS) {
AddChildView(active_);
}
@@ -123,14 +123,13 @@ void ContentsContainer::SetOverlay(views::WebView* overlay,
if (overlay_ == overlay && overlay_web_contents_ == overlay_web_contents &&
overlay_height_ == height && overlay_height_units_ == units &&
- draw_drop_shadow_ == draw_drop_shadow) {
+ draw_drop_shadow_ == draw_drop_shadow)
return;
- }
if (overlay_ != overlay) {
if (overlay_) {
// Order of children is important: always |active_| first, then
- // |overlay_|, then shadow view if necessary. To make sure the next view
+ // |overlay_|, then shadow view if necessary. To make sure the next view
// is added in the right order, remove shadow view every time |overlay_|
// is removed. Don't nuke the shadow view now in case it's needed below
// when we handle |draw_drop_shadow|.
@@ -173,16 +172,16 @@ void ContentsContainer::SetOverlay(views::WebView* overlay,
// Add shadow view if there's overlay and drop shadow is needed.
// Remove shadow view if there's no overlay.
// If there's overlay and drop shadow is not needed, that means the partial-
- // height overlay is going to be full-height. Don't remove the shadow view
- // yet because its view will disappear noticeably faster than the webview-ed
+ // height overlay is going to be full-height. Don't remove the shadow view yet
+ // because its view will disappear noticeably faster than the webview-ed
// overlay is repainted at the full height - when resizing web contents page,
// RenderWidgetHostViewAura locks the compositor until texture is updated or
- // timeout occurs. This out-of-sync refresh results in a split second where
+ // timeout occurs. This out-of-sync refresh results in a split second where
// there's no separator between the overlay and active contents, making the
- // overlay contents erroneously appear to be part of active contents.
- // When the overlay is repainted at the full height, we'll be notified via
- // NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKGING_STORE, at which time
- // the shadow view will be removed.
+ // overlay contents erroneously appear to be part of active contents. When the
+ // overlay is repainted at the full height, we'll be notified via
+ // NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE, at which time the
+ // shadow view will be removed.
if (overlay_ && draw_drop_shadow_) {
#if !defined(OS_WIN)
if (!shadow_view_.get()) // Shadow view has not been created.
@@ -197,24 +196,6 @@ void ContentsContainer::SetOverlay(views::WebView* overlay,
Layout();
}
-void ContentsContainer::MaybeStackOverlayAtTop() {
- if (!overlay_)
- return;
- // To force |overlay_| to the topmost in the z-order, remove it, then add it
- // back.
- // See comments in SetOverlay() for why shadow view is removed.
- bool removed_shadow = false;
- if (shadow_view_.get()) {
- RemoveChildView(shadow_view_.get());
- removed_shadow = true;
- }
- RemoveChildView(overlay_);
- AddChildView(overlay_);
- if (removed_shadow) // Add back shadow view if it was removed.
- AddChildView(shadow_view_.get());
- Layout();
-}
-
void ContentsContainer::SetActiveTopMargin(int margin) {
if (active_top_margin_ == margin)
return;

Powered by Google App Engine
This is Rietveld 408576698