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

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: Move height to ShowPreview. 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
« no previous file with comments | « chrome/browser/ui/views/frame/contents_container.h ('k') | chrome/test/base/test_browser_window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3ad5317b13b3ffcbd54bcc4bab546fc51cdfd035 100644
--- a/chrome/browser/ui/views/frame/contents_container.cc
+++ b/chrome/browser/ui/views/frame/contents_container.cc
@@ -18,7 +18,9 @@ ContentsContainer::ContentsContainer(views::WebView* active)
overlay_(NULL),
preview_(NULL),
preview_web_contents_(NULL),
- active_top_margin_(0) {
+ active_top_margin_(0),
+ preview_height_(100),
+ preview_height_units_(INSTANT_SIZE_PERCENT) {
AddChildView(active_);
}
@@ -54,17 +56,21 @@ void ContentsContainer::MakePreviewContentsActiveContents() {
}
void ContentsContainer::SetPreview(views::WebView* preview,
- WebContents* preview_web_contents) {
- if (preview == preview_)
+ WebContents* preview_web_contents,
+ int height,
+ InstantSizeUnits units) {
+ if (preview == preview_ &&
+ height == preview_height_ && units == preview_height_units_)
return;
if (preview_)
RemoveChildView(preview_);
preview_ = preview;
preview_web_contents_ = preview_web_contents;
+ preview_height_ = height;
+ preview_height_units_ = units;
if (preview_)
AddChildView(preview_);
-
Layout();
sreeram 2012/09/19 19:59:52 This method needs to be slightly different: void
Jered 2012/09/19 20:22:18 Done.
}
@@ -95,13 +101,25 @@ void ContentsContainer::Layout() {
overlay_->SetBounds(0, 0, width(), height());
if (preview_)
- preview_->SetBounds(0, 0, width(), height());
+ preview_->SetBounds(0, 0, width(), PreviewHeightInPixels());
// Need to invoke views::View in case any views whose bounds didn't change
// still need a layout.
views::View::Layout();
}
+int ContentsContainer::PreviewHeightInPixels() const {
+ switch (preview_height_units_) {
+ case INSTANT_SIZE_PERCENT:
+ return std::min(height(), (height() * preview_height_) / 100);
+
+ case INSTANT_SIZE_PIXELS:
+ return std::min(height(), preview_height_);
+ }
+ NOTREACHED() << "unknown units: " << preview_height_units_;
+ return 0;
+}
+
std::string ContentsContainer::GetClassName() const {
return kViewClassName;
}
« no previous file with comments | « chrome/browser/ui/views/frame/contents_container.h ('k') | chrome/test/base/test_browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698