OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/go_button_gtk.h" | 5 #include "chrome/browser/gtk/go_button_gtk.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/i18n/rtl.h" |
8 #include "base/logging.h" | 9 #include "base/logging.h" |
9 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
10 #include "chrome/app/chrome_dll_resource.h" | 11 #include "chrome/app/chrome_dll_resource.h" |
11 #include "chrome/browser/browser.h" | 12 #include "chrome/browser/browser.h" |
12 #include "chrome/browser/gtk/gtk_chrome_button.h" | 13 #include "chrome/browser/gtk/gtk_chrome_button.h" |
13 #include "chrome/browser/gtk/gtk_theme_provider.h" | 14 #include "chrome/browser/gtk/gtk_theme_provider.h" |
14 #include "chrome/browser/gtk/gtk_util.h" | 15 #include "chrome/browser/gtk/gtk_util.h" |
15 #include "chrome/browser/gtk/location_bar_view_gtk.h" | 16 #include "chrome/browser/gtk/location_bar_view_gtk.h" |
16 #include "chrome/browser/profile.h" | 17 #include "chrome/browser/profile.h" |
17 #include "chrome/browser/search_engines/template_url_model.h" | 18 #include "chrome/browser/search_engines/template_url_model.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 169 } |
169 | 170 |
170 gboolean GoButtonGtk::OnQueryTooltip(GtkTooltip* tooltip) { | 171 gboolean GoButtonGtk::OnQueryTooltip(GtkTooltip* tooltip) { |
171 // |location_bar_| can be NULL in tests. | 172 // |location_bar_| can be NULL in tests. |
172 if (!location_bar_) | 173 if (!location_bar_) |
173 return FALSE; | 174 return FALSE; |
174 | 175 |
175 std::string text; | 176 std::string text; |
176 if (visible_mode_ == MODE_GO) { | 177 if (visible_mode_ == MODE_GO) { |
177 std::wstring current_text_wstr(location_bar_->location_entry()->GetText()); | 178 std::wstring current_text_wstr(location_bar_->location_entry()->GetText()); |
178 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) | 179 if (base::i18n::IsRTL()) |
179 l10n_util::WrapStringWithLTRFormatting(¤t_text_wstr); | 180 base::i18n::WrapStringWithLTRFormatting(¤t_text_wstr); |
180 string16 current_text = WideToUTF16Hack( | 181 string16 current_text = WideToUTF16Hack( |
181 l10n_util::TruncateString(current_text_wstr, kMaxTooltipTextLength)); | 182 l10n_util::TruncateString(current_text_wstr, kMaxTooltipTextLength)); |
182 | 183 |
183 AutocompleteEditModel* edit_model = | 184 AutocompleteEditModel* edit_model = |
184 location_bar_->location_entry()->model(); | 185 location_bar_->location_entry()->model(); |
185 if (edit_model->CurrentTextIsURL()) { | 186 if (edit_model->CurrentTextIsURL()) { |
186 text = l10n_util::GetStringFUTF8(IDS_TOOLTIP_GO_SITE, current_text); | 187 text = l10n_util::GetStringFUTF8(IDS_TOOLTIP_GO_SITE, current_text); |
187 } else { | 188 } else { |
188 std::wstring keyword(edit_model->keyword()); | 189 std::wstring keyword(edit_model->keyword()); |
189 TemplateURLModel* template_url_model = | 190 TemplateURLModel* template_url_model = |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 gtk_widget_set_size_request(widget_.get(), go_.Width(), go_.Height()); | 229 gtk_widget_set_size_request(widget_.get(), go_.Width(), go_.Height()); |
229 | 230 |
230 gtk_widget_set_app_paintable(widget_.get(), TRUE); | 231 gtk_widget_set_app_paintable(widget_.get(), TRUE); |
231 // We effectively double-buffer by virtue of having only one image... | 232 // We effectively double-buffer by virtue of having only one image... |
232 gtk_widget_set_double_buffered(widget_.get(), FALSE); | 233 gtk_widget_set_double_buffered(widget_.get(), FALSE); |
233 } | 234 } |
234 | 235 |
235 gtk_chrome_button_set_use_gtk_rendering( | 236 gtk_chrome_button_set_use_gtk_rendering( |
236 GTK_CHROME_BUTTON(widget_.get()), use_gtk); | 237 GTK_CHROME_BUTTON(widget_.get()), use_gtk); |
237 } | 238 } |
OLD | NEW |