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

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

Issue 2348853004: Remove non-md code in location bar (Views). (Closed)
Patch Set: images Created 4 years, 3 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/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..d74505327e6af0cf7a415e0deb3380da44793457 100644
--- a/chrome/browser/ui/views/location_bar/selected_keyword_view.cc
+++ b/chrome/browser/ui/views/location_bar/selected_keyword_view.cc
@@ -15,7 +15,6 @@
#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"
@@ -25,15 +24,8 @@
#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,19 +36,11 @@ 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, 16,
+ GetTextColor()));
}
SkColor SelectedKeywordView::GetTextColor() const {
- if (!ui::MaterialDesignController::IsModeMaterial())
- return text_color_;
-
return GetNativeTheme()->GetSystemColor(
color_utils::IsDark(GetParentBackgroundColor())
? ui::NativeTheme::kColorId_TextfieldDefaultColor
@@ -64,7 +48,6 @@ SkColor SelectedKeywordView::GetTextColor() const {
}
SkColor SelectedKeywordView::GetBorderColor() const {
- DCHECK(ui::MaterialDesignController::IsModeMaterial());
return GetTextColor();
}
@@ -97,21 +80,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);
Peter Kasting 2016/09/19 23:46:46 Is this a bugfix?
Evan Stade 2016/09/20 17:37:04 not really, it replaces the SetBackgroundImageGrid
Peter Kasting 2016/09/20 20:18:05 Should we just call Layout() here? Maybe this des
Evan Stade 2016/09/21 17:05:00 added a comment
}
const char* SelectedKeywordView::GetClassName() const {

Powered by Google App Engine
This is Rietveld 408576698