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

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

Issue 7810002: Move infobar handling to a tab helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 9 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
« no previous file with comments | « chrome/browser/plugin_observer.cc ('k') | chrome/browser/tab_contents/infobar_container.cc » ('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 "build/build_config.h" 9 #include "build/build_config.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "chrome/browser/infobars/infobar_tab_helper.h"
11 #include "chrome/browser/tab_contents/infobar_container.h" 12 #include "chrome/browser/tab_contents/infobar_container.h"
12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
13 #include "ui/base/animation/slide_animation.h" 14 #include "ui/base/animation/slide_animation.h"
14 15
15 SkColor GetInfoBarTopColor(InfoBarDelegate::Type infobar_type) { 16 SkColor GetInfoBarTopColor(InfoBarDelegate::Type infobar_type) {
16 // Yellow 17 // Yellow
17 static const SkColor kWarningBackgroundColorTop = 18 static const SkColor kWarningBackgroundColorTop =
18 SkColorSetRGB(255, 242, 183); 19 SkColorSetRGB(255, 242, 183);
19 // Gray 20 // Gray
20 static const SkColor kPageActionBackgroundColorTop = 21 static const SkColor kPageActionBackgroundColorTop =
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 98 }
98 99
99 void InfoBar::AnimationProgressed(const ui::Animation* animation) { 100 void InfoBar::AnimationProgressed(const ui::Animation* animation) {
100 RecalculateHeights(false); 101 RecalculateHeights(false);
101 } 102 }
102 103
103 void InfoBar::RemoveSelf() { 104 void InfoBar::RemoveSelf() {
104 // |owner_| can be NULL here, e.g. because the user clicks the close button 105 // |owner_| can be NULL here, e.g. because the user clicks the close button
105 // when the infobar is already closing. 106 // when the infobar is already closing.
106 if (delegate_ && owner_) 107 if (delegate_ && owner_)
107 owner_->RemoveInfoBar(delegate_); 108 owner_->infobar_tab_helper()->RemoveInfoBar(delegate_);
108 } 109 }
109 110
110 void InfoBar::SetBarTargetHeight(int height) { 111 void InfoBar::SetBarTargetHeight(int height) {
111 if (bar_target_height_ != height) { 112 if (bar_target_height_ != height) {
112 bar_target_height_ = height; 113 bar_target_height_ = height;
113 RecalculateHeights(false); 114 RecalculateHeights(false);
114 } 115 }
115 } 116 }
116 117
117 int InfoBar::OffsetY(const gfx::Size& prefsize) const { 118 int InfoBar::OffsetY(const gfx::Size& prefsize) const {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 void InfoBar::MaybeDelete() { 176 void InfoBar::MaybeDelete() {
176 if (!owner_ && delegate_ && (animation_.GetCurrentValue() == 0.0)) { 177 if (!owner_ && delegate_ && (animation_.GetCurrentValue() == 0.0)) {
177 if (container_) 178 if (container_)
178 container_->RemoveInfoBar(this); 179 container_->RemoveInfoBar(this);
179 delegate_->InfoBarClosed(); 180 delegate_->InfoBarClosed();
180 delegate_ = NULL; 181 delegate_ = NULL;
181 } 182 }
182 } 183 }
183 184
184 #endif // TOOLKIT_VIEWS || TOOLKIT_GTK 185 #endif // TOOLKIT_VIEWS || TOOLKIT_GTK
OLDNEW
« no previous file with comments | « chrome/browser/plugin_observer.cc ('k') | chrome/browser/tab_contents/infobar_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698