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

Side by Side Diff: chrome/browser/infobars/infobar_container.cc

Issue 23531053: ui/base/animation -> ui/gfx/animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 2 trunk Created 7 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 unified diff | Download patch | Annotate | Revision Log
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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/infobars/infobar_container.h" 7 #include "chrome/browser/infobars/infobar_container.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/infobars/infobar.h" 13 #include "chrome/browser/infobars/infobar.h"
14 #include "chrome/browser/infobars/infobar_delegate.h" 14 #include "chrome/browser/infobars/infobar_delegate.h"
15 #include "chrome/browser/infobars/infobar_service.h" 15 #include "chrome/browser/infobars/infobar_service.h"
16 #include "content/public/browser/notification_details.h" 16 #include "content/public/browser/notification_details.h"
17 #include "content/public/browser/notification_source.h" 17 #include "content/public/browser/notification_source.h"
18 #include "ui/base/animation/slide_animation.h" 18 #include "ui/gfx/animation/slide_animation.h"
19 19
20 InfoBarContainer::Delegate::~Delegate() { 20 InfoBarContainer::Delegate::~Delegate() {
21 } 21 }
22 22
23 InfoBarContainer::InfoBarContainer(Delegate* delegate) 23 InfoBarContainer::InfoBarContainer(Delegate* delegate)
24 : delegate_(delegate), 24 : delegate_(delegate),
25 infobar_service_(NULL), 25 infobar_service_(NULL),
26 top_arrow_target_height_(InfoBar::kDefaultArrowTargetHeight) { 26 top_arrow_target_height_(InfoBar::kDefaultArrowTargetHeight) {
27 } 27 }
28 28
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 void InfoBarContainer::UpdateInfoBarArrowTargetHeights() { 214 void InfoBarContainer::UpdateInfoBarArrowTargetHeights() {
215 for (size_t i = 0; i < infobars_.size(); ++i) 215 for (size_t i = 0; i < infobars_.size(); ++i)
216 infobars_[i]->SetArrowTargetHeight(ArrowTargetHeightForInfoBar(i)); 216 infobars_[i]->SetArrowTargetHeight(ArrowTargetHeightForInfoBar(i));
217 } 217 }
218 218
219 int InfoBarContainer::ArrowTargetHeightForInfoBar(size_t infobar_index) const { 219 int InfoBarContainer::ArrowTargetHeightForInfoBar(size_t infobar_index) const {
220 if (!delegate_ || !delegate_->DrawInfoBarArrows(NULL)) 220 if (!delegate_ || !delegate_->DrawInfoBarArrows(NULL))
221 return 0; 221 return 0;
222 if (infobar_index == 0) 222 if (infobar_index == 0)
223 return top_arrow_target_height_; 223 return top_arrow_target_height_;
224 const ui::SlideAnimation& first_infobar_animation = 224 const gfx::SlideAnimation& first_infobar_animation =
225 const_cast<const InfoBar*>(infobars_.front())->animation(); 225 const_cast<const InfoBar*>(infobars_.front())->animation();
226 if ((infobar_index > 1) || first_infobar_animation.IsShowing()) 226 if ((infobar_index > 1) || first_infobar_animation.IsShowing())
227 return InfoBar::kDefaultArrowTargetHeight; 227 return InfoBar::kDefaultArrowTargetHeight;
228 // When the first infobar is animating closed, we animate the second infobar's 228 // When the first infobar is animating closed, we animate the second infobar's
229 // arrow target height from the default to the top target height. Note that 229 // arrow target height from the default to the top target height. Note that
230 // the animation values here are going from 1.0 -> 0.0 as the top bar closes. 230 // the animation values here are going from 1.0 -> 0.0 as the top bar closes.
231 return top_arrow_target_height_ + static_cast<int>( 231 return top_arrow_target_height_ + static_cast<int>(
232 (InfoBar::kDefaultArrowTargetHeight - top_arrow_target_height_) * 232 (InfoBar::kDefaultArrowTargetHeight - top_arrow_target_height_) *
233 first_infobar_animation.GetCurrentValue()); 233 first_infobar_animation.GetCurrentValue());
234 } 234 }
OLDNEW
« no previous file with comments | « chrome/browser/infobars/infobar.cc ('k') | chrome/browser/ui/autofill/autofill_dialog_controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698