| 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/gtk/location_bar_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 if (keyword.empty()) | 983 if (keyword.empty()) |
| 984 return; | 984 return; |
| 985 | 985 |
| 986 Profile* profile = browser_->profile(); | 986 Profile* profile = browser_->profile(); |
| 987 TemplateURLService* template_url_service = | 987 TemplateURLService* template_url_service = |
| 988 TemplateURLServiceFactory::GetForProfile(profile); | 988 TemplateURLServiceFactory::GetForProfile(profile); |
| 989 if (!template_url_service) | 989 if (!template_url_service) |
| 990 return; | 990 return; |
| 991 | 991 |
| 992 bool is_extension_keyword; | 992 bool is_extension_keyword; |
| 993 const string16 short_name = template_url_service-> | 993 const string16 short_name = template_url_service->GetKeywordShortName( |
| 994 GetKeywordShortName(keyword, &is_extension_keyword); | 994 keyword, &is_extension_keyword); |
| 995 int message_id = is_extension_keyword ? | 995 int message_id = is_extension_keyword ? |
| 996 IDS_OMNIBOX_EXTENSION_KEYWORD_TEXT : IDS_OMNIBOX_KEYWORD_TEXT; | 996 IDS_OMNIBOX_EXTENSION_KEYWORD_TEXT : IDS_OMNIBOX_KEYWORD_TEXT; |
| 997 string16 full_name = l10n_util::GetStringFUTF16(message_id, | 997 string16 full_name = l10n_util::GetStringFUTF16(message_id, short_name); |
| 998 short_name); | |
| 999 string16 partial_name = l10n_util::GetStringFUTF16( | 998 string16 partial_name = l10n_util::GetStringFUTF16( |
| 1000 message_id, | 999 message_id, location_bar_util::CalculateMinString(short_name)); |
| 1001 WideToUTF16Hack( | |
| 1002 location_bar_util::CalculateMinString(UTF16ToWideHack(short_name)))); | |
| 1003 gtk_label_set_text(GTK_LABEL(tab_to_search_full_label_), | 1000 gtk_label_set_text(GTK_LABEL(tab_to_search_full_label_), |
| 1004 UTF16ToUTF8(full_name).c_str()); | 1001 UTF16ToUTF8(full_name).c_str()); |
| 1005 gtk_label_set_text(GTK_LABEL(tab_to_search_partial_label_), | 1002 gtk_label_set_text(GTK_LABEL(tab_to_search_partial_label_), |
| 1006 UTF16ToUTF8(partial_name).c_str()); | 1003 UTF16ToUTF8(partial_name).c_str()); |
| 1007 | 1004 |
| 1008 if (last_keyword_ != keyword) { | 1005 if (last_keyword_ != keyword) { |
| 1009 last_keyword_ = keyword; | 1006 last_keyword_ = keyword; |
| 1010 | 1007 |
| 1011 if (is_extension_keyword) { | 1008 if (is_extension_keyword) { |
| 1012 const TemplateURL* template_url = | 1009 const TemplateURL* template_url = |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1803 GdkModifierType modifier, | 1800 GdkModifierType modifier, |
| 1804 void* user_data) { | 1801 void* user_data) { |
| 1805 PageActionViewGtk* view = static_cast<PageActionViewGtk*>(user_data); | 1802 PageActionViewGtk* view = static_cast<PageActionViewGtk*>(user_data); |
| 1806 if (!gtk_widget_get_visible(view->widget())) | 1803 if (!gtk_widget_get_visible(view->widget())) |
| 1807 return FALSE; | 1804 return FALSE; |
| 1808 | 1805 |
| 1809 GdkEventButton event = {}; | 1806 GdkEventButton event = {}; |
| 1810 event.button = 1; | 1807 event.button = 1; |
| 1811 return view->OnButtonPressed(view->widget(), &event); | 1808 return view->OnButtonPressed(view->widget(), &event); |
| 1812 } | 1809 } |
| OLD | NEW |