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

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

Issue 1406613002: For some vector icons, get the size from the vector definition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 if (!image.IsEmpty()) { 218 if (!image.IsEmpty()) {
219 icon_ = new views::ImageView; 219 icon_ = new views::ImageView;
220 icon_->SetImage(image.ToImageSkia()); 220 icon_->SetImage(image.ToImageSkia());
221 icon_->SizeToPreferredSize(); 221 icon_->SizeToPreferredSize();
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 226
227 if (ui::MaterialDesignController::IsModeMaterial()) { 227 if (ui::MaterialDesignController::IsModeMaterial()) {
228 gfx::ImageSkia image = gfx::CreateVectorIcon(gfx::VectorIconId::BAR_CLOSE, 228 gfx::ImageSkia image = gfx::CreatePrimaryVectorIcon(
229 16, gfx::kChromeIconGrey); 229 gfx::VectorIconId::BAR_CLOSE, gfx::kChromeIconGrey);
230 close_button_->SetImage(views::CustomButton::STATE_NORMAL, &image); 230 close_button_->SetImage(views::CustomButton::STATE_NORMAL, &image);
231 } else { 231 } else {
232 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 232 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
233 close_button_->SetImage(views::CustomButton::STATE_NORMAL, 233 close_button_->SetImage(views::CustomButton::STATE_NORMAL,
234 rb.GetImageNamed(IDR_CLOSE_1).ToImageSkia()); 234 rb.GetImageNamed(IDR_CLOSE_1).ToImageSkia());
235 close_button_->SetImage(views::CustomButton::STATE_HOVERED, 235 close_button_->SetImage(views::CustomButton::STATE_HOVERED,
236 rb.GetImageNamed(IDR_CLOSE_1_H).ToImageSkia()); 236 rb.GetImageNamed(IDR_CLOSE_1_H).ToImageSkia());
237 close_button_->SetImage(views::CustomButton::STATE_PRESSED, 237 close_button_->SetImage(views::CustomButton::STATE_PRESSED,
238 rb.GetImageNamed(IDR_CLOSE_1_P).ToImageSkia()); 238 rb.GetImageNamed(IDR_CLOSE_1_P).ToImageSkia());
239 } 239 }
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) { 399 void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) {
400 views::ExternalFocusTracker::OnWillChangeFocus(focused_before, focused_now); 400 views::ExternalFocusTracker::OnWillChangeFocus(focused_before, focused_now);
401 401
402 // This will trigger some screen readers to read the entire contents of this 402 // This will trigger some screen readers to read the entire contents of this
403 // infobar. 403 // infobar.
404 if (focused_before && focused_now && !Contains(focused_before) && 404 if (focused_before && focused_now && !Contains(focused_before) &&
405 Contains(focused_now)) { 405 Contains(focused_now)) {
406 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 406 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
407 } 407 }
408 } 408 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698