| OLD | NEW |
| 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/selected_keyword_view.h" | 5 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/search_engines/template_url_service_factory.h" | 9 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 10 #include "chrome/browser/ui/location_bar/location_bar_util.h" | 10 #include "chrome/browser/ui/location_bar/location_bar_util.h" |
| 11 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 11 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 12 #include "chrome/grit/generated_resources.h" | 12 #include "chrome/grit/generated_resources.h" |
| 13 #include "components/omnibox/browser/vector_icons.h" |
| 13 #include "components/search_engines/template_url_service.h" | 14 #include "components/search_engines/template_url_service.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/base/theme_provider.h" | 16 #include "ui/base/theme_provider.h" |
| 16 #include "ui/gfx/color_palette.h" | 17 #include "ui/gfx/color_palette.h" |
| 17 #include "ui/gfx/color_utils.h" | 18 #include "ui/gfx/color_utils.h" |
| 18 #include "ui/gfx/paint_vector_icon.h" | 19 #include "ui/gfx/paint_vector_icon.h" |
| 19 #include "ui/gfx/vector_icons_public.h" | 20 #include "ui/gfx/vector_icons_public.h" |
| 20 #include "ui/native_theme/native_theme.h" | 21 #include "ui/native_theme/native_theme.h" |
| 21 | 22 |
| 22 SelectedKeywordView::SelectedKeywordView(const gfx::FontList& font_list, | 23 SelectedKeywordView::SelectedKeywordView(const gfx::FontList& font_list, |
| 23 Profile* profile) | 24 Profile* profile) |
| 24 : IconLabelBubbleView(font_list, false), profile_(profile) { | 25 : IconLabelBubbleView(font_list, false), profile_(profile) { |
| 25 full_label_.SetFontList(font_list); | 26 full_label_.SetFontList(font_list); |
| 26 full_label_.SetVisible(false); | 27 full_label_.SetVisible(false); |
| 27 partial_label_.SetFontList(font_list); | 28 partial_label_.SetFontList(font_list); |
| 28 partial_label_.SetVisible(false); | 29 partial_label_.SetVisible(false); |
| 29 } | 30 } |
| 30 | 31 |
| 31 SelectedKeywordView::~SelectedKeywordView() { | 32 SelectedKeywordView::~SelectedKeywordView() { |
| 32 } | 33 } |
| 33 | 34 |
| 34 void SelectedKeywordView::ResetImage() { | 35 void SelectedKeywordView::ResetImage() { |
| 35 SetImage(gfx::CreateVectorIcon(gfx::VectorIconId::OMNIBOX_SEARCH, | 36 SetImage(gfx::CreateVectorIcon(omnibox::kSearchIcon, |
| 36 LocationBarView::kIconWidth, GetTextColor())); | 37 LocationBarView::kIconWidth, GetTextColor())); |
| 37 } | 38 } |
| 38 | 39 |
| 39 SkColor SelectedKeywordView::GetTextColor() const { | 40 SkColor SelectedKeywordView::GetTextColor() const { |
| 40 return GetNativeTheme()->GetSystemColor( | 41 return GetNativeTheme()->GetSystemColor( |
| 41 color_utils::IsDark(GetParentBackgroundColor()) | 42 color_utils::IsDark(GetParentBackgroundColor()) |
| 42 ? ui::NativeTheme::kColorId_TextfieldDefaultColor | 43 ? ui::NativeTheme::kColorId_TextfieldDefaultColor |
| 43 : ui::NativeTheme::kColorId_LinkEnabled); | 44 : ui::NativeTheme::kColorId_LinkEnabled); |
| 44 } | 45 } |
| 45 | 46 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 90 |
| 90 // Update the label now so ShouldShowLabel() works correctly when the parent | 91 // Update the label now so ShouldShowLabel() works correctly when the parent |
| 91 // class is calculating the preferred size. It will be updated again in | 92 // class is calculating the preferred size. It will be updated again in |
| 92 // Layout(), taking into account how much space has actually been allotted. | 93 // Layout(), taking into account how much space has actually been allotted. |
| 93 SetLabel(full_name); | 94 SetLabel(full_name); |
| 94 } | 95 } |
| 95 | 96 |
| 96 const char* SelectedKeywordView::GetClassName() const { | 97 const char* SelectedKeywordView::GetClassName() const { |
| 97 return "SelectedKeywordView"; | 98 return "SelectedKeywordView"; |
| 98 } | 99 } |
| OLD | NEW |