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

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

Issue 1520543004: Add method for identifying different InfoBars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: -1 to INVALID Created 4 years, 11 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
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"
11 #include "base/metrics/histogram_base.h"
12 #include "base/metrics/metrics_hashes.h"
13 #include "base/metrics/sparse_histogram.h"
11 #include "build/build_config.h" 14 #include "build/build_config.h"
12 #include "components/infobars/core/infobar.h" 15 #include "components/infobars/core/infobar.h"
13 #include "components/infobars/core/infobar_delegate.h" 16 #include "components/infobars/core/infobar_delegate.h"
14 17
15 namespace infobars { 18 namespace infobars {
16 19
17 InfoBarContainer::Delegate::~Delegate() { 20 InfoBarContainer::Delegate::~Delegate() {
18 } 21 }
19 22
20 InfoBarContainer::InfoBarContainer(Delegate* delegate) 23 InfoBarContainer::InfoBarContainer(Delegate* delegate)
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 size_t position, 148 size_t position,
146 bool animate) { 149 bool animate) {
147 DCHECK(std::find(infobars_.begin(), infobars_.end(), infobar) == 150 DCHECK(std::find(infobars_.begin(), infobars_.end(), infobar) ==
148 infobars_.end()); 151 infobars_.end());
149 DCHECK_LE(position, infobars_.size()); 152 DCHECK_LE(position, infobars_.size());
150 infobars_.insert(infobars_.begin() + position, infobar); 153 infobars_.insert(infobars_.begin() + position, infobar);
151 UpdateInfoBarArrowTargetHeights(); 154 UpdateInfoBarArrowTargetHeights();
152 PlatformSpecificAddInfoBar(infobar, position); 155 PlatformSpecificAddInfoBar(infobar, position);
153 infobar->set_container(this); 156 infobar->set_container(this);
154 infobar->Show(animate); 157 infobar->Show(animate);
158
159 // Record the infobar being displayed.
160 DCHECK(infobar->delegate()->GetIdentifier() != InfoBarDelegate::INVALID);
Peter Kasting 2015/12/30 13:09:26 Nit: DCHECK_NE(InfoBarDelegate::INVALID, infobar->
gone 2015/12/30 18:38:43 Done.
161 UMA_HISTOGRAM_SPARSE_SLOWLY("InfoBar.Shown",
162 infobar->delegate()->GetIdentifier());
155 } 163 }
156 164
157 } // namespace infobars 165 } // namespace infobars
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_cc_infobar_delegate.cc ('k') | components/infobars/core/infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698