| 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/autocomplete/autocomplete_popup_view_gtk.h" | 5 #include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "app/gfx/font.h" | 12 #include "app/gfx/font.h" |
| 13 #include "app/l10n_util.h" | |
| 14 #include "app/resource_bundle.h" | 13 #include "app/resource_bundle.h" |
| 15 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/i18n/rtl.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 18 #include "chrome/browser/autocomplete/autocomplete.h" | 18 #include "chrome/browser/autocomplete/autocomplete.h" |
| 19 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 19 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 20 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" | 20 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" |
| 21 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 21 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 22 #include "chrome/browser/bubble_positioner.h" | 22 #include "chrome/browser/bubble_positioner.h" |
| 23 #include "chrome/browser/defaults.h" | 23 #include "chrome/browser/defaults.h" |
| 24 #include "chrome/browser/gtk/gtk_util.h" | 24 #include "chrome/browser/gtk/gtk_util.h" |
| 25 #include "chrome/browser/profile.h" | 25 #include "chrome/browser/profile.h" |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 break; | 390 break; |
| 391 default: | 391 default: |
| 392 // Don't open the result. | 392 // Don't open the result. |
| 393 break; | 393 break; |
| 394 } | 394 } |
| 395 return TRUE; | 395 return TRUE; |
| 396 } | 396 } |
| 397 | 397 |
| 398 gboolean AutocompletePopupViewGtk::HandleExpose(GtkWidget* widget, | 398 gboolean AutocompletePopupViewGtk::HandleExpose(GtkWidget* widget, |
| 399 GdkEventExpose* event) { | 399 GdkEventExpose* event) { |
| 400 bool ltr = (l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT); | 400 bool ltr = !base::i18n::IsRTL(); |
| 401 const AutocompleteResult& result = model_->result(); | 401 const AutocompleteResult& result = model_->result(); |
| 402 | 402 |
| 403 gfx::Rect window_rect = GetWindowRect(event->window); | 403 gfx::Rect window_rect = GetWindowRect(event->window); |
| 404 gfx::Rect damage_rect = gfx::Rect(event->area); | 404 gfx::Rect damage_rect = gfx::Rect(event->area); |
| 405 // Handle when our window is super narrow. A bunch of the calculations | 405 // Handle when our window is super narrow. A bunch of the calculations |
| 406 // below would go negative, and really we're not going to fit anything | 406 // below would go negative, and really we're not going to fit anything |
| 407 // useful in such a small window anyway. Just don't paint anything. | 407 // useful in such a small window anyway. Just don't paint anything. |
| 408 // This means we won't draw the border, but, yeah, whatever. | 408 // This means we won't draw the border, but, yeah, whatever. |
| 409 // TODO(deanm): Make the code more robust and remove this check. | 409 // TODO(deanm): Make the code more robust and remove this check. |
| 410 if (window_rect.width() < (kIconAreaWidth * 3)) | 410 if (window_rect.width() < (kIconAreaWidth * 3)) |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 // static | 506 // static |
| 507 AutocompletePopupView* AutocompletePopupView::CreatePopupView( | 507 AutocompletePopupView* AutocompletePopupView::CreatePopupView( |
| 508 const gfx::Font& font, | 508 const gfx::Font& font, |
| 509 AutocompleteEditView* edit_view, | 509 AutocompleteEditView* edit_view, |
| 510 AutocompleteEditModel* edit_model, | 510 AutocompleteEditModel* edit_model, |
| 511 Profile* profile, | 511 Profile* profile, |
| 512 const BubblePositioner* bubble_positioner) { | 512 const BubblePositioner* bubble_positioner) { |
| 513 return new AutocompletePopupViewGtk(edit_view, edit_model, profile, | 513 return new AutocompletePopupViewGtk(edit_view, edit_model, profile, |
| 514 bubble_positioner); | 514 bubble_positioner); |
| 515 } | 515 } |
| OLD | NEW |