OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/find_bar_gtk.h" | 5 #include "chrome/browser/ui/gtk/find_bar_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "chrome/browser/ui/gtk/custom_button.h" | 25 #include "chrome/browser/ui/gtk/custom_button.h" |
26 #include "chrome/browser/ui/gtk/gtk_floating_container.h" | 26 #include "chrome/browser/ui/gtk/gtk_floating_container.h" |
27 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 27 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
28 #include "chrome/browser/ui/gtk/gtk_util.h" | 28 #include "chrome/browser/ui/gtk/gtk_util.h" |
29 #include "chrome/browser/ui/gtk/nine_box.h" | 29 #include "chrome/browser/ui/gtk/nine_box.h" |
30 #include "chrome/browser/ui/gtk/slide_animator_gtk.h" | 30 #include "chrome/browser/ui/gtk/slide_animator_gtk.h" |
31 #include "chrome/browser/ui/gtk/tab_contents_container_gtk.h" | 31 #include "chrome/browser/ui/gtk/tab_contents_container_gtk.h" |
32 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" | 32 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" |
33 #include "chrome/browser/ui/gtk/view_id_util.h" | 33 #include "chrome/browser/ui/gtk/view_id_util.h" |
34 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 34 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 35 #include "chrome/common/chrome_notification_types.h" |
35 #include "content/browser/renderer_host/render_view_host.h" | 36 #include "content/browser/renderer_host/render_view_host.h" |
36 #include "content/browser/tab_contents/tab_contents.h" | 37 #include "content/browser/tab_contents/tab_contents.h" |
37 #include "content/common/native_web_keyboard_event.h" | 38 #include "content/common/native_web_keyboard_event.h" |
38 #include "content/common/notification_service.h" | 39 #include "content/common/notification_service.h" |
39 #include "content/common/view_messages.h" | 40 #include "content/common/view_messages.h" |
40 #include "grit/generated_resources.h" | 41 #include "grit/generated_resources.h" |
41 #include "grit/theme_resources.h" | 42 #include "grit/theme_resources.h" |
42 #include "grit/theme_resources_standard.h" | 43 #include "grit/theme_resources_standard.h" |
43 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
44 #include "ui/base/resource/resource_bundle.h" | 45 #include "ui/base/resource/resource_bundle.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 G_CALLBACK(OnContentEventBoxExpose), this); | 294 G_CALLBACK(OnContentEventBoxExpose), this); |
294 | 295 |
295 // This alignment isn't centered and is used for spacing in chrome theme | 296 // This alignment isn't centered and is used for spacing in chrome theme |
296 // mode. (It's also used in GTK mode for padding because left padding doesn't | 297 // mode. (It's also used in GTK mode for padding because left padding doesn't |
297 // equal bottom padding naturally.) | 298 // equal bottom padding naturally.) |
298 BuildBorder(content_event_box_, 2, 2, 2, 0, | 299 BuildBorder(content_event_box_, 2, 2, 2, 0, |
299 &border_bin_, &border_bin_alignment_); | 300 &border_bin_, &border_bin_alignment_); |
300 gtk_box_pack_end(GTK_BOX(hbox), border_bin_, TRUE, TRUE, 0); | 301 gtk_box_pack_end(GTK_BOX(hbox), border_bin_, TRUE, TRUE, 0); |
301 | 302 |
302 theme_service_->InitThemesFor(this); | 303 theme_service_->InitThemesFor(this); |
303 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, | 304 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
304 Source<ThemeService>(theme_service_)); | 305 Source<ThemeService>(theme_service_)); |
305 | 306 |
306 g_signal_connect(widget(), "parent-set", G_CALLBACK(OnParentSet), this); | 307 g_signal_connect(widget(), "parent-set", G_CALLBACK(OnParentSet), this); |
307 | 308 |
308 // We take care to avoid showing the slide animator widget. | 309 // We take care to avoid showing the slide animator widget. |
309 gtk_widget_show_all(container_); | 310 gtk_widget_show_all(container_); |
310 gtk_widget_show(widget()); | 311 gtk_widget_show(widget()); |
311 } | 312 } |
312 | 313 |
313 FindBarController* FindBarGtk::GetFindBarController() const { | 314 FindBarController* FindBarGtk::GetFindBarController() const { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 if (focus_store_.widget()) | 450 if (focus_store_.widget()) |
450 gtk_widget_grab_focus(focus_store_.widget()); | 451 gtk_widget_grab_focus(focus_store_.widget()); |
451 else | 452 else |
452 find_bar_controller_->tab_contents()->tab_contents()->Focus(); | 453 find_bar_controller_->tab_contents()->tab_contents()->Focus(); |
453 } | 454 } |
454 | 455 |
455 FindBarTesting* FindBarGtk::GetFindBarTesting() { | 456 FindBarTesting* FindBarGtk::GetFindBarTesting() { |
456 return this; | 457 return this; |
457 } | 458 } |
458 | 459 |
459 void FindBarGtk::Observe(NotificationType type, | 460 void FindBarGtk::Observe(int type, |
460 const NotificationSource& source, | 461 const NotificationSource& source, |
461 const NotificationDetails& details) { | 462 const NotificationDetails& details) { |
462 DCHECK_EQ(type.value, NotificationType::BROWSER_THEME_CHANGED); | 463 DCHECK_EQ(type, chrome::NOTIFICATION_BROWSER_THEME_CHANGED); |
463 | 464 |
464 // Force reshapings of the find bar window. | 465 // Force reshapings of the find bar window. |
465 container_width_ = -1; | 466 container_width_ = -1; |
466 container_height_ = -1; | 467 container_height_ = -1; |
467 | 468 |
468 if (theme_service_->UsingNativeTheme()) { | 469 if (theme_service_->UsingNativeTheme()) { |
469 gtk_widget_modify_cursor(text_entry_, NULL, NULL); | 470 gtk_widget_modify_cursor(text_entry_, NULL, NULL); |
470 gtk_widget_modify_base(text_entry_, GTK_STATE_NORMAL, NULL); | 471 gtk_widget_modify_base(text_entry_, GTK_STATE_NORMAL, NULL); |
471 gtk_widget_modify_text(text_entry_, GTK_STATE_NORMAL, NULL); | 472 gtk_widget_modify_text(text_entry_, GTK_STATE_NORMAL, NULL); |
472 | 473 |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 | 982 |
982 // static | 983 // static |
983 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, | 984 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, |
984 FindBarGtk* find_bar) { | 985 FindBarGtk* find_bar) { |
985 g_signal_handlers_disconnect_by_func( | 986 g_signal_handlers_disconnect_by_func( |
986 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), | 987 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), |
987 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); | 988 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); |
988 | 989 |
989 return FALSE; // Continue propagation. | 990 return FALSE; // Continue propagation. |
990 } | 991 } |
OLD | NEW |