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

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

Issue 2667753006: Make new target for vector icon structs to replace ui/gfx/vector_icons/ (Closed)
Patch Set: fix deps Created 3 years, 10 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
« no previous file with comments | « chrome/browser/ui/views/find_bar_view.cc ('k') | ui/gfx/vector_icons/BUILD.gn » ('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) 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 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/browser/ui/infobar_container_delegate.h" 13 #include "chrome/browser/ui/infobar_container_delegate.h"
14 #include "chrome/browser/ui/views/infobars/infobar_background.h" 14 #include "chrome/browser/ui/views/infobars/infobar_background.h"
15 #include "chrome/grit/generated_resources.h" 15 #include "chrome/grit/generated_resources.h"
16 #include "chrome/grit/theme_resources.h" 16 #include "chrome/grit/theme_resources.h"
17 #include "components/infobars/core/infobar_delegate.h" 17 #include "components/infobars/core/infobar_delegate.h"
18 #include "components/strings/grit/components_strings.h" 18 #include "components/strings/grit/components_strings.h"
19 #include "third_party/skia/include/effects/SkGradientShader.h" 19 #include "third_party/skia/include/effects/SkGradientShader.h"
20 #include "ui/accessibility/ax_node_data.h" 20 #include "ui/accessibility/ax_node_data.h"
21 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
22 #include "ui/gfx/canvas.h" 22 #include "ui/gfx/canvas.h"
23 #include "ui/gfx/color_palette.h" 23 #include "ui/gfx/color_palette.h"
24 #include "ui/gfx/image/image.h" 24 #include "ui/gfx/image/image.h"
25 #include "ui/gfx/paint_vector_icon.h" 25 #include "ui/gfx/paint_vector_icon.h"
26 #include "ui/gfx/vector_icons_public.h"
27 #include "ui/native_theme/common_theme.h" 26 #include "ui/native_theme/common_theme.h"
28 #include "ui/native_theme/native_theme.h" 27 #include "ui/native_theme/native_theme.h"
28 #include "ui/vector_icons/vector_icons.h"
29 #include "ui/views/controls/button/image_button.h" 29 #include "ui/views/controls/button/image_button.h"
30 #include "ui/views/controls/button/label_button_border.h" 30 #include "ui/views/controls/button/label_button_border.h"
31 #include "ui/views/controls/button/md_text_button.h" 31 #include "ui/views/controls/button/md_text_button.h"
32 #include "ui/views/controls/button/menu_button.h" 32 #include "ui/views/controls/button/menu_button.h"
33 #include "ui/views/controls/button/vector_icon_button.h" 33 #include "ui/views/controls/button/vector_icon_button.h"
34 #include "ui/views/controls/image_view.h" 34 #include "ui/views/controls/image_view.h"
35 #include "ui/views/controls/label.h" 35 #include "ui/views/controls/label.h"
36 #include "ui/views/controls/link.h" 36 #include "ui/views/controls/link.h"
37 #include "ui/views/controls/menu/menu_runner.h" 37 #include "ui/views/controls/menu/menu_runner.h"
38 #include "ui/views/layout/layout_constants.h" 38 #include "ui/views/layout/layout_constants.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 if (details.is_add && (details.child == this) && (close_button_ == NULL)) { 159 if (details.is_add && (details.child == this) && (close_button_ == NULL)) {
160 gfx::Image image = delegate()->GetIcon(); 160 gfx::Image image = delegate()->GetIcon();
161 if (!image.IsEmpty()) { 161 if (!image.IsEmpty()) {
162 icon_ = new views::ImageView; 162 icon_ = new views::ImageView;
163 icon_->SetImage(image.ToImageSkia()); 163 icon_->SetImage(image.ToImageSkia());
164 icon_->SizeToPreferredSize(); 164 icon_->SizeToPreferredSize();
165 child_container_->AddChildView(icon_); 165 child_container_->AddChildView(icon_);
166 } 166 }
167 167
168 close_button_ = new views::VectorIconButton(this); 168 close_button_ = new views::VectorIconButton(this);
169 close_button_->SetIcon(gfx::VectorIconId::BAR_CLOSE); 169 close_button_->SetIcon(ui::kCloseIcon);
170 close_button_->SetAccessibleName( 170 close_button_->SetAccessibleName(
171 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); 171 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE));
172 close_button_->SetFocusForPlatform(); 172 close_button_->SetFocusForPlatform();
173 // Subclasses should already be done adding child views by this point (see 173 // Subclasses should already be done adding child views by this point (see
174 // related DCHECK in Layout()). 174 // related DCHECK in Layout()).
175 child_container_->AddChildView(close_button_); 175 child_container_->AddChildView(close_button_);
176 } 176 }
177 177
178 // Ensure the infobar is tall enough to display its contents. 178 // Ensure the infobar is tall enough to display its contents.
179 int height = InfoBarContainerDelegate::kDefaultBarTargetHeight; 179 int height = InfoBarContainerDelegate::kDefaultBarTargetHeight;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 } 302 }
303 303
304 bool InfoBarView::DoesIntersectRect(const View* target, 304 bool InfoBarView::DoesIntersectRect(const View* target,
305 const gfx::Rect& rect) const { 305 const gfx::Rect& rect) const {
306 DCHECK_EQ(this, target); 306 DCHECK_EQ(this, target);
307 // Only events that intersect the portion below the arrow are interesting. 307 // Only events that intersect the portion below the arrow are interesting.
308 gfx::Rect non_arrow_bounds = GetLocalBounds(); 308 gfx::Rect non_arrow_bounds = GetLocalBounds();
309 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); 309 non_arrow_bounds.Inset(0, arrow_height(), 0, 0);
310 return rect.Intersects(non_arrow_bounds); 310 return rect.Intersects(non_arrow_bounds);
311 } 311 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/find_bar_view.cc ('k') | ui/gfx/vector_icons/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698