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

Side by Side Diff: chrome/browser/ui/views/infobars/infobar_view.cc

Issue 15067008: [InfoBar] Add InfoBarDelegate::GetIconID() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit fixes redux Created 7 years, 7 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
OLDNEW
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 close_button_->SetBounds(std::max(start_x + ContentMinimumWidth(), 209 close_button_->SetBounds(std::max(start_x + ContentMinimumWidth(),
210 width() - kHorizontalPadding - button_size.width()), OffsetY(button_size), 210 width() - kHorizontalPadding - button_size.width()), OffsetY(button_size),
211 button_size.width(), button_size.height()); 211 button_size.width(), button_size.height());
212 } 212 }
213 213
214 void InfoBarView::ViewHierarchyChanged( 214 void InfoBarView::ViewHierarchyChanged(
215 const ViewHierarchyChangedDetails& details) { 215 const ViewHierarchyChangedDetails& details) {
216 View::ViewHierarchyChanged(details); 216 View::ViewHierarchyChanged(details);
217 217
218 if (details.is_add && (details.child == this) && (close_button_ == NULL)) { 218 if (details.is_add && (details.child == this) && (close_button_ == NULL)) {
219 gfx::Image* image = delegate()->GetIcon(); 219 gfx::Image image = delegate()->GetIcon();
220 if (image) { 220 if (!image.IsEmpty()) {
221 icon_ = new views::ImageView; 221 icon_ = new views::ImageView;
222 icon_->SetImage(image->ToImageSkia()); 222 icon_->SetImage(image.ToImageSkia());
223 AddChildView(icon_); 223 AddChildView(icon_);
224 } 224 }
225 225
226 close_button_ = new views::ImageButton(this); 226 close_button_ = new views::ImageButton(this);
227 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 227 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
228 close_button_->SetImage(views::CustomButton::STATE_NORMAL, 228 close_button_->SetImage(views::CustomButton::STATE_NORMAL,
229 rb.GetImageNamed(IDR_CLOSE_1).ToImageSkia()); 229 rb.GetImageNamed(IDR_CLOSE_1).ToImageSkia());
230 close_button_->SetImage(views::CustomButton::STATE_HOVERED, 230 close_button_->SetImage(views::CustomButton::STATE_HOVERED,
231 rb.GetImageNamed(IDR_CLOSE_1_H).ToImageSkia()); 231 rb.GetImageNamed(IDR_CLOSE_1_H).ToImageSkia());
232 close_button_->SetImage(views::CustomButton::STATE_PRESSED, 232 close_button_->SetImage(views::CustomButton::STATE_PRESSED,
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 // This will trigger some screen readers to read the entire contents of this 380 // This will trigger some screen readers to read the entire contents of this
381 // infobar. 381 // infobar.
382 if (focused_before && focused_now && !Contains(focused_before) && 382 if (focused_before && focused_now && !Contains(focused_before) &&
383 Contains(focused_now)) { 383 Contains(focused_now)) {
384 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true); 384 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true);
385 } 385 }
386 } 386 }
387 387
388 void InfoBarView::OnDidChangeFocus(View* focused_before, View* focused_now) { 388 void InfoBarView::OnDidChangeFocus(View* focused_before, View* focused_now) {
389 } 389 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698