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

Side by Side Diff: ash/system/tray/tray_details_view.cc

Issue 10332152: Add TraySms for SMS messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix bubble sizing code Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/system/tray/tray_constants.cc ('k') | ash/system/tray/tray_views.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/system/tray/tray_details_view.h" 5 #include "ash/system/tray/tray_details_view.h"
6 6
7 #include "ash/system/tray/tray_constants.h" 7 #include "ash/system/tray/tray_constants.h"
8 #include "ash/system/tray/tray_views.h" 8 #include "ash/system/tray/tray_views.h"
9 #include "ui/views/background.h" 9 #include "ui/views/background.h"
10 #include "ui/views/controls/scroll_view.h" 10 #include "ui/views/controls/scroll_view.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 void TrayDetailsView::Layout() { 54 void TrayDetailsView::Layout() {
55 if (!scroller_ || !footer_ || bounds().IsEmpty()) { 55 if (!scroller_ || !footer_ || bounds().IsEmpty()) {
56 views::View::Layout(); 56 views::View::Layout();
57 return; 57 return;
58 } 58 }
59 59
60 scroller_->set_fixed_size(gfx::Size()); 60 scroller_->set_fixed_size(gfx::Size());
61 gfx::Size size = GetPreferredSize(); 61 gfx::Size size = GetPreferredSize();
62 if (size.height() < height()) { 62 if (size.height() > height()) {
63 // The available size is larger than the requested size. In this case, do
64 // the normal layout, then make sure the footer element is bottom aligned.
65 views::View::Layout();
66 gfx::Rect fbounds = footer_->bounds();
67 fbounds.set_y(height() - footer_->height());
68 footer_->SetBoundsRect(fbounds);
69 } else {
70 // The available size is smaller than the requested size. Squeeze the 63 // The available size is smaller than the requested size. Squeeze the
71 // scroller so that everything fits in the available size, and then do the 64 // scroller so that everything fits in the available size.
72 // normal layout.
73 gfx::Size scroller_size = scroll_content_->GetPreferredSize(); 65 gfx::Size scroller_size = scroll_content_->GetPreferredSize();
74 scroller_->set_fixed_size(gfx::Size( 66 scroller_->set_fixed_size(gfx::Size(
75 width() + scroller_->GetScrollBarWidth(), 67 width() + scroller_->GetScrollBarWidth(),
76 scroller_size.height() - (size.height() - height()))); 68 scroller_size.height() - (size.height() - height())));
77 views::View::Layout();
78 } 69 }
70 views::View::Layout();
71 // Always make sure the footer element is bottom aligned.
72 gfx::Rect fbounds = footer_->bounds();
73 fbounds.set_y(height() - footer_->height());
74 footer_->SetBoundsRect(fbounds);
79 } 75 }
80 76
81 } // namespace internal 77 } // namespace internal
82 } // namespace ash 78 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/tray_constants.cc ('k') | ash/system/tray/tray_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698