OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/infobars/infobars.h" | 5 #include "chrome/browser/views/infobars/infobars.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "app/slide_animation.h" | |
10 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
11 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/views/event_utils.h" | 11 #include "chrome/browser/views/event_utils.h" |
13 #include "chrome/browser/views/infobars/infobar_container.h" | 12 #include "chrome/browser/views/infobars/infobar_container.h" |
14 #include "gfx/canvas.h" | 13 #include "gfx/canvas.h" |
15 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
16 #include "grit/theme_resources.h" | 15 #include "grit/theme_resources.h" |
| 16 #include "ui/base/animation/slide_animation.h" |
17 #include "views/background.h" | 17 #include "views/background.h" |
18 #include "views/controls/button/image_button.h" | 18 #include "views/controls/button/image_button.h" |
19 #include "views/controls/button/native_button.h" | 19 #include "views/controls/button/native_button.h" |
20 #include "views/controls/image_view.h" | 20 #include "views/controls/image_view.h" |
21 #include "views/controls/label.h" | 21 #include "views/controls/label.h" |
22 #include "views/focus/external_focus_tracker.h" | 22 #include "views/focus/external_focus_tracker.h" |
23 #include "views/widget/widget.h" | 23 #include "views/widget/widget.h" |
24 | 24 |
25 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
26 #include "app/win/hwnd_util.h" | 26 #include "app/win/hwnd_util.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 close_button_->SetImage(views::CustomButton::BS_NORMAL, | 112 close_button_->SetImage(views::CustomButton::BS_NORMAL, |
113 rb.GetBitmapNamed(IDR_CLOSE_BAR)); | 113 rb.GetBitmapNamed(IDR_CLOSE_BAR)); |
114 close_button_->SetImage(views::CustomButton::BS_HOT, | 114 close_button_->SetImage(views::CustomButton::BS_HOT, |
115 rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); | 115 rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); |
116 close_button_->SetImage(views::CustomButton::BS_PUSHED, | 116 close_button_->SetImage(views::CustomButton::BS_PUSHED, |
117 rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); | 117 rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); |
118 close_button_->SetAccessibleName( | 118 close_button_->SetAccessibleName( |
119 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE))); | 119 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE))); |
120 AddChildView(close_button_); | 120 AddChildView(close_button_); |
121 | 121 |
122 animation_.reset(new SlideAnimation(this)); | 122 animation_.reset(new ui::SlideAnimation(this)); |
123 animation_->SetTweenType(Tween::LINEAR); | 123 animation_->SetTweenType(ui::Tween::LINEAR); |
124 } | 124 } |
125 | 125 |
126 InfoBar::~InfoBar() { | 126 InfoBar::~InfoBar() { |
127 } | 127 } |
128 | 128 |
129 // InfoBar, views::View overrides: --------------------------------------------- | 129 // InfoBar, views::View overrides: --------------------------------------------- |
130 | 130 |
131 AccessibilityTypes::Role InfoBar::GetAccessibleRole() { | 131 AccessibilityTypes::Role InfoBar::GetAccessibleRole() { |
132 return AccessibilityTypes::ROLE_ALERT; | 132 return AccessibilityTypes::ROLE_ALERT; |
133 } | 133 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 void InfoBar::FocusWillChange(View* focused_before, View* focused_now) { | 204 void InfoBar::FocusWillChange(View* focused_before, View* focused_now) { |
205 // This will trigger some screen readers to read the entire contents of this | 205 // This will trigger some screen readers to read the entire contents of this |
206 // infobar. | 206 // infobar. |
207 if (focused_before && focused_now && | 207 if (focused_before && focused_now && |
208 !this->IsParentOf(focused_before) && this->IsParentOf(focused_now)) { | 208 !this->IsParentOf(focused_before) && this->IsParentOf(focused_now)) { |
209 NotifyAccessibilityEvent(AccessibilityTypes::EVENT_ALERT); | 209 NotifyAccessibilityEvent(AccessibilityTypes::EVENT_ALERT); |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 // InfoBar, AnimationDelegate implementation: ---------------------------------- | 213 // InfoBar, ui::AnimationDelegate implementation: ------------------------------ |
214 | 214 |
215 void InfoBar::AnimationProgressed(const Animation* animation) { | 215 void InfoBar::AnimationProgressed(const ui::Animation* animation) { |
216 if (container_) | 216 if (container_) |
217 container_->InfoBarAnimated(true); | 217 container_->InfoBarAnimated(true); |
218 } | 218 } |
219 | 219 |
220 void InfoBar::AnimationEnded(const Animation* animation) { | 220 void InfoBar::AnimationEnded(const ui::Animation* animation) { |
221 if (container_) { | 221 if (container_) { |
222 container_->InfoBarAnimated(false); | 222 container_->InfoBarAnimated(false); |
223 | 223 |
224 if (!animation_->IsShowing()) | 224 if (!animation_->IsShowing()) |
225 Close(); | 225 Close(); |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 // InfoBar, private: ----------------------------------------------------------- | 229 // InfoBar, private: ----------------------------------------------------------- |
230 | 230 |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 609 |
610 InfoBar* LinkInfoBarDelegate::CreateInfoBar() { | 610 InfoBar* LinkInfoBarDelegate::CreateInfoBar() { |
611 return new LinkInfoBar(this); | 611 return new LinkInfoBar(this); |
612 } | 612 } |
613 | 613 |
614 // ConfirmInfoBarDelegate, InfoBarDelegate overrides: -------------------------- | 614 // ConfirmInfoBarDelegate, InfoBarDelegate overrides: -------------------------- |
615 | 615 |
616 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() { | 616 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() { |
617 return new ConfirmInfoBar(this); | 617 return new ConfirmInfoBar(this); |
618 } | 618 } |
OLD | NEW |