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

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

Issue 7182004: infobars: Use TCW directly in InfoBar to remove the delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | « no previous file | chrome/browser/tab_contents/infobar_container.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 (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/tab_contents/infobar.h" 5 #include "chrome/browser/tab_contents/infobar.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/tab_contents/infobar_container.h" 10 #include "chrome/browser/tab_contents/infobar_container.h"
11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
11 #include "ui/base/animation/slide_animation.h" 12 #include "ui/base/animation/slide_animation.h"
12 13
13 SkColor GetInfoBarTopColor(InfoBarDelegate::Type infobar_type) { 14 SkColor GetInfoBarTopColor(InfoBarDelegate::Type infobar_type) {
14 // Yellow 15 // Yellow
15 static const SkColor kWarningBackgroundColorTop = 16 static const SkColor kWarningBackgroundColorTop =
16 SkColorSetRGB(255, 242, 183); 17 SkColorSetRGB(255, 242, 183);
17 // Gray 18 // Gray
18 static const SkColor kPageActionBackgroundColorTop = 19 static const SkColor kPageActionBackgroundColorTop =
19 SkColorSetRGB(237, 237, 237); 20 SkColorSetRGB(237, 237, 237);
20 21
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 arrow_target_height_ = height; 82 arrow_target_height_ = height;
82 RecalculateHeights(false); 83 RecalculateHeights(false);
83 } 84 }
84 } 85 }
85 86
86 void InfoBar::AnimationProgressed(const ui::Animation* animation) { 87 void InfoBar::AnimationProgressed(const ui::Animation* animation) {
87 RecalculateHeights(false); 88 RecalculateHeights(false);
88 } 89 }
89 90
90 void InfoBar::RemoveInfoBar() { 91 void InfoBar::RemoveInfoBar() {
91 if (container_) 92 owner_->RemoveInfoBar(delegate_);
92 container_->RemoveDelegate(delegate_);
93 } 93 }
94 94
95 void InfoBar::SetBarTargetHeight(int height) { 95 void InfoBar::SetBarTargetHeight(int height) {
96 if (bar_target_height_ != height) { 96 if (bar_target_height_ != height) {
97 bar_target_height_ = height; 97 bar_target_height_ = height;
98 RecalculateHeights(false); 98 RecalculateHeights(false);
99 } 99 }
100 } 100 }
101 101
102 int InfoBar::OffsetY(const gfx::Size& prefsize) const { 102 int InfoBar::OffsetY(const gfx::Size& prefsize) const {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 container_->RemoveInfoBar(this); 163 container_->RemoveInfoBar(this);
164 // 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
165 // 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
166 // window), since this action can cause the delegate to destroy itself. 166 // window), since this action can cause the delegate to destroy itself.
167 delegate_->InfoBarClosed(); 167 delegate_->InfoBarClosed();
168 delegate_ = NULL; 168 delegate_ = NULL;
169 } 169 }
170 } 170 }
171 171
172 #endif // TOOLKIT_VIEWS 172 #endif // TOOLKIT_VIEWS
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/tab_contents/infobar_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698