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

Side by Side Diff: chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc

Issue 2734113006: "Bootstrap" a toolkit-views Typography spec. (Closed)
Patch Set: Rebase (conflict in layout_delegate.h due to r457774) Created 3 years, 9 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/location_bar/icon_label_bubble_view.h" 5 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h"
6 6
7 #include "chrome/browser/ui/layout_constants.h" 7 #include "chrome/browser/ui/layout_constants.h"
8 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h" 8 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h"
9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
10 #include "ui/accessibility/ax_node_data.h" 10 #include "ui/accessibility/ax_node_data.h"
11 #include "ui/gfx/canvas.h" 11 #include "ui/gfx/canvas.h"
12 #include "ui/gfx/color_utils.h" 12 #include "ui/gfx/color_utils.h"
13 #include "ui/gfx/scoped_canvas.h" 13 #include "ui/gfx/scoped_canvas.h"
14 #include "ui/native_theme/native_theme.h" 14 #include "ui/native_theme/native_theme.h"
15 #include "ui/views/animation/ink_drop_highlight.h" 15 #include "ui/views/animation/ink_drop_highlight.h"
16 #include "ui/views/border.h" 16 #include "ui/views/border.h"
17 #include "ui/views/controls/image_view.h" 17 #include "ui/views/controls/image_view.h"
18 #include "ui/views/widget/widget.h" 18 #include "ui/views/widget/widget.h"
19 19
20 namespace { 20 namespace {
21 21
22 // Amount of space on either side of the separator that appears after the label. 22 // Amount of space on either side of the separator that appears after the label.
23 constexpr int kSpaceBesideSeparator = 8; 23 constexpr int kSpaceBesideSeparator = 8;
24 24
25 } // namespace 25 } // namespace
26 26
27 IconLabelBubbleView::IconLabelBubbleView(const gfx::FontList& font_list, 27 IconLabelBubbleView::IconLabelBubbleView(const gfx::FontList& font_list,
28 bool elide_in_middle) 28 bool elide_in_middle)
29 : image_(new views::ImageView()), 29 : image_(new views::ImageView()),
30 label_(new views::Label(base::string16(), font_list)) { 30 label_(new views::Label(base::string16(), {font_list})) {
31 // Disable separate hit testing for |image_|. This prevents views treating 31 // Disable separate hit testing for |image_|. This prevents views treating
32 // |image_| as a separate mouse hover region from |this|. 32 // |image_| as a separate mouse hover region from |this|.
33 image_->set_can_process_events_within_subtree(false); 33 image_->set_can_process_events_within_subtree(false);
34 image_->SetBorder(views::CreateEmptyBorder( 34 image_->SetBorder(views::CreateEmptyBorder(
35 gfx::Insets(LocationBarView::kIconInteriorPadding))); 35 gfx::Insets(LocationBarView::kIconInteriorPadding)));
36 AddChildView(image_); 36 AddChildView(image_);
37 37
38 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 38 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
39 39
40 if (elide_in_middle) 40 if (elide_in_middle)
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 const SkColor separator_color = SkColorSetA( 226 const SkColor separator_color = SkColorSetA(
227 plain_text_color, color_utils::IsDark(plain_text_color) ? 0x59 : 0xCC); 227 plain_text_color, color_utils::IsDark(plain_text_color) ? 0x59 : 0xCC);
228 228
229 gfx::Rect bounds(label_->bounds()); 229 gfx::Rect bounds(label_->bounds());
230 const int kSeparatorHeight = 16; 230 const int kSeparatorHeight = 16;
231 bounds.Inset(0, (bounds.height() - kSeparatorHeight) / 2); 231 bounds.Inset(0, (bounds.height() - kSeparatorHeight) / 2);
232 bounds.set_width(bounds.width() + kSpaceBesideSeparator); 232 bounds.set_width(bounds.width() + kSpaceBesideSeparator);
233 canvas->Draw1pxLine(gfx::PointF(bounds.top_right()), 233 canvas->Draw1pxLine(gfx::PointF(bounds.top_right()),
234 gfx::PointF(bounds.bottom_right()), separator_color); 234 gfx::PointF(bounds.bottom_right()), separator_color);
235 } 235 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698