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

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

Issue 2721783002: Disable info bar animations during automated testing. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « chrome/browser/infobars/infobar_service.cc ('k') | components/infobars/core/infobar_manager.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 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/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // and at worst disastrous to call that. 116 // and at worst disastrous to call that.
117 delegate_ = NULL; 117 delegate_ = NULL;
118 ChangeInfoBarManager(NULL); 118 ChangeInfoBarManager(NULL);
119 } 119 }
120 120
121 void InfoBarContainer::OnInfoBarAdded(InfoBar* infobar) { 121 void InfoBarContainer::OnInfoBarAdded(InfoBar* infobar) {
122 AddInfoBar(infobar, infobars_.size(), true); 122 AddInfoBar(infobar, infobars_.size(), true);
123 } 123 }
124 124
125 void InfoBarContainer::OnInfoBarRemoved(InfoBar* infobar, bool animate) { 125 void InfoBarContainer::OnInfoBarRemoved(InfoBar* infobar, bool animate) {
126 infobar->Hide(animate); 126 DCHECK(infobar_manager_);
127 infobar->Hide(infobar_manager_->animations_enabled() && animate);
127 UpdateInfoBarArrowTargetHeights(); 128 UpdateInfoBarArrowTargetHeights();
128 } 129 }
129 130
130 void InfoBarContainer::OnInfoBarReplaced(InfoBar* old_infobar, 131 void InfoBarContainer::OnInfoBarReplaced(InfoBar* old_infobar,
131 InfoBar* new_infobar) { 132 InfoBar* new_infobar) {
132 PlatformSpecificReplaceInfoBar(old_infobar, new_infobar); 133 PlatformSpecificReplaceInfoBar(old_infobar, new_infobar);
133 InfoBars::const_iterator i(std::find(infobars_.begin(), infobars_.end(), 134 InfoBars::const_iterator i(std::find(infobars_.begin(), infobars_.end(),
134 old_infobar)); 135 old_infobar));
135 DCHECK(i != infobars_.end()); 136 DCHECK(i != infobars_.end());
136 size_t position = i - infobars_.begin(); 137 size_t position = i - infobars_.begin();
(...skipping 10 matching lines...) Expand all
147 void InfoBarContainer::AddInfoBar(InfoBar* infobar, 148 void InfoBarContainer::AddInfoBar(InfoBar* infobar,
148 size_t position, 149 size_t position,
149 bool animate) { 150 bool animate) {
150 DCHECK(std::find(infobars_.begin(), infobars_.end(), infobar) == 151 DCHECK(std::find(infobars_.begin(), infobars_.end(), infobar) ==
151 infobars_.end()); 152 infobars_.end());
152 DCHECK_LE(position, infobars_.size()); 153 DCHECK_LE(position, infobars_.size());
153 infobars_.insert(infobars_.begin() + position, infobar); 154 infobars_.insert(infobars_.begin() + position, infobar);
154 UpdateInfoBarArrowTargetHeights(); 155 UpdateInfoBarArrowTargetHeights();
155 PlatformSpecificAddInfoBar(infobar, position); 156 PlatformSpecificAddInfoBar(infobar, position);
156 infobar->set_container(this); 157 infobar->set_container(this);
157 infobar->Show(animate); 158 DCHECK(infobar_manager_);
159 infobar->Show(infobar_manager_->animations_enabled() && animate);
158 160
159 // Record the infobar being displayed. 161 // Record the infobar being displayed.
160 DCHECK_NE(InfoBarDelegate::INVALID, infobar->delegate()->GetIdentifier()); 162 DCHECK_NE(InfoBarDelegate::INVALID, infobar->delegate()->GetIdentifier());
161 UMA_HISTOGRAM_SPARSE_SLOWLY("InfoBar.Shown", 163 UMA_HISTOGRAM_SPARSE_SLOWLY("InfoBar.Shown",
162 infobar->delegate()->GetIdentifier()); 164 infobar->delegate()->GetIdentifier());
163 } 165 }
164 166
165 } // namespace infobars 167 } // namespace infobars
OLDNEW
« no previous file with comments | « chrome/browser/infobars/infobar_service.cc ('k') | components/infobars/core/infobar_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698