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

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

Issue 10915217: Hook up SetInstantPreviewHeight for ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor fixes. Created 8 years, 3 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 508fff9f24523528d3bd8804b09a49af50f3bfda..85ba03c82bd5c410c4528d232d8d763a436991c8 100644
--- a/chrome/browser/ui/views/frame/contents_container.cc
+++ b/chrome/browser/ui/views/frame/contents_container.cc
@@ -18,7 +18,8 @@ ContentsContainer::ContentsContainer(views::WebView* active)
overlay_(NULL),
preview_(NULL),
preview_web_contents_(NULL),
- active_top_margin_(0) {
+ active_top_margin_(0),
+ preview_height_(-1) {
AddChildView(active_);
}
@@ -84,6 +85,12 @@ gfx::Rect ContentsContainer::GetPreviewBounds() {
return gfx::Rect(screen_loc, size());
}
+void ContentsContainer::SetPreviewHeight(int value, bool is_percent) {
+ preview_height_ = is_percent ? (value * height()) / 100 : value;
+
+ Layout();
+}
+
void ContentsContainer::Layout() {
int content_y = active_top_margin_;
int content_height = std::max(0, height() - content_y);
@@ -95,7 +102,9 @@ void ContentsContainer::Layout() {
overlay_->SetBounds(0, 0, width(), height());
if (preview_)
- preview_->SetBounds(0, 0, width(), height());
+ preview_->SetBounds(0, 0, width(),
+ (preview_height_ < 0 || preview_height_ > height() ?
+ height() : preview_height_));
// Need to invoke views::View in case any views whose bounds didn't change
// still need a layout.

Powered by Google App Engine
This is Rietveld 408576698