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

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

Issue 10830353: Introduce InfoBarTabService API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments, merge to LKGR Created 8 years, 4 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 // 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 tab_helper_ = tab_helper; 47 tab_helper_ = tab_helper;
48 if (tab_helper_) { 48 if (tab_helper_) {
49 content::Source<InfoBarTabHelper> th_source(tab_helper_); 49 content::Source<InfoBarTabHelper> th_source(tab_helper_);
50 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, 50 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
51 th_source); 51 th_source);
52 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, 52 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED,
53 th_source); 53 th_source);
54 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED, 54 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED,
55 th_source); 55 th_source);
56 56
57 for (size_t i = 0; i < tab_helper_->infobar_count(); ++i) { 57 for (size_t i = 0; i < tab_helper_->GetInfoBarCount(); ++i) {
58 // As when we removed the infobars above, we prevent callbacks to 58 // As when we removed the infobars above, we prevent callbacks to
59 // OnInfoBarAnimated() for each infobar. 59 // OnInfoBarAnimated() for each infobar.
60 AddInfoBar( 60 AddInfoBar(
61 tab_helper_->GetInfoBarDelegateAt(i)->CreateInfoBar(tab_helper_), 61 tab_helper_->GetInfoBarDelegateAt(i)->CreateInfoBar(tab_helper_),
62 i, false, NO_CALLBACK); 62 i, false, NO_CALLBACK);
63 } 63 }
64 } 64 }
65 65
66 // Now that everything is up to date, signal the delegate to re-layout. 66 // Now that everything is up to date, signal the delegate to re-layout.
67 OnInfoBarStateChanged(false); 67 OnInfoBarStateChanged(false);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 return InfoBar::kDefaultArrowTargetHeight; 211 return InfoBar::kDefaultArrowTargetHeight;
212 // When the first infobar is animating closed, we animate the second infobar's 212 // When the first infobar is animating closed, we animate the second infobar's
213 // arrow target height from the default to the top target height. Note that 213 // arrow target height from the default to the top target height. Note that
214 // the animation values here are going from 1.0 -> 0.0 as the top bar closes. 214 // the animation values here are going from 1.0 -> 0.0 as the top bar closes.
215 return top_arrow_target_height_ + static_cast<int>( 215 return top_arrow_target_height_ + static_cast<int>(
216 (InfoBar::kDefaultArrowTargetHeight - top_arrow_target_height_) * 216 (InfoBar::kDefaultArrowTargetHeight - top_arrow_target_height_) *
217 first_infobar_animation.GetCurrentValue()); 217 first_infobar_animation.GetCurrentValue());
218 } 218 }
219 219
220 #endif // TOOLKIT_VIEWS || defined(TOOLKIT_GTK) 220 #endif // TOOLKIT_VIEWS || defined(TOOLKIT_GTK)
OLDNEW
« no previous file with comments | « chrome/browser/google/google_url_tracker.cc ('k') | chrome/browser/infobars/infobar_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698