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

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

Issue 23338005: Mac InfoBar: Use cross platform infobar classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/infobars/infobar.h" 5 #include "chrome/browser/infobars/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 12 matching lines...) Expand all
23 23
24 SkColor GetInfoBarBottomColor(InfoBarDelegate::Type infobar_type) { 24 SkColor GetInfoBarBottomColor(InfoBarDelegate::Type infobar_type) {
25 static const SkColor kWarningBackgroundColorBottom = 25 static const SkColor kWarningBackgroundColorBottom =
26 SkColorSetRGB(250, 230, 145); // Yellow 26 SkColorSetRGB(250, 230, 145); // Yellow
27 static const SkColor kPageActionBackgroundColorBottom = 27 static const SkColor kPageActionBackgroundColorBottom =
28 SkColorSetRGB(217, 217, 217); // Gray 28 SkColorSetRGB(217, 217, 217); // Gray
29 return (infobar_type == InfoBarDelegate::WARNING_TYPE) ? 29 return (infobar_type == InfoBarDelegate::WARNING_TYPE) ?
30 kWarningBackgroundColorBottom : kPageActionBackgroundColorBottom; 30 kWarningBackgroundColorBottom : kPageActionBackgroundColorBottom;
31 } 31 }
32 32
33 // TODO(pkasting): Port Mac to use this.
34 #if defined(TOOLKIT_VIEWS) || defined(TOOLKIT_GTK) || defined(OS_ANDROID)
35
36 InfoBar::InfoBar(InfoBarService* owner, InfoBarDelegate* delegate) 33 InfoBar::InfoBar(InfoBarService* owner, InfoBarDelegate* delegate)
37 : owner_(owner), 34 : owner_(owner),
38 delegate_(delegate), 35 delegate_(delegate),
39 container_(NULL), 36 container_(NULL),
40 animation_(this), 37 animation_(this),
41 arrow_height_(0), 38 arrow_height_(0),
42 arrow_target_height_(kDefaultArrowTargetHeight), 39 arrow_target_height_(kDefaultArrowTargetHeight),
43 arrow_half_width_(0), 40 arrow_half_width_(0),
44 bar_height_(0), 41 bar_height_(0),
45 bar_target_height_(kDefaultBarTargetHeight) { 42 bar_target_height_(kDefaultBarTargetHeight) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 171 }
175 172
176 void InfoBar::MaybeDelete() { 173 void InfoBar::MaybeDelete() {
177 if (!owner_ && delegate_ && (animation_.GetCurrentValue() == 0.0)) { 174 if (!owner_ && delegate_ && (animation_.GetCurrentValue() == 0.0)) {
178 if (container_) 175 if (container_)
179 container_->RemoveInfoBar(this); 176 container_->RemoveInfoBar(this);
180 delete delegate_; 177 delete delegate_;
181 delegate_ = NULL; 178 delegate_ = NULL;
182 } 179 }
183 } 180 }
184
185 #endif // TOOLKIT_VIEWS || TOOLKIT_GTK || OS_ANDROID
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698