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 | 10 |
11 #include "app/gfx/font.h" | 11 #include "app/gfx/font.h" |
12 #include "app/l10n_util.h" | 12 #include "app/l10n_util.h" |
13 #include "app/resource_bundle.h" | 13 #include "app/resource_bundle.h" |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/gfx/gtk_util.h" | 15 #include "base/gfx/gtk_util.h" |
16 #include "base/gfx/rect.h" | 16 #include "base/gfx/rect.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
19 #include "chrome/browser/autocomplete/autocomplete.h" | 19 #include "chrome/browser/autocomplete/autocomplete.h" |
20 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 20 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
21 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" | 21 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
22 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 22 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
23 #include "chrome/browser/defaults.h" | 23 #include "chrome/browser/defaults.h" |
24 #include "chrome/browser/profile.h" | 24 #include "chrome/browser/profile.h" |
25 #include "chrome/browser/search_engines/template_url.h" | 25 #include "chrome/browser/search_engines/template_url.h" |
26 #include "chrome/browser/search_engines/template_url_model.h" | 26 #include "chrome/browser/search_engines/template_url_model.h" |
27 #include "chrome/common/notification_service.h" | 27 #include "chrome/common/notification_service.h" |
28 #include "grit/theme_resources.h" | 28 #include "grit/theme_resources.h" |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 NOTREACHED(); | 228 NOTREACHED(); |
229 break; | 229 break; |
230 } | 230 } |
231 | 231 |
232 return NULL; | 232 return NULL; |
233 } | 233 } |
234 | 234 |
235 } // namespace | 235 } // namespace |
236 | 236 |
237 AutocompletePopupViewGtk::AutocompletePopupViewGtk( | 237 AutocompletePopupViewGtk::AutocompletePopupViewGtk( |
238 AutocompleteEditViewGtk* edit_view, | 238 AutocompleteEditView* edit_view, |
239 AutocompleteEditModel* edit_model, | 239 AutocompleteEditModel* edit_model, |
240 Profile* profile, | 240 Profile* profile, |
241 AutocompletePopupPositioner* popup_positioner) | 241 AutocompletePopupPositioner* popup_positioner) |
242 : model_(new AutocompletePopupModel(this, edit_model, profile)), | 242 : model_(new AutocompletePopupModel(this, edit_model, profile)), |
243 edit_view_(edit_view), | 243 edit_view_(edit_view), |
244 popup_positioner_(popup_positioner), | 244 popup_positioner_(popup_positioner), |
245 window_(gtk_window_new(GTK_WINDOW_POPUP)), | 245 window_(gtk_window_new(GTK_WINDOW_POPUP)), |
246 layout_(NULL), | 246 layout_(NULL), |
247 opened_(false) { | 247 opened_(false) { |
248 GTK_WIDGET_UNSET_FLAGS(window_, GTK_CAN_FOCUS); | 248 GTK_WIDGET_UNSET_FLAGS(window_, GTK_CAN_FOCUS); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 text_width - actual_content_width - | 501 text_width - actual_content_width - |
502 actual_description_width / PANGO_SCALE, | 502 actual_description_width / PANGO_SCALE, |
503 content_y, layout_); | 503 content_y, layout_); |
504 } | 504 } |
505 } | 505 } |
506 | 506 |
507 g_object_unref(gc); | 507 g_object_unref(gc); |
508 | 508 |
509 return TRUE; | 509 return TRUE; |
510 } | 510 } |
| 511 |
| 512 #if !defined(TOOLKIT_VIEWS) |
| 513 // static |
| 514 AutocompletePopupView* AutocompletePopupView::CreatePopupView( |
| 515 const gfx::Font& font, |
| 516 AutocompleteEditView* edit_view, |
| 517 AutocompleteEditModel* edit_model, |
| 518 Profile* profile, |
| 519 AutocompletePopupPositioner* popup_positioner) { |
| 520 return new AutocompletePopupViewGtk(edit_view, edit_model, profile, |
| 521 popup_positioner); |
| 522 } |
| 523 #endif |
OLD | NEW |