| 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 "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/search_engines/template_url_service_factory.h" | 10 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 return; | 89 return; |
| 90 DCHECK(profile_); | 90 DCHECK(profile_); |
| 91 TemplateURLService* model = | 91 TemplateURLService* model = |
| 92 TemplateURLServiceFactory::GetForProfile(profile_); | 92 TemplateURLServiceFactory::GetForProfile(profile_); |
| 93 if (!model) | 93 if (!model) |
| 94 return; | 94 return; |
| 95 | 95 |
| 96 bool is_extension_keyword; | 96 bool is_extension_keyword; |
| 97 const base::string16 short_name = | 97 const base::string16 short_name = |
| 98 model->GetKeywordShortName(keyword, &is_extension_keyword); | 98 model->GetKeywordShortName(keyword, &is_extension_keyword); |
| 99 const base::string16 full_name = is_extension_keyword ? | 99 int keyword_text_ids = ui::MaterialDesignController::IsModeMaterial() |
| 100 short_name : | 100 ? IDS_OMNIBOX_KEYWORD_TEXT_MD |
| 101 l10n_util::GetStringFUTF16(IDS_OMNIBOX_KEYWORD_TEXT, short_name); | 101 : IDS_OMNIBOX_KEYWORD_TEXT; |
| 102 const base::string16 full_name = |
| 103 is_extension_keyword ? short_name : l10n_util::GetStringFUTF16( |
| 104 keyword_text_ids, short_name); |
| 102 full_label_.SetText(full_name); | 105 full_label_.SetText(full_name); |
| 103 | 106 |
| 104 const base::string16 min_string( | 107 const base::string16 min_string( |
| 105 location_bar_util::CalculateMinString(short_name)); | 108 location_bar_util::CalculateMinString(short_name)); |
| 106 const base::string16 partial_name = is_extension_keyword ? | 109 const base::string16 partial_name = |
| 107 min_string : | 110 is_extension_keyword ? min_string : l10n_util::GetStringFUTF16( |
| 108 l10n_util::GetStringFUTF16(IDS_OMNIBOX_KEYWORD_TEXT, min_string); | 111 keyword_text_ids, min_string); |
| 109 partial_label_.SetText(min_string.empty() ? | 112 partial_label_.SetText(min_string.empty() ? |
| 110 full_label_.text() : partial_name); | 113 full_label_.text() : partial_name); |
| 111 } | 114 } |
| 112 | 115 |
| 113 const char* SelectedKeywordView::GetClassName() const { | 116 const char* SelectedKeywordView::GetClassName() const { |
| 114 return "SelectedKeywordView"; | 117 return "SelectedKeywordView"; |
| 115 } | 118 } |
| OLD | NEW |