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

Side by Side Diff: components/infobars/core/infobar_container.cc

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 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 | « components/infobars/core/infobar_container.h ('k') | content/shell/browser/shell_views.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/infobars/core/infobar_container.h" 5 #include "components/infobars/core/infobar_container.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // As when we removed the infobars above, we prevent callbacks to 51 // As when we removed the infobars above, we prevent callbacks to
52 // OnInfoBarStateChanged() for each infobar. 52 // OnInfoBarStateChanged() for each infobar.
53 AddInfoBar(infobar_manager_->infobar_at(i), i, false, NO_CALLBACK); 53 AddInfoBar(infobar_manager_->infobar_at(i), i, false, NO_CALLBACK);
54 } 54 }
55 } 55 }
56 56
57 // Now that everything is up to date, signal the delegate to re-layout. 57 // Now that everything is up to date, signal the delegate to re-layout.
58 OnInfoBarStateChanged(false); 58 OnInfoBarStateChanged(false);
59 } 59 }
60 60
61 int InfoBarContainer::GetVerticalOverlap(int* total_height) { 61 int InfoBarContainer::GetVerticalOverlap(int* total_height) const {
62 // Our |total_height| is the sum of the preferred heights of the InfoBars 62 // Our |total_height| is the sum of the preferred heights of the InfoBars
63 // contained within us plus the |vertical_overlap|. 63 // contained within us plus the |vertical_overlap|.
64 int vertical_overlap = 0; 64 int vertical_overlap = 0;
65 int next_infobar_y = 0; 65 int next_infobar_y = 0;
66 66
67 for (InfoBars::iterator i(infobars_.begin()); i != infobars_.end(); ++i) { 67 for (InfoBars::const_iterator i(infobars_.begin()); i != infobars_.end();
68 ++i) {
68 InfoBar* infobar = *i; 69 InfoBar* infobar = *i;
69 next_infobar_y -= infobar->arrow_height(); 70 next_infobar_y -= infobar->arrow_height();
70 vertical_overlap = std::max(vertical_overlap, -next_infobar_y); 71 vertical_overlap = std::max(vertical_overlap, -next_infobar_y);
71 next_infobar_y += infobar->total_height(); 72 next_infobar_y += infobar->total_height();
72 } 73 }
73 74
74 if (total_height) 75 if (total_height)
75 *total_height = next_infobar_y + vertical_overlap; 76 *total_height = next_infobar_y + vertical_overlap;
76 return vertical_overlap; 77 return vertical_overlap;
77 } 78 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 return InfoBar::kDefaultArrowTargetHeight; 170 return InfoBar::kDefaultArrowTargetHeight;
170 // When the first infobar is animating closed, we animate the second infobar's 171 // When the first infobar is animating closed, we animate the second infobar's
171 // arrow target height from the default to the top target height. Note that 172 // arrow target height from the default to the top target height. Note that
172 // the animation values here are going from 1.0 -> 0.0 as the top bar closes. 173 // the animation values here are going from 1.0 -> 0.0 as the top bar closes.
173 return top_arrow_target_height_ + static_cast<int>( 174 return top_arrow_target_height_ + static_cast<int>(
174 (InfoBar::kDefaultArrowTargetHeight - top_arrow_target_height_) * 175 (InfoBar::kDefaultArrowTargetHeight - top_arrow_target_height_) *
175 first_infobar_animation.GetCurrentValue()); 176 first_infobar_animation.GetCurrentValue());
176 } 177 }
177 178
178 } // namespace infobars 179 } // namespace infobars
OLDNEW
« no previous file with comments | « components/infobars/core/infobar_container.h ('k') | content/shell/browser/shell_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698