Chromium Code Reviews| Index: chrome/browser/ui/views/location_bar/selected_keyword_view.cc |
| diff --git a/chrome/browser/ui/views/location_bar/selected_keyword_view.cc b/chrome/browser/ui/views/location_bar/selected_keyword_view.cc |
| index 6b2d235ab3927fdeca2b550d07ea3cf0fd259186..9089b0ba3aff1c21e1768881942e5bf64f5a5b13 100644 |
| --- a/chrome/browser/ui/views/location_bar/selected_keyword_view.cc |
| +++ b/chrome/browser/ui/views/location_bar/selected_keyword_view.cc |
| @@ -5,35 +5,22 @@ |
| #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" |
| #include "base/logging.h" |
| -#include "base/strings/utf_string_conversions.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/search_engines/template_url_service_factory.h" |
| #include "chrome/browser/ui/location_bar/location_bar_util.h" |
| -#include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" |
| #include "chrome/grit/generated_resources.h" |
| -#include "chrome/grit/theme_resources.h" |
| -#include "components/grit/components_scaled_resources.h" |
| #include "components/search_engines/template_url_service.h" |
| #include "ui/base/l10n/l10n_util.h" |
| -#include "ui/base/material_design/material_design_controller.h" |
| #include "ui/base/theme_provider.h" |
| #include "ui/gfx/color_palette.h" |
| #include "ui/gfx/color_utils.h" |
| #include "ui/gfx/paint_vector_icon.h" |
| #include "ui/gfx/vector_icons_public.h" |
| #include "ui/native_theme/native_theme.h" |
| -#include "ui/views/painter.h" |
| SelectedKeywordView::SelectedKeywordView(const gfx::FontList& font_list, |
| - SkColor text_color, |
| - SkColor parent_background_color, |
| Profile* profile) |
| - : IconLabelBubbleView(0, font_list, parent_background_color, false), |
| - text_color_(text_color), |
| - profile_(profile) { |
| - static const int kBackgroundImages[] = |
| - IMAGE_GRID(IDR_OMNIBOX_SELECTED_KEYWORD_BUBBLE); |
| - SetBackgroundImageGrid(kBackgroundImages); |
| + : IconLabelBubbleView(font_list, false), profile_(profile) { |
| full_label_.SetFontList(font_list); |
| full_label_.SetVisible(false); |
| partial_label_.SetFontList(font_list); |
| @@ -44,30 +31,17 @@ SelectedKeywordView::~SelectedKeywordView() { |
| } |
| void SelectedKeywordView::ResetImage() { |
| - if (ui::MaterialDesignController::IsModeMaterial()) { |
| - SetImage(gfx::CreateVectorIcon(gfx::VectorIconId::OMNIBOX_SEARCH, |
| - 16, |
| - GetTextColor())); |
| - } else { |
| - SetImage(*GetThemeProvider()->GetImageSkiaNamed(IDR_OMNIBOX_SEARCH)); |
| - } |
| + SetImage( |
| + gfx::CreateVectorIcon(gfx::VectorIconId::OMNIBOX_SEARCH, GetTextColor())); |
|
Peter Kasting
2016/09/20 20:18:05
Explicit size not needed?
Evan Stade
2016/09/21 17:05:00
correct, it's part of this icon's definition
|
| } |
| SkColor SelectedKeywordView::GetTextColor() const { |
| - if (!ui::MaterialDesignController::IsModeMaterial()) |
| - return text_color_; |
| - |
| return GetNativeTheme()->GetSystemColor( |
| color_utils::IsDark(GetParentBackgroundColor()) |
| ? ui::NativeTheme::kColorId_TextfieldDefaultColor |
| : ui::NativeTheme::kColorId_LinkEnabled); |
| } |
| -SkColor SelectedKeywordView::GetBorderColor() const { |
| - DCHECK(ui::MaterialDesignController::IsModeMaterial()); |
| - return GetTextColor(); |
| -} |
| - |
| gfx::Size SelectedKeywordView::GetPreferredSize() const { |
| // Height will be ignored by the LocationBarView. |
| return GetSizeForLabelWidth(full_label_.GetPreferredSize().width()); |
| @@ -97,21 +71,22 @@ void SelectedKeywordView::SetKeyword(const base::string16& keyword) { |
| bool is_extension_keyword; |
| const base::string16 short_name = |
| model->GetKeywordShortName(keyword, &is_extension_keyword); |
| - int keyword_text_id = ui::MaterialDesignController::IsModeMaterial() |
| - ? IDS_OMNIBOX_KEYWORD_TEXT_MD |
| - : IDS_OMNIBOX_KEYWORD_TEXT; |
| const base::string16 full_name = |
| - is_extension_keyword ? short_name : l10n_util::GetStringFUTF16( |
| - keyword_text_id, short_name); |
| + is_extension_keyword |
| + ? short_name |
| + : l10n_util::GetStringFUTF16(IDS_OMNIBOX_KEYWORD_TEXT_MD, short_name); |
| full_label_.SetText(full_name); |
| const base::string16 min_string( |
| location_bar_util::CalculateMinString(short_name)); |
| const base::string16 partial_name = |
| - is_extension_keyword ? min_string : l10n_util::GetStringFUTF16( |
| - keyword_text_id, min_string); |
| + is_extension_keyword |
| + ? min_string |
| + : l10n_util::GetStringFUTF16(IDS_OMNIBOX_KEYWORD_TEXT_MD, min_string); |
| partial_label_.SetText(min_string.empty() ? |
| full_label_.text() : partial_name); |
| + |
| + SetLabel(full_name); |
| } |
| const char* SelectedKeywordView::GetClassName() const { |