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

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

Issue 1448433004: [MD] update EV bubble icon and location bar https icons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix build.gn Created 5 years, 1 month 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/ev_bubble_view.h" 5 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h"
6 #include "grit/theme_resources.h" 6 #include "grit/theme_resources.h"
7 #include "ui/base/resource/material_design/material_design_controller.h" 7 #include "ui/base/resource/material_design/material_design_controller.h"
8 #include "ui/gfx/paint_vector_icon.h"
9 #include "ui/gfx/vector_icons_public.h"
8 #include "ui/views/controls/label.h" 10 #include "ui/views/controls/label.h"
9 #include "ui/views/painter.h" 11 #include "ui/views/painter.h"
10 12
11 EVBubbleView::EVBubbleView(const gfx::FontList& font_list, 13 EVBubbleView::EVBubbleView(const gfx::FontList& font_list,
12 SkColor text_color, 14 SkColor text_color,
13 SkColor parent_background_color, 15 SkColor parent_background_color,
14 LocationBarView* location_bar) 16 LocationBarView* location_bar)
15 : IconLabelBubbleView(IDR_OMNIBOX_HTTPS_VALID, 17 : IconLabelBubbleView(ui::MaterialDesignController::IsModeMaterial()
18 ? 0
19 : IDR_OMNIBOX_HTTPS_VALID,
16 font_list, 20 font_list,
17 text_color, 21 text_color,
18 parent_background_color, 22 parent_background_color,
19 true), 23 true),
20 text_color_(text_color), 24 text_color_(text_color),
21 page_info_helper_(this, location_bar) { 25 page_info_helper_(this, location_bar) {
22 if (!ui::MaterialDesignController::IsModeMaterial()) { 26 if (!ui::MaterialDesignController::IsModeMaterial()) {
23 static const int kBackgroundImages[] = IMAGE_GRID(IDR_OMNIBOX_EV_BUBBLE); 27 static const int kBackgroundImages[] = IMAGE_GRID(IDR_OMNIBOX_EV_BUBBLE);
24 SetBackgroundImageGrid(kBackgroundImages); 28 SetBackgroundImageGrid(kBackgroundImages);
25 } 29 }
(...skipping 24 matching lines...) Expand all
50 page_info_helper_.ProcessEvent(event); 54 page_info_helper_.ProcessEvent(event);
51 } 55 }
52 56
53 void EVBubbleView::OnGestureEvent(ui::GestureEvent* event) { 57 void EVBubbleView::OnGestureEvent(ui::GestureEvent* event) {
54 if (event->type() == ui::ET_GESTURE_TAP) { 58 if (event->type() == ui::ET_GESTURE_TAP) {
55 page_info_helper_.ProcessEvent(*event); 59 page_info_helper_.ProcessEvent(*event);
56 event->SetHandled(); 60 event->SetHandled();
57 } 61 }
58 } 62 }
59 63
64 void EVBubbleView::OnNativeThemeChanged(const ui::NativeTheme* native_theme) {
65 if (ui::MaterialDesignController::IsModeMaterial()) {
66 SetImage(gfx::CreateVectorIcon(
67 gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID_IN_CHIP, 16,
68 GetTextColor()));
69 }
70
71 IconLabelBubbleView::OnNativeThemeChanged(native_theme);
72 }
73
60 gfx::Size EVBubbleView::GetMinimumSizeForLabelText( 74 gfx::Size EVBubbleView::GetMinimumSizeForLabelText(
61 const base::string16& text) const { 75 const base::string16& text) const {
62 views::Label label(text, font_list()); 76 views::Label label(text, font_list());
63 return GetMinimumSizeForPreferredSize( 77 return GetMinimumSizeForPreferredSize(
64 GetSizeForLabelWidth(label.GetPreferredSize().width())); 78 GetSizeForLabelWidth(label.GetPreferredSize().width()));
65 } 79 }
66 80
67 gfx::Size EVBubbleView::GetMinimumSizeForPreferredSize(gfx::Size size) const { 81 gfx::Size EVBubbleView::GetMinimumSizeForPreferredSize(gfx::Size size) const {
68 const int kMinCharacters = 10; 82 const int kMinCharacters = 10;
69 size.SetToMin( 83 size.SetToMin(
70 GetSizeForLabelWidth(font_list().GetExpectedTextWidth(kMinCharacters))); 84 GetSizeForLabelWidth(font_list().GetExpectedTextWidth(kMinCharacters)));
71 return size; 85 return size;
72 } 86 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/ev_bubble_view.h ('k') | chrome/browser/ui/views/location_bar/icon_label_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698