OLD | NEW |
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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 // TODO(pkasting): Port Mac to use this. | 7 // TODO(pkasting): Port Mac to use this. |
8 #if defined(TOOLKIT_VIEWS) || defined(TOOLKIT_GTK) | 8 #if defined(TOOLKIT_VIEWS) || defined(TOOLKIT_GTK) |
9 | 9 |
10 #include "chrome/browser/infobars/infobar_container.h" | 10 #include "chrome/browser/infobars/infobar_container.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 if (infobar_service_) { | 64 if (infobar_service_) { |
65 content::Source<InfoBarService> source(infobar_service_); | 65 content::Source<InfoBarService> source(infobar_service_); |
66 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, | 66 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, |
67 source); | 67 source); |
68 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, | 68 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, |
69 source); | 69 source); |
70 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED, | 70 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED, |
71 source); | 71 source); |
72 | 72 |
73 for (size_t i = 0; i < infobar_service_->GetInfoBarCount(); ++i) { | 73 for (size_t i = 0; i < infobar_service_->infobar_count(); ++i) { |
74 // As when we removed the infobars above, we prevent callbacks to | 74 // As when we removed the infobars above, we prevent callbacks to |
75 // OnInfoBarAnimated() for each infobar. | 75 // OnInfoBarAnimated() for each infobar. |
76 AddInfoBar( | 76 AddInfoBar( |
77 infobar_service_->GetInfoBarDelegateAt(i)->CreateInfoBar( | 77 infobar_service_->infobar_at(i)->CreateInfoBar(infobar_service_), |
78 infobar_service_), | |
79 i, false, NO_CALLBACK); | 78 i, false, NO_CALLBACK); |
80 } | 79 } |
81 } | 80 } |
82 | 81 |
83 // Now that everything is up to date, signal the delegate to re-layout. | 82 // Now that everything is up to date, signal the delegate to re-layout. |
84 OnInfoBarStateChanged(false); | 83 OnInfoBarStateChanged(false); |
85 } | 84 } |
86 | 85 |
87 int InfoBarContainer::GetVerticalOverlap(int* total_height) { | 86 int InfoBarContainer::GetVerticalOverlap(int* total_height) { |
88 // Our |total_height| is the sum of the preferred heights of the InfoBars | 87 // Our |total_height| is the sum of the preferred heights of the InfoBars |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 return InfoBar::kDefaultArrowTargetHeight; | 259 return InfoBar::kDefaultArrowTargetHeight; |
261 // When the first infobar is animating closed, we animate the second infobar's | 260 // When the first infobar is animating closed, we animate the second infobar's |
262 // arrow target height from the default to the top target height. Note that | 261 // arrow target height from the default to the top target height. Note that |
263 // the animation values here are going from 1.0 -> 0.0 as the top bar closes. | 262 // the animation values here are going from 1.0 -> 0.0 as the top bar closes. |
264 return top_arrow_target_height_ + static_cast<int>( | 263 return top_arrow_target_height_ + static_cast<int>( |
265 (InfoBar::kDefaultArrowTargetHeight - top_arrow_target_height_) * | 264 (InfoBar::kDefaultArrowTargetHeight - top_arrow_target_height_) * |
266 first_infobar_animation.GetCurrentValue()); | 265 first_infobar_animation.GetCurrentValue()); |
267 } | 266 } |
268 | 267 |
269 #endif // TOOLKIT_VIEWS || defined(TOOLKIT_GTK) | 268 #endif // TOOLKIT_VIEWS || defined(TOOLKIT_GTK) |
OLD | NEW |