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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 1998493002: Update omnibox chips in MD (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: slight refactor Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 122dfdc4c0c6104e3bc956f5791fafee00ae155d..14861072c928eee6b4a4335b431f446555d951d5 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -218,10 +218,13 @@ void LocationBarView::Init() {
const int bubble_height = location_height - (bubble_padding * 2);
gfx::FontList bubble_font_list =
font_list.DeriveWithHeightUpperBound(bubble_height);
+ gfx::FontList chip_font_list = ui::MaterialDesignController::IsModeMaterial()
+ ? font_list
+ : bubble_font_list;
const SkColor background_color = GetColor(BACKGROUND);
location_icon_view_ =
- new LocationIconView(bubble_font_list, background_color, this);
+ new LocationIconView(chip_font_list, background_color, this);
location_icon_view_->set_drag_controller(this);
AddChildView(location_icon_view_);
@@ -248,7 +251,7 @@ void LocationBarView::Init() {
const SkColor selected_text_color = GetColor(TEXT);
selected_keyword_view_ = new SelectedKeywordView(
- bubble_font_list, selected_text_color, background_color, profile());
+ chip_font_list, selected_text_color, background_color, profile());
AddChildView(selected_keyword_view_);
suggested_text_view_ = new views::Label(base::string16(), font_list);
@@ -269,7 +272,7 @@ void LocationBarView::Init() {
for (ContentSettingImageModel* model : models.get()) {
// ContentSettingImageView takes ownership of its model.
ContentSettingImageView* image_view = new ContentSettingImageView(
- model, this, bubble_font_list, background_color);
+ model, this, chip_font_list, background_color);
content_setting_views_.push_back(image_view);
image_view->SetVisible(false);
AddChildView(image_view);
@@ -330,7 +333,8 @@ SkColor LocationBarView::GetColor(
case EV_BUBBLE_TEXT_AND_BORDER:
return ui::MaterialDesignController::IsModeMaterial()
- ? gfx::kGoogleGreen700
+ ? GetSecureTextColor(
+ GetToolbarModel()->GetSecurityLevel(false))
: SkColorSetRGB(7, 149, 0);
}
NOTREACHED();
@@ -353,8 +357,10 @@ SkColor LocationBarView::GetSecureTextColor(
return text_color;
if (security_level == security_state::SecurityStateModel::SECURITY_ERROR)
text_color = md ? gfx::kGoogleRed700 : SkColorSetRGB(162, 0, 0);
+ else if (md)
+ return gfx::kGoogleGreen700;
else
- text_color = GetColor(EV_BUBBLE_TEXT_AND_BORDER);
+ return GetColor(EV_BUBBLE_TEXT_AND_BORDER);
Peter Kasting 2016/05/25 00:03:27 Nit: Shorter, and avoids else after return: i
Evan Stade 2016/05/25 20:03:44 good suggestion. Since we're switching on md so mu
}
return color_utils::GetReadableColor(text_color, GetColor(BACKGROUND));
}
@@ -564,8 +570,10 @@ void LocationBarView::Layout() {
LocationBarLayout leading_decorations(
LocationBarLayout::LEFT_EDGE, item_padding,
- item_padding - omnibox_view_->GetInsets().left() -
- GetEditLeadingInternalSpace());
+ ui::MaterialDesignController::IsModeMaterial()
+ ? GetLayoutConstant(LOCATION_BAR_PRE_EDIT_SPACING)
+ : (item_padding - omnibox_view_->GetInsets().left() -
+ GetEditLeadingInternalSpace()));
Peter Kasting 2016/05/25 00:03:27 Won't not factoring in GetEditLeadingInternalSpace
Evan Stade 2016/05/25 20:03:44 changed RTL is tricky to get precisely correct be
LocationBarLayout trailing_decorations(
LocationBarLayout::RIGHT_EDGE, item_padding, trailing_edge_item_padding);
@@ -849,22 +857,15 @@ void LocationBarView::RefreshLocationIcon() {
return;
if (ui::MaterialDesignController::IsModeMaterial()) {
- gfx::VectorIconId icon_id = gfx::VectorIconId::VECTOR_ICON_NONE;
const int kIconSize = 16;
- SkColor icon_color = gfx::kPlaceholderColor;
- if (ShouldShowEVBubble()) {
- icon_id = gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID_IN_CHIP;
- icon_color = location_icon_view_->GetTextColor();
- } else {
- icon_id = omnibox_view_->GetVectorIcon();
- security_state::SecurityStateModel::SecurityLevel security_level =
- GetToolbarModel()->GetSecurityLevel(false);
- icon_color = (security_level == security_state::SecurityStateModel::NONE)
- ? color_utils::DeriveDefaultIconColor(GetColor(TEXT))
- : GetSecureTextColor(security_level);
- }
- location_icon_view_->SetImage(
- gfx::CreateVectorIcon(icon_id, kIconSize, icon_color));
+ security_state::SecurityStateModel::SecurityLevel security_level =
+ GetToolbarModel()->GetSecurityLevel(false);
+ SkColor icon_color =
+ (security_level == security_state::SecurityStateModel::NONE)
+ ? color_utils::DeriveDefaultIconColor(GetColor(TEXT))
+ : GetSecureTextColor(security_level);
+ location_icon_view_->SetImage(gfx::CreateVectorIcon(
+ omnibox_view_->GetVectorIcon(), kIconSize, icon_color));
} else {
location_icon_view_->SetImage(
*GetThemeProvider()->GetImageSkiaNamed(omnibox_view_->GetIcon()));

Powered by Google App Engine
This is Rietveld 408576698