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

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

Issue 7130001: Make infobar background gray (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 9 years, 6 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
« no previous file with comments | « chrome/browser/tab_contents/infobar.h ('k') | chrome/browser/themes/theme_service_mac.mm » ('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 (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 #if defined(TOOLKIT_VIEWS) // TODO(pkasting): Port non-views to use this.
6
7 #include "chrome/browser/tab_contents/infobar.h" 5 #include "chrome/browser/tab_contents/infobar.h"
8 6
9 #include <cmath> 7 #include <cmath>
10 8
11 #include "base/logging.h" 9 #include "base/logging.h"
12 #include "chrome/browser/tab_contents/infobar_container.h" 10 #include "chrome/browser/tab_contents/infobar_container.h"
13 #include "chrome/browser/tab_contents/infobar_delegate.h"
14 #include "ui/base/animation/slide_animation.h" 11 #include "ui/base/animation/slide_animation.h"
15 12
13 SkColor GetInfoBarTopColor(InfoBarDelegate::Type infobar_type) {
14 // Yellow
15 static const SkColor kWarningBackgroundColorTop =
16 SkColorSetRGB(255, 242, 183);
17 // Gray
18 static const SkColor kPageActionBackgroundColorTop =
19 SkColorSetRGB(237, 237, 237);
20
21 return (infobar_type == InfoBarDelegate::WARNING_TYPE) ?
22 kWarningBackgroundColorTop : kPageActionBackgroundColorTop;
23 }
24
25 SkColor GetInfoBarBottomColor(InfoBarDelegate::Type infobar_type) {
26 // Yellow
27 static const SkColor kWarningBackgroundColorBottom =
28 SkColorSetRGB(250, 230, 145);
29 // Gray
30 static const SkColor kPageActionBackgroundColorBottom =
31 SkColorSetRGB(217, 217, 217);
32
33 return (infobar_type == InfoBarDelegate::WARNING_TYPE) ?
34 kWarningBackgroundColorBottom : kPageActionBackgroundColorBottom;
35 }
36
37 #if defined(TOOLKIT_VIEWS) // TODO(pkasting): Port non-views to use this.
38
16 InfoBar::InfoBar(TabContentsWrapper* owner, InfoBarDelegate* delegate) 39 InfoBar::InfoBar(TabContentsWrapper* owner, InfoBarDelegate* delegate)
17 : owner_(owner), 40 : owner_(owner),
18 delegate_(delegate), 41 delegate_(delegate),
19 container_(NULL), 42 container_(NULL),
20 ALLOW_THIS_IN_INITIALIZER_LIST(animation_(new ui::SlideAnimation(this))), 43 ALLOW_THIS_IN_INITIALIZER_LIST(animation_(new ui::SlideAnimation(this))),
21 arrow_height_(0), 44 arrow_height_(0),
22 arrow_target_height_(kDefaultArrowTargetHeight), 45 arrow_target_height_(kDefaultArrowTargetHeight),
23 arrow_half_width_(0), 46 arrow_half_width_(0),
24 bar_height_(0), 47 bar_height_(0),
25 bar_target_height_(kDefaultBarTargetHeight) { 48 bar_target_height_(kDefaultBarTargetHeight) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 container_->RemoveInfoBar(this); 163 container_->RemoveInfoBar(this);
141 // Note that we only tell the delegate we're closed here, and not when we're 164 // Note that we only tell the delegate we're closed here, and not when we're
142 // simply destroyed (by virtue of a tab switch or being moved from window to 165 // simply destroyed (by virtue of a tab switch or being moved from window to
143 // window), since this action can cause the delegate to destroy itself. 166 // window), since this action can cause the delegate to destroy itself.
144 delegate_->InfoBarClosed(); 167 delegate_->InfoBarClosed();
145 delegate_ = NULL; 168 delegate_ = NULL;
146 } 169 }
147 } 170 }
148 171
149 #endif // TOOLKIT_VIEWS 172 #endif // TOOLKIT_VIEWS
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/infobar.h ('k') | chrome/browser/themes/theme_service_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698