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

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

Issue 1142153002: Simplify infobar expiry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Android compile Created 5 years, 7 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.h" 5 #include "components/infobars/core/infobar.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 SkColorSetRGB(250, 230, 145); // Yellow 49 SkColorSetRGB(250, 230, 145); // Yellow
50 static const SkColor kPageActionBackgroundColorBottom = 50 static const SkColor kPageActionBackgroundColorBottom =
51 SkColorSetRGB(217, 217, 217); // Gray 51 SkColorSetRGB(217, 217, 217); // Gray
52 return (infobar_type == InfoBarDelegate::WARNING_TYPE) ? 52 return (infobar_type == InfoBarDelegate::WARNING_TYPE) ?
53 kWarningBackgroundColorBottom : kPageActionBackgroundColorBottom; 53 kWarningBackgroundColorBottom : kPageActionBackgroundColorBottom;
54 } 54 }
55 55
56 void InfoBar::SetOwner(InfoBarManager* owner) { 56 void InfoBar::SetOwner(InfoBarManager* owner) {
57 DCHECK(!owner_); 57 DCHECK(!owner_);
58 owner_ = owner; 58 owner_ = owner;
59 delegate_->StoreActiveEntryUniqueID();
60 PlatformSpecificSetOwner(); 59 PlatformSpecificSetOwner();
61 } 60 }
62 61
63 void InfoBar::Show(bool animate) { 62 void InfoBar::Show(bool animate) {
64 PlatformSpecificShow(animate); 63 PlatformSpecificShow(animate);
65 if (animate) { 64 if (animate) {
66 animation_.Show(); 65 animation_.Show();
67 } else { 66 } else {
68 animation_.Reset(1.0); 67 animation_.Reset(1.0);
69 RecalculateHeights(true); 68 RecalculateHeights(true);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 152
154 void InfoBar::MaybeDelete() { 153 void InfoBar::MaybeDelete() {
155 if (!owner_ && (animation_.GetCurrentValue() == 0.0)) { 154 if (!owner_ && (animation_.GetCurrentValue() == 0.0)) {
156 if (container_) 155 if (container_)
157 container_->RemoveInfoBar(this); 156 container_->RemoveInfoBar(this);
158 delete this; 157 delete this;
159 } 158 }
160 } 159 }
161 160
162 } // namespace infobars 161 } // namespace infobars
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698