| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/infobars/infobar_view.h" | 5 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 button_size.width(), button_size.height()); | 211 button_size.width(), button_size.height()); |
| 212 } | 212 } |
| 213 | 213 |
| 214 void InfoBarView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { | 214 void InfoBarView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { |
| 215 View::ViewHierarchyChanged(is_add, parent, child); | 215 View::ViewHierarchyChanged(is_add, parent, child); |
| 216 | 216 |
| 217 if (is_add && (child == this) && (close_button_ == NULL)) { | 217 if (is_add && (child == this) && (close_button_ == NULL)) { |
| 218 gfx::Image* image = delegate()->GetIcon(); | 218 gfx::Image* image = delegate()->GetIcon(); |
| 219 if (image) { | 219 if (image) { |
| 220 icon_ = new views::ImageView; | 220 icon_ = new views::ImageView; |
| 221 icon_->SetImage(image->ToSkBitmap()); | 221 icon_->SetImage(image->ToImageSkia()); |
| 222 AddChildView(icon_); | 222 AddChildView(icon_); |
| 223 } | 223 } |
| 224 | 224 |
| 225 close_button_ = new views::ImageButton(this); | 225 close_button_ = new views::ImageButton(this); |
| 226 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 226 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 227 close_button_->SetImage(views::CustomButton::BS_NORMAL, | 227 close_button_->SetImage(views::CustomButton::BS_NORMAL, |
| 228 rb.GetImageNamed(IDR_CLOSE_BAR).ToSkBitmap()); | 228 rb.GetImageNamed(IDR_CLOSE_BAR).ToImageSkia()); |
| 229 close_button_->SetImage(views::CustomButton::BS_HOT, | 229 close_button_->SetImage(views::CustomButton::BS_HOT, |
| 230 rb.GetImageNamed(IDR_CLOSE_BAR_H).ToSkBitmap()); | 230 rb.GetImageNamed(IDR_CLOSE_BAR_H).ToImageSkia()); |
| 231 close_button_->SetImage(views::CustomButton::BS_PUSHED, | 231 close_button_->SetImage(views::CustomButton::BS_PUSHED, |
| 232 rb.GetImageNamed(IDR_CLOSE_BAR_P).ToSkBitmap()); | 232 rb.GetImageNamed(IDR_CLOSE_BAR_P).ToImageSkia()); |
| 233 close_button_->SetAccessibleName( | 233 close_button_->SetAccessibleName( |
| 234 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); | 234 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |
| 235 close_button_->set_focusable(true); | 235 close_button_->set_focusable(true); |
| 236 AddChildView(close_button_); | 236 AddChildView(close_button_); |
| 237 } else if ((close_button_ != NULL) && (parent == this) && | 237 } else if ((close_button_ != NULL) && (parent == this) && |
| 238 (child != close_button_) && (close_button_->parent() == this) && | 238 (child != close_button_) && (close_button_->parent() == this) && |
| 239 (child_at(child_count() - 1) != close_button_)) { | 239 (child_at(child_count() - 1) != close_button_)) { |
| 240 // For accessibility, ensure the close button is the last child view. | 240 // For accessibility, ensure the close button is the last child view. |
| 241 RemoveChildView(close_button_); | 241 RemoveChildView(close_button_); |
| 242 AddChildView(close_button_); | 242 AddChildView(close_button_); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 // infobar. | 375 // infobar. |
| 376 if (focused_before && focused_now && !Contains(focused_before) && | 376 if (focused_before && focused_now && !Contains(focused_before) && |
| 377 Contains(focused_now) && GetWidget()) { | 377 Contains(focused_now) && GetWidget()) { |
| 378 GetWidget()->NotifyAccessibilityEvent( | 378 GetWidget()->NotifyAccessibilityEvent( |
| 379 this, ui::AccessibilityTypes::EVENT_ALERT, true); | 379 this, ui::AccessibilityTypes::EVENT_ALERT, true); |
| 380 } | 380 } |
| 381 } | 381 } |
| 382 | 382 |
| 383 void InfoBarView::OnDidChangeFocus(View* focused_before, View* focused_now) { | 383 void InfoBarView::OnDidChangeFocus(View* focused_before, View* focused_now) { |
| 384 } | 384 } |
| OLD | NEW |