summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-14 00:19:04 +0000
committermsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-14 00:19:04 +0000
commit736d1898191dc530e603a996d8c4bf2415326aa7 (patch)
tree79c524d49f164c8c970b119279be072aaaaee91d /chrome
parent2dee6d5003f0d5a9fffd55856b9f54b404988cab (diff)
downloadchromium_src-736d1898191dc530e603a996d8c4bf2415326aa7.zip
chromium_src-736d1898191dc530e603a996d8c4bf2415326aa7.tar.gz
chromium_src-736d1898191dc530e603a996d8c4bf2415326aa7.tar.bz2
Move chrome/browser/gtk/ to chrome/browser/ui/gtk/
(moved *.cc using 'svn mv' to preserve history) (copied *.h using 'svn cp' to preserve history and stub out originals) Stubbed out original headers in chrome/browser/gtk/ Update header guards & copyright dates in chrome/browser/ui/gtk/ Update .gypi files Remove chrome/chrome_browser.gypi:4228 reference to nonexistant: ['include', '^browser/gtk/pk11_password_dialog.h'], Remove stray header guard in: chrome/browser/ui/gtk/bookmark_bar_instructions_gtk.cc Add #pragma once to the following files: chrome/browser/ui/gtk/instant_confirm_dialog_gtk.h chrome/browser/ui/gtk/infobar_arrow_model.h Ran the following to appease presubmit: 'svn pset svn:eol-style LF \ chrome/browser/ui/gtk/info_bubble_accelerators_gtk.cc \ chrome/browser/ui/gtk/gtk_custom_menu.cc \ chrome/browser/ui/gtk/info_bubble_accelerators_gtk.h \ chrome/browser/ui/gtk/gtk_custom_menu.h \ chrome/browser/ui/gtk/options/managed_prefs_banner_gtk.h \ chrome/browser/ui/gtk/chrome_gtk_frame.h \ chrome/browser/ui/gtk/chrome_gtk_frame.cc \ chrome/browser/ui/gtk/gtk_custom_menu_item.h \ chrome/browser/gtk/info_bubble_accelerators_gtk.h \ chrome/browser/gtk/gtk_custom_menu.h \ chrome/browser/gtk/options/managed_prefs_banner_gtk.h \ chrome/browser/gtk/chrome_gtk_frame.h \ chrome/browser/gtk/gtk_custom_menu_item.h' BUG=69289 TEST=Compile&Trybots Review URL: http://codereview.chromium.org/6251001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71397 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/gtk/about_chrome_dialog.h9
-rw-r--r--chrome/browser/gtk/accelerators_gtk.h39
-rw-r--r--chrome/browser/gtk/accessibility_event_router_gtk.h202
-rw-r--r--chrome/browser/gtk/accessible_widget_helper_gtk.h60
-rw-r--r--chrome/browser/gtk/back_forward_button_gtk.h66
-rw-r--r--chrome/browser/gtk/bookmark_bar_gtk.h395
-rw-r--r--chrome/browser/gtk/bookmark_bar_instructions_gtk.h56
-rw-r--r--chrome/browser/gtk/bookmark_bubble_gtk.h123
-rw-r--r--chrome/browser/gtk/bookmark_editor_gtk.h161
-rw-r--r--chrome/browser/gtk/bookmark_menu_controller_gtk.h139
-rw-r--r--chrome/browser/gtk/bookmark_tree_model.h71
-rw-r--r--chrome/browser/gtk/bookmark_utils_gtk.h104
-rw-r--r--chrome/browser/gtk/browser_actions_toolbar_gtk.h217
-rw-r--r--chrome/browser/gtk/browser_titlebar.h233
-rw-r--r--chrome/browser/gtk/browser_toolbar_gtk.h213
-rw-r--r--chrome/browser/gtk/browser_window_gtk.h488
-rw-r--r--chrome/browser/gtk/cairo_cached_surface.h54
-rw-r--r--chrome/browser/gtk/certificate_dialogs.h15
-rw-r--r--chrome/browser/gtk/certificate_viewer.h10
-rw-r--r--chrome/browser/gtk/chrome_gtk_frame.h50
-rw-r--r--chrome/browser/gtk/clear_browsing_data_dialog_gtk.h64
-rw-r--r--chrome/browser/gtk/collected_cookies_gtk.h102
-rw-r--r--chrome/browser/gtk/constrained_window_gtk.h87
-rw-r--r--chrome/browser/gtk/content_setting_bubble_gtk.h86
-rw-r--r--chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h113
-rw-r--r--chrome/browser/gtk/custom_button.h221
-rw-r--r--chrome/browser/gtk/custom_drag.h94
-rw-r--r--chrome/browser/gtk/download_in_progress_dialog_gtk.h25
-rw-r--r--chrome/browser/gtk/download_item_gtk.h214
-rw-r--r--chrome/browser/gtk/download_shelf_gtk.h103
-rw-r--r--chrome/browser/gtk/edit_search_engine_dialog.h77
-rw-r--r--chrome/browser/gtk/extension_infobar_gtk.h44
-rw-r--r--chrome/browser/gtk/extension_installed_bubble_gtk.h91
-rw-r--r--chrome/browser/gtk/extension_popup_gtk.h94
-rw-r--r--chrome/browser/gtk/extension_view_gtk.h64
-rw-r--r--chrome/browser/gtk/external_protocol_dialog_gtk.h27
-rw-r--r--chrome/browser/gtk/find_bar_gtk.h234
-rw-r--r--chrome/browser/gtk/first_run_bubble.h84
-rw-r--r--chrome/browser/gtk/first_run_dialog.h76
-rw-r--r--chrome/browser/gtk/focus_store_gtk.h37
-rw-r--r--chrome/browser/gtk/fullscreen_exit_bubble_gtk.h45
-rw-r--r--chrome/browser/gtk/gconf_titlebar_listener.h66
-rw-r--r--chrome/browser/gtk/gtk_chrome_button.h55
-rw-r--r--chrome/browser/gtk/gtk_chrome_cookie_view.h188
-rw-r--r--chrome/browser/gtk/gtk_chrome_link_button.h73
-rw-r--r--chrome/browser/gtk/gtk_chrome_shrinkable_hbox.h81
-rw-r--r--chrome/browser/gtk/gtk_custom_menu.h48
-rw-r--r--chrome/browser/gtk/gtk_custom_menu_item.h135
-rw-r--r--chrome/browser/gtk/gtk_expanded_container.h65
-rw-r--r--chrome/browser/gtk/gtk_floating_container.h81
-rw-r--r--chrome/browser/gtk/gtk_theme_provider.h303
-rw-r--r--chrome/browser/gtk/gtk_tree.h201
-rw-r--r--chrome/browser/gtk/gtk_util.h374
-rw-r--r--chrome/browser/gtk/hover_controller_gtk.h61
-rw-r--r--chrome/browser/gtk/html_dialog_gtk.h69
-rw-r--r--chrome/browser/gtk/import_dialog_gtk.h83
-rw-r--r--chrome/browser/gtk/import_lock_dialog_gtk.h31
-rw-r--r--chrome/browser/gtk/import_progress_dialog_gtk.h77
-rw-r--r--chrome/browser/gtk/info_bubble_accelerators_gtk.h33
-rw-r--r--chrome/browser/gtk/info_bubble_gtk.h209
-rw-r--r--chrome/browser/gtk/infobar_arrow_model.h74
-rw-r--r--chrome/browser/gtk/infobar_container_gtk.h79
-rw-r--r--chrome/browser/gtk/infobar_gtk.h138
-rw-r--r--chrome/browser/gtk/instant_confirm_dialog_gtk.h27
-rw-r--r--chrome/browser/gtk/js_modal_dialog_gtk.h36
-rw-r--r--chrome/browser/gtk/keyword_editor_view.h161
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.h429
-rw-r--r--chrome/browser/gtk/menu_bar_helper.h72
-rw-r--r--chrome/browser/gtk/menu_gtk.h193
-rw-r--r--chrome/browser/gtk/nine_box.h55
-rw-r--r--chrome/browser/gtk/notifications/balloon_view_gtk.h124
-rw-r--r--chrome/browser/gtk/notifications/balloon_view_host_gtk.h37
-rw-r--r--chrome/browser/gtk/options/advanced_contents_gtk.h45
-rw-r--r--chrome/browser/gtk/options/advanced_page_gtk.h43
-rw-r--r--chrome/browser/gtk/options/content_exception_editor.h75
-rw-r--r--chrome/browser/gtk/options/content_exceptions_window_gtk.h114
-rw-r--r--chrome/browser/gtk/options/content_filter_page_gtk.h66
-rw-r--r--chrome/browser/gtk/options/content_page_gtk.h114
-rw-r--r--chrome/browser/gtk/options/content_settings_window_gtk.h67
-rw-r--r--chrome/browser/gtk/options/cookie_filter_page_gtk.h71
-rw-r--r--chrome/browser/gtk/options/cookies_view.h145
-rw-r--r--chrome/browser/gtk/options/fonts_page_gtk.h69
-rw-r--r--chrome/browser/gtk/options/general_page_gtk.h173
-rw-r--r--chrome/browser/gtk/options/languages_page_gtk.h126
-rw-r--r--chrome/browser/gtk/options/managed_prefs_banner_gtk.h30
-rw-r--r--chrome/browser/gtk/options/options_layout_gtk.h40
-rw-r--r--chrome/browser/gtk/options/passwords_exceptions_page_gtk.h89
-rw-r--r--chrome/browser/gtk/options/passwords_exceptions_window_gtk.h7
-rw-r--r--chrome/browser/gtk/options/passwords_page_gtk.h109
-rw-r--r--chrome/browser/gtk/options/simple_content_exceptions_window.h74
-rw-r--r--chrome/browser/gtk/options/url_picker_dialog_gtk.h87
-rw-r--r--chrome/browser/gtk/overflow_button.h32
-rw-r--r--chrome/browser/gtk/owned_widget_gtk.h84
-rw-r--r--chrome/browser/gtk/process_singleton_dialog.h29
-rw-r--r--chrome/browser/gtk/reload_button_gtk.h97
-rw-r--r--chrome/browser/gtk/repost_form_warning_gtk.h45
-rw-r--r--chrome/browser/gtk/rounded_window.h58
-rw-r--r--chrome/browser/gtk/sad_tab_gtk.h34
-rw-r--r--chrome/browser/gtk/slide_animator_gtk.h117
-rw-r--r--chrome/browser/gtk/status_bubble_gtk.h170
-rw-r--r--chrome/browser/gtk/status_icons/status_icon_gtk.h41
-rw-r--r--chrome/browser/gtk/status_icons/status_tray_gtk.h18
-rw-r--r--chrome/browser/gtk/tab_contents_container_gtk.h104
-rw-r--r--chrome/browser/gtk/tab_contents_drag_source.h104
-rw-r--r--chrome/browser/gtk/tabs/dragged_tab_controller_gtk.h266
-rw-r--r--chrome/browser/gtk/tabs/dragged_tab_gtk.h141
-rw-r--r--chrome/browser/gtk/tabs/tab_gtk.h207
-rw-r--r--chrome/browser/gtk/tabs/tab_renderer_gtk.h450
-rw-r--r--chrome/browser/gtk/tabs/tab_strip_gtk.h460
-rw-r--r--chrome/browser/gtk/tabstrip_origin_provider.h25
-rw-r--r--chrome/browser/gtk/task_manager_gtk.h227
-rw-r--r--chrome/browser/gtk/theme_install_bubble_view_gtk.h56
-rw-r--r--chrome/browser/gtk/translate/after_translate_infobar_gtk.h34
-rw-r--r--chrome/browser/gtk/translate/before_translate_infobar_gtk.h28
-rw-r--r--chrome/browser/gtk/translate/translate_infobar_base_gtk.h83
-rw-r--r--chrome/browser/gtk/translate/translate_message_infobar_gtk.h21
-rw-r--r--chrome/browser/gtk/update_recommended_dialog.h25
-rw-r--r--chrome/browser/gtk/view_id_util.h27
-rw-r--r--chrome/browser/ui/gtk/about_chrome_dialog.cc (renamed from chrome/browser/gtk/about_chrome_dialog.cc)2
-rw-r--r--chrome/browser/ui/gtk/about_chrome_dialog.h15
-rw-r--r--chrome/browser/ui/gtk/accelerators_gtk.cc (renamed from chrome/browser/gtk/accelerators_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/accelerators_gtk.h45
-rw-r--r--chrome/browser/ui/gtk/accessibility_event_router_gtk.cc (renamed from chrome/browser/gtk/accessibility_event_router_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/accessibility_event_router_gtk.h208
-rw-r--r--chrome/browser/ui/gtk/accessibility_event_router_gtk_unittest.cc (renamed from chrome/browser/gtk/accessibility_event_router_gtk_unittest.cc)2
-rw-r--r--chrome/browser/ui/gtk/accessible_widget_helper_gtk.cc (renamed from chrome/browser/gtk/accessible_widget_helper_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/accessible_widget_helper_gtk.h66
-rw-r--r--chrome/browser/ui/gtk/back_forward_button_gtk.cc (renamed from chrome/browser/gtk/back_forward_button_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/back_forward_button_gtk.h72
-rw-r--r--chrome/browser/ui/gtk/bookmark_bar_gtk.cc (renamed from chrome/browser/gtk/bookmark_bar_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/bookmark_bar_gtk.h401
-rw-r--r--chrome/browser/ui/gtk/bookmark_bar_gtk_interactive_uitest.cc (renamed from chrome/browser/gtk/bookmark_bar_gtk_interactive_uitest.cc)2
-rw-r--r--chrome/browser/ui/gtk/bookmark_bar_gtk_unittest.cc (renamed from chrome/browser/gtk/bookmark_bar_gtk_unittest.cc)2
-rw-r--r--chrome/browser/ui/gtk/bookmark_bar_instructions_gtk.cc (renamed from chrome/browser/gtk/bookmark_bar_instructions_gtk.cc)7
-rw-r--r--chrome/browser/ui/gtk/bookmark_bar_instructions_gtk.h62
-rw-r--r--chrome/browser/ui/gtk/bookmark_bubble_gtk.cc (renamed from chrome/browser/gtk/bookmark_bubble_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/bookmark_bubble_gtk.h129
-rw-r--r--chrome/browser/ui/gtk/bookmark_editor_gtk.cc (renamed from chrome/browser/gtk/bookmark_editor_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/bookmark_editor_gtk.h167
-rw-r--r--chrome/browser/ui/gtk/bookmark_editor_gtk_unittest.cc (renamed from chrome/browser/gtk/bookmark_editor_gtk_unittest.cc)2
-rw-r--r--chrome/browser/ui/gtk/bookmark_menu_controller_gtk.cc (renamed from chrome/browser/gtk/bookmark_menu_controller_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/bookmark_menu_controller_gtk.h145
-rw-r--r--chrome/browser/ui/gtk/bookmark_tree_model.cc (renamed from chrome/browser/gtk/bookmark_tree_model.cc)2
-rw-r--r--chrome/browser/ui/gtk/bookmark_tree_model.h77
-rw-r--r--chrome/browser/ui/gtk/bookmark_utils_gtk.cc (renamed from chrome/browser/gtk/bookmark_utils_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/bookmark_utils_gtk.h110
-rw-r--r--chrome/browser/ui/gtk/bookmark_utils_gtk_unittest.cc (renamed from chrome/browser/gtk/bookmark_utils_gtk_unittest.cc)2
-rw-r--r--chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc (renamed from chrome/browser/gtk/browser_actions_toolbar_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h223
-rw-r--r--chrome/browser/ui/gtk/browser_titlebar.cc (renamed from chrome/browser/gtk/browser_titlebar.cc)2
-rw-r--r--chrome/browser/ui/gtk/browser_titlebar.h239
-rw-r--r--chrome/browser/ui/gtk/browser_toolbar_gtk.cc (renamed from chrome/browser/gtk/browser_toolbar_gtk.cc)0
-rw-r--r--chrome/browser/ui/gtk/browser_toolbar_gtk.h219
-rw-r--r--chrome/browser/ui/gtk/browser_window_factory_gtk.cc (renamed from chrome/browser/gtk/browser_window_factory_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/browser_window_gtk.cc (renamed from chrome/browser/gtk/browser_window_gtk.cc)0
-rw-r--r--chrome/browser/ui/gtk/browser_window_gtk.h496
-rw-r--r--chrome/browser/ui/gtk/cairo_cached_surface.cc (renamed from chrome/browser/gtk/cairo_cached_surface.cc)2
-rw-r--r--chrome/browser/ui/gtk/cairo_cached_surface.h60
-rw-r--r--chrome/browser/ui/gtk/certificate_dialogs.cc (renamed from chrome/browser/gtk/certificate_dialogs.cc)2
-rw-r--r--chrome/browser/ui/gtk/certificate_dialogs.h21
-rw-r--r--chrome/browser/ui/gtk/certificate_viewer.cc (renamed from chrome/browser/gtk/certificate_viewer.cc)2
-rw-r--r--chrome/browser/ui/gtk/certificate_viewer.h16
-rw-r--r--chrome/browser/ui/gtk/chrome_gtk_frame.cc (renamed from chrome/browser/gtk/chrome_gtk_frame.cc)2
-rw-r--r--chrome/browser/ui/gtk/chrome_gtk_frame.h56
-rw-r--r--chrome/browser/ui/gtk/clear_browsing_data_dialog_gtk.cc (renamed from chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/clear_browsing_data_dialog_gtk.h70
-rw-r--r--chrome/browser/ui/gtk/collected_cookies_gtk.cc (renamed from chrome/browser/gtk/collected_cookies_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/collected_cookies_gtk.h108
-rw-r--r--chrome/browser/ui/gtk/constrained_html_delegate_gtk.cc (renamed from chrome/browser/gtk/constrained_html_delegate_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/constrained_window_gtk.cc (renamed from chrome/browser/gtk/constrained_window_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/constrained_window_gtk.h93
-rw-r--r--chrome/browser/ui/gtk/content_setting_bubble_gtk.cc (renamed from chrome/browser/gtk/content_setting_bubble_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/content_setting_bubble_gtk.h92
-rw-r--r--chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc (renamed from chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h119
-rw-r--r--chrome/browser/ui/gtk/custom_button.cc (renamed from chrome/browser/gtk/custom_button.cc)2
-rw-r--r--chrome/browser/ui/gtk/custom_button.h227
-rw-r--r--chrome/browser/ui/gtk/custom_drag.cc (renamed from chrome/browser/gtk/custom_drag.cc)2
-rw-r--r--chrome/browser/ui/gtk/custom_drag.h100
-rw-r--r--chrome/browser/ui/gtk/dialogs_gtk.cc (renamed from chrome/browser/gtk/dialogs_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/download_in_progress_dialog_gtk.cc (renamed from chrome/browser/gtk/download_in_progress_dialog_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/download_in_progress_dialog_gtk.h31
-rw-r--r--chrome/browser/ui/gtk/download_item_gtk.cc (renamed from chrome/browser/gtk/download_item_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/download_item_gtk.h220
-rw-r--r--chrome/browser/ui/gtk/download_shelf_gtk.cc (renamed from chrome/browser/gtk/download_shelf_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/download_shelf_gtk.h109
-rw-r--r--chrome/browser/ui/gtk/download_started_animation_gtk.cc (renamed from chrome/browser/gtk/download_started_animation_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/edit_search_engine_dialog.cc (renamed from chrome/browser/gtk/edit_search_engine_dialog.cc)2
-rw-r--r--chrome/browser/ui/gtk/edit_search_engine_dialog.h83
-rw-r--r--chrome/browser/ui/gtk/extension_infobar_gtk.cc (renamed from chrome/browser/gtk/extension_infobar_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/extension_infobar_gtk.h50
-rw-r--r--chrome/browser/ui/gtk/extension_install_prompt2_gtk.cc (renamed from chrome/browser/gtk/extension_install_prompt2_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/extension_install_prompt_gtk.cc (renamed from chrome/browser/gtk/extension_install_prompt_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/extension_installed_bubble_gtk.cc (renamed from chrome/browser/gtk/extension_installed_bubble_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/extension_installed_bubble_gtk.h97
-rw-r--r--chrome/browser/ui/gtk/extension_popup_gtk.cc (renamed from chrome/browser/gtk/extension_popup_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/extension_popup_gtk.h100
-rw-r--r--chrome/browser/ui/gtk/extension_view_gtk.cc (renamed from chrome/browser/gtk/extension_view_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/extension_view_gtk.h70
-rw-r--r--chrome/browser/ui/gtk/external_protocol_dialog_gtk.cc (renamed from chrome/browser/gtk/external_protocol_dialog_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/external_protocol_dialog_gtk.h33
-rw-r--r--chrome/browser/ui/gtk/find_bar_gtk.cc (renamed from chrome/browser/gtk/find_bar_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/find_bar_gtk.h240
-rw-r--r--chrome/browser/ui/gtk/first_run_bubble.cc (renamed from chrome/browser/gtk/first_run_bubble.cc)2
-rw-r--r--chrome/browser/ui/gtk/first_run_bubble.h90
-rw-r--r--chrome/browser/ui/gtk/first_run_dialog.cc (renamed from chrome/browser/gtk/first_run_dialog.cc)2
-rw-r--r--chrome/browser/ui/gtk/first_run_dialog.h82
-rw-r--r--chrome/browser/ui/gtk/focus_store_gtk.cc (renamed from chrome/browser/gtk/focus_store_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/focus_store_gtk.h43
-rw-r--r--chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.cc (renamed from chrome/browser/gtk/fullscreen_exit_bubble_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.h51
-rw-r--r--chrome/browser/ui/gtk/gconf_titlebar_listener.cc (renamed from chrome/browser/gtk/gconf_titlebar_listener.cc)2
-rw-r--r--chrome/browser/ui/gtk/gconf_titlebar_listener.h72
-rw-r--r--chrome/browser/ui/gtk/gtk_chrome_button.cc (renamed from chrome/browser/gtk/gtk_chrome_button.cc)2
-rw-r--r--chrome/browser/ui/gtk/gtk_chrome_button.h61
-rw-r--r--chrome/browser/ui/gtk/gtk_chrome_cookie_view.cc (renamed from chrome/browser/gtk/gtk_chrome_cookie_view.cc)2
-rw-r--r--chrome/browser/ui/gtk/gtk_chrome_cookie_view.h194
-rw-r--r--chrome/browser/ui/gtk/gtk_chrome_link_button.cc (renamed from chrome/browser/gtk/gtk_chrome_link_button.cc)2
-rw-r--r--chrome/browser/ui/gtk/gtk_chrome_link_button.h79
-rw-r--r--chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.cc (renamed from chrome/browser/gtk/gtk_chrome_shrinkable_hbox.cc)2
-rw-r--r--chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h87
-rw-r--r--chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox_unittest.cc (renamed from chrome/browser/gtk/gtk_chrome_shrinkable_hbox_unittest.cc)2
-rw-r--r--chrome/browser/ui/gtk/gtk_custom_menu.cc (renamed from chrome/browser/gtk/gtk_custom_menu.cc)2
-rw-r--r--chrome/browser/ui/gtk/gtk_custom_menu.h54
-rw-r--r--chrome/browser/ui/gtk/gtk_custom_menu_item.cc (renamed from chrome/browser/gtk/gtk_custom_menu_item.cc)2
-rw-r--r--chrome/browser/ui/gtk/gtk_custom_menu_item.h141
-rw-r--r--chrome/browser/ui/gtk/gtk_expanded_container.cc (renamed from chrome/browser/gtk/gtk_expanded_container.cc)2
-rw-r--r--chrome/browser/ui/gtk/gtk_expanded_container.h71
-rw-r--r--chrome/browser/ui/gtk/gtk_expanded_container_unittest.cc (renamed from chrome/browser/gtk/gtk_expanded_container_unittest.cc)2
-rw-r--r--chrome/browser/ui/gtk/gtk_floating_container.cc (renamed from chrome/browser/gtk/gtk_floating_container.cc)2
-rw-r--r--chrome/browser/ui/gtk/gtk_floating_container.h87
-rw-r--r--chrome/browser/ui/gtk/gtk_theme_provider.cc (renamed from chrome/browser/gtk/gtk_theme_provider.cc)2
-rw-r--r--chrome/browser/ui/gtk/gtk_theme_provider.h309
-rw-r--r--chrome/browser/ui/gtk/gtk_theme_provider_unittest.cc (renamed from chrome/browser/gtk/gtk_theme_provider_unittest.cc)2
-rw-r--r--chrome/browser/ui/gtk/gtk_tree.cc (renamed from chrome/browser/gtk/gtk_tree.cc)2
-rw-r--r--chrome/browser/ui/gtk/gtk_tree.h207
-rw-r--r--chrome/browser/ui/gtk/gtk_util.cc (renamed from chrome/browser/gtk/gtk_util.cc)2
-rw-r--r--chrome/browser/ui/gtk/gtk_util.h380
-rw-r--r--chrome/browser/ui/gtk/hover_controller_gtk.cc (renamed from chrome/browser/gtk/hover_controller_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/hover_controller_gtk.h67
-rw-r--r--chrome/browser/ui/gtk/html_dialog_gtk.cc (renamed from chrome/browser/gtk/html_dialog_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/html_dialog_gtk.h75
-rw-r--r--chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc (renamed from chrome/browser/gtk/hung_renderer_dialog_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/import_dialog_gtk.cc (renamed from chrome/browser/gtk/import_dialog_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/import_dialog_gtk.h89
-rw-r--r--chrome/browser/ui/gtk/import_lock_dialog_gtk.cc (renamed from chrome/browser/gtk/import_lock_dialog_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/import_lock_dialog_gtk.h37
-rw-r--r--chrome/browser/ui/gtk/import_progress_dialog_gtk.cc (renamed from chrome/browser/gtk/import_progress_dialog_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/import_progress_dialog_gtk.h83
-rw-r--r--chrome/browser/ui/gtk/info_bubble_accelerators_gtk.cc (renamed from chrome/browser/gtk/info_bubble_accelerators_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/info_bubble_accelerators_gtk.h39
-rw-r--r--chrome/browser/ui/gtk/info_bubble_gtk.cc (renamed from chrome/browser/gtk/info_bubble_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/info_bubble_gtk.h215
-rw-r--r--chrome/browser/ui/gtk/infobar_arrow_model.cc (renamed from chrome/browser/gtk/infobar_arrow_model.cc)2
-rw-r--r--chrome/browser/ui/gtk/infobar_arrow_model.h79
-rw-r--r--chrome/browser/ui/gtk/infobar_container_gtk.cc (renamed from chrome/browser/gtk/infobar_container_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/infobar_container_gtk.h85
-rw-r--r--chrome/browser/ui/gtk/infobar_gtk.cc (renamed from chrome/browser/gtk/infobar_gtk.cc)0
-rw-r--r--chrome/browser/ui/gtk/infobar_gtk.h144
-rw-r--r--chrome/browser/ui/gtk/instant_confirm_dialog_gtk.cc (renamed from chrome/browser/gtk/instant_confirm_dialog_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/instant_confirm_dialog_gtk.h32
-rw-r--r--chrome/browser/ui/gtk/js_modal_dialog_gtk.cc (renamed from chrome/browser/gtk/js_modal_dialog_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/js_modal_dialog_gtk.h42
-rw-r--r--chrome/browser/ui/gtk/keyword_editor_view.cc (renamed from chrome/browser/gtk/keyword_editor_view.cc)2
-rw-r--r--chrome/browser/ui/gtk/keyword_editor_view.h167
-rw-r--r--chrome/browser/ui/gtk/keyword_editor_view_unittest.cc (renamed from chrome/browser/gtk/keyword_editor_view_unittest.cc)2
-rw-r--r--chrome/browser/ui/gtk/location_bar_view_gtk.cc (renamed from chrome/browser/gtk/location_bar_view_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/location_bar_view_gtk.h435
-rw-r--r--chrome/browser/ui/gtk/menu_bar_helper.cc (renamed from chrome/browser/gtk/menu_bar_helper.cc)2
-rw-r--r--chrome/browser/ui/gtk/menu_bar_helper.h78
-rw-r--r--chrome/browser/ui/gtk/menu_gtk.cc (renamed from chrome/browser/gtk/menu_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/menu_gtk.h199
-rw-r--r--chrome/browser/ui/gtk/nine_box.cc (renamed from chrome/browser/gtk/nine_box.cc)2
-rw-r--r--chrome/browser/ui/gtk/nine_box.h61
-rw-r--r--chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc (renamed from chrome/browser/gtk/notifications/balloon_view_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/notifications/balloon_view_gtk.h130
-rw-r--r--chrome/browser/ui/gtk/notifications/balloon_view_host_gtk.cc (renamed from chrome/browser/gtk/notifications/balloon_view_host_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/notifications/balloon_view_host_gtk.h43
-rw-r--r--chrome/browser/ui/gtk/options/advanced_contents_gtk.cc (renamed from chrome/browser/gtk/options/advanced_contents_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/advanced_contents_gtk.h51
-rw-r--r--chrome/browser/ui/gtk/options/advanced_page_gtk.cc (renamed from chrome/browser/gtk/options/advanced_page_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/advanced_page_gtk.h49
-rw-r--r--chrome/browser/ui/gtk/options/content_exception_editor.cc (renamed from chrome/browser/gtk/options/content_exception_editor.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/content_exception_editor.h81
-rw-r--r--chrome/browser/ui/gtk/options/content_exceptions_window_gtk.cc (renamed from chrome/browser/gtk/options/content_exceptions_window_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/content_exceptions_window_gtk.h120
-rw-r--r--chrome/browser/ui/gtk/options/content_exceptions_window_gtk_unittest.cc (renamed from chrome/browser/gtk/options/content_exceptions_window_gtk_unittest.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/content_filter_page_gtk.cc (renamed from chrome/browser/gtk/options/content_filter_page_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/content_filter_page_gtk.h72
-rw-r--r--chrome/browser/ui/gtk/options/content_page_gtk.cc (renamed from chrome/browser/gtk/options/content_page_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/content_page_gtk.h120
-rw-r--r--chrome/browser/ui/gtk/options/content_settings_window_gtk.cc (renamed from chrome/browser/gtk/options/content_settings_window_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/content_settings_window_gtk.h73
-rw-r--r--chrome/browser/ui/gtk/options/cookie_filter_page_gtk.cc (renamed from chrome/browser/gtk/options/cookie_filter_page_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/cookie_filter_page_gtk.h77
-rw-r--r--chrome/browser/ui/gtk/options/cookies_view.cc (renamed from chrome/browser/gtk/options/cookies_view.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/cookies_view.h151
-rw-r--r--chrome/browser/ui/gtk/options/cookies_view_unittest.cc (renamed from chrome/browser/gtk/options/cookies_view_unittest.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/fonts_languages_window_gtk.cc (renamed from chrome/browser/gtk/options/fonts_languages_window_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/fonts_page_gtk.cc (renamed from chrome/browser/gtk/options/fonts_page_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/fonts_page_gtk.h75
-rw-r--r--chrome/browser/ui/gtk/options/general_page_gtk.cc (renamed from chrome/browser/gtk/options/general_page_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/general_page_gtk.h179
-rw-r--r--chrome/browser/ui/gtk/options/languages_page_gtk.cc (renamed from chrome/browser/gtk/options/languages_page_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/languages_page_gtk.h132
-rw-r--r--chrome/browser/ui/gtk/options/languages_page_gtk_unittest.cc (renamed from chrome/browser/gtk/options/languages_page_gtk_unittest.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/managed_prefs_banner_gtk.cc (renamed from chrome/browser/gtk/options/managed_prefs_banner_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/managed_prefs_banner_gtk.h36
-rw-r--r--chrome/browser/ui/gtk/options/options_layout_gtk.cc (renamed from chrome/browser/gtk/options/options_layout_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/options_layout_gtk.h46
-rw-r--r--chrome/browser/ui/gtk/options/options_window_gtk.cc (renamed from chrome/browser/gtk/options/options_window_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/passwords_exceptions_page_gtk.cc (renamed from chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/passwords_exceptions_page_gtk.h95
-rw-r--r--chrome/browser/ui/gtk/options/passwords_exceptions_window_gtk.cc (renamed from chrome/browser/gtk/options/passwords_exceptions_window_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/passwords_exceptions_window_gtk.h13
-rw-r--r--chrome/browser/ui/gtk/options/passwords_page_gtk.cc (renamed from chrome/browser/gtk/options/passwords_page_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/passwords_page_gtk.h115
-rw-r--r--chrome/browser/ui/gtk/options/simple_content_exceptions_window.cc (renamed from chrome/browser/gtk/options/simple_content_exceptions_window.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/simple_content_exceptions_window.h80
-rw-r--r--chrome/browser/ui/gtk/options/url_picker_dialog_gtk.cc (renamed from chrome/browser/gtk/options/url_picker_dialog_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/options/url_picker_dialog_gtk.h93
-rw-r--r--chrome/browser/ui/gtk/overflow_button.cc (renamed from chrome/browser/gtk/overflow_button.cc)2
-rw-r--r--chrome/browser/ui/gtk/overflow_button.h38
-rw-r--r--chrome/browser/ui/gtk/owned_widget_gtk.cc (renamed from chrome/browser/gtk/owned_widget_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/owned_widget_gtk.h90
-rw-r--r--chrome/browser/ui/gtk/page_info_bubble_gtk.cc (renamed from chrome/browser/gtk/page_info_bubble_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/pk11_password_dialog.cc (renamed from chrome/browser/gtk/pk11_password_dialog.cc)2
-rw-r--r--chrome/browser/ui/gtk/process_singleton_dialog.cc (renamed from chrome/browser/gtk/process_singleton_dialog.cc)2
-rw-r--r--chrome/browser/ui/gtk/process_singleton_dialog.h35
-rw-r--r--chrome/browser/ui/gtk/reload_button_gtk.cc (renamed from chrome/browser/gtk/reload_button_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/reload_button_gtk.h103
-rw-r--r--chrome/browser/ui/gtk/reload_button_gtk_unittest.cc (renamed from chrome/browser/gtk/reload_button_gtk_unittest.cc)2
-rw-r--r--chrome/browser/ui/gtk/repost_form_warning_gtk.cc (renamed from chrome/browser/gtk/repost_form_warning_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/repost_form_warning_gtk.h51
-rw-r--r--chrome/browser/ui/gtk/rounded_window.cc (renamed from chrome/browser/gtk/rounded_window.cc)2
-rw-r--r--chrome/browser/ui/gtk/rounded_window.h64
-rw-r--r--chrome/browser/ui/gtk/sad_tab_gtk.cc (renamed from chrome/browser/gtk/sad_tab_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/sad_tab_gtk.h40
-rw-r--r--chrome/browser/ui/gtk/slide_animator_gtk.cc (renamed from chrome/browser/gtk/slide_animator_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/slide_animator_gtk.h123
-rw-r--r--chrome/browser/ui/gtk/ssl_client_certificate_selector.cc (renamed from chrome/browser/gtk/ssl_client_certificate_selector.cc)2
-rw-r--r--chrome/browser/ui/gtk/status_bubble_gtk.cc (renamed from chrome/browser/gtk/status_bubble_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/status_bubble_gtk.h176
-rw-r--r--chrome/browser/ui/gtk/status_icons/status_icon_gtk.cc (renamed from chrome/browser/gtk/status_icons/status_icon_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/status_icons/status_icon_gtk.h47
-rw-r--r--chrome/browser/ui/gtk/status_icons/status_tray_gtk.cc (renamed from chrome/browser/gtk/status_icons/status_tray_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/status_icons/status_tray_gtk.h24
-rw-r--r--chrome/browser/ui/gtk/status_icons/status_tray_gtk_unittest.cc (renamed from chrome/browser/gtk/status_icons/status_tray_gtk_unittest.cc)2
-rw-r--r--chrome/browser/ui/gtk/tab_contents_container_gtk.cc (renamed from chrome/browser/gtk/tab_contents_container_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/tab_contents_container_gtk.h110
-rw-r--r--chrome/browser/ui/gtk/tab_contents_drag_source.cc (renamed from chrome/browser/gtk/tab_contents_drag_source.cc)2
-rw-r--r--chrome/browser/ui/gtk/tab_contents_drag_source.h110
-rw-r--r--chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc (renamed from chrome/browser/gtk/tabs/dragged_tab_controller_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h272
-rw-r--r--chrome/browser/ui/gtk/tabs/dragged_tab_gtk.cc (renamed from chrome/browser/gtk/tabs/dragged_tab_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/tabs/dragged_tab_gtk.h147
-rw-r--r--chrome/browser/ui/gtk/tabs/tab_gtk.cc (renamed from chrome/browser/gtk/tabs/tab_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/tabs/tab_gtk.h213
-rw-r--r--chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc (renamed from chrome/browser/gtk/tabs/tab_renderer_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h456
-rw-r--r--chrome/browser/ui/gtk/tabs/tab_renderer_gtk_unittest.cc (renamed from chrome/browser/gtk/tabs/tab_renderer_gtk_unittest.cc)2
-rw-r--r--chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc (renamed from chrome/browser/gtk/tabs/tab_strip_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/tabs/tab_strip_gtk.h466
-rw-r--r--chrome/browser/ui/gtk/tabstrip_origin_provider.h31
-rw-r--r--chrome/browser/ui/gtk/task_manager_gtk.cc (renamed from chrome/browser/gtk/task_manager_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/task_manager_gtk.h233
-rw-r--r--chrome/browser/ui/gtk/theme_install_bubble_view_gtk.cc (renamed from chrome/browser/gtk/theme_install_bubble_view_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/theme_install_bubble_view_gtk.h62
-rw-r--r--chrome/browser/ui/gtk/translate/after_translate_infobar_gtk.cc (renamed from chrome/browser/gtk/translate/after_translate_infobar_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/translate/after_translate_infobar_gtk.h40
-rw-r--r--chrome/browser/ui/gtk/translate/before_translate_infobar_gtk.cc (renamed from chrome/browser/gtk/translate/before_translate_infobar_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/translate/before_translate_infobar_gtk.h34
-rw-r--r--chrome/browser/ui/gtk/translate/translate_infobar_base_gtk.cc (renamed from chrome/browser/gtk/translate/translate_infobar_base_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/translate/translate_infobar_base_gtk.h89
-rw-r--r--chrome/browser/ui/gtk/translate/translate_message_infobar_gtk.cc (renamed from chrome/browser/gtk/translate/translate_message_infobar_gtk.cc)2
-rw-r--r--chrome/browser/ui/gtk/translate/translate_message_infobar_gtk.h27
-rw-r--r--chrome/browser/ui/gtk/update_recommended_dialog.cc (renamed from chrome/browser/gtk/update_recommended_dialog.cc)2
-rw-r--r--chrome/browser/ui/gtk/update_recommended_dialog.h31
-rw-r--r--chrome/browser/ui/gtk/view_id_util.cc (renamed from chrome/browser/gtk/view_id_util.cc)2
-rw-r--r--chrome/browser/ui/gtk/view_id_util.h33
-rw-r--r--chrome/browser/ui/gtk/view_id_util_browsertest.cc (renamed from chrome/browser/gtk/view_id_util_browsertest.cc)2
-rw-r--r--chrome/chrome_browser.gypi653
-rw-r--r--chrome/chrome_tests.gypi60
383 files changed, 14433 insertions, 13021 deletions
diff --git a/chrome/browser/gtk/about_chrome_dialog.h b/chrome/browser/gtk/about_chrome_dialog.h
index 020e3e5..c895fba 100644
--- a/chrome/browser/gtk/about_chrome_dialog.h
+++ b/chrome/browser/gtk/about_chrome_dialog.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,10 +6,7 @@
#define CHROME_BROWSER_GTK_ABOUT_CHROME_DIALOG_H_
#pragma once
-class Profile;
-typedef struct _GtkWindow GtkWindow;
-
-// Displays the about box, using data copied from |profile|.
-void ShowAboutDialogForProfile(GtkWindow* parent, Profile* profile);
+#include "chrome/browser/ui/gtk/about_chrome_dialog.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_ABOUT_CHROME_DIALOG_H_
diff --git a/chrome/browser/gtk/accelerators_gtk.h b/chrome/browser/gtk/accelerators_gtk.h
index 2e45700..f42f3ec 100644
--- a/chrome/browser/gtk/accelerators_gtk.h
+++ b/chrome/browser/gtk/accelerators_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,40 +6,7 @@
#define CHROME_BROWSER_GTK_ACCELERATORS_GTK_H_
#pragma once
-#include "app/menus/accelerator_gtk.h"
-#include "base/hash_tables.h"
-
-template <typename T> struct DefaultSingletonTraits;
-
-class AcceleratorsGtk {
- public:
- typedef std::vector<std::pair<int, menus::AcceleratorGtk> >
- AcceleratorGtkList;
- typedef AcceleratorGtkList::const_iterator const_iterator;
-
- // Returns the singleton instance.
- static AcceleratorsGtk* GetInstance();
-
- const_iterator const begin() {
- return all_accelerators_.begin();
- }
-
- const_iterator const end() {
- return all_accelerators_.end();
- }
-
- // Returns NULL if there is no accelerator for the command.
- const menus::AcceleratorGtk* GetPrimaryAcceleratorForCommand(int command_id);
-
- private:
- friend struct DefaultSingletonTraits<AcceleratorsGtk>;
-
- AcceleratorsGtk();
- ~AcceleratorsGtk();
-
- base::hash_map<int, menus::AcceleratorGtk> primary_accelerators_;
-
- AcceleratorGtkList all_accelerators_;
-};
+#include "chrome/browser/ui/gtk/accelerators_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_ACCELERATORS_GTK_H_
diff --git a/chrome/browser/gtk/accessibility_event_router_gtk.h b/chrome/browser/gtk/accessibility_event_router_gtk.h
index 2cc2cf9..6bc914e 100644
--- a/chrome/browser/gtk/accessibility_event_router_gtk.h
+++ b/chrome/browser/gtk/accessibility_event_router_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,203 +6,7 @@
#define CHROME_BROWSER_GTK_ACCESSIBILITY_EVENT_ROUTER_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/gtest_prod_util.h"
-#include "base/hash_tables.h"
-#include "base/singleton.h"
-#include "base/task.h"
-#include "chrome/browser/accessibility_events.h"
-
-class Profile;
-#if defined (TOOLKIT_VIEWS)
-namespace views {
-class NativeTextfieldGtk;
-}
-#endif
-
-// Allows us to use (GtkWidget*) in a hash_map with gcc.
-namespace __gnu_cxx {
-template<>
-struct hash<GtkWidget*> {
- size_t operator()(GtkWidget* widget) const {
- return reinterpret_cast<size_t>(widget);
- }
-};
-} // namespace __gnu_cxx
-
-// Struct to keep track of event listener hook ids to remove them later.
-struct InstalledHook {
- InstalledHook(guint _signal_id, gulong _hook_id)
- : signal_id(_signal_id), hook_id(_hook_id) { }
- guint signal_id;
- gulong hook_id;
-};
-
-// NOTE: This class is part of the Accessibility Extension API, which lets
-// extensions receive accessibility events. It's distinct from code that
-// implements platform accessibility APIs like MSAA or ATK.
-//
-// Singleton class that adds a signal emission hook to many gtk events, and
-// then sends an accessibility notification whenever a relevant event is
-// sent to an accessible control.
-//
-// Gtk widgets are not accessible by default. When you register a root widget,
-// that widget and all of its descendants will start sending accessibility
-// event notifications. You can then override the default behavior for
-// specific descendants using other methods.
-//
-// You can use Profile::PauseAccessibilityEvents to prevent a flurry
-// of accessibility events when a window is being created or initialized.
-class AccessibilityEventRouterGtk {
- public:
- // Internal information about a particular widget to override the
- // information we get directly from gtk.
- struct WidgetInfo {
- WidgetInfo() : refcount(0) { }
-
- // The number of times that AddWidgetNameOverride has been called on this
- // widget. When RemoveWidget has been called an equal number of
- // times and the refcount reaches zero, this entry will be deleted.
- int refcount;
-
- // If nonempty, will use this name instead of the widget's label.
- std::string name;
- };
-
- // Internal information about a root widget
- struct RootWidgetInfo {
- RootWidgetInfo() : refcount(0), profile(NULL) { }
-
- // The number of times that AddRootWidget has been called on this
- // widget. When RemoveRootWidget has been called an equal number of
- // times and the refcount reaches zero, this entry will be deleted.
- int refcount;
-
- // The profile associated with this root widget; accessibility
- // notifications for any descendant of this root widget will get routed
- // to this profile.
- Profile* profile;
- };
-
- // Get the single instance of this class.
- static AccessibilityEventRouterGtk* GetInstance();
-
- // Start sending accessibility events for this widget and all of its
- // descendants. Notifications will go to the specified profile.
- // Uses reference counting, so it's safe to call this twice on the
- // same widget, as long as each call is paired with a call to
- // RemoveRootWidget.
- void AddRootWidget(GtkWidget* root_widget, Profile* profile);
-
- // Stop sending accessibility events for this widget and all of its
- // descendants.
- void RemoveRootWidget(GtkWidget* root_widget);
-
- // Use the following string as the name of this widget, instead of the
- // gtk label associated with the widget. Must be paired with a call to
- // RemoveWidgetNameOverride.
- void AddWidgetNameOverride(GtkWidget* widget, std::string name);
-
- // Forget widget name override. Must be paired with a call to
- // AddWidgetNameOverride (uses reference counting).
- void RemoveWidgetNameOverride(GtkWidget* widget);
-
- //
- // The following methods are only for use by gtk signal handlers.
- //
-
- // Called by the signal handler. Checks the type of the widget and
- // calls one of the more specific Send*Notification methods, below.
- void DispatchAccessibilityNotification(
- GtkWidget* widget, NotificationType type);
-
- // Post a task to call DispatchAccessibilityNotification the next time
- // through the event loop.
- void PostDispatchAccessibilityNotification(
- GtkWidget* widget, NotificationType type);
-
- private:
- AccessibilityEventRouterGtk();
- virtual ~AccessibilityEventRouterGtk();
-
- // Given a widget, determine if it's the descendant of a root widget
- // that's mapped to a profile and if so, if it's marked as accessible.
- void FindWidget(GtkWidget* widget, Profile** profile, bool* is_accessible);
-
- // Return the name of a widget.
- std::string GetWidgetName(GtkWidget* widget);
-
- // Each of these methods constructs an AccessibilityControlInfo object
- // and sends a notification of a specific accessibility event.
- void SendButtonNotification(
- GtkWidget* widget, NotificationType type, Profile* profile);
- void SendCheckboxNotification(
- GtkWidget* widget, NotificationType type, Profile* profile);
- void SendComboBoxNotification(
- GtkWidget* widget, NotificationType type, Profile* profile);
- void SendListBoxNotification(
- GtkWidget* widget, NotificationType type, Profile* profile);
- void SendMenuItemNotification(
- GtkWidget* widget, NotificationType type, Profile* profile);
- void SendRadioButtonNotification(
- GtkWidget* widget, NotificationType type, Profile* profile);
- void SendTabNotification(
- GtkWidget* widget, NotificationType type, Profile* profile);
- void SendEntryNotification(
- GtkWidget* widget, NotificationType type, Profile* profile);
- void SendTextViewNotification(
- GtkWidget* widget, NotificationType type, Profile* profile);
-
- bool IsPassword(GtkWidget* widget);
- void InstallEventListeners();
- void RemoveEventListeners();
-
- // Start and stop listening to signals.
- void StartListening();
- void StopListening();
-
- // Add a signal emission hook for one particular signal name and
- // widget type, and save the hook_id in installed_hooks so we can
- // remove it later.
- void InstallEventListener(
- const char *signal_name,
- GType widget_type,
- GSignalEmissionHook hook_func);
-
- friend struct DefaultSingletonTraits<AccessibilityEventRouterGtk>;
-
- // The set of all root widgets; only descendants of these will generate
- // accessibility notifications.
- base::hash_map<GtkWidget*, RootWidgetInfo> root_widget_info_map_;
-
- // Extra information about specific widgets.
- base::hash_map<GtkWidget*, WidgetInfo> widget_info_map_;
-
- // Installed event listener hook ids so we can remove them later.
- std::vector<InstalledHook> installed_hooks_;
-
- // True if we are currently listening to signals.
- bool listening_;
-
- // The profile associated with the most recent window event - used to
- // figure out where to route a few events that can't be directly traced
- // to a window with a profile (like menu events).
- Profile* most_recent_profile_;
-
- // The most recent focused widget.
- GtkWidget* most_recent_widget_;
-
- // Used to schedule invocations of StartListening() and to defer handling
- // of some events until the next time through the event loop.
- ScopedRunnableMethodFactory<AccessibilityEventRouterGtk> method_factory_;
-
- friend class AccessibilityEventRouterGtkTest;
- FRIEND_TEST_ALL_PREFIXES(AccessibilityEventRouterGtkTest, AddRootWidgetTwice);
-};
+#include "chrome/browser/ui/gtk/accessibility_event_router_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_ACCESSIBILITY_EVENT_ROUTER_GTK_H_
diff --git a/chrome/browser/gtk/accessible_widget_helper_gtk.h b/chrome/browser/gtk/accessible_widget_helper_gtk.h
index 2b06fac..03946e6 100644
--- a/chrome/browser/gtk/accessible_widget_helper_gtk.h
+++ b/chrome/browser/gtk/accessible_widget_helper_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,61 +6,7 @@
#define CHROME_BROWSER_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <set>
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/singleton.h"
-#include "chrome/browser/accessibility_events.h"
-#include "chrome/browser/gtk/accessibility_event_router_gtk.h"
-
-class Profile;
-
-// NOTE: This class is part of the Accessibility Extension API, which lets
-// extensions receive accessibility events. It's distinct from code that
-// implements platform accessibility APIs like MSAA or ATK.
-//
-// Helper class that helps to manage the accessibility information for all
-// of the widgets in a container. Create an instance of this class for
-// each container GtkWidget (like a dialog) that should send accessibility
-// events for all of its descendants.
-//
-// Most controls have default behavior for accessibility; when this needs
-// to be augmented, call one of the methods below to change its details.
-//
-// All of the information managed by this class is registered with the
-// (global) AccessibilityEventRouterGtk and unregistered when this object is
-// destroyed.
-class AccessibleWidgetHelper {
- public:
- // Contruct an AccessibleWidgetHelper that makes the given root widget
- // accessible for the lifetime of this object, sending accessibility
- // notifications to the given profile.
- AccessibleWidgetHelper(GtkWidget* root_widget, Profile* profile);
-
- virtual ~AccessibleWidgetHelper();
-
- // Send a notification that a new window was opened now, and a
- // corresponding close window notification when this object
- // goes out of scope.
- void SendOpenWindowNotification(const std::string& window_title);
-
- // Use the following string as the name of this widget, instead of the
- // gtk label associated with the widget.
- void SetWidgetName(GtkWidget* widget, std::string name);
-
- // Use the following string as the name of this widget, instead of the
- // gtk label associated with the widget.
- void SetWidgetName(GtkWidget* widget, int string_id);
-
- private:
- AccessibilityEventRouterGtk* accessibility_event_router_;
- Profile* profile_;
- GtkWidget* root_widget_;
- std::string window_title_;
- std::set<GtkWidget*> managed_widgets_;
-};
+#include "chrome/browser/ui/gtk/accessible_widget_helper_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_
diff --git a/chrome/browser/gtk/back_forward_button_gtk.h b/chrome/browser/gtk/back_forward_button_gtk.h
index c136627..375c08e 100644
--- a/chrome/browser/gtk/back_forward_button_gtk.h
+++ b/chrome/browser/gtk/back_forward_button_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,67 +6,7 @@
#define CHROME_BROWSER_GTK_BACK_FORWARD_BUTTON_GTK_H_
#pragma once
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-#include "base/task.h"
-#include "chrome/browser/gtk/custom_button.h"
-#include "chrome/browser/gtk/menu_gtk.h"
-
-class BackForwardMenuModel;
-class Browser;
-
-typedef struct _GtkWidget GtkWidget;
-
-// When clicked, these buttons will navigate forward or backward. When
-// pressed and held, they show a dropdown menu of recent web sites.
-class BackForwardButtonGtk : MenuGtk::Delegate {
- public:
- BackForwardButtonGtk(Browser* browser, bool is_forward);
- virtual ~BackForwardButtonGtk();
-
- // MenuGtk::Delegate implementation.
- virtual void StoppedShowing();
- virtual bool AlwaysShowIconForCmd(int command_id) const;
-
- GtkWidget* widget() { return button_->widget(); }
-
- private:
- // Executes the browser command.
- CHROMEGTK_CALLBACK_0(BackForwardButtonGtk, void, OnClick);
-
- // Starts a timer to show the dropdown menu.
- CHROMEGTK_CALLBACK_1(BackForwardButtonGtk, gboolean, OnButtonPress,
- GdkEventButton*);
-
- // If there is a timer to show the dropdown menu, and the mouse has moved
- // sufficiently down the screen, cancel the timer and immediately show the
- // menu.
- CHROMEGTK_CALLBACK_1(BackForwardButtonGtk, gboolean, OnMouseMove,
- GdkEventMotion*);
-
- // Shows the dropdown menu.
- void ShowBackForwardMenu();
-
- // The menu gets reset every time it is shown.
- scoped_ptr<MenuGtk> menu_;
-
- scoped_ptr<CustomDrawButton> button_;
-
- // The browser to which we will send commands.
- Browser* browser_;
-
- // Whether this button is a forward button.
- bool is_forward_;
-
- // The dropdown menu model.
- scoped_ptr<BackForwardMenuModel> menu_model_;
-
- // The y position of the last mouse down event.
- int y_position_of_last_press_;
-
- ScopedRunnableMethodFactory<BackForwardButtonGtk> show_menu_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(BackForwardButtonGtk);
-};
+#include "chrome/browser/ui/gtk/back_forward_button_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_BACK_FORWARD_BUTTON_GTK_H_
diff --git a/chrome/browser/gtk/bookmark_bar_gtk.h b/chrome/browser/gtk/bookmark_bar_gtk.h
index 7d62572..f58ca0f 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk.h
+++ b/chrome/browser/gtk/bookmark_bar_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,396 +6,7 @@
#define CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <vector>
-
-#include "app/gtk_signal.h"
-#include "base/gtest_prod_util.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/bookmarks/bookmark_context_menu_controller.h"
-#include "chrome/browser/bookmarks/bookmark_model_observer.h"
-#include "chrome/browser/gtk/bookmark_bar_instructions_gtk.h"
-#include "chrome/browser/gtk/menu_bar_helper.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/browser/gtk/view_id_util.h"
-#include "chrome/browser/sync/profile_sync_service.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "gfx/point.h"
-#include "gfx/size.h"
-#include "ui/base/animation/animation_delegate.h"
-
-class BookmarkMenuController;
-class Browser;
-class BrowserWindowGtk;
-class CustomContainerButton;
-class GtkThemeProvider;
-class MenuGtk;
-class PageNavigator;
-class Profile;
-class TabstripOriginProvider;
-
-namespace ui {
-class SlideAnimation;
-}
-
-class BookmarkBarGtk : public ui::AnimationDelegate,
- public ProfileSyncServiceObserver,
- public BookmarkModelObserver,
- public MenuBarHelper::Delegate,
- public NotificationObserver,
- public BookmarkBarInstructionsGtk::Delegate,
- public BookmarkContextMenuControllerDelegate {
- public:
- BookmarkBarGtk(BrowserWindowGtk* window,
- Profile* profile,
- Browser* browser,
- TabstripOriginProvider* tabstrip_origin_provider);
- virtual ~BookmarkBarGtk();
-
- // Resets the profile. This removes any buttons for the current profile and
- // recreates the models.
- void SetProfile(Profile* profile);
-
- // Returns the current profile.
- Profile* GetProfile() { return profile_; }
-
- // Returns the current browser.
- Browser* browser() const { return browser_; }
-
- // Returns the top level widget.
- GtkWidget* widget() const { return event_box_.get(); }
-
- // Sets the PageNavigator that is used when the user selects an entry on
- // the bookmark bar.
- void SetPageNavigator(PageNavigator* navigator);
-
- // Create the contents of the bookmark bar.
- void Init(Profile* profile);
-
- // Whether the current page is the New Tag Page (which requires different
- // rendering).
- bool OnNewTabPage();
-
- // Change the visibility of the bookmarks bar. (Starts out hidden, per GTK's
- // default behaviour). There are three visiblity states:
- //
- // Showing - bookmark bar is fully visible.
- // Hidden - bookmark bar is hidden except for a few pixels that give
- // extra padding to the bottom of the toolbar. Buttons are not
- // clickable.
- // Fullscreen - bookmark bar is fully hidden.
- void Show(bool animate);
- void Hide(bool animate);
- void EnterFullscreen();
-
- // Get the current height of the bookmark bar.
- int GetHeight();
-
- // Returns true if the bookmark bar is showing an animation.
- bool IsAnimating();
-
- // Returns true if the bookmarks bar preference is set to 'always show'.
- bool IsAlwaysShown();
-
- // ui::AnimationDelegate implementation --------------------------------------
- virtual void AnimationProgressed(const ui::Animation* animation);
- virtual void AnimationEnded(const ui::Animation* animation);
-
- // MenuBarHelper::Delegate implementation ------------------------------------
- virtual void PopupForButton(GtkWidget* button);
- virtual void PopupForButtonNextTo(GtkWidget* button,
- GtkMenuDirectionType dir);
-
- // The NTP needs to have access to this.
- static const int kBookmarkBarNTPHeight;
-
- // BookmarkContextMenuController::Delegate implementation --------------------
- virtual void CloseMenu();
-
- private:
- FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, DisplaysHelpMessageOnEmpty);
- FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest,
- HidesHelpMessageWithBookmark);
- FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, BuildsButtons);
-
- // Helper function which generates GtkToolItems for |bookmark_toolbar_|.
- void CreateAllBookmarkButtons();
-
- // Sets the visibility of the instructional text based on whether there are
- // any bookmarks in the bookmark bar node.
- void SetInstructionState();
-
- // Sets the visibility of the overflow chevron.
- void SetChevronState();
-
- // Helper function which destroys all the bookmark buttons in the GtkToolbar.
- void RemoveAllBookmarkButtons();
-
- // Returns the number of buttons corresponding to starred urls/groups. This
- // is equivalent to the number of children the bookmark bar node from the
- // bookmark bar model has.
- int GetBookmarkButtonCount();
-
- // Set the appearance of the overflow button appropriately (either chromium
- // style or GTK style).
- void SetOverflowButtonAppearance();
-
- // Returns the index of the first bookmark that is not visible on the bar.
- // Returns -1 if they are all visible.
- // |extra_space| is how much extra space to give the toolbar during the
- // calculation (for the purposes of determining if ditching the chevron
- // would be a good idea).
- // If non-NULL, |showing_folders| will be packed with all the folders that are
- // showing on the bar.
- int GetFirstHiddenBookmark(int extra_space,
- std::vector<GtkWidget*>* showing_folders);
-
- // Returns true if the bookmark bar should be floating on the page (for
- // NTP).
- bool ShouldBeFloating();
- // Update the floating state (either enable or disable it, or do nothing).
- void UpdateFloatingState();
-
- // Turns on or off the app_paintable flag on |event_box_|, depending on our
- // state.
- void UpdateEventBoxPaintability();
-
- // Queue a paint on the event box.
- void PaintEventBox();
-
- // Finds the size of the current tab contents, if it exists and sets |size|
- // to the correct value. Returns false if there isn't a TabContents, a
- // condition that can happen during testing.
- bool GetTabContentsSize(gfx::Size* size);
-
- // Makes the appropriate widget on the bookmark bar stop throbbing
- // (a folder, the overflow chevron, or nothing).
- void StartThrobbing(const BookmarkNode* node);
-
- // Set |throbbing_widget_| to |widget|. Also makes sure that
- // |throbbing_widget_| doesn't become stale.
- void SetThrobbingWidget(GtkWidget* widget);
-
- // An item has been dragged over the toolbar, update the drag context
- // and toolbar UI appropriately.
- gboolean ItemDraggedOverToolbar(
- GdkDragContext* context, int index, guint time);
-
- // When dragging in the middle of a folder, assume the user wants to drop
- // on the folder. Towards the edges, assume the user wants to drop on the
- // toolbar. This makes it possible to drop between two folders. This function
- // returns the index on the toolbar the drag should target, or -1 if the
- // drag should hit the folder.
- int GetToolbarIndexForDragOverFolder(GtkWidget* button, gint x);
-
- void ClearToolbarDropHighlighting();
-
- // Overridden from BookmarkModelObserver:
-
- // Invoked when the bookmark model has finished loading. Creates a button
- // for each of the children of the root node from the model.
- virtual void Loaded(BookmarkModel* model);
-
- // Invoked when the model is being deleted.
- virtual void BookmarkModelBeingDeleted(BookmarkModel* model);
-
- // Invoked when a node has moved.
- virtual void BookmarkNodeMoved(BookmarkModel* model,
- const BookmarkNode* old_parent,
- int old_index,
- const BookmarkNode* new_parent,
- int new_index);
- virtual void BookmarkNodeAdded(BookmarkModel* model,
- const BookmarkNode* parent,
- int index);
- virtual void BookmarkNodeRemoved(BookmarkModel* model,
- const BookmarkNode* parent,
- int old_index,
- const BookmarkNode* node);
- virtual void BookmarkNodeChanged(BookmarkModel* model,
- const BookmarkNode* node);
- // Invoked when a favicon has finished loading.
- virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model,
- const BookmarkNode* node);
- virtual void BookmarkNodeChildrenReordered(BookmarkModel* model,
- const BookmarkNode* node);
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- GtkWidget* CreateBookmarkButton(const BookmarkNode* node);
- GtkToolItem* CreateBookmarkToolItem(const BookmarkNode* node);
-
- void ConnectFolderButtonEvents(GtkWidget* widget, bool is_tool_item);
-
- // Finds the BookmarkNode from the model associated with |button|.
- const BookmarkNode* GetNodeForToolButton(GtkWidget* button);
-
- // Creates and displays a popup menu for BookmarkNode |node|.
- void PopupMenuForNode(GtkWidget* sender, const BookmarkNode* node,
- GdkEventButton* event);
-
- // GtkButton callbacks.
- CHROMEGTK_CALLBACK_1(BookmarkBarGtk, gboolean, OnButtonPressed,
- GdkEventButton*);
- CHROMEGTK_CALLBACK_1(BookmarkBarGtk, gboolean, OnSyncErrorButtonPressed,
- GdkEventButton*);
- CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnClicked);
- CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnButtonDragBegin,
- GdkDragContext*);
- CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnButtonDragEnd, GdkDragContext*);
- CHROMEGTK_CALLBACK_4(BookmarkBarGtk, void, OnButtonDragGet,
- GdkDragContext*, GtkSelectionData*, guint, guint);
-
- // GtkButton callbacks for folder buttons.
- CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnFolderClicked);
-
- // GtkToolbar callbacks.
- CHROMEGTK_CALLBACK_4(BookmarkBarGtk, gboolean, OnToolbarDragMotion,
- GdkDragContext*, gint, gint, guint);
- CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnToolbarSizeAllocate,
- GtkAllocation*);
-
- // Used for both folder buttons and the toolbar.
- CHROMEGTK_CALLBACK_6(BookmarkBarGtk, void, OnDragReceived,
- GdkDragContext*, gint, gint, GtkSelectionData*,
- guint, guint);
- CHROMEGTK_CALLBACK_2(BookmarkBarGtk, void, OnDragLeave,
- GdkDragContext*, guint);
-
- // Used for folder buttons.
- CHROMEGTK_CALLBACK_4(BookmarkBarGtk, gboolean, OnFolderDragMotion,
- GdkDragContext*, gint, gint, guint);
-
- // GtkEventBox callbacks.
- CHROMEGTK_CALLBACK_1(BookmarkBarGtk, gboolean, OnEventBoxExpose,
- GdkEventExpose*);
- CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnEventBoxDestroy);
-
- // Callbacks on our parent widget.
- CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnParentSizeAllocate,
- GtkAllocation*);
-
- // |throbbing_widget_| callback.
- CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnThrobbingWidgetDestroy);
-
- // ProfileSyncServiceObserver method.
- virtual void OnStateChanged();
-
- // Overriden from BookmarkBarInstructionsGtk::Delegate.
- virtual void ShowImportDialog();
-
- Profile* profile_;
-
- // Used for opening urls.
- PageNavigator* page_navigator_;
-
- Browser* browser_;
- BrowserWindowGtk* window_;
-
- // Provides us with the offset into the background theme image.
- TabstripOriginProvider* tabstrip_origin_provider_;
-
- // Model providing details as to the starred entries/groups that should be
- // shown. This is owned by the Profile.
- BookmarkModel* model_;
-
- // Contains |bookmark_hbox_|. Event box exists to prevent leakage of
- // background color from the toplevel application window's GDK window.
- OwnedWidgetGtk event_box_;
-
- // Used to float the bookmark bar when on the NTP.
- GtkWidget* ntp_padding_box_;
-
- // Used to paint the background of the bookmark bar when in floating mode.
- GtkWidget* paint_box_;
-
- // Used to position all children.
- GtkWidget* bookmark_hbox_;
-
- // Alignment widget that is visible if there are no bookmarks on
- // the bookmar bar.
- GtkWidget* instructions_;
-
- // BookmarkBarInstructionsGtk that holds the label and the link for importing
- // bookmarks when there are no bookmarks on the bookmark bar.
- scoped_ptr<BookmarkBarInstructionsGtk> instructions_gtk_;
-
- // GtkToolbar which contains all the bookmark buttons.
- OwnedWidgetGtk bookmark_toolbar_;
-
- // The button that shows extra bookmarks that don't fit on the bookmark
- // bar.
- GtkWidget* overflow_button_;
-
- // The other bookmarks button.
- GtkWidget* other_bookmarks_button_;
-
- // The sync error button.
- GtkWidget* sync_error_button_;
-
- // A pointer to the ProfileSyncService instance if one exists.
- ProfileSyncService* sync_service_;
-
- // The BookmarkNode from the model being dragged. NULL when we aren't
- // dragging.
- const BookmarkNode* dragged_node_;
-
- // The visual representation that follows the cursor during drags.
- GtkWidget* drag_icon_;
-
- // We create a GtkToolbarItem from |dragged_node_| ;or display.
- GtkToolItem* toolbar_drop_item_;
-
- // Theme provider for building buttons.
- GtkThemeProvider* theme_provider_;
-
- // Whether we should show the instructional text in the bookmark bar.
- bool show_instructions_;
-
- MenuBarHelper menu_bar_helper_;
-
- // The last displayed right click menu, or NULL if no menus have been
- // displayed yet.
- // The controller.
- scoped_ptr<BookmarkContextMenuController> current_context_menu_controller_;
- // The view.
- scoped_ptr<MenuGtk> current_context_menu_;
-
- // The last displayed left click menu, or NULL if no menus have been
- // displayed yet.
- scoped_ptr<BookmarkMenuController> current_menu_;
-
- scoped_ptr<ui::SlideAnimation> slide_animation_;
-
- // Whether we are currently configured as floating (detached from the
- // toolbar). This reflects our actual state, and can be out of sync with
- // what ShouldShowFloating() returns.
- bool floating_;
-
- // Used to optimize out |bookmark_toolbar_| size-allocate events we don't
- // need to respond to.
- int last_allocation_width_;
-
- NotificationRegistrar registrar_;
-
- // The size of the tab contents last time we forced a paint. We keep track
- // of this so we don't force too many paints.
- gfx::Size last_tab_contents_size_;
-
- // The last coordinates recorded by OnButtonPress; used to line up the
- // drag icon during bookmark drags.
- gfx::Point last_pressed_coordinates_;
-
- // The currently throbbing widget. This is NULL if no widget is throbbing.
- // We track it because we only want to allow one widget to throb at a time.
- GtkWidget* throbbing_widget_;
-
- ScopedRunnableMethodFactory<BookmarkBarGtk> method_factory_;
-};
+#include "chrome/browser/ui/gtk/bookmark_bar_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_
diff --git a/chrome/browser/gtk/bookmark_bar_instructions_gtk.h b/chrome/browser/gtk/bookmark_bar_instructions_gtk.h
index b58e507..03a5af5 100644
--- a/chrome/browser/gtk/bookmark_bar_instructions_gtk.h
+++ b/chrome/browser/gtk/bookmark_bar_instructions_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,57 +6,7 @@
#define CHROME_BROWSER_GTK_BOOKMARK_BAR_INSTRUCTIONS_GTK_H_
#pragma once
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-
-typedef struct _GtkWidget GtkWidget;
-class GtkThemeProvider;
-class Profile;
-
-class BookmarkBarInstructionsGtk : public NotificationObserver {
- public:
- // The delegate is notified once the user clicks on the link to import
- // bookmarks.
- class Delegate {
- public:
- virtual void ShowImportDialog() = 0;
-
- protected:
- virtual ~Delegate() {}
- };
-
- explicit BookmarkBarInstructionsGtk(Delegate* delegate, Profile* profile);
-
- // Get the native widget.
- GtkWidget* widget() const { return instructions_hbox_; }
-
- private:
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- CHROMEGTK_CALLBACK_0(BookmarkBarInstructionsGtk, void, OnButtonClick);
-
- // Sets the correct color for |instructions_label_| and |instructions_link_|.
- void UpdateColors();
-
- Delegate* delegate_;
-
- Profile* profile_;
-
- GtkThemeProvider* theme_provider_;
-
- // HBox that holds the the label and link of bookmark bar import promotion.
- GtkWidget* instructions_hbox_;
- GtkWidget* instructions_label_;
- GtkWidget* instructions_link_;
-
- NotificationRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(BookmarkBarInstructionsGtk);
-};
+#include "chrome/browser/ui/gtk/bookmark_bar_instructions_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_BOOKMARK_BAR_INSTRUCTIONS_GTK_H_
diff --git a/chrome/browser/gtk/bookmark_bubble_gtk.h b/chrome/browser/gtk/bookmark_bubble_gtk.h
index 6c7de88..d6908e9 100644
--- a/chrome/browser/gtk/bookmark_bubble_gtk.h
+++ b/chrome/browser/gtk/bookmark_bubble_gtk.h
@@ -1,129 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// This is the GTK implementation of the bookmark bubble, the dialog box
-// presented to create or edit a bookmark. There can only ever be a single
-// bubble open, so the class presents only static methods, and handles the
-// singleton behavior for you. It also handles the object and widget
-// lifetimes, destroying everything and possibly committing any changes when
-// the bubble is closed.
-
#ifndef CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_
#define CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_
#pragma once
-#include <string>
-#include <vector>
-
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "base/task.h"
-#include "chrome/browser/gtk/info_bubble_gtk.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "googleurl/src/gurl.h"
-
-class BookmarkNode;
-class Profile;
-class RecentlyUsedFoldersComboModel;
-
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GParamSpec GParamSpec;
-
-class BookmarkBubbleGtk : public InfoBubbleGtkDelegate,
- public NotificationObserver {
- public:
- // Shows the bookmark bubble, pointing at |anchor_widget|.
- static void Show(GtkWidget* anchor_widget,
- Profile* profile,
- const GURL& url,
- bool newly_bookmarked);
-
- // Implements the InfoBubbleGtkDelegate. We are notified when the bubble
- // is about to be closed, so we have a chance to save any state / input in
- // our widgets before they are destroyed.
- virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble,
- bool closed_by_escape);
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- private:
- BookmarkBubbleGtk(GtkWidget* anchor,
- Profile* profile,
- const GURL& url,
- bool newly_bookmarked);
- ~BookmarkBubbleGtk();
-
- // Notified when |content_| is destroyed so we can delete our instance.
- CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnDestroy);
- CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnNameActivate);
- CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnFolderChanged);
- CHROMEGTK_CALLBACK_1(BookmarkBubbleGtk, void, OnFolderPopupShown,
- GParamSpec*);
- CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnEditClicked);
- CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnCloseClicked);
- CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnRemoveClicked);
-
- // Update the bookmark with any edits that have been made.
- void ApplyEdits();
-
- // Open the bookmark editor for the current url and close the bubble.
- void ShowEditor();
-
- // Return the UTF8 encoded title for the current |url_|.
- std::string GetTitle();
-
- void InitFolderComboModel();
-
- // The URL of the bookmark.
- GURL url_;
- // Our current profile (used to access the bookmark system).
- Profile* profile_;
-
- // Provides colors and stuff.
- GtkThemeProvider* theme_provider_;
-
- // The widget relative to which we are positioned.
- GtkWidget* anchor_;
-
- // We let the InfoBubble own our content, and then we delete ourself
- // when the widget is destroyed (when the InfoBubble is destroyed).
- GtkWidget* content_;
-
- // The button that removes the bookmark.
- GtkWidget* remove_button_;
-
- // The various labels in the interface. We keep track of them for theme
- // changes.
- std::vector<GtkWidget*> labels_;
-
- // The GtkEntry for editing the bookmark name / title.
- GtkWidget* name_entry_;
-
- // The combo box for selecting the bookmark folder.
- GtkWidget* folder_combo_;
- scoped_ptr<RecentlyUsedFoldersComboModel> folder_combo_model_;
-
- InfoBubbleGtk* bubble_;
-
- // We need to push some things on the back of the message loop, so we have
- // a factory attached to our instance to manage task lifetimes.
- ScopedRunnableMethodFactory<BookmarkBubbleGtk> factory_;
-
- // Whether the bubble is creating or editing an existing bookmark.
- bool newly_bookmarked_;
- // When closing the window, whether we should update or remove the bookmark.
- bool apply_edits_;
- bool remove_bookmark_;
-
- NotificationRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleGtk);
-};
+#include "chrome/browser/ui/gtk/bookmark_bubble_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_
diff --git a/chrome/browser/gtk/bookmark_editor_gtk.h b/chrome/browser/gtk/bookmark_editor_gtk.h
index 7295689..6073026 100644
--- a/chrome/browser/gtk/bookmark_editor_gtk.h
+++ b/chrome/browser/gtk/bookmark_editor_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,162 +6,7 @@
#define CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_
#pragma once
-#include "app/gtk_integers.h"
-#include "app/gtk_signal.h"
-#include "base/gtest_prod_util.h"
-#include "base/scoped_ptr.h"
-#include "base/string16.h"
-#include "chrome/browser/bookmarks/bookmark_editor.h"
-#include "chrome/browser/bookmarks/bookmark_model_observer.h"
-
-class GURL;
-
-typedef union _GdkEvent GdkEvent;
-typedef struct _GdkEventButton GdkEventButton;
-typedef struct _GtkTreeIter GtkTreeIter;
-typedef struct _GtkTreeSelection GtkTreeSelection;
-typedef struct _GtkTreeStore GtkTreeStore;
-typedef struct _GtkWidget GtkWidget;
-
-namespace gfx {
-class Point;
-} // namespace gfx
-
-// GTK version of the bookmark editor dialog.
-class BookmarkEditorGtk : public BookmarkEditor,
- public BookmarkModelObserver {
- public:
- BookmarkEditorGtk(GtkWindow* window,
- Profile* profile,
- const BookmarkNode* parent,
- const EditDetails& details,
- BookmarkEditor::Configuration configuration);
-
- virtual ~BookmarkEditorGtk();
-
- void Show();
- void Close();
-
- private:
- FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeParent);
- FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeParentAndURL);
- FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeURLToExistingURL);
- FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, EditTitleKeepsPosition);
- FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, EditURLKeepsPosition);
- FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ModelsMatch);
- FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, MoveToNewParent);
- FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, NewURL);
- FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeURLNoTree);
- FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeTitleNoTree);
-
- class ContextMenuController;
- friend class ContextMenuController;
-
- void Init(GtkWindow* parent_window);
-
- // BookmarkModel observer methods. Any structural change results in
- // resetting the tree model.
- virtual void Loaded(BookmarkModel* model) { }
- virtual void BookmarkNodeMoved(BookmarkModel* model,
- const BookmarkNode* old_parent,
- int old_index,
- const BookmarkNode* new_parent,
- int new_index);
- virtual void BookmarkNodeAdded(BookmarkModel* model,
- const BookmarkNode* parent,
- int index);
- virtual void BookmarkNodeRemoved(BookmarkModel* model,
- const BookmarkNode* parent,
- int old_index,
- const BookmarkNode* node);
- virtual void BookmarkNodeChanged(BookmarkModel* model,
- const BookmarkNode* node) {}
- virtual void BookmarkNodeChildrenReordered(BookmarkModel* model,
- const BookmarkNode* node);
- virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model,
- const BookmarkNode* node) {}
-
- // Resets the model of the tree and updates the various buttons appropriately.
- void Reset();
-
- // Returns the current url the user has input.
- GURL GetInputURL() const;
-
- // Returns the title the user has input.
- string16 GetInputTitle() const;
-
- // Invokes ApplyEdits with the selected node.
- //
- // TODO(erg): This was copied from the windows version. Both should be
- // cleaned up so that we don't overload ApplyEdits.
- void ApplyEdits();
-
- // Applies the edits done by the user. |selected_parent| gives the parent of
- // the URL being edited.
- void ApplyEdits(GtkTreeIter* selected_parent);
-
- // Adds a new group parented on |parent| and sets |child| to point to this
- // new group.
- void AddNewGroup(GtkTreeIter* parent, GtkTreeIter* child);
-
- CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnSelectionChanged);
- CHROMEGTK_CALLBACK_1(BookmarkEditorGtk, void, OnResponse, int);
- CHROMEGTK_CALLBACK_1(BookmarkEditorGtk, gboolean, OnWindowDeleteEvent,
- GdkEvent*);
-
- CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnWindowDestroy);
- CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnEntryChanged);
-
- CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnNewFolderClicked);
-
- CHROMEGTK_CALLBACK_1(BookmarkEditorGtk, gboolean, OnTreeViewButtonPressEvent,
- GdkEventButton*);
-
- void ShowContextMenu(const gfx::Point& point);
-
- void NewFolder();
-
- // Profile the entry is from.
- Profile* profile_;
-
- // The dialog to display on screen.
- GtkWidget* dialog_;
- GtkWidget* name_entry_;
- GtkWidget* url_entry_; // This is NULL if IsEditingFolder.
- GtkWidget* tree_view_;
- GtkWidget* new_folder_button_;
-
- // Helper object that manages the currently selected item in |tree_view_|.
- GtkTreeSelection* tree_selection_;
-
- // Our local copy of the bookmark data that we make from the BookmarkModel
- // that we can modify as much as we want and still discard when the user
- // clicks Cancel.
- GtkTreeStore* tree_store_;
-
- // TODO(erg): BookmarkEditorView has an EditorTreeModel object here; convert
- // that into a GObject that implements the interface GtkTreeModel.
-
- // Initial parent to select. Is only used if node_ is NULL.
- const BookmarkNode* parent_;
-
- // Details about the node we're editing.
- const EditDetails details_;
-
- // Mode used to create nodes from.
- BookmarkModel* bb_model_;
-
- // If true, we're running the menu for the bookmark bar or other bookmarks
- // nodes.
- bool running_menu_for_root_;
-
- // Is the tree shown?
- bool show_tree_;
-
- // The context menu controller.
- scoped_ptr<ContextMenuController> menu_controller_;
-
- DISALLOW_COPY_AND_ASSIGN(BookmarkEditorGtk);
-};
+#include "chrome/browser/ui/gtk/bookmark_editor_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_
diff --git a/chrome/browser/gtk/bookmark_menu_controller_gtk.h b/chrome/browser/gtk/bookmark_menu_controller_gtk.h
index 0060267..92467d2 100644
--- a/chrome/browser/gtk/bookmark_menu_controller_gtk.h
+++ b/chrome/browser/gtk/bookmark_menu_controller_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,140 +6,7 @@
#define CHROME_BROWSER_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_
#pragma once
-#include <map>
-
-#include "app/gtk_integers.h"
-#include "app/gtk_signal.h"
-#include "app/gtk_signal_registrar.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/bookmarks/base_bookmark_model_observer.h"
-#include "chrome/browser/bookmarks/bookmark_context_menu_controller.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "webkit/glue/window_open_disposition.h"
-
-class Browser;
-class Profile;
-class Profiler;
-class PageNavigator;
-class BookmarkModel;
-class BookmarkNode;
-class MenuGtk;
-
-typedef struct _GdkDragContext GdkDragContext;
-typedef struct _GdkEventButton GdkEventButton;
-typedef struct _GtkSelectionData GtkSelectionData;
-typedef struct _GtkWidget GtkWidget;
-
-class BookmarkMenuController : public BaseBookmarkModelObserver,
- public BookmarkContextMenuControllerDelegate {
- public:
- // Creates a BookmarkMenuController showing the children of |node| starting
- // at index |start_child_index|.
- BookmarkMenuController(Browser* browser,
- Profile* profile,
- PageNavigator* page_navigator,
- GtkWindow* window,
- const BookmarkNode* node,
- int start_child_index);
- virtual ~BookmarkMenuController();
-
- GtkWidget* widget() { return menu_; }
-
- // Pops up the menu. |widget| must be a GtkChromeButton.
- void Popup(GtkWidget* widget, gint button_type, guint32 timestamp);
-
- // Overridden from BaseBookmarkModelObserver:
- virtual void BookmarkModelChanged();
- virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model,
- const BookmarkNode* node);
-
- // Overridden from BookmarkContextMenuController::Delegate:
- virtual void WillExecuteCommand();
- virtual void CloseMenu();
-
- private:
- // Recursively change the bookmark hierarchy rooted in |parent| into a set of
- // gtk menus rooted in |menu|.
- void BuildMenu(const BookmarkNode* parent,
- int start_child_index,
- GtkWidget* menu);
-
- // Calls the page navigator to navigate to the node represented by
- // |menu_item|.
- void NavigateToMenuItem(GtkWidget* menu_item,
- WindowOpenDisposition disposition);
-
- // Button press and release events for a GtkMenu.
- CHROMEGTK_CALLBACK_1(BookmarkMenuController, gboolean,
- OnMenuButtonPressedOrReleased, GdkEventButton*);
-
- // Button release event for a GtkMenuItem.
- CHROMEGTK_CALLBACK_1(BookmarkMenuController, gboolean, OnButtonReleased,
- GdkEventButton*);
-
- // We connect this handler to the button-press-event signal for folder nodes.
- // It suppresses the normal behavior (popping up the submenu) to allow these
- // nodes to be draggable. The submenu is instead popped up on a
- // button-release-event.
- CHROMEGTK_CALLBACK_1(BookmarkMenuController, gboolean, OnFolderButtonPressed,
- GdkEventButton*);
-
- // We have to stop drawing |triggering_widget_| as active when the menu
- // closes.
- CHROMEGTK_CALLBACK_0(BookmarkMenuController, void, OnMenuHidden)
-
- // We respond to the activate signal because things other than mouse button
- // events can trigger it.
- CHROMEGTK_CALLBACK_0(BookmarkMenuController, void, OnMenuItemActivated);
-
- // The individual GtkMenuItems in the BookmarkMenu are all drag sources.
- CHROMEGTK_CALLBACK_1(BookmarkMenuController, void, OnMenuItemDragBegin,
- GdkDragContext*);
- CHROMEGTK_CALLBACK_1(BookmarkMenuController, void, OnMenuItemDragEnd,
- GdkDragContext*);
- CHROMEGTK_CALLBACK_4(BookmarkMenuController, void, OnMenuItemDragGet,
- GdkDragContext*, GtkSelectionData*, guint, guint);
-
- Browser* browser_;
- Profile* profile_;
- PageNavigator* page_navigator_;
-
- // Parent window of this menu.
- GtkWindow* parent_window_;
-
- // The bookmark model.
- BookmarkModel* model_;
-
- // The node we're showing the contents of.
- const BookmarkNode* node_;
-
- // Our bookmark menus. We don't use the MenuGtk class because we have to do
- // all sorts of weird non-standard things with this menu, like:
- // - The menu is a drag target
- // - The menu items have context menus.
- GtkWidget* menu_;
-
- // The visual representation that follows the cursor during drags.
- GtkWidget* drag_icon_;
-
- // Whether we should ignore the next button release event (because we were
- // dragging).
- bool ignore_button_release_;
-
- // The widget we are showing for (i.e. the bookmark bar folder button).
- GtkWidget* triggering_widget_;
-
- // Mapping from node to GtkMenuItem menu id. This only contains entries for
- // nodes of type URL.
- std::map<const BookmarkNode*, GtkWidget*> node_to_menu_widget_map_;
-
- // The controller and view for the right click context menu.
- scoped_ptr<BookmarkContextMenuController> context_menu_controller_;
- scoped_ptr<MenuGtk> context_menu_;
-
- GtkSignalRegistrar signals_;
-
- DISALLOW_COPY_AND_ASSIGN(BookmarkMenuController);
-};
+#include "chrome/browser/ui/gtk/bookmark_menu_controller_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_
diff --git a/chrome/browser/gtk/bookmark_tree_model.h b/chrome/browser/gtk/bookmark_tree_model.h
index 1d28fbd..5c12b6e 100644
--- a/chrome/browser/gtk/bookmark_tree_model.h
+++ b/chrome/browser/gtk/bookmark_tree_model.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,72 +6,7 @@
#define CHROME_BROWSER_GTK_BOOKMARK_TREE_MODEL_H_
#pragma once
-#include "base/basictypes.h"
-#include "base/string16.h"
-
-class BookmarkModel;
-class BookmarkNode;
-
-typedef struct _GtkCellRenderer GtkCellRenderer;
-typedef struct _GtkTreeIter GtkTreeIter;
-typedef struct _GtkTreeModel GtkTreeModel;
-typedef struct _GtkTreeStore GtkTreeStore;
-typedef struct _GtkTreeView GtkTreeView;
-typedef struct _GdkPixbuf GdkPixbuf;
-typedef struct _GtkWidget GtkWidget;
-
-namespace bookmark_utils {
-
-enum FolderTreeStoreColumns {
- FOLDER_ICON,
- FOLDER_NAME,
- ITEM_ID,
- IS_EDITABLE,
- FOLDER_STORE_NUM_COLUMNS
-};
-
-// Make a tree store that has two columns: name and id.
-GtkTreeStore* MakeFolderTreeStore();
-
-// Copies the folders in the model's root node into a GtkTreeStore. We
-// want the user to be able to modify the tree of folders, but to be able to
-// click Cancel and discard their modifications. |selected_id| is the
-// node->id() of the BookmarkNode that should selected on
-// node->screen. |selected_iter| is an out value that points to the
-// node->representation of the node associated with |selected_id| in |store|.
-// |recursive| indicates whether to recurse into sub-directories (if false,
-// the tree store will effectively be a list). |only_folders| indicates whether
-// to include bookmarks in the tree, or to only show folders.
-void AddToTreeStore(BookmarkModel* model, int64 selected_id,
- GtkTreeStore* store, GtkTreeIter* selected_iter);
-
-// As above, but inserts just the tree rooted at |node| as a child of |parent|.
-// If |parent| is NULL, add it at the top level.
-void AddToTreeStoreAt(const BookmarkNode* node, int64 selected_id,
- GtkTreeStore* store, GtkTreeIter* selected_iter,
- GtkTreeIter* parent);
-
-// Makes a tree view for the store. This will take ownership of |store| and the
-// returned widget has a floating reference.
-GtkWidget* MakeTreeViewForStore(GtkTreeStore* store);
-
-// A helper method for getting pointer back to the GtkCellRendererText used for
-// the folder names.
-GtkCellRenderer* GetCellRendererText(GtkTreeView* tree_view);
-
-// Commits changes to a GtkTreeStore built from BuildTreeStoreFrom() back
-// into the BookmarkModel it was generated from. Returns the BookmarkNode that
-// represented by |selected|.
-const BookmarkNode* CommitTreeStoreDifferencesBetween(
- BookmarkModel* model, GtkTreeStore* tree_store,
- GtkTreeIter* selected);
-
-// Returns the id field of the row pointed to by |iter|.
-int64 GetIdFromTreeIter(GtkTreeModel* model, GtkTreeIter* iter);
-
-// Returns the title field in utf8 of the row pointed to by |iter|.
-string16 GetTitleFromTreeIter(GtkTreeModel* model, GtkTreeIter* iter);
-
-} // namespace bookmark_utils
+#include "chrome/browser/ui/gtk/bookmark_tree_model.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_BOOKMARK_TREE_MODEL_H_
diff --git a/chrome/browser/gtk/bookmark_utils_gtk.h b/chrome/browser/gtk/bookmark_utils_gtk.h
index 1ebc627..d49d136 100644
--- a/chrome/browser/gtk/bookmark_utils_gtk.h
+++ b/chrome/browser/gtk/bookmark_utils_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,105 +6,7 @@
#define CHROME_BROWSER_GTK_BOOKMARK_UTILS_GTK_H_
#pragma once
-#include <vector>
-#include <string>
-
-#include "app/gtk_integers.h"
-#include "base/string16.h"
-
-class BookmarkModel;
-class BookmarkNode;
-class GtkThemeProvider;
-class Profile;
-
-typedef struct _GdkDragContext GdkDragContext;
-typedef struct _GdkPixbuf GdkPixbuf;
-typedef struct _GtkSelectionData GtkSelectionData;
-typedef struct _GtkWidget GtkWidget;
-
-namespace bookmark_utils {
-
-extern const char kBookmarkNode[];
-
-// Get the image that is used to represent the node. This function adds a ref
-// to the returned pixbuf, so it requires a matching call to g_object_unref().
-GdkPixbuf* GetPixbufForNode(const BookmarkNode* node, BookmarkModel* model,
- bool native);
-
-// Returns a GtkWindow with a visual hierarchy for passing to
-// gtk_drag_set_icon_widget().
-GtkWidget* GetDragRepresentation(GdkPixbuf* pixbuf,
- const string16& title,
- GtkThemeProvider* provider);
-GtkWidget* GetDragRepresentationForNode(const BookmarkNode* node,
- BookmarkModel* model,
- GtkThemeProvider* provider);
-
-// Helper function that sets visual properties of GtkButton |button| to the
-// contents of |node|.
-void ConfigureButtonForNode(const BookmarkNode* node, BookmarkModel* model,
- GtkWidget* button, GtkThemeProvider* provider);
-
-// Returns the tooltip.
-std::string BuildTooltipFor(const BookmarkNode* node);
-
-// Returns the "bookmark-node" property of |widget| casted to the correct type.
-const BookmarkNode* BookmarkNodeForWidget(GtkWidget* widget);
-
-// Set the colors on |label| as per the theme.
-void SetButtonTextColors(GtkWidget* label, GtkThemeProvider* provider);
-
-// Drag and drop. --------------------------------------------------------------
-
-// Get the DnD target mask for a bookmark drag. This will vary based on whether
-// the node in question is a folder.
-int GetCodeMask(bool folder);
-
-// Pickle a node into a GtkSelection.
-void WriteBookmarkToSelection(const BookmarkNode* node,
- GtkSelectionData* selection_data,
- guint target_type,
- Profile* profile);
-
-// Pickle a vector of nodes into a GtkSelection.
-void WriteBookmarksToSelection(const std::vector<const BookmarkNode*>& nodes,
- GtkSelectionData* selection_data,
- guint target_type,
- Profile* profile);
-
-// Un-pickle node(s) from a GtkSelection.
-// The last two arguments are out parameters.
-std::vector<const BookmarkNode*> GetNodesFromSelection(
- GdkDragContext* context,
- GtkSelectionData* selection_data,
- guint target_type,
- Profile* profile,
- gboolean* delete_selection_data,
- gboolean* dnd_success);
-
-// Unpickle a new bookmark of the CHROME_NAMED_URL drag type, and put it in
-// the appropriate location in the model.
-bool CreateNewBookmarkFromNamedUrl(
- GtkSelectionData* selection_data,
- BookmarkModel* model,
- const BookmarkNode* parent,
- int idx);
-
-// Add the URIs in |selection_data| into the model at the given position. They
-// will be added whether or not the URL is valid.
-bool CreateNewBookmarksFromURIList(
- GtkSelectionData* selection_data,
- BookmarkModel* model,
- const BookmarkNode* parent,
- int idx);
-
-// Add the "url\ntitle" combination into the model at the given position.
-bool CreateNewBookmarkFromNetscapeURL(
- GtkSelectionData* selection_data,
- BookmarkModel* model,
- const BookmarkNode* parent,
- int idx);
-
-} // namespace bookmark_utils
+#include "chrome/browser/ui/gtk/bookmark_utils_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_BOOKMARK_UTILS_GTK_H_
diff --git a/chrome/browser/gtk/browser_actions_toolbar_gtk.h b/chrome/browser/gtk/browser_actions_toolbar_gtk.h
index 4d49416..c377a09 100644
--- a/chrome/browser/gtk/browser_actions_toolbar_gtk.h
+++ b/chrome/browser/gtk/browser_actions_toolbar_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,218 +6,7 @@
#define CHROME_BROWSER_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_
#pragma once
-#include <map>
-#include <string>
-
-#include "app/gtk_signal.h"
-#include "app/gtk_signal_registrar.h"
-#include "app/menus/simple_menu_model.h"
-#include "base/linked_ptr.h"
-#include "base/task.h"
-#include "chrome/browser/extensions/extension_toolbar_model.h"
-#include "chrome/browser/gtk/custom_button.h"
-#include "chrome/browser/gtk/menu_gtk.h"
-#include "chrome/browser/gtk/overflow_button.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "ui/base/animation/animation_delegate.h"
-#include "ui/base/animation/slide_animation.h"
-
-class Browser;
-class BrowserActionButton;
-class Extension;
-class GtkThemeProvider;
-class Profile;
-
-typedef struct _GdkDragContext GdkDragContext;
-typedef struct _GtkWidget GtkWidget;
-
-class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer,
- public ui::AnimationDelegate,
- public MenuGtk::Delegate,
- public menus::SimpleMenuModel::Delegate,
- public NotificationObserver {
- public:
- explicit BrowserActionsToolbarGtk(Browser* browser);
- virtual ~BrowserActionsToolbarGtk();
-
- GtkWidget* widget() { return hbox_.get(); }
- GtkWidget* chevron() { return overflow_button_->widget(); }
-
- // Returns the widget in use by the BrowserActionButton corresponding to
- // |extension|. Used in positioning the ExtensionInstalledBubble for
- // BrowserActions.
- GtkWidget* GetBrowserActionWidget(const Extension* extension);
-
- int button_count() { return extension_button_map_.size(); }
-
- Browser* browser() { return browser_; }
-
- // Returns the currently selected tab ID, or -1 if there is none.
- int GetCurrentTabId();
-
- // Update the display of all buttons.
- void Update();
-
- // NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- bool animating() {
- return resize_animation_.is_animating();
- }
-
- private:
- friend class BrowserActionButton;
-
- // Initialize drag and drop.
- void SetupDrags();
-
- // Query the extensions service for all extensions with browser actions,
- // and create the UI for them.
- void CreateAllButtons();
-
- // Sets the width of the container and overflow state according to the model.
- void SetContainerWidth();
-
- // Create the UI for a single browser action. This will stick the button
- // at the end of the toolbar.
- void CreateButtonForExtension(const Extension* extension, int index);
-
- // Delete resources associated with UI for a browser action.
- void RemoveButtonForExtension(const Extension* extension);
-
- // Change the visibility of widget() based on whether we have any buttons
- // to show.
- void UpdateVisibility();
-
- // Hide the extension popup, if any.
- void HidePopup();
-
- // Animate the toolbar to show the given number of icons. This assumes the
- // visibility of the overflow button will not change.
- void AnimateToShowNIcons(int count);
-
- // Returns true if this extension should be shown in this toolbar. This can
- // return false if we are in an incognito window and the extension is disabled
- // for incognito.
- bool ShouldDisplayBrowserAction(const Extension* extension);
-
- // ExtensionToolbarModel::Observer implementation.
- virtual void BrowserActionAdded(const Extension* extension, int index);
- virtual void BrowserActionRemoved(const Extension* extension);
- virtual void BrowserActionMoved(const Extension* extension, int index);
- virtual void ModelLoaded();
-
- // ui::AnimationDelegate implementation.
- virtual void AnimationProgressed(const ui::Animation* animation);
- virtual void AnimationEnded(const ui::Animation* animation);
-
- // SimpleMenuModel::Delegate implementation.
- // In our case, |command_id| is be the index into the model's extension list.
- virtual bool IsCommandIdChecked(int command_id) const;
- virtual bool IsCommandIdEnabled(int command_id) const;
- virtual bool GetAcceleratorForCommandId(
- int command_id,
- menus::Accelerator* accelerator);
- virtual void ExecuteCommand(int command_id);
-
- // MenuGtk::Delegate implementation.
- virtual void StoppedShowing();
- virtual bool AlwaysShowIconForCmd(int command_id) const;
-
- // Called by the BrowserActionButton in response to drag-begin.
- void DragStarted(BrowserActionButton* button, GdkDragContext* drag_context);
-
- // Sets the width of the button area of the toolbar to |new_width|, clamping
- // it to appropriate values.
- void SetButtonHBoxWidth(int new_width);
-
- // Shows or hides the chevron as appropriate.
- void UpdateChevronVisibility();
-
- CHROMEGTK_CALLBACK_4(BrowserActionsToolbarGtk, gboolean, OnDragMotion,
- GdkDragContext*, gint, gint, guint);
- CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, void, OnDragEnd,
- GdkDragContext*);
- CHROMEGTK_CALLBACK_2(BrowserActionsToolbarGtk, gboolean, OnDragFailed,
- GdkDragContext*, GtkDragResult);
- CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, void, OnHierarchyChanged,
- GtkWidget*);
- CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, void, OnSetFocus, GtkWidget*);
- CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, gboolean,
- OnGripperMotionNotify, GdkEventMotion*);
- CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, gboolean, OnGripperExpose,
- GdkEventExpose*);
- CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, gboolean,
- OnGripperEnterNotify, GdkEventCrossing*);
- CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, gboolean,
- OnGripperLeaveNotify, GdkEventCrossing*);
- CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, gboolean,
- OnGripperButtonRelease, GdkEventButton*);
- CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, gboolean,
- OnGripperButtonPress, GdkEventButton*);
- // The overflow button is pressed.
- CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, gboolean,
- OnOverflowButtonPress, GdkEventButton*);
- // The user presses a mouse button over the popped up overflow menu.
- CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, gboolean,
- OnOverflowMenuButtonPress, GdkEventButton*);
- CHROMEGTK_CALLBACK_0(BrowserActionsToolbarGtk, void, OnButtonShowOrHide);
-
- Browser* browser_;
-
- Profile* profile_;
- GtkThemeProvider* theme_provider_;
-
- ExtensionToolbarModel* model_;
-
- // Contains the drag gripper, browser action buttons, and overflow chevron.
- OwnedWidgetGtk hbox_;
-
- // Contains the browser action buttons.
- OwnedWidgetGtk button_hbox_;
-
- // The overflow button for chrome theme mode.
- scoped_ptr<CustomDrawButton> overflow_button_;
- // The separator just next to the overflow button. Only shown in GTK+ theme
- // mode. In Chrome theme mode, the overflow button has a separator built in.
- GtkWidget* separator_;
- scoped_ptr<MenuGtk> overflow_menu_;
- scoped_ptr<menus::SimpleMenuModel> overflow_menu_model_;
- GtkWidget* overflow_area_;
- // A widget for adding extra padding to the left of the overflow button.
- GtkWidget* overflow_alignment_;
-
- // The button that is currently being dragged, or NULL.
- BrowserActionButton* drag_button_;
-
- // The new position of the button in the drag, or -1.
- int drop_index_;
-
- // Map from extension ID to BrowserActionButton, which is a wrapper for
- // a chrome button and related functionality. There should be one entry
- // for every extension that has a browser action.
- typedef std::map<std::string, linked_ptr<BrowserActionButton> >
- ExtensionButtonMap;
- ExtensionButtonMap extension_button_map_;
-
- // We use this animation for the smart resizing of the toolbar.
- ui::SlideAnimation resize_animation_;
- // This is the final width we are animating towards.
- int desired_width_;
- // This is the width we were at when we started animating.
- int start_width_;
-
- GtkSignalRegistrar signals_;
-
- NotificationRegistrar registrar_;
-
- ScopedRunnableMethodFactory<BrowserActionsToolbarGtk> method_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserActionsToolbarGtk);
-};
+#include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_
diff --git a/chrome/browser/gtk/browser_titlebar.h b/chrome/browser/gtk/browser_titlebar.h
index 5cd30e6..b59f3fe 100644
--- a/chrome/browser/gtk/browser_titlebar.h
+++ b/chrome/browser/gtk/browser_titlebar.h
@@ -1,239 +1,12 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-//
-// A helper class that contains the gtk widgets that make up the titlebar. The
-// titlebar consists of the tabstrip and if the custom chrome frame is turned
-// on, it includes the taller titlebar and minimize, restore, maximize, and
-// close buttons.
#ifndef CHROME_BROWSER_GTK_BROWSER_TITLEBAR_H_
#define CHROME_BROWSER_GTK_BROWSER_TITLEBAR_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/active_window_watcher_x.h"
-#include "app/menus/simple_menu_model.h"
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-
-class BrowserWindowGtk;
-class CustomDrawButton;
-class GtkThemeProvider;
-class MenuGtk;
-class PopupPageMenuModel;
-class TabContents;
-
-class BrowserTitlebar : public NotificationObserver,
- public ActiveWindowWatcherX::Observer,
- public menus::SimpleMenuModel::Delegate {
- public:
- // A default button order string for when we aren't asking gconf for the
- // metacity configuration.
- static const char kDefaultButtonString[];
-
- BrowserTitlebar(BrowserWindowGtk* browser_window, GtkWindow* window);
- virtual ~BrowserTitlebar();
-
- GtkWidget* widget() {
- return container_;
- }
-
- void set_window(GtkWindow* window) { window_ = window; }
-
- // Builds the buttons based on the metacity |button_string|.
- void BuildButtons(const std::string& button_string);
-
- // Update the appearance of the title bar based on whether we're showing a
- // custom frame or not. If |use_custom_frame| is true, we show an extra
- // tall titlebar and the min/max/close buttons.
- void UpdateCustomFrame(bool use_custom_frame);
-
- // Updates the title and icon when in app or popup mode (no tabstrip).
- void UpdateTitleAndIcon();
-
- // Called by the browser asking us to update the loading throbber.
- // |tab_contents| is the tab that is associated with the window throbber.
- // |tab_contents| can be null.
- void UpdateThrobber(TabContents* tab_contents);
-
- // On Windows, right clicking in the titlebar background brings up the system
- // menu. There's no such thing on linux, so we just show the menu items we
- // add to the menu.
- void ShowContextMenu();
-
- private:
- // A helper class to keep track of which frame of the throbber animation
- // we're showing.
- class Throbber {
- public:
- Throbber() : current_frame_(0), current_waiting_frame_(0) {}
-
- // Get the next frame in the animation. The image is owned by the throbber
- // so the caller doesn't need to unref. |is_waiting| is true if we're
- // still waiting for a response.
- GdkPixbuf* GetNextFrame(bool is_waiting);
-
- // Reset back to the first frame.
- void Reset();
- private:
- // Make sure the frames are loaded.
- static void InitFrames();
-
- int current_frame_;
- int current_waiting_frame_;
- };
-
- class ContextMenuModel : public menus::SimpleMenuModel {
- public:
- explicit ContextMenuModel(menus::SimpleMenuModel::Delegate* delegate);
- };
-
- // Build the titlebar, the space above the tab
- // strip, and (maybe) the min, max, close buttons. |container| is the gtk
- // continer that we put the widget into.
- void Init();
-
- // Lazily builds and returns |titlebar_{left,right}_buttons_vbox_| and their
- // subtrees. We do this lazily because in most situations, only one of them
- // is allocated (though the user can (and do) manually mess with their gconf
- // settings to get absolutely horrid combinations of buttons on both sides.
- GtkWidget* GetButtonHBox(bool left_side);
-
- // Constructs a CustomDraw button given 3 image ids (IDR_), the box to place
- // the button into, and a tooltip id (IDS_).
- CustomDrawButton* BuildTitlebarButton(int image, int image_pressed,
- int image_hot, GtkWidget* box,
- int tooltip);
-
- // Update the titlebar spacing based on the custom frame and maximized state.
- void UpdateTitlebarAlignment();
-
- // Updates the color of the title bar. Called whenever we have a state
- // change in the window.
- void UpdateTextColor();
-
- // Show the menu that the user gets from left-clicking the favicon.
- void ShowFaviconMenu(GdkEventButton* event);
-
- // The maximize button was clicked, take an action depending on which mouse
- // button the user pressed.
- void MaximizeButtonClicked();
-
- // Updates the visibility of the maximize and restore buttons; only one can
- // be visible at a time.
- void UpdateMaximizeRestoreVisibility();
-
- // Callback for changes to window state. This includes
- // maximizing/restoring/minimizing the window.
- CHROMEG_CALLBACK_1(BrowserTitlebar, gboolean, OnWindowStateChanged,
- GtkWindow*, GdkEventWindowState*);
-
- // Callback for mousewheel events.
- CHROMEGTK_CALLBACK_1(BrowserTitlebar, gboolean, OnScroll,
- GdkEventScroll*);
-
- // Callback for min/max/close buttons.
- CHROMEGTK_CALLBACK_0(BrowserTitlebar, void, OnButtonClicked);
-
- // Callback for favicon.
- CHROMEGTK_CALLBACK_1(BrowserTitlebar, gboolean, OnButtonPressed,
- GdkEventButton*);
-
- // -- Context Menu -----------------------------------------------------------
-
- // SimpleMenuModel::Delegate implementation:
- virtual bool IsCommandIdEnabled(int command_id) const;
- virtual bool IsCommandIdChecked(int command_id) const;
- virtual void ExecuteCommand(int command_id);
- virtual bool GetAcceleratorForCommandId(int command_id,
- menus::Accelerator* accelerator);
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Overriden from ActiveWindowWatcher::Observer.
- virtual void ActiveWindowChanged(GdkWindow* active_window);
-
- // Pointers to the browser window that owns us and it's GtkWindow.
- BrowserWindowGtk* browser_window_;
- GtkWindow* window_;
-
- // The container widget the holds the hbox which contains the whole titlebar.
- GtkWidget* container_;
-
- // The hbox that contains the whole titlebar.
- GtkWidget* container_hbox_;
-
- // VBoxes that holds the min/max/close buttons box and an optional padding
- // that defines the skyline if the user turns off window manager decorations.
- // There is a left and right version of this box since we try to integrate
- // with the recent Ubuntu theme changes which put the buttons on the left.
- GtkWidget* titlebar_left_buttons_vbox_;
- GtkWidget* titlebar_right_buttons_vbox_;
-
- // HBoxes that contains the actual min/max/close buttons.
- GtkWidget* titlebar_left_buttons_hbox_;
- GtkWidget* titlebar_right_buttons_hbox_;
-
- // Spy frame. One of these frames holds the spy guy in incognito mode. It's
- // the side with the least buttons. These are NULL when we aren't in
- // incognito mode.
- GtkWidget* titlebar_left_spy_frame_;
- GtkWidget* titlebar_right_spy_frame_;
-
- // Padding between the titlebar buttons and the top of the screen. Only show
- // when not maximized.
- GtkWidget* top_padding_left_;
- GtkWidget* top_padding_right_;
-
- // Gtk alignment that contains the tab strip. If the user turns off window
- // manager decorations, we draw this taller.
- GtkWidget* titlebar_alignment_;
-
- // The favicon and page title used when in app mode or popup mode.
- GtkWidget* app_mode_favicon_;
- GtkWidget* app_mode_title_;
-
- // Whether we are using a custom frame.
- bool using_custom_frame_;
-
- // Whether we have focus (gtk_window_is_active() sometimes returns the wrong
- // value, so manually track the focus-in and focus-out events.)
- bool window_has_focus_;
-
- // We change the size of these three buttons when the window is maximized, so
- // we use these structs to keep track of their original size.
- GtkRequisition close_button_req_;
- GtkRequisition minimize_button_req_;
- GtkRequisition restore_button_req_;
-
- // Maximize and restore widgets in the titlebar.
- scoped_ptr<CustomDrawButton> minimize_button_;
- scoped_ptr<CustomDrawButton> maximize_button_;
- scoped_ptr<CustomDrawButton> restore_button_;
- scoped_ptr<CustomDrawButton> close_button_;
-
- // The context menu view and model.
- scoped_ptr<MenuGtk> context_menu_;
- scoped_ptr<ContextMenuModel> context_menu_model_;
-
- // The favicon menu view and model.
- scoped_ptr<MenuGtk> favicon_menu_;
- scoped_ptr<PopupPageMenuModel> favicon_menu_model_;
-
- // The throbber used when the window is in app mode or popup window mode.
- Throbber throbber_;
-
- // Theme provider for building buttons.
- GtkThemeProvider* theme_provider_;
-
- NotificationRegistrar registrar_;
-};
+#include "chrome/browser/ui/gtk/browser_titlebar.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_BROWSER_TITLEBAR_H_
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.h b/chrome/browser/gtk/browser_toolbar_gtk.h
index 431c573..2c57ec0 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.h
+++ b/chrome/browser/gtk/browser_toolbar_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,214 +6,7 @@
#define CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-#include <string>
-
-#include "app/active_window_watcher_x.h"
-#include "app/gtk_signal.h"
-#include "app/gtk_signal_registrar.h"
-#include "app/menus/accelerator.h"
-#include "app/menus/simple_menu_model.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/command_updater.h"
-#include "chrome/browser/gtk/custom_button.h"
-#include "chrome/browser/gtk/menu_gtk.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/browser/ui/toolbar/wrench_menu_model.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-
-class BackForwardButtonGtk;
-class Browser;
-class BrowserActionsToolbarGtk;
-class BrowserWindowGtk;
-class CustomDrawButton;
-class GtkThemeProvider;
-class LocationBar;
-class LocationBarViewGtk;
-class Profile;
-class ReloadButtonGtk;
-class TabContents;
-class ToolbarModel;
-
-// View class that displays the GTK version of the toolbar and routes gtk
-// events back to the Browser.
-class BrowserToolbarGtk : public CommandUpdater::CommandObserver,
- public menus::AcceleratorProvider,
- public MenuGtk::Delegate,
- public NotificationObserver {
- public:
- explicit BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window);
- virtual ~BrowserToolbarGtk();
-
- // Create the contents of the toolbar. |top_level_window| is the GtkWindow
- // to which we attach our accelerators.
- void Init(Profile* profile, GtkWindow* top_level_window);
-
- // Set the various widgets' ViewIDs.
- void SetViewIDs();
-
- void Show();
- void Hide();
-
- // Getter for the containing widget.
- GtkWidget* widget() {
- return event_box_;
- }
-
- // Getter for associated browser object.
- Browser* browser() {
- return browser_;
- }
-
- virtual LocationBar* GetLocationBar() const;
-
- ReloadButtonGtk* GetReloadButton() { return reload_.get(); }
-
- GtkWidget* GetAppMenuButton() { return wrench_menu_button_->widget(); }
-
- BrowserActionsToolbarGtk* GetBrowserActionsToolbar() {
- return actions_toolbar_.get();
- }
-
- LocationBarViewGtk* GetLocationBarView() { return location_bar_.get(); }
-
- // We have to show padding on the bottom of the toolbar when the bookmark
- // is in floating mode. Otherwise the bookmark bar will paint it for us.
- void UpdateForBookmarkBarVisibility(bool show_bottom_padding);
-
- void ShowAppMenu();
-
- // Overridden from CommandUpdater::CommandObserver:
- virtual void EnabledStateChangedForCommand(int id, bool enabled);
-
- // Overridden from MenuGtk::Delegate:
- virtual void StoppedShowing();
- virtual GtkIconSet* GetIconSetForId(int idr);
- virtual bool AlwaysShowIconForCmd(int command_id) const;
-
- // Overridden from menus::AcceleratorProvider:
- virtual bool GetAcceleratorForCommandId(int id,
- menus::Accelerator* accelerator);
-
- // NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- Profile* profile() { return profile_; }
- void SetProfile(Profile* profile);
-
- // Message that we should react to a state change.
- void UpdateTabContents(TabContents* contents, bool should_restore_state);
-
- private:
- // Connect/Disconnect signals for dragging a url onto the home button.
- void SetUpDragForHomeButton(bool enable);
-
- // Sets the top corners of the toolbar to rounded, or sets them to normal,
- // depending on the state of the browser window. Returns false if no action
- // was taken (the roundedness was already correct), true otherwise.
- bool UpdateRoundedness();
-
- // Gtk callback for the "expose-event" signal.
- // The alignment contains the toolbar.
- CHROMEGTK_CALLBACK_1(BrowserToolbarGtk, gboolean, OnAlignmentExpose,
- GdkEventExpose*);
- CHROMEGTK_CALLBACK_1(BrowserToolbarGtk, gboolean, OnLocationHboxExpose,
- GdkEventExpose*);
-
- // Gtk callback for the "clicked" signal.
- CHROMEGTK_CALLBACK_0(BrowserToolbarGtk, void, OnButtonClick);
-
- // Gtk callback to intercept mouse clicks to the menu buttons.
- CHROMEGTK_CALLBACK_1(BrowserToolbarGtk, gboolean, OnMenuButtonPressEvent,
- GdkEventButton*);
-
- // Used for drags onto home button.
- CHROMEGTK_CALLBACK_6(BrowserToolbarGtk, void, OnDragDataReceived,
- GdkDragContext*, gint, gint, GtkSelectionData*,
- guint, guint);
-
- // Used to draw the upgrade notification badge.
- CHROMEGTK_CALLBACK_1(BrowserToolbarGtk, gboolean, OnWrenchMenuButtonExpose,
- GdkEventExpose*);
-
- // Updates preference-dependent state.
- void NotifyPrefChanged(const std::string* pref);
-
- static void SetSyncMenuLabel(GtkWidget* widget, gpointer userdata);
-
- // Sometimes we only want to show the location w/o the toolbar buttons (e.g.,
- // in a popup window).
- bool ShouldOnlyShowLocation() const;
-
- // An event box that holds |toolbar_|. We need the toolbar to have its own
- // GdkWindow when we use the GTK drawing because otherwise the color from our
- // parent GdkWindow will leak through with some theme engines (such as
- // Clearlooks).
- GtkWidget* event_box_;
-
- // This widget handles padding around the outside of the toolbar.
- GtkWidget* alignment_;
-
- // Gtk widgets. The toolbar is an hbox with each of the other pieces of the
- // toolbar placed side by side.
- GtkWidget* toolbar_;
-
- // All widgets to the left or right of the |location_hbox_|. We put the
- // widgets on either side of location_hbox_ in their own toolbar so we can
- // set their minimum sizes independently of |location_hbox_| which needs to
- // grow/shrink in GTK+ mode.
- GtkWidget* toolbar_left_;
-
- // Contains all the widgets of the location bar.
- GtkWidget* location_hbox_;
-
- // The location bar view.
- scoped_ptr<LocationBarViewGtk> location_bar_;
-
- // All the buttons in the toolbar.
- scoped_ptr<BackForwardButtonGtk> back_, forward_;
- scoped_ptr<CustomDrawButton> home_;
- scoped_ptr<ReloadButtonGtk> reload_;
- scoped_ptr<BrowserActionsToolbarGtk> actions_toolbar_;
- scoped_ptr<CustomDrawButton> wrench_menu_button_;
-
- // The image shown in GTK+ mode in the wrench button.
- GtkWidget* wrench_menu_image_;
-
- // The model that contains the security level, text, icon to display...
- ToolbarModel* model_;
-
- GtkThemeProvider* theme_provider_;
-
- scoped_ptr<MenuGtk> wrench_menu_;
-
- WrenchMenuModel wrench_menu_model_;
-
- Browser* browser_;
- BrowserWindowGtk* window_;
- Profile* profile_;
-
- // Controls whether or not a home button should be shown on the toolbar.
- BooleanPrefMember show_home_button_;
-
- // Preferences controlling the configured home page.
- StringPrefMember home_page_;
- BooleanPrefMember home_page_is_new_tab_page_;
-
- NotificationRegistrar registrar_;
-
- // A GtkEntry that isn't part of the hierarchy. We keep this for native
- // rendering.
- OwnedWidgetGtk offscreen_entry_;
-
- // Manages the home button drop signal handler.
- scoped_ptr<GtkSignalRegistrar> drop_handler_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserToolbarGtk);
-};
+#include "chrome/browser/ui/gtk/browser_toolbar_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_
diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h
index e851c15..ad14be2 100644
--- a/chrome/browser/gtk/browser_window_gtk.h
+++ b/chrome/browser/gtk/browser_window_gtk.h
@@ -6,491 +6,7 @@
#define CHROME_BROWSER_GTK_BROWSER_WINDOW_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <map>
-
-#include "app/active_window_watcher_x.h"
-#include "app/gtk_signal.h"
-#include "app/x11_util.h"
-#include "base/scoped_ptr.h"
-#include "base/timer.h"
-#include "build/build_config.h"
-#include "chrome/browser/browser_window.h"
-#include "chrome/browser/gtk/infobar_arrow_model.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/browser/tabs/tab_strip_model_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "gfx/rect.h"
-
-class BookmarkBarGtk;
-class Browser;
-class BrowserTitlebar;
-class BrowserToolbarGtk;
-class CustomDrawButton;
-class DownloadShelfGtk;
-class FindBarGtk;
-class FullscreenExitBubbleGtk;
-class InfoBarContainerGtk;
-class LocationBar;
-class StatusBubbleGtk;
-class TabContentsContainerGtk;
-class TabStripGtk;
-
-// An implementation of BrowserWindow for GTK.
-// Cross-platform code will interact with this object when
-// it needs to manipulate the window.
-
-class BrowserWindowGtk : public BrowserWindow,
- public NotificationObserver,
- public TabStripModelObserver,
- public ActiveWindowWatcherX::Observer,
- public InfoBarArrowModel::Observer {
- public:
- explicit BrowserWindowGtk(Browser* browser);
- virtual ~BrowserWindowGtk();
-
- // Overridden from BrowserWindow
- virtual void Show();
- virtual void SetBounds(const gfx::Rect& bounds);
- virtual void Close();
- virtual void Activate();
- virtual void Deactivate();
- virtual bool IsActive() const;
- virtual void FlashFrame();
- virtual gfx::NativeWindow GetNativeHandle();
- virtual BrowserWindowTesting* GetBrowserWindowTesting();
- virtual StatusBubble* GetStatusBubble();
- virtual void SelectedTabToolbarSizeChanged(bool is_animating);
- virtual void UpdateTitleBar();
- virtual void ShelfVisibilityChanged();
- virtual void UpdateDevTools();
- virtual void UpdateLoadingAnimations(bool should_animate);
- virtual void SetStarredState(bool is_starred);
- virtual gfx::Rect GetRestoredBounds() const;
- virtual bool IsMaximized() const;
- virtual void SetFullscreen(bool fullscreen);
- virtual bool IsFullscreen() const;
- virtual bool IsFullscreenBubbleVisible() const;
- virtual LocationBar* GetLocationBar() const;
- virtual void SetFocusToLocationBar(bool select_all);
- virtual void UpdateReloadStopState(bool is_loading, bool force);
- virtual void UpdateToolbar(TabContentsWrapper* contents,
- bool should_restore_state);
- virtual void FocusToolbar();
- virtual void FocusAppMenu();
- virtual void FocusBookmarksToolbar();
- virtual void FocusChromeOSStatus();
- virtual void RotatePaneFocus(bool forwards);
- virtual bool IsBookmarkBarVisible() const;
- virtual bool IsBookmarkBarAnimating() const;
- virtual bool IsTabStripEditable() const;
- virtual bool IsToolbarVisible() const;
- virtual void ConfirmAddSearchProvider(const TemplateURL* template_url,
- Profile* profile);
- virtual void ToggleBookmarkBar();
- virtual views::Window* ShowAboutChromeDialog();
- virtual void ShowUpdateChromeDialog();
- virtual void ShowTaskManager();
- virtual void ShowBookmarkBubble(const GURL& url, bool already_bookmarked);
- virtual bool IsDownloadShelfVisible() const;
- virtual DownloadShelf* GetDownloadShelf();
- virtual void ShowClearBrowsingDataDialog();
- virtual void ShowImportDialog();
- virtual void ShowSearchEnginesDialog();
- virtual void ShowPasswordManager();
- virtual void ShowRepostFormWarningDialog(TabContents* tab_contents);
- virtual void ShowContentSettingsWindow(ContentSettingsType content_type,
- Profile* profile);
- virtual void ShowCollectedCookiesDialog(TabContents* tab_contents);
- virtual void ShowProfileErrorDialog(int message_id);
- virtual void ShowThemeInstallBubble();
- virtual void ConfirmBrowserCloseWithPendingDownloads();
- virtual void ShowHTMLDialog(HtmlDialogUIDelegate* delegate,
- gfx::NativeWindow parent_window);
- virtual void UserChangedTheme();
- virtual int GetExtraRenderViewHeight() const;
- virtual void TabContentsFocused(TabContents* tab_contents);
- virtual void ShowPageInfo(Profile* profile,
- const GURL& url,
- const NavigationEntry::SSLStatus& ssl,
- bool show_history);
- virtual void ShowAppMenu();
- virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
- bool* is_keyboard_shortcut);
- virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event);
- virtual void ShowCreateWebAppShortcutsDialog(TabContents* tab_contents);
- virtual void ShowCreateChromeAppShortcutsDialog(Profile* profile,
- const Extension* app);
- virtual void Cut();
- virtual void Copy();
- virtual void Paste();
- virtual void ToggleTabStripMode() {}
- virtual void PrepareForInstant();
- virtual void ShowInstant(TabContents* preview_contents);
- virtual void HideInstant(bool instant_is_active);
- virtual gfx::Rect GetInstantBounds();
-
- virtual gfx::Rect GrabWindowSnapshot(
- std::vector<unsigned char>* png_representation);
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Overridden from TabStripModelObserver:
- virtual void TabDetachedAt(TabContentsWrapper* contents, int index);
- virtual void TabSelectedAt(TabContentsWrapper* old_contents,
- TabContentsWrapper* new_contents,
- int index,
- bool user_gesture);
-
- // Overridden from ActiveWindowWatcher::Observer.
- virtual void ActiveWindowChanged(GdkWindow* active_window);
-
- // Overridden from InfoBarArrowModel::Observer.
- virtual void PaintStateChanged();
-
- // Accessor for the tab strip.
- TabStripGtk* tabstrip() const { return tabstrip_.get(); }
-
- void UpdateDevToolsForContents(TabContents* contents);
-
- void OnBoundsChanged(const gfx::Rect& bounds);
- void OnDebouncedBoundsChanged();
- void OnStateChanged(GdkWindowState state, GdkWindowState changed_mask);
-
- // Request the underlying window to unmaximize. Also tries to work around
- // a window manager "feature" that can prevent this in some edge cases.
- void UnMaximize();
-
- // Returns false if we're not ready to close yet. E.g., a tab may have an
- // onbeforeunload handler that prevents us from closing.
- bool CanClose() const;
-
- bool ShouldShowWindowIcon() const;
-
- // Add the find bar widget to the window hierarchy.
- void AddFindBar(FindBarGtk* findbar);
-
- // Reset the mouse cursor to the default cursor if it was set to something
- // else for the custom frame.
- void ResetCustomFrameCursor();
-
- // Toggles whether an infobar is showing.
- // |animate| controls whether we animate to the new state set by |bar|.
- void SetInfoBarShowing(InfoBar* bar, bool animate);
-
- // Returns the BrowserWindowGtk registered with |window|.
- static BrowserWindowGtk* GetBrowserWindowForNativeWindow(
- gfx::NativeWindow window);
-
- // Retrieves the GtkWindow associated with |xid|, which is the X Window
- // ID of the top-level X window of this object.
- static GtkWindow* GetBrowserWindowForXID(XID xid);
-
- Browser* browser() const { return browser_.get(); }
-
- GtkWindow* window() const { return window_; }
-
- BrowserToolbarGtk* GetToolbar() { return toolbar_.get(); }
-
- gfx::Rect bounds() const { return bounds_; }
-
- // Make changes necessary when the floating state of the bookmark bar changes.
- // This should only be called by the bookmark bar itself.
- void BookmarkBarIsFloating(bool is_floating);
-
- // Returns the tab contents we're currently displaying in the tab contents
- // container.
- TabContents* GetDisplayedTabContents();
-
- static void RegisterUserPrefs(PrefService* prefs);
-
- // Returns whether to draw the content drop shadow on the sides and bottom
- // of the browser window. When false, we still draw a shadow on the top of
- // the toolbar (under the tab strip), but do not round the top corners.
- bool ShouldDrawContentDropShadow();
-
- // Tells GTK that the toolbar area is invalidated and needs redrawing. We
- // have this method as a hack because GTK doesn't queue the toolbar area for
- // redraw when it should.
- void QueueToolbarRedraw();
-
- // Get the position where the infobar arrow should be anchored in
- // |relative_to| coordinates. This is the middle of the omnibox location icon.
- int GetXPositionOfLocationIcon(GtkWidget* relative_to);
-
- protected:
- virtual void DestroyBrowser();
- // Top level window.
- GtkWindow* window_;
- // GtkAlignment that holds the interior components of the chromium window.
- // This is used to draw the custom frame border and content shadow.
- GtkWidget* window_container_;
- // VBox that holds everything (tabs, toolbar, bookmarks bar, tab contents).
- GtkWidget* window_vbox_;
- // VBox that holds everything below the toolbar.
- GtkWidget* render_area_vbox_;
- // Floating container that holds the render area. It is needed to position
- // the findbar.
- GtkWidget* render_area_floating_container_;
- // EventBox that holds render_area_floating_container_.
- GtkWidget* render_area_event_box_;
- // Border between toolbar and render area.
- GtkWidget* toolbar_border_;
-
- scoped_ptr<Browser> browser_;
-
- // The download shelf view (view at the bottom of the page).
- scoped_ptr<DownloadShelfGtk> download_shelf_;
-
- private:
- // Show or hide the bookmark bar.
- void MaybeShowBookmarkBar(bool animate);
-
- // Sets the default size for the window and the the way the user is allowed to
- // resize it.
- void SetGeometryHints();
-
- // Connect to signals on |window_|.
- void ConnectHandlersToSignals();
-
- // Create the various UI components.
- void InitWidgets();
-
- // Set up background color of the window (depends on if we're incognito or
- // not).
- void SetBackgroundColor();
-
- // Called when the window size changed.
- void OnSizeChanged(int width, int height);
-
- // Applies the window shape to if we're in custom drawing mode.
- void UpdateWindowShape(int width, int height);
-
- // Connect accelerators that aren't connected to menu items (like ctrl-o,
- // ctrl-l, etc.).
- void ConnectAccelerators();
-
- // Change whether we're showing the custom blue frame.
- // Must be called once at startup.
- // Triggers relayout of the content.
- void UpdateCustomFrame();
-
- // Save the window position in the prefs.
- void SaveWindowPosition();
-
- // Set the bounds of the current window. If |exterior| is true, set the size
- // of the window itself, otherwise set the bounds of the web contents.
- // If |move| is true, set the position of the window, otherwise leave the
- // position to the WM.
- void SetBoundsImpl(const gfx::Rect& bounds, bool exterior, bool move);
-
- // Callback for when the custom frame alignment needs to be redrawn.
- // The content area includes the toolbar and web page but not the tab strip.
- CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnCustomFrameExpose,
- GdkEventExpose*);
-
- // A helper method that draws the shadow above the toolbar and in the frame
- // border during an expose.
- void DrawContentShadow(cairo_t* cr);
-
- // Draws the tab image as the frame so we can write legible text.
- void DrawPopupFrame(cairo_t* cr, GtkWidget* widget, GdkEventExpose* event);
-
- // Draws the normal custom frame using theme_frame.
- void DrawCustomFrame(cairo_t* cr, GtkWidget* widget, GdkEventExpose* event);
-
- // The background frame image needs to be offset by the size of the top of
- // the window to the top of the tabs when the full skyline isn't displayed
- // for some reason.
- int GetVerticalOffset();
-
- // Returns which frame image we should use based on the window's current
- // activation state / incognito state.
- int GetThemeFrameResource();
-
- // Invalidate all the widgets that need to redraw when the infobar draw state
- // has changed.
- void InvalidateInfoBarBits();
-
- // When the location icon moves, we have to redraw the arrow.
- CHROMEGTK_CALLBACK_1(BrowserWindowGtk, void, OnLocationIconSizeAllocate,
- GtkAllocation*);
-
- // Used to draw the infobar arrow and drop shadow. This is connected to
- // multiple widgets' expose events because it overlaps several widgets.
- CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnExposeDrawInfobarBits,
- GdkEventExpose*);
-
- // Used to draw the infobar bits for the bookmark bar. When the bookmark
- // bar is in floating mode, it has to draw a drop shadow only; otherwise
- // it is responsible for its portion of the arrow as well as some shadowing.
- CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnBookmarkBarExpose,
- GdkEventExpose*);
-
- // Callback for "size-allocate" signal on bookmark bar; this is relevant
- // because when the bookmark bar changes dimensions, the infobar arrow has to
- // change its shape, and we need to queue appropriate redraws.
- CHROMEGTK_CALLBACK_1(BrowserWindowGtk, void, OnBookmarkBarSizeAllocate,
- GtkAllocation*);
-
- // Callback for accelerator activation. |user_data| stores the command id
- // of the matched accelerator.
- static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group,
- GObject* acceleratable,
- guint keyval,
- GdkModifierType modifier,
- void* user_data);
-
- // Key press event callback.
- CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnKeyPress, GdkEventKey*);
-
- // Mouse move and mouse button press callbacks.
- CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnMouseMoveEvent,
- GdkEventMotion*);
- CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnButtonPressEvent,
- GdkEventButton*);
-
- // Maps and Unmaps the xid of |widget| to |window|.
- static void MainWindowMapped(GtkWidget* widget);
- static void MainWindowUnMapped(GtkWidget* widget);
-
- // Tracks focus state of browser.
- CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnFocusIn,
- GdkEventFocus*);
- CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnFocusOut,
- GdkEventFocus*);
-
- // Callback for the loading animation(s) associated with this window.
- void LoadingAnimationCallback();
-
- // Shows UI elements for supported window features.
- void ShowSupportedWindowFeatures();
-
- // Hides UI elements for unsupported window features.
- void HideUnsupportedWindowFeatures();
-
- // Helper functions that query |browser_| concerning support for UI features
- // in this window. (For example, a popup window might not support a tabstrip).
- bool IsTabStripSupported() const;
- bool IsToolbarSupported() const;
- bool IsBookmarkBarSupported() const;
-
- // Whether we should draw the tab background instead of the theme_frame
- // background because this window is a popup.
- bool UsingCustomPopupFrame() const;
-
- // Checks to see if the mouse pointer at |x|, |y| is over the border of the
- // custom frame (a spot that should trigger a window resize). Returns true if
- // it should and sets |edge|.
- bool GetWindowEdge(int x, int y, GdkWindowEdge* edge);
-
- // Returns |true| if we should use the custom frame.
- bool UseCustomFrame();
-
- // Returns |true| if the window bounds match the monitor size.
- bool BoundsMatchMonitorSize();
-
- // Put the bookmark bar where it belongs.
- void PlaceBookmarkBar(bool is_floating);
-
- // Determine whether we use should default to native decorations or the custom
- // frame based on the currently-running window manager.
- static bool GetCustomFramePrefDefault();
-
- NotificationRegistrar registrar_;
-
- // The position and size of the current window.
- gfx::Rect bounds_;
-
- // The position and size of the non-maximized, non-fullscreen window.
- gfx::Rect restored_bounds_;
-
- GdkWindowState state_;
-
- // The container for the titlebar + tab strip.
- scoped_ptr<BrowserTitlebar> titlebar_;
-
- // The object that manages all of the widgets in the toolbar.
- scoped_ptr<BrowserToolbarGtk> toolbar_;
-
- // The object that manages the bookmark bar. This will be NULL if the
- // bookmark bar is not supported.
- scoped_ptr<BookmarkBarGtk> bookmark_bar_;
-
- // Caches the hover state of the bookmark bar.
- bool bookmark_bar_is_floating_;
-
- // The status bubble manager. Always non-NULL.
- scoped_ptr<StatusBubbleGtk> status_bubble_;
-
- // A container that manages the GtkWidget*s that are the webpage display
- // (along with associated infobars, shelves, and other things that are part
- // of the content area).
- scoped_ptr<TabContentsContainerGtk> contents_container_;
-
- // A container that manages the GtkWidget*s of developer tools for the
- // selected tab contents.
- scoped_ptr<TabContentsContainerGtk> devtools_container_;
-
- // Split pane containing the contents_container_ and the devtools_container_.
- GtkWidget* contents_split_;
-
- // The tab strip. Always non-NULL.
- scoped_ptr<TabStripGtk> tabstrip_;
-
- // The container for info bars. Always non-NULL.
- scoped_ptr<InfoBarContainerGtk> infobar_container_;
-
- // The timer used to update frames for the Loading Animation.
- base::RepeatingTimer<BrowserWindowGtk> loading_animation_timer_;
-
- // The timer used to save the window position for session restore.
- base::OneShotTimer<BrowserWindowGtk> window_configure_debounce_timer_;
-
- // Whether the custom chrome frame pref is set. Normally you want to use
- // UseCustomFrame() above to determine whether to use the custom frame or
- // not.
- BooleanPrefMember use_custom_frame_pref_;
-
- // A map which translates an X Window ID into its respective GtkWindow.
- static std::map<XID, GtkWindow*> xid_map_;
-
- // The current window cursor. We set it to a resize cursor when over the
- // custom frame border. We set it to NULL if we want the default cursor.
- GdkCursor* frame_cursor_;
-
- // True if the window manager thinks the window is active. Not all window
- // managers keep track of this state (_NET_ACTIVE_WINDOW), in which case
- // this will always be true.
- bool is_active_;
-
- // Keep track of the last click time and the last click position so we can
- // filter out extra GDK_BUTTON_PRESS events when a double click happens.
- guint32 last_click_time_;
- gfx::Point last_click_position_;
-
- // If true, maximize the window after we call BrowserWindow::Show for the
- // first time. This is to work around a compiz bug.
- bool maximize_after_show_;
-
- // If true, don't call gdk_window_raise() when we get a click in the title
- // bar or window border. This is to work around a compiz bug.
- bool suppress_window_raise_;
-
- // The accelerator group used to handle accelerators, owned by this object.
- GtkAccelGroup* accel_group_;
-
- scoped_ptr<FullscreenExitBubbleGtk> fullscreen_exit_bubble_;
-
- // The model that tracks the paint state of the arrow for the infobar
- // directly below the toolbar.
- InfoBarArrowModel infobar_arrow_model_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserWindowGtk);
-};
+#include "chrome/browser/ui/gtk/browser_window_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_BROWSER_WINDOW_GTK_H_
diff --git a/chrome/browser/gtk/cairo_cached_surface.h b/chrome/browser/gtk/cairo_cached_surface.h
index b257062..bff7af0 100644
--- a/chrome/browser/gtk/cairo_cached_surface.h
+++ b/chrome/browser/gtk/cairo_cached_surface.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,55 +6,7 @@
#define CHROME_BROWSER_GTK_CAIRO_CACHED_SURFACE_H_
#pragma once
-typedef struct _GdkPixbuf GdkPixbuf;
-typedef struct _cairo cairo_t;
-typedef struct _cairo_surface cairo_surface_t;
-
-// A helper class that takes a GdkPixbuf* and renders it to the screen. Unlike
-// gdk_cairo_set_source_pixbuf(), CairoCachedSurface assumes that the pixbuf is
-// immutable after UsePixbuf() is called and can be sent to the X server
-// once. From then on, that cached version is used so we don't upload the same
-// image each and every time we expose.
-//
-// Most cached surfaces are owned by the GtkThemeProvider, which associates
-// them with a certain XDisplay. Some users of surfaces (CustomDrawButtonBase,
-// for example) own their surfaces instead since they interact with the
-// ResourceBundle instead of the GtkThemeProvider.
-class CairoCachedSurface {
- public:
- CairoCachedSurface();
- ~CairoCachedSurface();
-
- // Whether this CairoCachedSurface owns a GdkPixbuf.
- bool valid() const {
- return pixbuf_;
- }
-
- // The dimensions of the underlying pixbuf/surface. (or -1 if invalid.)
- int Width() const;
- int Height() const;
-
- // Sets the pixbuf that we pass to cairo. Calling UsePixbuf() only derefs the
- // current pixbuf and surface (if they exist). Actually transfering data to
- // the X server occurs at SetSource() time. Calling UsePixbuf() should only
- // be done once as it clears cached data from the X server.
- void UsePixbuf(GdkPixbuf* pixbuf);
-
- // Sets our pixbuf as the active surface starting at (x, y), uploading it in
- // case we don't have an X backed surface cached.
- void SetSource(cairo_t* cr, int x, int y);
-
- // Raw access to the pixbuf. May be NULL. Used for a few gdk operations
- // regarding window shaping.
- GdkPixbuf* pixbuf() { return pixbuf_; }
-
- private:
- // The source pixbuf.
- GdkPixbuf* pixbuf_;
-
- // Our cached surface. This should be a xlib surface so the data lives on the
- // server instead of on the client.
- cairo_surface_t* surface_;
-};
+#include "chrome/browser/ui/gtk/cairo_cached_surface.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_CAIRO_CACHED_SURFACE_H_
diff --git a/chrome/browser/gtk/certificate_dialogs.h b/chrome/browser/gtk/certificate_dialogs.h
index e982195..0816747 100644
--- a/chrome/browser/gtk/certificate_dialogs.h
+++ b/chrome/browser/gtk/certificate_dialogs.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,16 +6,7 @@
#define CHROME_BROWSER_GTK_CERTIFICATE_DIALOGS_H_
#pragma once
-#include "chrome/browser/shell_dialogs.h"
-#include "net/base/x509_certificate.h"
-
-void ShowCertSelectFileDialog(SelectFileDialog* select_file_dialog,
- SelectFileDialog::Type type,
- const FilePath& suggested_path,
- gfx::NativeWindow parent,
- void* params);
-
-void ShowCertExportDialog(gfx::NativeWindow parent,
- net::X509Certificate::OSCertHandle cert);
+#include "chrome/browser/ui/gtk/certificate_dialogs.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_CERTIFICATE_DIALOGS_H_
diff --git a/chrome/browser/gtk/certificate_viewer.h b/chrome/browser/gtk/certificate_viewer.h
index 16ad370..0e7392b 100644
--- a/chrome/browser/gtk/certificate_viewer.h
+++ b/chrome/browser/gtk/certificate_viewer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,11 +6,7 @@
#define CHROME_BROWSER_GTK_CERTIFICATE_VIEWER_H_
#pragma once
-#include "chrome/browser/certificate_viewer.h"
-#include "gfx/native_widget_types.h"
-#include "net/base/x509_certificate.h"
-
-void ShowCertificateViewer(gfx::NativeWindow parent,
- net::X509Certificate::OSCertHandle);
+#include "chrome/browser/ui/gtk/certificate_viewer.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_CERTIFICATE_VIEWER_H_
diff --git a/chrome/browser/gtk/chrome_gtk_frame.h b/chrome/browser/gtk/chrome_gtk_frame.h
index 0fd7d28..d5afd42 100644
--- a/chrome/browser/gtk/chrome_gtk_frame.h
+++ b/chrome/browser/gtk/chrome_gtk_frame.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,51 +6,7 @@
#define CHROME_BROWSER_GTK_CHROME_GTK_FRAME_H_
#pragma once
-#include <gdk/gdk.h>
-#include <gtk/gtkwindow.h>
-
-G_BEGIN_DECLS
-
-// This file declares two subclasses of GtkWindow for easier gtk+ theme
-// integration.
-//
-// The first is "MetaFrames," which is (was?) the name of a gobject class in
-// the metacity window manager. To actually get at those values, we need to
-// have an object whose gobject class name string matches the definitions in
-// the gtkrc file. MetaFrames derives from GtkWindow.
-//
-// Metaframes can not be instantiated. It has no constructor; instantiate
-// ChromeGtkFrame instead.
-typedef struct _MetaFrames MetaFrames;
-typedef struct _MetaFramesClass MetaFramesClass;
-
-struct _MetaFrames {
- GtkWindow window;
-};
-
-struct _MetaFramesClass {
- GtkWindowClass parent_class;
-};
-
-
-// The second is ChromeGtkFrame, which defines a number of optional style
-// properties so theme authors can control how chromium appears in gtk-theme
-// mode. It derives from MetaFrames in chrome so older themes that declare a
-// MetaFrames theme will still work. New themes should target this class.
-typedef struct _ChromeGtkFrame ChromeGtkFrame;
-typedef struct _ChromeGtkFrameClass ChromeGtkFrameClass;
-
-struct _ChromeGtkFrame {
- MetaFrames frames;
-};
-
-struct _ChromeGtkFrameClass {
- MetaFramesClass frames_class;
-};
-
-// Creates a GtkWindow object the the class name "ChromeGtkFrame".
-GtkWidget* chrome_gtk_frame_new();
-
-G_END_DECLS
+#include "chrome/browser/ui/gtk/chrome_gtk_frame.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_CHROME_GTK_FRAME_H_
diff --git a/chrome/browser/gtk/clear_browsing_data_dialog_gtk.h b/chrome/browser/gtk/clear_browsing_data_dialog_gtk.h
index 87a4546..c9db24d 100644
--- a/chrome/browser/gtk/clear_browsing_data_dialog_gtk.h
+++ b/chrome/browser/gtk/clear_browsing_data_dialog_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,65 +6,7 @@
#define CHROME_BROWSER_GTK_CLEAR_BROWSING_DATA_DIALOG_GTK_H_
#pragma once
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-
-class AccessibleWidgetHelper;
-class BrowsingDataRemover;
-class Profile;
-
-class ClearBrowsingDataDialogGtk {
- public:
- // Displays the dialog box to clear browsing data from |profile|.
- static void Show(GtkWindow* parent, Profile* profile);
-
- private:
- ClearBrowsingDataDialogGtk(GtkWindow* parent, Profile* profile);
- ~ClearBrowsingDataDialogGtk();
-
- // Handler to respond to Ok and Cancel responses from the dialog.
- CHROMEGTK_CALLBACK_1(ClearBrowsingDataDialogGtk, void, OnDialogResponse, int);
-
- // Handler to respond to widget clicked actions from the dialog.
- CHROMEGTK_CALLBACK_0(ClearBrowsingDataDialogGtk, void, OnDialogWidgetClicked);
-
- CHROMEGTK_CALLBACK_0(ClearBrowsingDataDialogGtk, void, OnFlashLinkClicked);
-
- // Enable or disable the dialog buttons depending on the state of the
- // checkboxes.
- void UpdateDialogButtons();
-
- // Create a bitmask from the checkboxes of the dialog.
- int GetCheckedItems();
-
- // The dialog window.
- GtkWidget* dialog_;
-
- // UI elements.
- GtkWidget* del_history_checkbox_;
- GtkWidget* del_downloads_checkbox_;
- GtkWidget* del_cache_checkbox_;
- GtkWidget* del_cookies_checkbox_;
- GtkWidget* del_passwords_checkbox_;
- GtkWidget* del_form_data_checkbox_;
- GtkWidget* time_period_combobox_;
-
- // Our current profile.
- Profile* profile_;
-
- // If non-null it means removal is in progress. BrowsingDataRemover takes care
- // of deleting itself when done.
- BrowsingDataRemover* remover_;
-
- // Helper object to manage accessibility metadata.
- scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
-
- DISALLOW_COPY_AND_ASSIGN(ClearBrowsingDataDialogGtk);
-};
-
+#include "chrome/browser/ui/gtk/clear_browsing_data_dialog_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_CLEAR_BROWSING_DATA_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/collected_cookies_gtk.h b/chrome/browser/gtk/collected_cookies_gtk.h
index f4348b2..94ef7cd 100644
--- a/chrome/browser/gtk/collected_cookies_gtk.h
+++ b/chrome/browser/gtk/collected_cookies_gtk.h
@@ -1,108 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// This is the Gtk implementation of the collected Cookies dialog.
-
#ifndef CHROME_BROWSER_GTK_COLLECTED_COOKIES_GTK_H_
#define CHROME_BROWSER_GTK_COLLECTED_COOKIES_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/gtk/constrained_window_gtk.h"
-#include "chrome/browser/gtk/gtk_tree.h"
-#include "chrome/common/content_settings.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-
-class CookiesTreeModel;
-
-// CollectedCookiesGtk is a dialog that displays the allowed and blocked
-// cookies of the current tab contents. To display the dialog, invoke
-// ShowCollectedCookiesDialog() on the delegate of the tab contents.
-
-class CollectedCookiesGtk : public ConstrainedDialogDelegate,
- gtk_tree::TreeAdapter::Delegate,
- NotificationObserver {
- public:
- CollectedCookiesGtk(GtkWindow* parent, TabContents* tab_contents);
-
- // ConstrainedDialogDelegate methods.
- virtual GtkWidget* GetWidgetRoot();
- virtual void DeleteDelegate();
-
- private:
- virtual ~CollectedCookiesGtk();
-
- // Initialize all widgets of this dialog.
- void Init();
-
- // True if the selection contains at least one origin node.
- bool SelectionContainsOriginNode(GtkTreeSelection* selection,
- gtk_tree::TreeAdapter* adapter);
-
- // Enable the allow/block buttons if at least one origin node is selected.
- void EnableControls();
-
- // Add exceptions for all origin nodes within the selection.
- void AddExceptions(GtkTreeSelection* selection,
- gtk_tree::TreeAdapter* adapter,
- ContentSetting setting);
-
- // Notification Observer implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Callbacks.
- CHROMEGTK_CALLBACK_2(CollectedCookiesGtk, void, OnTreeViewRowExpanded,
- GtkTreeIter*, GtkTreePath*);
- CHROMEGTK_CALLBACK_0(CollectedCookiesGtk, void, OnTreeViewSelectionChange);
- CHROMEGTK_CALLBACK_0(CollectedCookiesGtk, void, OnClose);
- CHROMEGTK_CALLBACK_0(CollectedCookiesGtk, void, OnBlockAllowedButtonClicked);
- CHROMEGTK_CALLBACK_0(CollectedCookiesGtk, void, OnAllowBlockedButtonClicked);
- CHROMEGTK_CALLBACK_0(CollectedCookiesGtk, void,
- OnForSessionBlockedButtonClicked);
-
- NotificationRegistrar registrar_;
-
- ConstrainedWindow* window_;
-
- // Widgets of the dialog.
- GtkWidget* dialog_;
-
- GtkWidget* allowed_description_label_;
- GtkWidget* blocked_description_label_;
-
- GtkWidget* block_allowed_cookie_button_;
-
- GtkWidget* allow_blocked_cookie_button_;
- GtkWidget* for_session_blocked_cookie_button_;
-
- // The table listing the cookies.
- GtkWidget* allowed_tree_;
- GtkWidget* blocked_tree_;
-
- GtkTreeSelection* allowed_selection_;
- GtkTreeSelection* blocked_selection_;
-
- // The infobar widget.
- GtkWidget* infobar_;
- GtkWidget* infobar_label_;
-
- // The tab contents.
- TabContents* tab_contents_;
-
- // The Cookies Table model.
- scoped_ptr<CookiesTreeModel> allowed_cookies_tree_model_;
- scoped_ptr<CookiesTreeModel> blocked_cookies_tree_model_;
- scoped_ptr<gtk_tree::TreeAdapter> allowed_cookies_tree_adapter_;
- scoped_ptr<gtk_tree::TreeAdapter> blocked_cookies_tree_adapter_;
-
- DISALLOW_COPY_AND_ASSIGN(CollectedCookiesGtk);
-};
+#include "chrome/browser/ui/gtk/collected_cookies_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_COLLECTED_COOKIES_GTK_H_
diff --git a/chrome/browser/gtk/constrained_window_gtk.h b/chrome/browser/gtk/constrained_window_gtk.h
index 0f57f65..3a44fd1 100644
--- a/chrome/browser/gtk/constrained_window_gtk.h
+++ b/chrome/browser/gtk/constrained_window_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,88 +6,7 @@
#define CHROME_BROWSER_GTK_CONSTRAINED_WINDOW_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "base/task.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/browser/tab_contents/constrained_window.h"
-
-class TabContents;
-typedef struct _GdkColor GdkColor;
-#if defined(TOUCH_UI)
-class TabContentsViewViews;
-#else
-class TabContentsViewGtk;
-#endif
-
-class ConstrainedWindowGtkDelegate {
- public:
- // Returns the widget that will be put in the constrained window's container.
- virtual GtkWidget* GetWidgetRoot() = 0;
-
- // Tells the delegate to either delete itself or set up a task to delete
- // itself later.
- virtual void DeleteDelegate() = 0;
-
- virtual bool GetBackgroundColor(GdkColor* color);
-
- protected:
- virtual ~ConstrainedWindowGtkDelegate();
-};
-
-// Constrained window implementation for the GTK port. Unlike the Win32 system,
-// ConstrainedWindowGtk doesn't draw draggable fake windows and instead just
-// centers the dialog. It is thus an order of magnitude simpler.
-class ConstrainedWindowGtk : public ConstrainedWindow {
- public:
-#if defined(TOUCH_UI)
- typedef TabContentsViewViews TabContentsViewType;
-#else
- typedef TabContentsViewGtk TabContentsViewType;
-#endif
-
- virtual ~ConstrainedWindowGtk();
-
- // Overridden from ConstrainedWindow:
- virtual void ShowConstrainedWindow();
- virtual void CloseConstrainedWindow();
-
- // Returns the TabContents that constrains this Constrained Window.
- TabContents* owner() const { return owner_; }
-
- // Returns the toplevel widget that displays this "window".
- GtkWidget* widget() { return border_.get(); }
-
- // Returns the View that we collaborate with to position ourselves.
- TabContentsViewType* ContainingView();
-
- private:
- friend class ConstrainedWindow;
-
- ConstrainedWindowGtk(TabContents* owner,
- ConstrainedWindowGtkDelegate* delegate);
-
- // Handler for Escape.
- CHROMEGTK_CALLBACK_1(ConstrainedWindowGtk, gboolean, OnKeyPress,
- GdkEventKey*);
-
- // The TabContents that owns and constrains this ConstrainedWindow.
- TabContents* owner_;
-
- // The top level widget container that exports to our TabContentsView.
- OwnedWidgetGtk border_;
-
- // Delegate that provides the contents of this constrained window.
- ConstrainedWindowGtkDelegate* delegate_;
-
- // Stores if |ShowConstrainedWindow()| has been called.
- bool visible_;
-
- ScopedRunnableMethodFactory<ConstrainedWindowGtk> factory_;
-
- DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowGtk);
-};
+#include "chrome/browser/ui/gtk/constrained_window_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_CONSTRAINED_WINDOW_GTK_H_
diff --git a/chrome/browser/gtk/content_setting_bubble_gtk.h b/chrome/browser/gtk/content_setting_bubble_gtk.h
index f003ab6..d020c66 100644
--- a/chrome/browser/gtk/content_setting_bubble_gtk.h
+++ b/chrome/browser/gtk/content_setting_bubble_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,87 +6,7 @@
#define CHROME_BROWSER_GTK_CONTENT_SETTING_BUBBLE_GTK_H_
#pragma once
-#include <map>
-
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/gtk/info_bubble_gtk.h"
-#include "chrome/common/content_settings_types.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-
-class ContentSettingBubbleModel;
-class Profile;
-class TabContents;
-
-// ContentSettingBubbleGtk is used when the user turns on different kinds of
-// content blocking (e.g. "block images"). An icon appears in the location bar,
-// and when clicked, an instance of this class is created specialized for the
-// type of content being blocked.
-class ContentSettingBubbleGtk : public InfoBubbleGtkDelegate,
- public NotificationObserver {
- public:
- ContentSettingBubbleGtk(
- GtkWidget* anchor,
- InfoBubbleGtkDelegate* delegate,
- ContentSettingBubbleModel* content_setting_bubble_model,
- Profile* profile, TabContents* tab_contents);
- virtual ~ContentSettingBubbleGtk();
-
- // Dismisses the infobubble.
- void Close();
-
- private:
- typedef std::map<GtkWidget*, int> PopupMap;
-
- // InfoBubbleGtkDelegate:
- virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble,
- bool closed_by_escape);
-
- // NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Builds the info bubble and all the widgets that it displays.
- void BuildBubble();
-
- // Widget callback methods.
- CHROMEGTK_CALLBACK_1(ContentSettingBubbleGtk, void, OnPopupIconButtonPress,
- GdkEventButton*);
- CHROMEGTK_CALLBACK_0(ContentSettingBubbleGtk, void, OnPopupLinkClicked);
- CHROMEGTK_CALLBACK_0(ContentSettingBubbleGtk, void, OnRadioToggled);
- CHROMEGTK_CALLBACK_0(ContentSettingBubbleGtk, void, OnCustomLinkClicked);
- CHROMEGTK_CALLBACK_0(ContentSettingBubbleGtk, void, OnManageLinkClicked);
- CHROMEGTK_CALLBACK_0(ContentSettingBubbleGtk, void, OnCloseButtonClicked);
-
- // We position the bubble near this widget.
- GtkWidget* anchor_;
-
- // The active profile.
- Profile* profile_;
-
- // The active tab contents.
- TabContents* tab_contents_;
-
- // A registrar for listening for TAB_CONTENTS_DESTROYED notifications.
- NotificationRegistrar registrar_;
-
- // Pass on delegate messages to this.
- InfoBubbleGtkDelegate* delegate_;
-
- // Provides data for this bubble.
- scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model_;
-
- // The info bubble.
- InfoBubbleGtk* info_bubble_;
-
- // Stored controls so we can figure out what was clicked.
- PopupMap popup_links_;
- PopupMap popup_icons_;
-
- typedef std::vector<GtkWidget*> RadioGroupGtk;
- RadioGroupGtk radio_group_gtk_;
-};
+#include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_CONTENT_SETTING_BUBBLE_GTK_H_
diff --git a/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h b/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h
index 5570e0c..801f7d8 100644
--- a/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h
+++ b/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,114 +6,7 @@
#define CHROME_BROWSER_GTK_CREATE_APPLICATION_SHORTCUTS_DIALOG_GTK_H_
#pragma once
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "base/ref_counted.h"
-#include "chrome/browser/browser_thread.h"
-#include "chrome/browser/extensions/image_loading_tracker.h"
-#include "chrome/browser/shell_integration.h"
-#include "googleurl/src/gurl.h"
-
-typedef struct _GdkPixbuf GdkPixbuf;
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-
-class Extension;
-class TabContents;
-
-class CreateApplicationShortcutsDialogGtk
- : public base::RefCountedThreadSafe<CreateApplicationShortcutsDialogGtk,
- BrowserThread::DeleteOnUIThread> {
- protected:
- explicit CreateApplicationShortcutsDialogGtk(GtkWindow* parent);
- virtual ~CreateApplicationShortcutsDialogGtk();
-
- CHROMEGTK_CALLBACK_1(CreateApplicationShortcutsDialogGtk, void,
- OnCreateDialogResponse, int);
-
- CHROMEGTK_CALLBACK_1(CreateApplicationShortcutsDialogGtk, void,
- OnErrorDialogResponse, int);
-
- CHROMEGTK_CALLBACK_0(CreateApplicationShortcutsDialogGtk, void,
- OnToggleCheckbox);
-
- virtual void CreateDialogBox(GtkWindow* parent);
- virtual void CreateIconPixBuf(const SkBitmap& bitmap);
-
- // This method is called after a shortcut is created.
- // Subclasses can override it to take some action at that time.
- virtual void OnCreatedShortcut(void) {}
-
- void CreateDesktopShortcut(
- const ShellIntegration::ShortcutInfo& shortcut_info);
- void ShowErrorDialog();
-
- GtkWindow* parent_;
-
- // UI elements.
- GtkWidget* desktop_checkbox_;
- GtkWidget* menu_checkbox_;
-
- // ShortcutInfo for the new shortcut.
- ShellIntegration::ShortcutInfo shortcut_info_;
-
- // Image associated with the site.
- GdkPixbuf* favicon_pixbuf_;
-
- // Dialog box that allows the user to create an application shortcut.
- GtkWidget* create_dialog_;
-
- // Dialog box that shows the error message.
- GtkWidget* error_dialog_;
-
- private:
- friend class BrowserThread;
- friend class DeleteTask<CreateApplicationShortcutsDialogGtk>;
- DISALLOW_COPY_AND_ASSIGN(CreateApplicationShortcutsDialogGtk);
-};
-
-class CreateWebApplicationShortcutsDialogGtk
- : public CreateApplicationShortcutsDialogGtk {
- public:
- // Displays the dialog box to create application shortcuts for |tab_contents|.
- static void Show(GtkWindow* parent, TabContents* tab_contents);
-
- explicit CreateWebApplicationShortcutsDialogGtk(GtkWindow* parent,
- TabContents* tab_contents);
- virtual ~CreateWebApplicationShortcutsDialogGtk() {}
-
- virtual void OnCreatedShortcut(void);
-
- private:
-
- // TabContents for which the shortcut will be created.
- TabContents* tab_contents_;
-
- DISALLOW_COPY_AND_ASSIGN(CreateWebApplicationShortcutsDialogGtk);
-};
-
-class CreateChromeApplicationShortcutsDialogGtk
- : public CreateApplicationShortcutsDialogGtk,
- public ImageLoadingTracker::Observer {
- public:
- // Displays the dialog box to create application shortcuts for |app|.
- static void Show(GtkWindow* parent, const Extension* app);
-
- explicit CreateChromeApplicationShortcutsDialogGtk(GtkWindow* parent,
- const Extension* app);
- virtual ~CreateChromeApplicationShortcutsDialogGtk() {}
-
- // Implement ImageLoadingTracker::Observer. |tracker_| is used to
- // load the app's icon. This method recieves the icon, and adds
- // it to the "Create Shortcut" dailog box.
- virtual void OnImageLoaded(SkBitmap* image,
- ExtensionResource resource,
- int index);
-
- private:
- const Extension* app_;
- ImageLoadingTracker tracker_;
- DISALLOW_COPY_AND_ASSIGN(CreateChromeApplicationShortcutsDialogGtk);
-};
+#include "chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_CREATE_APPLICATION_SHORTCUTS_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/custom_button.h b/chrome/browser/gtk/custom_button.h
index 85f07b1..455cbee 100644
--- a/chrome/browser/gtk/custom_button.h
+++ b/chrome/browser/gtk/custom_button.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,222 +6,7 @@
#define CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "gfx/rect.h"
-#include "third_party/skia/include/core/SkColor.h"
-#include "ui/base/animation/animation_delegate.h"
-#include "ui/base/animation/slide_animation.h"
-
-class CairoCachedSurface;
-class GtkThemeProvider;
-class SkBitmap;
-
-// These classes implement two kinds of custom-drawn buttons. They're
-// used on the toolbar and the bookmarks bar.
-
-// CustomDrawButtonBase provides the base for building a custom drawn button.
-// It handles managing the pixbufs containing all the static images used to draw
-// the button. It also manages painting these pixbufs.
-class CustomDrawButtonBase : public NotificationObserver {
- public:
- // If the images come from ResourceBundle rather than the theme provider,
- // pass in NULL for |theme_provider|.
- CustomDrawButtonBase(GtkThemeProvider* theme_provider,
- int normal_id,
- int pressed_id,
- int hover_id,
- int disabled_id);
-
- ~CustomDrawButtonBase();
-
- // Flip the image horizontally. Not to be used for RTL/LTR reasons. (In RTL
- // mode, this will unflip the image.)
- void set_flipped(bool flipped) { flipped_ = flipped; }
-
- // Returns the dimensions of the first surface.
- int Width() const;
- int Height() const;
-
- gboolean OnExpose(GtkWidget* widget, GdkEventExpose* e, gdouble hover_state);
-
- void set_paint_override(int state) { paint_override_ = state; }
- int paint_override() const { return paint_override_; }
-
- // Set the background details.
- void SetBackground(SkColor color, SkBitmap* image, SkBitmap* mask);
-
- // Provide NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- private:
- // Get the CairoCachedSurface from |surfaces_| for |state|.
- CairoCachedSurface* PixbufForState(int state);
-
- // We store one surface for each possible state of the button;
- // INSENSITIVE is the last available state;
- scoped_ptr<CairoCachedSurface> surfaces_[GTK_STATE_INSENSITIVE + 1];
-
- // The background image.
- scoped_ptr<CairoCachedSurface> background_image_;
-
- // If non-negative, the state to paint the button.
- int paint_override_;
-
- // We need to remember the image ids that the user passes in and the theme
- // provider so we can reload images if the user changes theme.
- int normal_id_;
- int pressed_id_;
- int hover_id_;
- int disabled_id_;
- GtkThemeProvider* theme_provider_;
-
- // Whether the button is flipped horizontally. Not used for RTL (we get
- // flipped versions from the theme provider). Used for the flipped window
- // buttons.
- bool flipped_;
-
- // Used to listen for theme change notifications.
- NotificationRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(CustomDrawButtonBase);
-};
-
-// CustomDrawHoverController is a convenience class that eases the common task
-// of controlling the hover state of a button. The "hover state" refers to the
-// percent opacity of a button's PRELIGHT. The PRELIGHT is animated such that
-// when a user moves a mouse over a button the PRELIGHT fades in.
-class CustomDrawHoverController : public ui::AnimationDelegate {
- public:
- explicit CustomDrawHoverController(GtkWidget* widget);
- CustomDrawHoverController();
-
- virtual ~CustomDrawHoverController();
-
- void Init(GtkWidget* widget);
-
- double GetCurrentValue() {
- return slide_animation_.GetCurrentValue();
- }
-
- private:
- virtual void AnimationProgressed(const ui::Animation* animation);
-
- CHROMEGTK_CALLBACK_1(CustomDrawHoverController, gboolean, OnEnter,
- GdkEventCrossing*);
- CHROMEGTK_CALLBACK_1(CustomDrawHoverController, gboolean, OnLeave,
- GdkEventCrossing*);
-
- ui::SlideAnimation slide_animation_;
- GtkWidget* widget_;
-};
-
-// CustomDrawButton is a plain button where all its various states are drawn
-// with static images. In GTK rendering mode, it will show the standard button
-// with GTK |stock_id|.
-class CustomDrawButton : public NotificationObserver {
- public:
- // The constructor takes 4 resource ids. If a resource doesn't exist for a
- // button, pass in 0.
- CustomDrawButton(int normal_id,
- int pressed_id,
- int hover_id,
- int disabled_id);
-
- // Same as above, but uses themed (and possibly tinted) images. |stock_id| and
- // |stock_size| are used for GTK+ theme mode.
- CustomDrawButton(GtkThemeProvider* theme_provider,
- int normal_id,
- int pressed_id,
- int hover_id,
- int disabled_id,
- const char* stock_id,
- GtkIconSize stock_size);
-
- // As above, but uses an arbitrary GtkImage rather than a stock icon. This
- // constructor takes ownership of |native_widget|.
- CustomDrawButton(GtkThemeProvider* theme_provider,
- int normal_id,
- int pressed_id,
- int hover_id,
- int disabled_id,
- GtkWidget* native_widget);
-
- ~CustomDrawButton();
-
- void Init();
-
- // Flip the image horizontally. Not to be used for RTL/LTR reasons. (In RTL
- // mode, this will unflip the image.)
- void set_flipped(bool flipped) { button_base_.set_flipped(flipped); }
-
- GtkWidget* widget() const { return widget_.get(); }
-
- gfx::Rect bounds() const {
- return gfx::Rect(widget_->allocation.x,
- widget_->allocation.y,
- widget_->allocation.width,
- widget_->allocation.height);
- }
-
- int width() const { return widget_->allocation.width; }
- int height() const { return widget_->allocation.height; }
-
- // Set the state to draw. We will paint the widget as if it were in this
- // state.
- void SetPaintOverride(GtkStateType state);
-
- // Resume normal drawing of the widget's state.
- void UnsetPaintOverride();
-
- // Set the background details.
- void SetBackground(SkColor color, SkBitmap* image, SkBitmap* mask);
-
- // NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Returns a standard close button. Pass a |theme_provider| to use Gtk icons
- // in Gtk rendering mode.
- static CustomDrawButton* CloseButton(GtkThemeProvider* theme_provider);
-
- private:
- // Sets the button to themed or not.
- void SetBrowserTheme();
-
- // Whether to use the GTK+ theme. For this to be true, we have to be in GTK+
- // theme mode and we must have a valid stock icon resource.
- bool UseGtkTheme();
-
- // Callback for custom button expose, used to draw the custom graphics.
- CHROMEGTK_CALLBACK_1(CustomDrawButton, gboolean, OnCustomExpose,
- GdkEventExpose*);
-
- // The actual button widget.
- OwnedWidgetGtk widget_;
-
- CustomDrawButtonBase button_base_;
-
- CustomDrawHoverController hover_controller_;
-
- // The widget to use when we are displaying in GTK+ theme mode.
- OwnedWidgetGtk native_widget_;
-
- // Our theme provider.
- GtkThemeProvider* theme_provider_;
-
- // Used to listen for theme change notifications.
- NotificationRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(CustomDrawButton);
-};
+#include "chrome/browser/ui/gtk/custom_button.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_
diff --git a/chrome/browser/gtk/custom_drag.h b/chrome/browser/gtk/custom_drag.h
index 679fac0..c4c4cce 100644
--- a/chrome/browser/gtk/custom_drag.h
+++ b/chrome/browser/gtk/custom_drag.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,95 +6,7 @@
#define CHROME_BROWSER_GTK_CUSTOM_DRAG_H_
#pragma once
-#include <gtk/gtk.h>
-#include <vector>
-
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-
-class BookmarkNode;
-class DownloadItem;
-class Profile;
-class SkBitmap;
-
-// Base class for programatically generated drags.
-class CustomDrag {
- protected:
- explicit CustomDrag(SkBitmap* icon, int code_mask, GdkDragAction action);
- virtual ~CustomDrag();
-
- virtual void OnDragDataGet(GtkWidget* widget, GdkDragContext* context,
- GtkSelectionData* selection_data,
- guint target_type, guint time) = 0;
-
- private:
- CHROMEGTK_CALLBACK_1(CustomDrag, void, OnDragBegin, GdkDragContext*);
- CHROMEGTK_CALLBACK_1(CustomDrag, void, OnDragEnd, GdkDragContext*);
-
- // Since this uses a virtual function, we can't use a macro.
- static void OnDragDataGetThunk(GtkWidget* widget, GdkDragContext* context,
- GtkSelectionData* selection_data,
- guint target_type, guint time,
- CustomDrag* custom_drag) {
- return custom_drag->OnDragDataGet(widget, context, selection_data,
- target_type, time);
- }
-
- // Can't use a OwnedWidgetGtk because the initialization of GtkInvisible
- // sinks the reference.
- GtkWidget* drag_widget_;
-
- GdkPixbuf* pixbuf_;
-
- DISALLOW_COPY_AND_ASSIGN(CustomDrag);
-};
-
-// Encapsulates functionality for drags of download items.
-class DownloadItemDrag : public CustomDrag {
- public:
- // Sets |widget| as a source for drags pertaining to |item|. No
- // DownloadItemDrag object is created.
- // It is safe to call this multiple times with different values of |icon|.
- static void SetSource(GtkWidget* widget, DownloadItem* item, SkBitmap* icon);
-
- // Creates a new DownloadItemDrag, the lifetime of which is tied to the
- // system drag.
- static void BeginDrag(const DownloadItem* item, SkBitmap* icon);
-
- private:
- DownloadItemDrag(const DownloadItem* item, SkBitmap* icon);
- virtual ~DownloadItemDrag();
-
- virtual void OnDragDataGet(GtkWidget* widget, GdkDragContext* context,
- GtkSelectionData* selection_data,
- guint target_type, guint time);
-
- const DownloadItem* download_item_;
-
- DISALLOW_COPY_AND_ASSIGN(DownloadItemDrag);
-};
-
-// Encapsulates functionality for drags of one or more bookmarks.
-class BookmarkDrag : public CustomDrag {
- public:
- // Creates a new BookmarkDrag, the lifetime of which is tied to the
- // system drag.
- static void BeginDrag(Profile* profile,
- const std::vector<const BookmarkNode*>& nodes);
-
- private:
- BookmarkDrag(Profile* profile,
- const std::vector<const BookmarkNode*>& nodes);
- virtual ~BookmarkDrag();
-
- virtual void OnDragDataGet(GtkWidget* widget, GdkDragContext* context,
- GtkSelectionData* selection_data,
- guint target_type, guint time);
-
- Profile* profile_;
- std::vector<const BookmarkNode*> nodes_;
-
- DISALLOW_COPY_AND_ASSIGN(BookmarkDrag);
-};
+#include "chrome/browser/ui/gtk/custom_drag.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_CUSTOM_DRAG_H_
diff --git a/chrome/browser/gtk/download_in_progress_dialog_gtk.h b/chrome/browser/gtk/download_in_progress_dialog_gtk.h
index 86f736a..64b8652f 100644
--- a/chrome/browser/gtk/download_in_progress_dialog_gtk.h
+++ b/chrome/browser/gtk/download_in_progress_dialog_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,26 +6,7 @@
#define CHROME_BROWSER_GTK_DOWNLOAD_IN_PROGRESS_DIALOG_GTK_H_
#pragma once
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-
-class Browser;
-
-typedef struct _GtkWidget GtkWidget;
-
-class DownloadInProgressDialogGtk {
- public:
- explicit DownloadInProgressDialogGtk(Browser* browser);
-
- protected:
- virtual ~DownloadInProgressDialogGtk() {}
-
- private:
- CHROMEGTK_CALLBACK_1(DownloadInProgressDialogGtk, void, OnResponse, int);
-
- Browser* browser_;
-
- DISALLOW_COPY_AND_ASSIGN(DownloadInProgressDialogGtk);
-};
+#include "chrome/browser/ui/gtk/download_in_progress_dialog_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_DOWNLOAD_IN_PROGRESS_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/download_item_gtk.h b/chrome/browser/gtk/download_item_gtk.h
index 56a0890..1c4fe58 100644
--- a/chrome/browser/gtk/download_item_gtk.h
+++ b/chrome/browser/gtk/download_item_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,215 +6,7 @@
#define CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <string>
-
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-#include "base/time.h"
-#include "chrome/browser/download/download_item.h"
-#include "chrome/browser/icon_manager.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "ui/base/animation/animation_delegate.h"
-
-class BaseDownloadItemModel;
-class DownloadShelfContextMenuGtk;
-class DownloadShelfGtk;
-class GtkThemeProvider;
-class NineBox;
-class SkBitmap;
-
-namespace ui {
-class SlideAnimation;
-}
-
-class DownloadItemGtk : public DownloadItem::Observer,
- public ui::AnimationDelegate,
- public NotificationObserver {
- public:
- // DownloadItemGtk takes ownership of |download_item_model|.
- DownloadItemGtk(DownloadShelfGtk* parent_shelf,
- BaseDownloadItemModel* download_item_model);
-
- // Destroys all widgets belonging to this DownloadItemGtk.
- ~DownloadItemGtk();
-
- // DownloadItem::Observer implementation.
- virtual void OnDownloadUpdated(DownloadItem* download);
- virtual void OnDownloadFileCompleted(DownloadItem* download) { }
- virtual void OnDownloadOpened(DownloadItem* download) { }
-
- // ui::AnimationDelegate implementation.
- virtual void AnimationProgressed(const ui::Animation* animation);
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Called when the icon manager has finished loading the icon. We take
- // ownership of |icon_bitmap|.
- void OnLoadSmallIconComplete(IconManager::Handle handle,
- SkBitmap* icon_bitmap);
- void OnLoadLargeIconComplete(IconManager::Handle handle,
- SkBitmap* icon_bitmap);
-
- // Returns the DownloadItem model object belonging to this item.
- DownloadItem* get_download();
-
- private:
- friend class DownloadShelfContextMenuGtk;
-
- // Returns true IFF the download is dangerous and unconfirmed.
- bool IsDangerous();
-
- // Functions for controlling the progress animation.
- // Repaint the download progress.
- void UpdateDownloadProgress();
-
- // Starts a repeating timer for UpdateDownloadProgress.
- void StartDownloadProgress();
-
- // Stops the repeating timer.
- void StopDownloadProgress();
-
- // Ask the icon manager to asynchronously start loading the icon for the file.
- void LoadIcon();
-
- // Sets the tooltip on the download button.
- void UpdateTooltip();
-
- // Sets the name label to the correct color.
- void UpdateNameLabel();
-
- // Sets the text of |status_label_| with the correct color.
- void UpdateStatusLabel(const std::string& status_text);
-
- // Sets the components of the danger warning.
- void UpdateDangerWarning();
-
- static void InitNineBoxes();
-
- // Draws everything in GTK rendering mode.
- CHROMEGTK_CALLBACK_1(DownloadItemGtk, gboolean, OnHboxExpose,
- GdkEventExpose*);
-
- // Used for the download item's body and menu button in chrome theme mode.
- CHROMEGTK_CALLBACK_1(DownloadItemGtk, gboolean, OnExpose, GdkEventExpose*);
-
- // Called when |body_| is clicked.
- CHROMEGTK_CALLBACK_0(DownloadItemGtk, void, OnClick);
-
- // Used for the download icon.
- CHROMEGTK_CALLBACK_1(DownloadItemGtk, gboolean, OnProgressAreaExpose,
- GdkEventExpose*);
-
- CHROMEGTK_CALLBACK_1(DownloadItemGtk, gboolean, OnMenuButtonPressEvent,
- GdkEvent*);
-
- // Dangerous download related. -----------------------------------------------
- CHROMEGTK_CALLBACK_1(DownloadItemGtk, gboolean, OnDangerousPromptExpose,
- GdkEventExpose*);
- CHROMEGTK_CALLBACK_0(DownloadItemGtk, void, OnDangerousAccept);
- CHROMEGTK_CALLBACK_0(DownloadItemGtk, void, OnDangerousDecline);
-
- // Nineboxes for the body area.
- static NineBox* body_nine_box_normal_;
- static NineBox* body_nine_box_prelight_;
- static NineBox* body_nine_box_active_;
-
- // Nineboxes for the menu button.
- static NineBox* menu_nine_box_normal_;
- static NineBox* menu_nine_box_prelight_;
- static NineBox* menu_nine_box_active_;
-
- // Ninebox for the background of the dangerous download prompt.
- static NineBox* dangerous_nine_box_;
-
- // The shelf on which we are displayed.
- DownloadShelfGtk* parent_shelf_;
-
- // The widget that contains the body and menu dropdown.
- OwnedWidgetGtk hbox_;
-
- // The widget that contains the name of the download and the progress
- // animation.
- OwnedWidgetGtk body_;
-
- // The GtkLabel that holds the download title text.
- GtkWidget* name_label_;
-
- // The GtkLabel that holds the status text.
- GtkWidget* status_label_;
-
- // The current text of status label
- std::string status_text_;
-
- // The widget that creates a dropdown menu when pressed.
- GtkWidget* menu_button_;
-
- // A gtk arrow pointing downward displayed in |menu_button_|. Only displayed
- // in GTK mode.
- GtkWidget* arrow_;
-
- // Whether the menu is currently showing for |menu_button_|. Affects how we
- // draw the button.
- bool menu_showing_;
-
- // Whether we should use the GTK text color
- GtkThemeProvider* theme_provider_;
-
- // The widget that contains the animation progress and the file's icon
- // (as well as the complete animation).
- OwnedWidgetGtk progress_area_;
-
- // In degrees. Only used for downloads with no known total size.
- int progress_angle_;
-
- // The menu that pops down when the user presses |menu_button_|. We do not
- // create this until the first time we actually need it.
- scoped_ptr<DownloadShelfContextMenuGtk> menu_;
-
- // The download item model we represent.
- scoped_ptr<BaseDownloadItemModel> download_model_;
-
- // The dangerous download dialog. This will be null for safe downloads.
- GtkWidget* dangerous_prompt_;
- GtkWidget* dangerous_image_;
- GtkWidget* dangerous_label_;
-
- // An hbox for holding components of the dangerous download dialog.
- GtkWidget* dangerous_hbox_;
- int dangerous_hbox_start_width_;
- int dangerous_hbox_full_width_;
-
- // The animation when this item is first added to the shelf.
- scoped_ptr<ui::SlideAnimation> new_item_animation_;
-
- // Progress animation.
- base::RepeatingTimer<DownloadItemGtk> progress_timer_;
-
- // Animation for download complete.
- scoped_ptr<ui::SlideAnimation> complete_animation_;
-
- // The file icon for the download. May be null. The small version is used
- // for display in the shelf; the large version is for use as a drag icon.
- SkBitmap* icon_small_;
- SkBitmap* icon_large_;
-
- // The last download file path for which we requested an icon.
- FilePath icon_filepath_;
-
- NotificationRegistrar registrar_;
-
- // The time at which we were insantiated.
- base::Time creation_time_;
-
- // For canceling an in progress icon request.
- CancelableRequestConsumerT<int, 0> icon_consumer_;
-};
+#include "chrome/browser/ui/gtk/download_item_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_
diff --git a/chrome/browser/gtk/download_shelf_gtk.h b/chrome/browser/gtk/download_shelf_gtk.h
index 9c6cceb..5d2dc24 100644
--- a/chrome/browser/gtk/download_shelf_gtk.h
+++ b/chrome/browser/gtk/download_shelf_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,104 +6,7 @@
#define CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <vector>
-
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/download/download_shelf.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/browser/gtk/slide_animator_gtk.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "gfx/native_widget_types.h"
-
-class BaseDownloadItemModel;
-class Browser;
-class CustomDrawButton;
-class DownloadItemGtk;
-class GtkThemeProvider;
-class SlideAnimatorGtk;
-
-class DownloadShelfGtk : public DownloadShelf,
- public NotificationObserver,
- public SlideAnimatorGtk::Delegate {
- public:
- explicit DownloadShelfGtk(Browser* browser, gfx::NativeView view);
-
- ~DownloadShelfGtk();
-
- // DownloadShelf implementation.
- virtual void AddDownload(BaseDownloadItemModel* download_model);
- virtual bool IsShowing() const;
- virtual bool IsClosing() const;
- virtual void Show();
- virtual void Close();
- virtual Browser* browser() const;
-
- // SlideAnimatorGtk::Delegate implementation.
- virtual void Closed();
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Returns the current height of the shelf.
- int GetHeight() const;
-
- private:
- // Remove |download_item| from the download shelf and delete it.
- void RemoveDownloadItem(DownloadItemGtk* download_item);
-
- // Get the hbox download items ought to pack themselves into.
- GtkWidget* GetHBox() const;
-
- // Show more hidden download items if there is enough space in the shelf.
- // It's called when a download item is removed from the shelf or an item's
- // size is changed.
- void MaybeShowMoreDownloadItems();
-
- CHROMEGTK_CALLBACK_0(DownloadShelfGtk, void, OnButtonClick);
-
- // The browser that owns this download shelf.
- Browser* browser_;
-
- // The top level widget of the shelf.
- scoped_ptr<SlideAnimatorGtk> slide_widget_;
-
- // |items_hbox_| holds the download items.
- OwnedWidgetGtk items_hbox_;
-
- // |shelf_| is the second highest level widget. See the constructor
- // for an explanation of the widget layout.
- OwnedWidgetGtk shelf_;
-
- // Top level event box which draws the one pixel border.
- GtkWidget* top_border_;
-
- // A GtkEventBox which we color.
- GtkWidget* padding_bg_;
-
- // The "Show all downloads..." link.
- GtkWidget* link_button_;
-
- // The 'x' that the user can press to hide the download shelf.
- scoped_ptr<CustomDrawButton> close_button_;
-
- // Keeps track of our current hide/show state.
- bool is_showing_;
-
- // The download items we have added to our shelf.
- std::vector<DownloadItemGtk*> download_items_;
-
- // Gives us our colors and theme information.
- GtkThemeProvider* theme_provider_;
-
- NotificationRegistrar registrar_;
-
- friend class DownloadItemGtk;
-};
+#include "chrome/browser/ui/gtk/download_shelf_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_
diff --git a/chrome/browser/gtk/edit_search_engine_dialog.h b/chrome/browser/gtk/edit_search_engine_dialog.h
index df5f308a..5124893 100644
--- a/chrome/browser/gtk/edit_search_engine_dialog.h
+++ b/chrome/browser/gtk/edit_search_engine_dialog.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,78 +6,7 @@
#define CHROME_BROWSER_GTK_EDIT_SEARCH_ENGINE_DIALOG_H_
#pragma once
-#include <gtk/gtk.h>
-#include <string>
-
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "base/string16.h"
-
-class AccessibleWidgetHelper;
-class EditSearchEngineController;
-class EditSearchEngineControllerDelegate;
-class Profile;
-class TemplateURL;
-
-class EditSearchEngineDialog {
- public:
- EditSearchEngineDialog(GtkWindow* parent_window,
- const TemplateURL* template_url,
- EditSearchEngineControllerDelegate* delegate,
- Profile* profile);
- virtual ~EditSearchEngineDialog();
-
- private:
- // Create and show the window.
- void Init(GtkWindow* parent_window, Profile* profile);
-
- // Retrieve the user input in the various fields.
- string16 GetTitleInput() const;
- string16 GetKeywordInput() const;
- std::string GetURLInput() const;
-
- // Set sensitivity of buttons based on entry state.
- void EnableControls();
-
- // Updates the tooltip and image of the image view based on is_valid. If
- // is_valid is false the tooltip of the image view is set to the message with
- // id invalid_message_id, otherwise the tooltip is set to the empty text.
- void UpdateImage(GtkWidget* image, bool is_valid, int invalid_message_id);
-
- // Callback for entry changes.
- CHROMEG_CALLBACK_0(EditSearchEngineDialog, void, OnEntryChanged,
- GtkEditable*);
-
- // Callback for dialog buttons.
- CHROMEG_CALLBACK_1(EditSearchEngineDialog, void, OnResponse, GtkDialog*, int);
-
- // Callback for window destruction.
- CHROMEGTK_CALLBACK_0(EditSearchEngineDialog, void, OnWindowDestroy);
-
- // The dialog window.
- GtkWidget* dialog_;
-
- // Text entries for each field.
- GtkWidget* title_entry_;
- GtkWidget* keyword_entry_;
- GtkWidget* url_entry_;
-
- // Images showing whether each entry is okay or has errors.
- GtkWidget* title_image_;
- GtkWidget* keyword_image_;
- GtkWidget* url_image_;
-
- // The ok button (we need a reference to it so we can de-activate it when the
- // entries are not all filled in.)
- GtkWidget* ok_button_;
-
- scoped_ptr<EditSearchEngineController> controller_;
-
- // Helper object to manage accessibility metadata.
- scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
-
- DISALLOW_COPY_AND_ASSIGN(EditSearchEngineDialog);
-};
+#include "chrome/browser/ui/gtk/edit_search_engine_dialog.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_EDIT_SEARCH_ENGINE_DIALOG_H_
diff --git a/chrome/browser/gtk/extension_infobar_gtk.h b/chrome/browser/gtk/extension_infobar_gtk.h
index b204bfc..e8512ee 100644
--- a/chrome/browser/gtk/extension_infobar_gtk.h
+++ b/chrome/browser/gtk/extension_infobar_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,45 +6,7 @@
#define CHROME_BROWSER_GTK_EXTENSION_INFOBAR_GTK_H_
#pragma once
-#include "chrome/browser/gtk/extension_view_gtk.h"
-#include "chrome/browser/gtk/infobar_gtk.h"
-#include "chrome/browser/extensions/extension_infobar_delegate.h"
-#include "chrome/browser/extensions/image_loading_tracker.h"
-#include "gfx/gtk_util.h"
-
-class ExtensionInfobarDelegate;
-class ExtensionResource;
-class ExtensionViewGtk;
-
-class ExtensionInfoBarGtk : public InfoBar,
- public ImageLoadingTracker::Observer,
- public ExtensionViewGtk::Container {
- public:
- explicit ExtensionInfoBarGtk(ExtensionInfoBarDelegate* delegate);
- virtual ~ExtensionInfoBarGtk();
-
- // Overridden from ImageLoadingTracker::Observer:
- virtual void OnImageLoaded(
- SkBitmap* image, ExtensionResource resource, int index);
-
- // ExtensionViewGtk::Container implementation
- virtual void OnExtensionPreferredSizeChanged(ExtensionViewGtk* view,
- const gfx::Size& new_size);
-
- private:
- // Build the widgets of the Infobar.
- void BuildWidgets();
-
- CHROMEGTK_CALLBACK_1(ExtensionInfoBarGtk, void, OnSizeAllocate,
- GtkAllocation*);
-
- ImageLoadingTracker tracker_;
-
- ExtensionInfoBarDelegate* delegate_;
-
- ExtensionViewGtk* view_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarGtk);
-};
+#include "chrome/browser/ui/gtk/extension_infobar_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_EXTENSION_INFOBAR_GTK_H_
diff --git a/chrome/browser/gtk/extension_installed_bubble_gtk.h b/chrome/browser/gtk/extension_installed_bubble_gtk.h
index 06132836..56b005f 100644
--- a/chrome/browser/gtk/extension_installed_bubble_gtk.h
+++ b/chrome/browser/gtk/extension_installed_bubble_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,92 +6,7 @@
#define CHROME_BROWSER_GTK_EXTENSION_INSTALLED_BUBBLE_GTK_H_
#pragma once
-#include "base/ref_counted.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/gtk/custom_button.h"
-#include "chrome/browser/gtk/info_bubble_gtk.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-
-class Browser;
-class BrowserWindowGtk;
-class Extension;
-class SkBitmap;
-
-// Provides feedback to the user upon successful installation of an
-// extension. Depending on the type of extension, the InfoBubble will
-// point to:
-// OMNIBOX_KEYWORD-> The omnibox.
-// BROWSER_ACTION -> The browserAction icon in the toolbar.
-// PAGE_ACTION -> A preview of the page action icon in the location
-// bar which is shown while the InfoBubble is shown.
-// GENERIC -> The wrench menu. This case includes page actions that
-// don't specify a default icon.
-//
-// ExtensionInstallBubble manages its own lifetime.
-class ExtensionInstalledBubbleGtk
- : public InfoBubbleGtkDelegate,
- public NotificationObserver,
- public base::RefCountedThreadSafe<ExtensionInstalledBubbleGtk> {
- public:
- // The behavior and content of this InfoBubble comes in three varieties.
- enum BubbleType {
- OMNIBOX_KEYWORD,
- BROWSER_ACTION,
- PAGE_ACTION,
- GENERIC
- };
-
- // Creates the ExtensionInstalledBubble and schedules it to be shown once
- // the extension has loaded. |extension| is the installed extension. |browser|
- // is the browser window which will host the bubble. |icon| is the install
- // icon of the extension.
- static void Show(const Extension* extension, Browser *browser, SkBitmap icon);
-
- private:
- friend class base::RefCountedThreadSafe<ExtensionInstalledBubbleGtk>;
-
- // Private ctor. Registers a listener for EXTENSION_LOADED.
- ExtensionInstalledBubbleGtk(const Extension* extension, Browser *browser,
- SkBitmap icon);
-
- virtual ~ExtensionInstalledBubbleGtk();
-
- // Shows the bubble. Called internally via PostTask.
- void ShowInternal();
-
- // NotificationObserver
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // InfoBubbleDelegate
- virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble,
- bool closed_by_escape);
-
- // Calls Release() internally. Called internally via PostTask.
- void Close();
-
- static void OnButtonClick(GtkWidget* button,
- ExtensionInstalledBubbleGtk* toolbar);
-
- const Extension* extension_;
- Browser *browser_;
- SkBitmap icon_;
- NotificationRegistrar registrar_;
- BubbleType type_;
-
- // The number of times to retry showing the bubble if the browser action
- // toolbar is animating.
- int animation_wait_retries_;
-
- // The 'x' that the user can press to hide the info bubble shelf.
- scoped_ptr<CustomDrawButton> close_button_;
-
- InfoBubbleGtk* info_bubble_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubbleGtk);
-};
+#include "chrome/browser/ui/gtk/extension_installed_bubble_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_EXTENSION_INSTALLED_BUBBLE_GTK_H_
diff --git a/chrome/browser/gtk/extension_popup_gtk.h b/chrome/browser/gtk/extension_popup_gtk.h
index df983de..89fe0ad 100644
--- a/chrome/browser/gtk/extension_popup_gtk.h
+++ b/chrome/browser/gtk/extension_popup_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,95 +6,7 @@
#define CHROME_BROWSER_GTK_EXTENSION_POPUP_GTK_H_
#pragma once
-#include "base/scoped_ptr.h"
-#include "base/task.h"
-#include "chrome/browser/gtk/extension_view_gtk.h"
-#include "chrome/browser/gtk/info_bubble_gtk.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "gfx/rect.h"
-
-class Browser;
-class ExtensionHost;
-class GURL;
-
-class ExtensionPopupGtk : public NotificationObserver,
- public InfoBubbleGtkDelegate,
- public ExtensionViewGtk::Container {
- public:
- ExtensionPopupGtk(Browser* browser,
- ExtensionHost* host,
- GtkWidget* anchor,
- bool inspect);
- virtual ~ExtensionPopupGtk();
-
- static void Show(const GURL& url,
- Browser* browser,
- GtkWidget* anchor,
- bool inspect);
-
- // NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // InfoBubbleGtkDelegate implementation.
- virtual void InfoBubbleClosing(InfoBubbleGtk* bubble,
- bool closed_by_escape);
-
- // ExtensionViewGtk::Container implementation
- virtual void OnExtensionPreferredSizeChanged(ExtensionViewGtk* view,
- const gfx::Size& new_size);
-
- // Destroys the popup widget. This will in turn destroy us since we delete
- // ourselves when the info bubble closes. Returns true if we successfully
- // closed the bubble.
- bool DestroyPopup();
-
- // Get the currently showing extension popup, or NULL.
- static ExtensionPopupGtk* get_current_extension_popup() {
- return current_extension_popup_;
- }
-
- bool being_inspected() const {
- return being_inspected_;
- }
-
- // Declared here for testing.
- static const int kMinWidth;
- static const int kMinHeight;
- static const int kMaxWidth;
- static const int kMaxHeight;
-
- private:
- // Shows the popup widget. Called after loading completes.
- void ShowPopup();
-
- Browser* browser_;
-
- InfoBubbleGtk* bubble_;
-
- // We take ownership of the popup ExtensionHost.
- scoped_ptr<ExtensionHost> host_;
-
- // The widget for anchoring the position of the info bubble.
- GtkWidget* anchor_;
-
- NotificationRegistrar registrar_;
-
- static ExtensionPopupGtk* current_extension_popup_;
-
- // Whether a devtools window is attached to this bubble.
- bool being_inspected_;
-
- ScopedRunnableMethodFactory<ExtensionPopupGtk> method_factory_;
-
- // Used for testing. ---------------------------------------------------------
- gfx::Rect GetViewBounds();
-
- friend class BrowserActionTestUtil;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionPopupGtk);
-};
+#include "chrome/browser/ui/gtk/extension_popup_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_EXTENSION_POPUP_GTK_H_
diff --git a/chrome/browser/gtk/extension_view_gtk.h b/chrome/browser/gtk/extension_view_gtk.h
index 5e5f436..bb98f28 100644
--- a/chrome/browser/gtk/extension_view_gtk.h
+++ b/chrome/browser/gtk/extension_view_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,65 +6,7 @@
#define CHROME_BROWSER_GTK_EXTENSION_VIEW_GTK_H_
#pragma once
-#include "base/basictypes.h"
-#include "gfx/native_widget_types.h"
-#include "gfx/size.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-
-class Browser;
-class ExtensionHost;
-class RenderViewHost;
-class RenderWidgetHostViewGtk;
-class SkBitmap;
-
-class ExtensionViewGtk {
- public:
- ExtensionViewGtk(ExtensionHost* extension_host, Browser* browser);
-
- class Container {
- public:
- virtual ~Container() {}
- virtual void OnExtensionPreferredSizeChanged(ExtensionViewGtk* view,
- const gfx::Size& new_size) {}
- };
-
- void Init();
-
- gfx::NativeView native_view();
- Browser* browser() const { return browser_; }
-
- void SetBackground(const SkBitmap& background);
-
- // Sets the container for this view.
- void SetContainer(Container* container) { container_ = container; }
-
- // Method for the ExtensionHost to notify us about the correct size for
- // extension contents.
- void UpdatePreferredSize(const gfx::Size& new_size);
-
- // Method for the ExtensionHost to notify us when the RenderViewHost has a
- // connection.
- void RenderViewCreated();
-
- RenderViewHost* render_view_host() const;
-
- private:
- void CreateWidgetHostView();
-
- Browser* browser_;
-
- ExtensionHost* extension_host_;
-
- RenderWidgetHostViewGtk* render_widget_host_view_;
-
- // The background the view should have once it is initialized. This is set
- // when the view has a custom background, but hasn't been initialized yet.
- SkBitmap pending_background_;
-
- // This view's container.
- Container* container_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionViewGtk);
-};
+#include "chrome/browser/ui/gtk/extension_view_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_EXTENSION_VIEW_GTK_H_
diff --git a/chrome/browser/gtk/external_protocol_dialog_gtk.h b/chrome/browser/gtk/external_protocol_dialog_gtk.h
index 0703bc8..6d07c54 100644
--- a/chrome/browser/gtk/external_protocol_dialog_gtk.h
+++ b/chrome/browser/gtk/external_protocol_dialog_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,28 +6,7 @@
#define CHROME_BROWSER_GTK_EXTERNAL_PROTOCOL_DIALOG_GTK_H_
#pragma once
-#include "app/gtk_signal.h"
-#include "base/time.h"
-#include "googleurl/src/gurl.h"
-
-class TabContents;
-
-typedef struct _GtkWidget GtkWidget;
-
-class ExternalProtocolDialogGtk {
- public:
- explicit ExternalProtocolDialogGtk(const GURL& url);
-
- protected:
- virtual ~ExternalProtocolDialogGtk() {}
-
- private:
- CHROMEGTK_CALLBACK_1(ExternalProtocolDialogGtk, void, OnDialogResponse, int);
-
- GtkWidget* dialog_;
- GtkWidget* checkbox_;
- GURL url_;
- base::TimeTicks creation_time_;
-};
+#include "chrome/browser/ui/gtk/external_protocol_dialog_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_EXTERNAL_PROTOCOL_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/find_bar_gtk.h b/chrome/browser/gtk/find_bar_gtk.h
index 527644a..df5f34a 100644
--- a/chrome/browser/gtk/find_bar_gtk.h
+++ b/chrome/browser/gtk/find_bar_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,235 +6,7 @@
#define CHROME_BROWSER_GTK_FIND_BAR_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/gtk/focus_store_gtk.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/browser/gtk/slide_animator_gtk.h"
-#include "chrome/browser/ui/find_bar/find_bar.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "gfx/point.h"
-
-class Browser;
-class BrowserWindowGtk;
-class CustomDrawButton;
-class FindBarController;
-class GtkThemeProvider;
-class NineBox;
-class SlideAnimatorGtk;
-class TabContentsContainerGtk;
-
-typedef struct _GtkFloatingContainer GtkFloatingContainer;
-
-// Currently this class contains both a model and a view. We may want to
-// eventually pull out the model specific bits and share with Windows.
-class FindBarGtk : public FindBar,
- public FindBarTesting,
- public NotificationObserver {
- public:
- explicit FindBarGtk(Browser* browser);
- virtual ~FindBarGtk();
-
- GtkWidget* widget() const { return slide_widget_->widget(); }
-
- // Methods from FindBar.
- virtual FindBarController* GetFindBarController() const;
- virtual void SetFindBarController(FindBarController* find_bar_controller);
- virtual void Show(bool animate);
- virtual void Hide(bool animate);
- virtual void SetFocusAndSelection();
- virtual void ClearResults(const FindNotificationDetails& results);
- virtual void StopAnimation();
- virtual void MoveWindowIfNecessary(const gfx::Rect& selection_rect,
- bool no_redraw);
- virtual void SetFindText(const string16& find_text);
- virtual void UpdateUIForFindResult(const FindNotificationDetails& result,
- const string16& find_text);
- virtual void AudibleAlert();
- virtual bool IsFindBarVisible();
- virtual void RestoreSavedFocus();
- virtual FindBarTesting* GetFindBarTesting();
-
- // Methods from FindBarTesting.
- virtual bool GetFindBarWindowInfo(gfx::Point* position,
- bool* fully_visible);
- virtual string16 GetFindText();
- virtual string16 GetFindSelectedText();
- virtual string16 GetMatchCountText();
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- private:
- void InitWidgets();
-
- // Store the currently focused widget if it is not in the find bar.
- // This should always be called before we claim focus.
- void StoreOutsideFocus();
-
- // For certain keystrokes, such as up or down, we want to forward the event
- // to the renderer rather than handling it ourselves. Returns true if the
- // key event was forwarded.
- // See similar function in FindBarWin.
- bool MaybeForwardKeyEventToRenderer(GdkEventKey* event);
-
- // Searches for another occurrence of the entry text, moving forward if
- // |forward_search| is true.
- void FindEntryTextInContents(bool forward_search);
-
- void UpdateMatchLabelAppearance(bool failure);
-
- // Asynchronously repositions the dialog.
- void Reposition();
-
- // Returns the rectangle representing where to position the find bar. If
- // |avoid_overlapping_rect| is specified, the return value will be a rectangle
- // located immediately to the left of |avoid_overlapping_rect|, as long as
- // there is enough room for the dialog to draw within the bounds. If not, the
- // dialog position returned will overlap |avoid_overlapping_rect|.
- // Note: |avoid_overlapping_rect| is expected to use coordinates relative to
- // the top of the page area, (it will be converted to coordinates relative to
- // the top of the browser window, when comparing against the dialog
- // coordinates). The returned value is relative to the browser window.
- gfx::Rect GetDialogPosition(gfx::Rect avoid_overlapping_rect);
-
- // Adjust the text alignment according to the text direction of the widget
- // and |text_entry_|'s content, to make sure the real text alignment is
- // always in sync with the UI language direction.
- void AdjustTextAlignment();
-
- // Get the position of the findbar within the floating container.
- gfx::Point GetPosition();
-
- static void OnParentSet(GtkWidget* widget, GtkObject* old_parent,
- FindBarGtk* find_bar);
-
- static void OnSetFloatingPosition(GtkFloatingContainer* floating_container,
- GtkAllocation* allocation,
- FindBarGtk* find_bar);
-
- // Callback when the entry text changes.
- static gboolean OnChanged(GtkWindow* window, FindBarGtk* find_bar);
-
- static gboolean OnKeyPressEvent(GtkWidget* widget, GdkEventKey* event,
- FindBarGtk* find_bar);
- static gboolean OnKeyReleaseEvent(GtkWidget* widget, GdkEventKey* event,
- FindBarGtk* find_bar);
-
- // Callback for previous, next, and close button.
- static void OnClicked(GtkWidget* button, FindBarGtk* find_bar);
-
- // Handles shapping and drawing the find bar background.
- static gboolean OnExpose(GtkWidget* widget, GdkEventExpose* event,
- FindBarGtk* bar);
-
- // Expose that draws the text entry background in GTK mode.
- static gboolean OnContentEventBoxExpose(GtkWidget* widget,
- GdkEventExpose* event,
- FindBarGtk* bar);
-
- // These are both used for focus management.
- static gboolean OnFocus(GtkWidget* text_entry, GtkDirectionType focus,
- FindBarGtk* find_bar);
- static gboolean OnButtonPress(GtkWidget* text_entry, GdkEventButton* e,
- FindBarGtk* find_bar);
-
- // Forwards ctrl-Home/End key bindings to the renderer.
- static void OnMoveCursor(GtkEntry* entry, GtkMovementStep step, gint count,
- gboolean selection, FindBarGtk* bar);
-
- // Handles Enter key.
- static void OnActivate(GtkEntry* entry, FindBarGtk* bar);
-
- static void OnWidgetDirectionChanged(GtkWidget* widget,
- GtkTextDirection previous_direction,
- FindBarGtk* find_bar) {
- find_bar->AdjustTextAlignment();
- }
-
- static void OnKeymapDirectionChanged(GdkKeymap* keymap,
- FindBarGtk* find_bar) {
- find_bar->AdjustTextAlignment();
- }
-
- static gboolean OnFocusIn(GtkWidget* entry, GdkEventFocus* event,
- FindBarGtk* find_bar);
-
- static gboolean OnFocusOut(GtkWidget* entry, GdkEventFocus* event,
- FindBarGtk* find_bar);
-
- Browser* browser_;
- BrowserWindowGtk* window_;
-
- // Provides colors and information about GTK.
- GtkThemeProvider* theme_provider_;
-
- // The widget that animates the slide-in and -out of the findbar.
- scoped_ptr<SlideAnimatorGtk> slide_widget_;
-
- // A GtkAlignment that is the child of |slide_widget_|.
- GtkWidget* container_;
-
- // Cached allocation of |container_|. We keep this on hand so that we can
- // reset the widget's shape when the width/height change.
- int container_width_;
- int container_height_;
-
- // The widget where text is entered.
- GtkWidget* text_entry_;
-
- // An event box and alignment that wrap the entry area and the count label.
- GtkWidget* content_event_box_;
- GtkWidget* content_alignment_;
-
- // The border around the text entry area.
- GtkWidget* border_bin_;
- GtkWidget* border_bin_alignment_;
-
- // The next and previous match buttons.
- scoped_ptr<CustomDrawButton> find_previous_button_;
- scoped_ptr<CustomDrawButton> find_next_button_;
-
- // The GtkLabel listing how many results were found.
- GtkWidget* match_count_label_;
- GtkWidget* match_count_event_box_;
- // Cache whether the match count label is showing failure or not so that
- // we can update its appearance without changing its semantics.
- bool match_label_failure_;
-
- // The X to close the find bar.
- scoped_ptr<CustomDrawButton> close_button_;
-
- // The last matchcount number we reported to the user.
- int last_reported_matchcount_;
-
- // Pointer back to the owning controller.
- FindBarController* find_bar_controller_;
-
- // Saves where the focus used to be whenever we get it.
- FocusStoreGtk focus_store_;
-
- // If true, the change signal for the text entry is ignored.
- bool ignore_changed_signal_;
-
- // This is the width of widget(). We cache it so we can recognize whether
- // allocate signals have changed it, and if so take appropriate actions.
- int current_fixed_width_;
-
- scoped_ptr<NineBox> dialog_background_;
-
- // The selection rect we are currently showing. We cache it to avoid covering
- // it up.
- gfx::Rect selection_rect_;
-
- NotificationRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(FindBarGtk);
-};
+#include "chrome/browser/ui/gtk/find_bar_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_FIND_BAR_GTK_H_
diff --git a/chrome/browser/gtk/first_run_bubble.h b/chrome/browser/gtk/first_run_bubble.h
index 220c4f6..3bf2b0a 100644
--- a/chrome/browser/gtk/first_run_bubble.h
+++ b/chrome/browser/gtk/first_run_bubble.h
@@ -1,90 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// This is the GTK implementation of the First Run bubble, the dialog box
-// presented on first run of Chromium. There can only ever be a single
-// bubble open, so the class presents only static methods.
-
#ifndef CHROME_BROWSER_GTK_FIRST_RUN_BUBBLE_H_
#define CHROME_BROWSER_GTK_FIRST_RUN_BUBBLE_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <vector>
-
-#include "base/basictypes.h"
-#include "chrome/browser/first_run/first_run.h"
-#include "chrome/browser/gtk/info_bubble_gtk.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-
-class Profile;
-
-class FirstRunBubble : public InfoBubbleGtkDelegate,
- public NotificationObserver {
- public:
- // Shows the first run bubble, pointing at |rect|.
- static void Show(Profile* profile,
- GtkWidget* anchor,
- const gfx::Rect& rect,
- FirstRun::BubbleType bubble_type);
-
- // Implements the InfoBubbleGtkDelegate. We are notified when the bubble
- // is about to be closed.
- virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble,
- bool closed_by_escape);
- virtual bool CloseOnEscape();
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- private:
- FirstRunBubble(Profile* profile,
- GtkWidget* anchor,
- const gfx::Rect& rect,
- FirstRun::BubbleType bubble_type);
- virtual ~FirstRunBubble();
-
- // Create and pack widgets for different bubble types.
- void InitializeContentForLarge();
- void InitializeContentForOEM();
- void InitializeContentForMinimal();
-
- // Contains some common set up for the labels in the bubble. |width| is a
- // resource that holds the desired width for the labels.
- void InitializeLabels(int width_resource);
-
- CHROMEGTK_CALLBACK_0(FirstRunBubble, void, HandleDestroy);
- CHROMEGTK_CALLBACK_0(FirstRunBubble, void, HandleKeepButton);
- CHROMEGTK_CALLBACK_0(FirstRunBubble, void, HandleChangeButton);
-
- // Our current profile.
- Profile* profile_;
-
- // Provides colors and stuff.
- GtkThemeProvider* theme_provider_;
-
- // The widget we anchor to, and a descendant of the toplevel window we
- // are transient for.
- GtkWidget* anchor_;
-
- // We let the InfoBubble own our content, and then we delete ourself
- // when the widget is destroyed (when the InfoBubble is destroyed).
- GtkWidget* content_;
-
- // The various labels in the interface. We keep track of them for theme
- // changes.
- std::vector<GtkWidget*> labels_;
-
- InfoBubbleGtk* bubble_;
-
- NotificationRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(FirstRunBubble);
-};
+#include "chrome/browser/ui/gtk/first_run_bubble.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_FIRST_RUN_BUBBLE_H_
diff --git a/chrome/browser/gtk/first_run_dialog.h b/chrome/browser/gtk/first_run_dialog.h
index 234a64b..ae19ba13 100644
--- a/chrome/browser/gtk/first_run_dialog.h
+++ b/chrome/browser/gtk/first_run_dialog.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,77 +6,7 @@
#define CHROME_BROWSER_GTK_FIRST_RUN_DIALOG_H_
#pragma once
-typedef struct _GtkButton GtkButton;
-typedef struct _GtkWidget GtkWidget;
-
-#include "app/gtk_signal.h"
-#include "chrome/browser/first_run/first_run.h"
-#include "chrome/browser/search_engines/template_url_model_observer.h"
-
-class TemplateURL;
-class TemplateURLModel;
-
-class FirstRunDialog : public TemplateURLModelObserver {
- public:
- // Displays the first run UI for reporting opt-in, import data etc.
- static bool Show(Profile* profile, bool randomize_search_engine_order);
-
- virtual void OnTemplateURLModelChanged();
-
- private:
- FirstRunDialog(Profile* profile,
- bool show_reporting_dialog,
- bool show_search_engines_dialog,
- int* response);
- virtual ~FirstRunDialog();
-
- CHROMEGTK_CALLBACK_1(FirstRunDialog, void, OnResponseDialog, int);
- CHROMEGTK_CALLBACK_0(FirstRunDialog, void, OnSearchEngineButtonClicked);
- CHROMEGTK_CALLBACK_0(FirstRunDialog, void, OnSearchEngineWindowDestroy);
- CHROMEG_CALLBACK_0(FirstRunDialog, void, OnLearnMoreLinkClicked, GtkButton*);
-
- void ShowSearchEngineWindow();
- void ShowReportingDialog();
-
- // This method closes the first run window and quits the message loop so that
- // the Chrome startup can continue. This should be called when all the
- // first run tasks are done.
- void FirstRunDone();
-
- // The search engine choice window. This is created and shown before
- // |dialog_|.
- GtkWidget* search_engine_window_;
-
- // Dialog that holds the bug reporting and default browser checkboxes.
- GtkWidget* dialog_;
-
- // Container for the search engine choices.
- GtkWidget* search_engine_hbox_;
-
- // Crash reporting checkbox
- GtkWidget* report_crashes_;
-
- // Make browser default checkbox
- GtkWidget* make_default_;
-
- // Our current profile
- Profile* profile_;
-
- // Owned by the profile_.
- TemplateURLModel* search_engines_model_;
-
- // The search engine the user chose, or NULL if the user has not chosen a
- // search engine.
- TemplateURL* chosen_search_engine_;
-
- // Whether we should show the dialog asking the user whether to report
- // crashes and usage stats.
- bool show_reporting_dialog_;
-
- // User response (accept or cancel) is returned through this.
- int* response_;
-
- DISALLOW_COPY_AND_ASSIGN(FirstRunDialog);
-};
+#include "chrome/browser/ui/gtk/first_run_dialog.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_FIRST_RUN_DIALOG_H_
diff --git a/chrome/browser/gtk/focus_store_gtk.h b/chrome/browser/gtk/focus_store_gtk.h
index 2159f1e..b6120bc 100644
--- a/chrome/browser/gtk/focus_store_gtk.h
+++ b/chrome/browser/gtk/focus_store_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,38 +6,7 @@
#define CHROME_BROWSER_GTK_FOCUS_STORE_GTK_H_
#pragma once
-#include "base/basictypes.h"
-
-typedef struct _GtkWidget GtkWidget;
-
-class FocusStoreGtk {
- public:
- FocusStoreGtk();
-
- virtual ~FocusStoreGtk();
-
- GtkWidget* widget() const { return widget_; }
-
- // Save the widget that is currently focused for |widget|'s toplevel (NOT
- // |widget|).
- void Store(GtkWidget* widget);
-
- // Save |widget| as the focus widget. Call with NULL to clear |widget_|.
- void SetWidget(GtkWidget* widget);
-
- private:
- // Disconnect the previous destroy handler (if any).
- void DisconnectDestroyHandler();
-
- // The widget which last had focus.
- GtkWidget* widget_;
-
- // The widget for which we've stored focus might be destroyed by the time we
- // want to restore focus. Thus we connect to the "destroy" signal on that
- // widget. This is the ID for the destroy handler.
- unsigned int destroy_handler_id_;
-
- DISALLOW_COPY_AND_ASSIGN(FocusStoreGtk);
-};
+#include "chrome/browser/ui/gtk/focus_store_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_FOCUS_STORE_GTK_H_
diff --git a/chrome/browser/gtk/fullscreen_exit_bubble_gtk.h b/chrome/browser/gtk/fullscreen_exit_bubble_gtk.h
index 91be3ef..4c0cf60 100644
--- a/chrome/browser/gtk/fullscreen_exit_bubble_gtk.h
+++ b/chrome/browser/gtk/fullscreen_exit_bubble_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,46 +6,7 @@
#define CHROME_BROWSER_GTK_FULLSCREEN_EXIT_BUBBLE_GTK_H_
#pragma once
-#include "app/gtk_signal.h"
-#include "app/gtk_signal_registrar.h"
-#include "base/timer.h"
-#include "chrome/browser/gtk/slide_animator_gtk.h"
-
-typedef struct _GtkFloatingContainer GtkFloatingContainer;
-typedef struct _GtkWidget GtkWidget;
-
-// FullscreenExitBubbleGTK is responsible for showing a bubble atop the screen
-// in fullscreen mode, telling users how to exit and providing a click target.
-class FullscreenExitBubbleGtk {
- public:
- // We place the bubble in |container|.
- explicit FullscreenExitBubbleGtk(GtkFloatingContainer* container);
- virtual ~FullscreenExitBubbleGtk();
-
- void InitWidgets();
-
- private:
- GtkWidget* widget() const {
- return slide_widget_->widget();
- }
-
- // Hide the exit bubble.
- void Hide();
-
- CHROMEGTK_CALLBACK_1(FullscreenExitBubbleGtk, void, OnSetFloatingPosition,
- GtkAllocation*);
- CHROMEGTK_CALLBACK_0(FullscreenExitBubbleGtk, void, OnLinkClicked);
-
- // A pointer to the floating container that is our parent.
- GtkFloatingContainer* container_;
-
- // The widget that animates the slide-out of fullscreen exit bubble.
- scoped_ptr<SlideAnimatorGtk> slide_widget_;
-
- // The timer that does the initial hiding of the exit bubble.
- base::OneShotTimer<FullscreenExitBubbleGtk> initial_delay_;
-
- GtkSignalRegistrar signals_;
-};
+#include "chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_FULLSCREEN_EXIT_BUBBLE_GTK_H_
diff --git a/chrome/browser/gtk/gconf_titlebar_listener.h b/chrome/browser/gtk/gconf_titlebar_listener.h
index b96b759..87a2e3f 100644
--- a/chrome/browser/gtk/gconf_titlebar_listener.h
+++ b/chrome/browser/gtk/gconf_titlebar_listener.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,67 +6,7 @@
#define CHROME_BROWSER_GTK_GCONF_TITLEBAR_LISTENER_H_
#pragma once
-#include <gconf/gconf-client.h>
-#include <gtk/gtk.h>
-
-#include <set>
-#include <string>
-
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-
-class BrowserTitlebar;
-template <typename T> struct DefaultSingletonTraits;
-
-// On GNOME desktops, subscribes to the gconf key which controlls button order.
-// Everywhere else, SetTiltebarButtons() just calls back into BrowserTitlebar
-// with the default ordering.
-//
-// Meant to be used as a Singleton through base/singleton.h's interface.
-class GConfTitlebarListener {
- public:
- // Returns the singleton instance.
- static GConfTitlebarListener* GetInstance();
-
- // Sets the current titlebar button order. On GNOME desktops, also subscribes
- // to further notifications when this changes.
- void SetTitlebarButtons(BrowserTitlebar* titlebar);
-
- // Removes |titlebar| from the list of objects observing button order change
- // notifications.
- void RemoveObserver(BrowserTitlebar* titlebar);
-
- protected:
- virtual ~GConfTitlebarListener();
-
- private:
- // Private constructor to enforce singleton access.
- GConfTitlebarListener();
-
- // Called whenever the metacity key changes.
- CHROMEG_CALLBACK_2(GConfTitlebarListener, void, OnChangeNotification,
- GConfClient*, guint, GConfEntry*);
-
- // Checks |error|. On error, prints out a message and closes the connection
- // to GConf and reverts to default mode.
- bool HandleGError(GError* error, const char* key);
-
- // Parses the return data structure from GConf, falling back to the default
- // value on any error.
- void ParseAndStoreValue(GConfValue* gconf_value);
-
- // Pointer to our gconf context. NULL if we aren't on a desktop that uses
- // gconf.
- GConfClient* client_;
-
- // The current button ordering as heard from gconf.
- std::string current_value_;
-
- // BrowserTitlebar objects which have subscribed to updates.
- std::set<BrowserTitlebar*> titlebars_;
-
- friend struct DefaultSingletonTraits<GConfTitlebarListener>;
- DISALLOW_COPY_AND_ASSIGN(GConfTitlebarListener);
-};
+#include "chrome/browser/ui/gtk/gconf_titlebar_listener.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_GCONF_TITLEBAR_LISTENER_H_
diff --git a/chrome/browser/gtk/gtk_chrome_button.h b/chrome/browser/gtk/gtk_chrome_button.h
index e64c00b..5db741e 100644
--- a/chrome/browser/gtk/gtk_chrome_button.h
+++ b/chrome/browser/gtk/gtk_chrome_button.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,56 +6,7 @@
#define CHROME_BROWSER_GTK_GTK_CHROME_BUTTON_H_
#pragma once
-#include <gdk/gdk.h>
-#include <gtk/gtkbutton.h>
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_CHROME_BUTTON (gtk_chrome_button_get_type ())
-#define GTK_CHROME_BUTTON(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_CHROME_BUTTON, GtkChromeButton))
-#define GTK_CHROME_BUTTON_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_CHROME_BUTTON, \
- GtkChromeButtonClass))
-#define GTK_IS_CHROME_BUTTON(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_CHROME_BUTTON))
-#define GTK_IS_CHROME_BUTTON_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_CHROME_BUTTON))
-#define GTK_CHROME_BUTTON_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_CHROME_BUTTON, GtkChromeButton))
-
-typedef struct _GtkChromeButton GtkChromeButton;
-typedef struct _GtkChromeButtonClass GtkChromeButtonClass;
-
-struct _GtkChromeButton {
- GtkButton button;
-};
-
-struct _GtkChromeButtonClass {
- GtkButtonClass parent_class;
-};
-
-GtkWidget* gtk_chrome_button_new();
-
-GType gtk_chrome_button_get_type();
-
-// Set the paint state to |state|. This overrides the widget's current state.
-void gtk_chrome_button_set_paint_state(GtkChromeButton* button,
- GtkStateType state);
-
-// Revert to using the widget's current state for painting.
-void gtk_chrome_button_unset_paint_state(GtkChromeButton* button);
-
-// Whether we should use custom theme images or let GTK take care of it.
-void gtk_chrome_button_set_use_gtk_rendering(GtkChromeButton* button,
- gboolean value);
-
-// Sets the partial hover state of the button. The acceptable range is 0.0 to
-// 1.0. If |state| is outside of that range, then revert the button to normal
-// hovering. This can be overridden by gtk_chrome_button_set_paint_state.
-void gtk_chrome_button_set_hover_state(GtkChromeButton* button,
- gdouble state);
-
-G_END_DECLS
+#include "chrome/browser/ui/gtk/gtk_chrome_button.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_GTK_CHROME_BUTTON_H_
diff --git a/chrome/browser/gtk/gtk_chrome_cookie_view.h b/chrome/browser/gtk/gtk_chrome_cookie_view.h
index 93bc96c..859bf35 100644
--- a/chrome/browser/gtk/gtk_chrome_cookie_view.h
+++ b/chrome/browser/gtk/gtk_chrome_cookie_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,189 +6,7 @@
#define CHROME_BROWSER_GTK_GTK_CHROME_COOKIE_VIEW_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <string>
-
-#include "chrome/browser/browsing_data_appcache_helper.h"
-#include "chrome/browser/browsing_data_database_helper.h"
-#include "chrome/browser/browsing_data_indexed_db_helper.h"
-#include "chrome/browser/browsing_data_local_storage_helper.h"
-#include "net/base/cookie_monster.h"
-
-class GURL;
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_CHROME_COOKIE_VIEW gtk_chrome_cookie_view_get_type()
-
-#define GTK_CHROME_COOKIE_VIEW(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), \
- GTK_TYPE_CHROME_COOKIE_VIEW, GtkChromeCookieView))
-
-#define GTK_CHROME_COOKIE_VIEW_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), \
- GTK_TYPE_CHROME_COOKIE_VIEW, GtkChromeCookieViewClass))
-
-#define GTK_IS_CHROME_COOKIE_VIEW(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
- GTK_TYPE_CHROME_COOKIE_VIEW))
-
-#define GTK_IS_CHROME_COOKIE_VIEW_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), \
- GTK_TYPE_CHROME_COOKIE_VIEW))
-
-#define GTK_CHROME_COOKIE_VIEW_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), \
- GTK_TYPE_CHROME_COOKIE_VIEW, GtkChromeCookieViewClass))
-
-// TODO(erg): Refactor the following class. It's continuously grown as more
-// things have been added to it and should probably become a general key/value
-// table. The problem is that any implementation for that would be much more
-// complicated and would require changing a whole lot of code.
-typedef struct {
- GtkFrame parent;
-
- // All public for testing since I don't think there's a "friend" mechanism in
- // gobject.
-
- GtkWidget* table_box_;
-
- // A label we keep around so we can access its GtkStyle* once it is realized.
- GtkWidget* first_label_;
-
- // The cookie details widgets.
- GtkWidget* cookie_details_table_;
- GtkWidget* cookie_name_entry_;
- GtkWidget* cookie_content_entry_;
- GtkWidget* cookie_domain_entry_;
- GtkWidget* cookie_path_entry_;
- GtkWidget* cookie_send_for_entry_;
- GtkWidget* cookie_created_entry_;
-
- // Note: These two widgets are mutually exclusive based on what
- // |editable_expiration| was when the cookie view was created. One of these
- // variables will be NULL.
- GtkWidget* cookie_expires_entry_;
- GtkWidget* cookie_expires_combobox_;
-
- GtkListStore* cookie_expires_combobox_store_;
-
- // The database details widgets.
- GtkWidget* database_details_table_;
- GtkWidget* database_name_entry_;
- GtkWidget* database_description_entry_;
- GtkWidget* database_size_entry_;
- GtkWidget* database_last_modified_entry_;
-
- // The local storage details widgets.
- GtkWidget* local_storage_details_table_;
- GtkWidget* local_storage_origin_entry_;
- GtkWidget* local_storage_size_entry_;
- GtkWidget* local_storage_last_modified_entry_;
-
- // The appcache details widgets.
- GtkWidget* appcache_details_table_;
- GtkWidget* appcache_manifest_entry_;
- GtkWidget* appcache_size_entry_;
- GtkWidget* appcache_created_entry_;
- GtkWidget* appcache_last_accessed_entry_;
-
- // The IndexedDB details widgets.
- GtkWidget* indexed_db_details_table_;
- GtkWidget* indexed_db_origin_entry_;
- GtkWidget* indexed_db_size_entry_;
- GtkWidget* indexed_db_last_modified_entry_;
-
- // The local storage item widgets.
- GtkWidget* local_storage_item_table_;
- GtkWidget* local_storage_item_origin_entry_;
- GtkWidget* local_storage_item_key_entry_;
- GtkWidget* local_storage_item_value_entry_;
-
- // The database accessed widgets.
- GtkWidget* database_accessed_table_;
- GtkWidget* database_accessed_origin_entry_;
- GtkWidget* database_accessed_name_entry_;
- GtkWidget* database_accessed_description_entry_;
- GtkWidget* database_accessed_size_entry_;
-
- // The appcache created widgets.
- GtkWidget* appcache_created_table_;
- GtkWidget* appcache_created_manifest_entry_;
-} GtkChromeCookieView;
-
-typedef struct {
- GtkFrameClass parent_class;
-} GtkChromeCookieViewClass;
-
-GType gtk_chrome_cookie_view_get_type();
-
-// Builds a new cookie view.
-GtkWidget* gtk_chrome_cookie_view_new(gboolean editable_expiration);
-
-// Clears the cookie view.
-void gtk_chrome_cookie_view_clear(GtkChromeCookieView* widget);
-
-// NOTE: The G_END_DECLS ends here instead of at the end of the document
-// because we want to define some methods on GtkChromeCookieView that take C++
-// objects.
-G_END_DECLS
-// NOTE: ^^^^^^^^^^^^^^^^^^^^^^^
-
-// Switches the display to showing the passed in cookie.
-void gtk_chrome_cookie_view_display_cookie(
- GtkChromeCookieView* widget,
- const std::string& domain,
- const net::CookieMonster::CanonicalCookie& cookie);
-
-// Looks up the cookie_line in CookieMonster and displays that.
-void gtk_chrome_cookie_view_display_cookie_string(
- GtkChromeCookieView* widget,
- const GURL& url,
- const std::string& cookie_line);
-
-// Switches the display to showing the passed in database.
-void gtk_chrome_cookie_view_display_database(
- GtkChromeCookieView* widget,
- const BrowsingDataDatabaseHelper::DatabaseInfo& database_info);
-
-// Switches the display to showing the passed in local storage data.
-void gtk_chrome_cookie_view_display_local_storage(
- GtkChromeCookieView* widget,
- const BrowsingDataLocalStorageHelper::LocalStorageInfo&
- local_storage_info);
-
-// Switches the display to showing the passed in app cache.
-void gtk_chrome_cookie_view_display_app_cache(
- GtkChromeCookieView* widget,
- const appcache::AppCacheInfo& info);
-
-// Switches the display to showing the passed in IndexedDB data.
-void gtk_chrome_cookie_view_display_indexed_db(
- GtkChromeCookieView* widget,
- const BrowsingDataIndexedDBHelper::IndexedDBInfo& info);
-
-// Switches the display to an individual storage item.
-void gtk_chrome_cookie_view_display_local_storage_item(
- GtkChromeCookieView* widget,
- const std::string& host,
- const string16& key,
- const string16& value);
-
-void gtk_chrome_cookie_view_display_database_accessed(
- GtkChromeCookieView* self,
- const std::string& host,
- const string16& database_name,
- const string16& display_name,
- unsigned long estimated_size);
-
-void gtk_chrome_cookie_view_display_appcache_created(
- GtkChromeCookieView* self,
- const GURL& manifest_url);
-
-// If |editable_expiration| was true at construction time, returns the value of
-// the combo box. Otherwise, returns false.
-bool gtk_chrome_cookie_view_session_expires(GtkChromeCookieView* self);
+#include "chrome/browser/ui/gtk/gtk_chrome_cookie_view.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_GTK_CHROME_COOKIE_VIEW_H_
diff --git a/chrome/browser/gtk/gtk_chrome_link_button.h b/chrome/browser/gtk/gtk_chrome_link_button.h
index 4cde366..e54f8a1 100644
--- a/chrome/browser/gtk/gtk_chrome_link_button.h
+++ b/chrome/browser/gtk/gtk_chrome_link_button.h
@@ -1,79 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Creates a link button that shows |text| in blue and underlined. The cursor
-// changes to a hand when over the link. This is like the GTK LinkButton, but
-// it doesn't call the global URI link handler, etc. It is a button subclass,
-// so you can just handle the clicked signal.
-
#ifndef CHROME_BROWSER_GTK_GTK_CHROME_LINK_BUTTON_H_
#define CHROME_BROWSER_GTK_GTK_CHROME_LINK_BUTTON_H_
#pragma once
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_CHROME_LINK_BUTTON (gtk_chrome_link_button_get_type ())
-#define GTK_CHROME_LINK_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
- GTK_TYPE_CHROME_LINK_BUTTON, \
- GtkChromeLinkButton))
-#define GTK_CHROME_LINK_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
- GTK_TYPE_CHROME_LINK_BUTTON, \
- GtkChromeLinkButtonClass))
-#define GTK_IS_CHROME_LINK_BUTTON(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_CHROME_LINK_BUTTON))
-#define GTK_IS_CHROME_LINK_BUTTON_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_CHROME_LINK_BUTTON))
-#define GTK_CHROME_LINK_BUTTON_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_CHROME_LINK_BUTTON, \
- GtkChromeLinkButton))
-
-typedef struct _GtkChromeLinkButton GtkChromeLinkButton;
-typedef struct _GtkChromeLinkButtonClass GtkChromeLinkButtonClass;
-
-struct _GtkChromeLinkButton {
- GtkButton button;
- GtkWidget* label;
- gchar* normal_markup;
- gchar* pressed_markup;
- gboolean is_normal;
- gchar normal_color[9];
- gchar* native_markup;
- gboolean using_native_theme;
- GdkCursor* hand_cursor;
- gchar* text;
- gboolean uses_markup;
-};
-
-struct _GtkChromeLinkButtonClass {
- GtkButtonClass parent_class;
-};
-
-// Make a link button with display text |text|.
-GtkWidget* gtk_chrome_link_button_new(const char* text);
-
-// As above, but don't escape markup in the text.
-GtkWidget* gtk_chrome_link_button_new_with_markup(const char* markup);
-
-// Set whether the link button draws natively (using "link-color"). The default
-// is TRUE.
-void gtk_chrome_link_button_set_use_gtk_theme(GtkChromeLinkButton* button,
- gboolean use_gtk);
-
-// Set the label text of the link.
-void gtk_chrome_link_button_set_label(GtkChromeLinkButton* button,
- const char* text);
-
-// Set the color when the link is in a normal state (i.e. not pressed).
-// If not set, or called NULL |color|, the color will be blue.
-void gtk_chrome_link_button_set_normal_color(GtkChromeLinkButton* button,
- const GdkColor* color);
-
-GType gtk_chrome_link_button_get_type();
-
-G_END_DECLS
+#include "chrome/browser/ui/gtk/gtk_chrome_link_button.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_GTK_CHROME_LINK_BUTTON_H_
diff --git a/chrome/browser/gtk/gtk_chrome_shrinkable_hbox.h b/chrome/browser/gtk/gtk_chrome_shrinkable_hbox.h
index 9793548..29f6b4c 100644
--- a/chrome/browser/gtk/gtk_chrome_shrinkable_hbox.h
+++ b/chrome/browser/gtk/gtk_chrome_shrinkable_hbox.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,82 +6,7 @@
#define CHROME_BROWSER_GTK_GTK_CHROME_SHRINKABLE_HBOX_H_
#pragma once
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
-
-// A specialized container derived from GtkHBox, which can shrink or hide its
-// children one by one to fit into its width.
-//
-// Limitations of this container:
-// - All children should have the same pack type, otherwise they may be
-// overlapped with each other.
-// - All children must be packed with expand == false and fill == false,
-// otherwise they may be overlapped with each other.
-// - The visibility of a child is adjusted automatically according to the
-// container's width. The child may not show or hide itself.
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_CHROME_SHRINKABLE_HBOX \
- (gtk_chrome_shrinkable_hbox_get_type())
-#define GTK_CHROME_SHRINKABLE_HBOX(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_CHROME_SHRINKABLE_HBOX, \
- GtkChromeShrinkableHBox))
-#define GTK_CHROME_SHRINKABLE_HBOX_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_CHROME_SHRINKABLE_HBOX, \
- GtkChromeShrinkableHBoxClass))
-#define GTK_IS_CHROME_SHRINKABLE_HBOX(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_CHROME_SHRINKABLE_HBOX))
-#define GTK_IS_CHROME_SHRINKABLE_HBOX_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_CHROME_SHRINKABLE_HBOX))
-#define GTK_CHROME_SHRINKABLE_HBOX_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_CHROME_SHRINKABLE_HBOX, \
- GtkChromeShrinkableHBoxClass))
-
-typedef struct _GtkChromeShrinkableHBox GtkChromeShrinkableHBox;
-typedef struct _GtkChromeShrinkableHBoxClass GtkChromeShrinkableHBoxClass;
-
-struct _GtkChromeShrinkableHBox {
- // Parent class.
- GtkHBox hbox;
-
- gboolean hide_child_directly;
-
- // Private
- int children_width_requisition;
-};
-
-struct _GtkChromeShrinkableHBoxClass {
- GtkHBoxClass parent_class;
-};
-
-GType gtk_chrome_shrinkable_hbox_get_type() G_GNUC_CONST;
-
-// Creates a new shrinkable hbox.
-// If |hide_child_directly| is true then its child widgets will be hid directly
-// if they are too wide to be fit into the hbox's width. Otherwise they will be
-// shrunk first before being hid completely.
-GtkWidget* gtk_chrome_shrinkable_hbox_new(gboolean hide_child_directly,
- gboolean homogeneous,
- gint spacing);
-
-void gtk_chrome_shrinkable_hbox_set_hide_child_directly(
- GtkChromeShrinkableHBox* box, gboolean hide_child_directly);
-
-gboolean gtk_chrome_shrinkable_hbox_get_hide_child_directly(
- GtkChromeShrinkableHBox* box);
-
-void gtk_chrome_shrinkable_hbox_pack_start(GtkChromeShrinkableHBox* box,
- GtkWidget* child,
- guint padding);
-
-void gtk_chrome_shrinkable_hbox_pack_end(GtkChromeShrinkableHBox* box,
- GtkWidget* child,
- guint padding);
-
-gint gtk_chrome_shrinkable_hbox_get_visible_child_count(
- GtkChromeShrinkableHBox* box);
-
-G_END_DECLS
+#include "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_GTK_CHROME_SHRINKABLE_HBOX_H_
diff --git a/chrome/browser/gtk/gtk_custom_menu.h b/chrome/browser/gtk/gtk_custom_menu.h
index 1faa730..bd708c3 100644
--- a/chrome/browser/gtk/gtk_custom_menu.h
+++ b/chrome/browser/gtk/gtk_custom_menu.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,49 +6,7 @@
#define CHROME_BROWSER_GTK_GTK_CUSTOM_MENU_H_
#pragma once
-// GtkCustomMenu is a GtkMenu subclass that can contain, and collaborates with,
-// GtkCustomMenuItem instances. GtkCustomMenuItem is a GtkMenuItem that can
-// have buttons and other normal widgets embeded in it. GtkCustomMenu exists
-// only to override most of the button/motion/move callback functions so
-// that the normal GtkMenu implementation doesn't handle events related to
-// GtkCustomMenuItem items.
-//
-// For a more through overview of this system, see the comments in
-// gtk_custom_menu_item.h.
-
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
-#include <gtk/gtkmenuitem.h>
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_CUSTOM_MENU \
- (gtk_custom_menu_get_type())
-#define GTK_CUSTOM_MENU(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_CUSTOM_MENU, GtkCustomMenu))
-#define GTK_CUSTOM_MENU_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_CUSTOM_MENU, GtkCustomMenuClass))
-#define GTK_IS_CUSTOM_MENU(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_CUSTOM_MENU))
-#define GTK_IS_CUSTOM_MENU_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_CUSTOM_MENU))
-#define GTK_CUSTOM_MENU_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_CUSTOM_MENU, GtkCustomMenuClass))
-
-typedef struct _GtkCustomMenu GtkCustomMenu;
-typedef struct _GtkCustomMenuClass GtkCustomMenuClass;
-
-struct _GtkCustomMenu {
- GtkMenu menu;
-};
-
-struct _GtkCustomMenuClass {
- GtkMenuClass parent_class;
-};
-
-GType gtk_custom_menu_get_type(void) G_GNUC_CONST;
-GtkWidget* gtk_custom_menu_new();
-
-G_END_DECLS
+#include "chrome/browser/ui/gtk/gtk_custom_menu.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_GTK_CUSTOM_MENU_H_
diff --git a/chrome/browser/gtk/gtk_custom_menu_item.h b/chrome/browser/gtk/gtk_custom_menu_item.h
index 76e8c9a..4d9683c 100644
--- a/chrome/browser/gtk/gtk_custom_menu_item.h
+++ b/chrome/browser/gtk/gtk_custom_menu_item.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,136 +6,7 @@
#define CHROME_BROWSER_GTK_GTK_CUSTOM_MENU_ITEM_H_
#pragma once
-// GtkCustomMenuItem is a GtkMenuItem subclass that has buttons in it and acts
-// to support this. GtkCustomMenuItems only render properly when put in a
-// GtkCustomMenu; there's a lot of collaboration between these two classes
-// necessary to work around how gtk normally does menus.
-//
-// We can't rely on the normal event infrastructure. While a menu is up, the
-// GtkMenu has a grab on all events. Instead of trying to pump events through
-// the normal channels, we have the GtkCustomMenu selectively forward mouse
-// motion through a back channel. The GtkCustomMenu only listens for button
-// press information so it can block the effects of the click if the cursor
-// isn't in a button in the menu item.
-//
-// A GtkCustomMenuItem doesn't try to take these signals and forward them to
-// the buttons it owns. The GtkCustomMenu class keeps track of which button is
-// selected (due to key events and mouse movement) and otherwise acts like a
-// normal GtkItem. The buttons are only for sizing and rendering; they don't
-// respond to events. Instead, when the GtkCustomMenuItem is activated by the
-// GtkMenu, it uses which button was selected as a signal of what to do.
-//
-// Users should connect to the "button-pushed" signal to be notified when a
-// button was pushed. We don't go through the normal "activate" signal because
-// we need to communicate additional information, namely which button was
-// activated.
-
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_CUSTOM_MENU_ITEM \
- (gtk_custom_menu_item_get_type())
-#define GTK_CUSTOM_MENU_ITEM(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_CUSTOM_MENU_ITEM, \
- GtkCustomMenuItem))
-#define GTK_CUSTOM_MENU_ITEM_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_CUSTOM_MENU_ITEM, \
- GtkCustomMenuItemClass))
-#define GTK_IS_CUSTOM_MENU_ITEM(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_CUSTOM_MENU_ITEM))
-#define GTK_IS_CUSTOM_MENU_ITEM_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_CUSTOM_MENU_ITEM))
-#define GTK_CUSTOM_MENU_ITEM_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_CUSTOM_MENU_ITEM, \
- GtkCustomMenuItemClass))
-
-typedef struct _GtkCustomMenuItem GtkCustomMenuItem;
-typedef struct _GtkCustomMenuItemClass GtkCustomMenuItemClass;
-
-struct _GtkCustomMenuItem {
- GtkMenuItem menu_item;
-
- // Container for button widgets.
- GtkWidget* hbox;
-
- // Label on left side of menu item.
- GtkWidget* label;
-
- // List of all widgets we added. Used to find the leftmost and rightmost
- // continuous buttons.
- GList* all_widgets;
-
- // Possible button widgets. Used for keyboard navigation.
- GList* button_widgets;
-
- // The widget that currently has highlight.
- GtkWidget* currently_selected_button;
-
- // The widget that was selected *before* |currently_selected_button|. Why do
- // we hang on to this? Because the menu system sends us a deselect signal
- // right before activating us. We need to listen to deselect since that's
- // what we receive when the mouse cursor leaves us entirely.
- GtkWidget* previously_selected_button;
-};
-
-struct _GtkCustomMenuItemClass {
- GtkMenuItemClass parent_class;
-};
-
-GType gtk_custom_menu_item_get_type(void) G_GNUC_CONST;
-GtkWidget* gtk_custom_menu_item_new(const char* title);
-
-// Adds a button to our list of items in the |hbox|.
-GtkWidget* gtk_custom_menu_item_add_button(GtkCustomMenuItem* menu_item,
- int command_id);
-
-// Adds a button to our list of items in the |hbox|, but that isn't part of
-// |button_widgets| to prevent it from being activatable.
-GtkWidget* gtk_custom_menu_item_add_button_label(GtkCustomMenuItem* menu_item,
- int command_id);
-
-// Adds a vertical space in the |hbox|.
-void gtk_custom_menu_item_add_space(GtkCustomMenuItem* menu_item);
-
-// Receives a motion event from the GtkCustomMenu that contains us. We can't
-// just subscribe to motion-event or the individual widget enter/leave events
-// because the top level GtkMenu has an event grab.
-void gtk_custom_menu_item_receive_motion_event(GtkCustomMenuItem* menu_item,
- gdouble x, gdouble y);
-
-// Notification that the menu got a cursor key event. Used to move up/down
-// within the menu buttons. Returns TRUE to stop the default signal handler
-// from running.
-gboolean gtk_custom_menu_item_handle_move(GtkCustomMenuItem* menu_item,
- GtkMenuDirectionType direction);
-
-// Because we only get a generic "selected" signal when we've changed, we need
-// to have a way for the GtkCustomMenu to tell us that we were just
-// selected.
-void gtk_custom_menu_item_select_item_by_direction(
- GtkCustomMenuItem* menu_item, GtkMenuDirectionType direction);
-
-// Whether we are currently hovering over a clickable region on the menu
-// item. Used by GtkCustomMenu to determine whether it should discard click
-// events.
-gboolean gtk_custom_menu_item_is_in_clickable_region(
- GtkCustomMenuItem* menu_item);
-
-// If the button is released while the |currently_selected_button| isn't
-// supposed to dismiss the menu, this signals to our listeners that we want to
-// run this command if it doesn't dismiss the menu. Returns TRUE if we acted
-// on this button click (and should prevent the normal GtkMenu machinery from
-// firing an "activate" signal).
-gboolean gtk_custom_menu_item_try_no_dismiss_command(
- GtkCustomMenuItem* menu_item);
-
-// Calls |callback| with every button and button-label in the container.
-void gtk_custom_menu_item_foreach_button(GtkCustomMenuItem* menu_item,
- GtkCallback callback,
- gpointer callback_data);
-
-G_END_DECLS
+#include "chrome/browser/ui/gtk/gtk_custom_menu_item.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_GTK_CUSTOM_MENU_ITEM_H_
diff --git a/chrome/browser/gtk/gtk_expanded_container.h b/chrome/browser/gtk/gtk_expanded_container.h
index 0870bbc..f769d6e 100644
--- a/chrome/browser/gtk/gtk_expanded_container.h
+++ b/chrome/browser/gtk/gtk_expanded_container.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,66 +6,7 @@
#define CHROME_BROWSER_GTK_GTK_EXPANDED_CONTAINER_H_
#pragma once
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
-
-// A specialized container derived from GtkFixed, which expands the size of its
-// children to fill the container, in one or both directions. The usage of this
-// container is similar to GtkFixed.
-//
-// The "child-size-request" signal is optional, if you want to expand child
-// widgets to customized size other than the container's size. It should have
-// the following signature:
-//
-// void (*child_size_request)(GtkExpandedContainer* container,
-// GtkWidget* child,
-// GtkRequisition* requisition);
-//
-// This signal is emitted for each child with the requisition set to the size of
-// the container. Your handler may adjust the value of the requisition. If the
-// width or height is set to -1, then that direction will not be expanded, and
-// the original size request of the child will be used.
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_EXPANDED_CONTAINER \
- (gtk_expanded_container_get_type())
-#define GTK_EXPANDED_CONTAINER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_EXPANDED_CONTAINER, \
- GtkExpandedContainer))
-#define GTK_EXPANDED_CONTAINER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_EXPANDED_CONTAINER, \
- GtkExpandedContainerClass))
-#define GTK_IS_EXPANDED_CONTAINER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_EXPANDED_CONTAINER))
-#define GTK_IS_EXPANDED_CONTAINER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_EXPANDED_CONTAINER))
-#define GTK_EXPANDED_CONTAINER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_EXPANDED_CONTAINER, \
- GtkExpandedContainerClass))
-
-typedef struct _GtkExpandedContainer GtkExpandedContainer;
-typedef struct _GtkExpandedContainerClass GtkExpandedContainerClass;
-
-struct _GtkExpandedContainer {
- // Parent class.
- GtkFixed fixed;
-};
-
-struct _GtkExpandedContainerClass {
- GtkFixedClass parent_class;
-};
-
-GType gtk_expanded_container_get_type() G_GNUC_CONST;
-GtkWidget* gtk_expanded_container_new();
-void gtk_expanded_container_put(GtkExpandedContainer* container,
- GtkWidget* widget, gint x, gint y);
-void gtk_expanded_container_move(GtkExpandedContainer* container,
- GtkWidget* widget, gint x, gint y);
-void gtk_expanded_container_set_has_window(GtkExpandedContainer* container,
- gboolean has_window);
-gboolean gtk_expanded_container_get_has_window(GtkExpandedContainer* container);
-
-G_END_DECLS
+#include "chrome/browser/ui/gtk/gtk_expanded_container.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_GTK_EXPANDED_CONTAINER_H_
diff --git a/chrome/browser/gtk/gtk_floating_container.h b/chrome/browser/gtk/gtk_floating_container.h
index b0eed46..3418c74 100644
--- a/chrome/browser/gtk/gtk_floating_container.h
+++ b/chrome/browser/gtk/gtk_floating_container.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,82 +6,7 @@
#define CHROME_BROWSER_GTK_GTK_FLOATING_CONTAINER_H_
#pragma once
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
-
-// A specialized container, which is a cross between a GtkBin and a
-// GtkFixed. This container dervies from GtkBin and the implementation of
-// gtk_container_add() is the same: only one GtkWidget can be added through
-// that interface. The GtkBin portion contains normal content and is given the
-// same allocation that this container has.
-//
-// In addition, any number of widgets can be added through the
-// gtk_floating_container_add_floating() method, which provides functionality
-// similar to a GtkFixed. Unlike a GtkFixed, coordinates are not set when you
-// gtk_fixed_put(). The location of the floating widgets is determined while
-// running the "set-floating-position" signal, which is emitted during this
-// container's "size-allocate" handler.
-//
-// The "set-floating-position" signal is (semi-)mandatory if you want widgets
-// placed anywhere other than the origin and should have the following
-// signature:
-//
-// void (*set_floating_position)(GtkFloatingContainer* container,
-// GtkAllocation* allocation,
-// gpointer userdata);
-//
-// Your handler should, for each floating widget, set the "x" and "y" child
-// properties.
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_FLOATING_CONTAINER \
- (gtk_floating_container_get_type())
-#define GTK_FLOATING_CONTAINER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_FLOATING_CONTAINER, \
- GtkFloatingContainer))
-#define GTK_FLOATING_CONTAINER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_FLOATING_CONTAINER, \
- GtkFloatingContainerClass))
-#define GTK_IS_FLOATING_CONTAINER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_FLOATING_CONTAINER))
-#define GTK_IS_FLOATING_CONTAINER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_FLOATING_CONTAINER))
-#define GTK_FLOATING_CONTAINER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_FLOATING_CONTAINER, \
- GtkFloatingContainerClass))
-
-typedef struct _GtkFloatingContainer GtkFloatingContainer;
-typedef struct _GtkFloatingContainerClass GtkFloatingContainerClass;
-typedef struct _GtkFloatingContainerChild GtkFloatingContainerChild;
-
-struct _GtkFloatingContainer {
- // Parent class.
- GtkBin bin;
-
- // A GList of all our floating children, in GtkFloatingContainerChild
- // structs. Owned by the GtkFloatingContainer.
- GList* floating_children;
-};
-
-struct _GtkFloatingContainerClass {
- GtkBinClass parent_class;
-};
-
-// Internal structure used to associate a widget and its x/y child properties.
-struct _GtkFloatingContainerChild {
- GtkWidget* widget;
- gint x;
- gint y;
-};
-
-GType gtk_floating_container_get_type() G_GNUC_CONST;
-GtkWidget* gtk_floating_container_new();
-void gtk_floating_container_add_floating(GtkFloatingContainer* container,
- GtkWidget* widget);
-// Use gtk_container_remove to remove all widgets; both widgets added with
-// gtk_container_add() and gtk_floating_container_add_floating().
-
-G_END_DECLS
+#include "chrome/browser/ui/gtk/gtk_floating_container.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_GTK_FLOATING_CONTAINER_H_
diff --git a/chrome/browser/gtk/gtk_theme_provider.h b/chrome/browser/gtk/gtk_theme_provider.h
index 39233a3..0a3d8fb 100644
--- a/chrome/browser/gtk/gtk_theme_provider.h
+++ b/chrome/browser/gtk/gtk_theme_provider.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,304 +6,7 @@
#define CHROME_BROWSER_GTK_GTK_THEME_PROVIDER_H_
#pragma once
-#include <map>
-#include <vector>
-
-#include "app/gtk_integers.h"
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/prefs/pref_change_registrar.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/browser/themes/browser_theme_provider.h"
-#include "chrome/common/notification_observer.h"
-#include "gfx/color_utils.h"
-
-class CairoCachedSurface;
-class GtkSignalRegistrar;
-class Profile;
-
-typedef struct _GdkDisplay GdkDisplay;
-typedef struct _GdkEventExpose GdkEventExpose;
-typedef struct _GdkPixbuf GdkPixbuf;
-typedef struct _GtkIconSet GtkIconSet;
-typedef struct _GtkStyle GtkStyle;
-typedef struct _GtkWidget GtkWidget;
-
-// Specialization of BrowserThemeProvider which supplies system colors.
-class GtkThemeProvider : public BrowserThemeProvider,
- public NotificationObserver {
- public:
- // Returns GtkThemeProvider, casted from our superclass.
- static GtkThemeProvider* GetFrom(Profile* profile);
-
- GtkThemeProvider();
- virtual ~GtkThemeProvider();
-
- // Calls |observer|.Observe() for the browser theme with this provider as the
- // source.
- void InitThemesFor(NotificationObserver* observer);
-
- // Overridden from BrowserThemeProvider:
- //
- // Sets that we aren't using the system theme, then calls
- // BrowserThemeProvider's implementation.
- virtual void Init(Profile* profile);
- virtual SkBitmap* GetBitmapNamed(int id) const;
- virtual SkColor GetColor(int id) const;
- virtual bool HasCustomImage(int id) const;
- virtual void SetTheme(const Extension* extension);
- virtual void UseDefaultTheme();
- virtual void SetNativeTheme();
- virtual bool UsingDefaultTheme();
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Creates a GtkChromeButton instance, registered with this theme provider,
- // with a "destroy" signal to remove it from our internal list when it goes
- // away.
- GtkWidget* BuildChromeButton();
-
- // Creates a theme-aware vertical separator widget.
- GtkWidget* CreateToolbarSeparator();
-
- // Whether we should use the GTK system theme.
- bool UseGtkTheme() const;
-
- // A wrapper around ThemeProvider::GetColor, transforming the result to a
- // GdkColor.
- GdkColor GetGdkColor(int id) const;
-
- // A weighted average between the text color and the background color of a
- // label. Used for borders between GTK stuff and the webcontent.
- GdkColor GetBorderColor() const;
-
- // Returns a set of icons tinted for different GtkStateTypes based on the
- // label colors for the IDR resource |id|.
- GtkIconSet* GetIconSetForId(int id) const;
-
- // This method returns the colors webkit will use for the scrollbars. When no
- // colors are specified by the GTK+ theme, this function averages of the
- // thumb part and of the track colors.
- void GetScrollbarColors(GdkColor* thumb_active_color,
- GdkColor* thumb_inactive_color,
- GdkColor* track_color);
-
- // Expose the inner label. Only used for testing.
- GtkWidget* fake_label() { return fake_label_.get(); }
-
- // Returns a CairoCachedSurface for a particular Display. CairoCachedSurfaces
- // (hopefully) live on the X server, instead of the client so we don't have
- // to send the image to the server on each expose.
- CairoCachedSurface* GetSurfaceNamed(int id, GtkWidget* widget_on_display);
-
- // Same as above, but auto-mirrors the underlying pixbuf in RTL mode.
- CairoCachedSurface* GetRTLEnabledSurfaceNamed(int id,
- GtkWidget* widget_on_display);
-
- // Same as above, but gets the resource from the ResourceBundle instead of the
- // BrowserThemeProvider.
- // NOTE: Never call this with resource IDs that are ever passed to the above
- // two functions! Depending on which call comes first, all callers will
- // either get the themed or the unthemed version.
- CairoCachedSurface* GetUnthemedSurfaceNamed(int id,
- GtkWidget* widget_on_display);
-
- // Returns colors that we pass to webkit to match the system theme.
- const SkColor& get_focus_ring_color() const { return focus_ring_color_; }
- const SkColor& get_thumb_active_color() const { return thumb_active_color_; }
- const SkColor& get_thumb_inactive_color() const {
- return thumb_inactive_color_;
- }
- const SkColor& get_track_color() const { return track_color_; }
- const SkColor& get_active_selection_bg_color() const {
- return active_selection_bg_color_;
- }
- const SkColor& get_active_selection_fg_color() const {
- return active_selection_fg_color_;
- }
- const SkColor& get_inactive_selection_bg_color() const {
- return inactive_selection_bg_color_;
- }
- const SkColor& get_inactive_selection_fg_color() const {
- return inactive_selection_fg_color_;
- }
-
- // These functions do not add a ref to the returned pixbuf, and it should not
- // be unreffed. If |native| is true, get the GTK_STOCK version of the icon.
- static GdkPixbuf* GetFolderIcon(bool native);
- static GdkPixbuf* GetDefaultFavicon(bool native);
-
- // Whether we use the GTK theme by default in the current desktop
- // environment. Returns true when we GTK defaults to on.
- static bool DefaultUsesSystemTheme();
-
- private:
- typedef std::map<int, SkColor> ColorMap;
- typedef std::map<int, color_utils::HSL> TintMap;
- typedef std::map<int, SkBitmap*> ImageCache;
- typedef std::map<int, CairoCachedSurface*> CairoCachedSurfaceMap;
- typedef std::map<GdkDisplay*, CairoCachedSurfaceMap> PerDisplaySurfaceMap;
-
- // Clears all the GTK color overrides.
- virtual void ClearAllThemeData();
-
- // Load theme data from preferences, possibly picking colors from GTK.
- virtual void LoadThemePrefs();
-
- // Let all the browser views know that themes have changed.
- virtual void NotifyThemeChanged(const Extension* extension);
-
- // Additionally frees the CairoCachedSurfaces.
- virtual void FreePlatformCaches();
-
- // Extracts colors and tints from the GTK theme, both for the
- // BrowserThemeProvider interface and the colors we send to webkit.
- void LoadGtkValues();
-
- // Reads in explicit theme frame colors from the ChromeGtkFrame style class
- // or generates them per our fallback algorithm.
- GdkColor BuildFrameColors(GtkStyle* frame_style);
-
- // Sets the values that we send to webkit to safe defaults.
- void LoadDefaultValues();
-
- // Builds all of the tinted menus images needed for custom buttons. This is
- // always called on style-set even if we aren't using the gtk-theme because
- // the menus are always rendered with gtk colors.
- void RebuildMenuIconSets();
-
- // Sets the underlying theme colors/tints from a GTK color.
- void SetThemeColorFromGtk(int id, const GdkColor* color);
- void SetThemeTintFromGtk(int id, const GdkColor* color);
-
- // Creates and returns a frame color, either using |gtk_base| verbatim if
- // non-NULL, or tinting |base| with |tint|. Also sets |color_id| and
- // |tint_id| to the returned color.
- GdkColor BuildAndSetFrameColor(const GdkColor* base,
- const GdkColor* gtk_base,
- const color_utils::HSL& tint,
- int color_id,
- int tint_id);
-
- // Split out from FreePlatformCaches so it can be called in our destructor;
- // FreePlatformCaches() is called from the BrowserThemeProvider's destructor,
- // but by the time ~BrowserThemeProvider() is run, the vtable no longer
- // points to GtkThemeProvider's version.
- void FreePerDisplaySurfaces(PerDisplaySurfaceMap* per_display_map);
-
- // Frees all the created GtkIconSets we use for the chrome menu.
- void FreeIconSets();
-
- // Lazily generates each bitmap used in the gtk theme.
- SkBitmap* GenerateGtkThemeBitmap(int id) const;
-
- // Creates a GTK+ version of IDR_THEME_FRAME. Instead of tinting, this
- // creates a theme configurable gradient ending with |color_id| at the
- // bottom, and |gradient_name| at the top if that color is specified in the
- // theme.
- SkBitmap* GenerateFrameImage(int color_id,
- const char* gradient_name) const;
-
- // Takes the base frame image |base_id| and tints it with |tint_id|.
- SkBitmap* GenerateTabImage(int base_id) const;
-
- // Tints an icon based on tint.
- SkBitmap* GenerateTintedIcon(int base_id, color_utils::HSL tint) const;
-
- // Returns the tint for buttons that contrasts with the normal window
- // background color.
- void GetNormalButtonTintHSL(color_utils::HSL* tint) const;
-
- // Returns a tint that's the color of the current normal text in an entry.
- void GetNormalEntryForegroundHSL(color_utils::HSL* tint) const;
-
- // Returns a tint that's the color of the current highlighted text in an
- // entry.
- void GetSelectedEntryForegroundHSL(color_utils::HSL* tint) const;
-
- // Implements GetXXXSurfaceNamed(), given the appropriate pixbuf to use.
- CairoCachedSurface* GetSurfaceNamedImpl(int id,
- PerDisplaySurfaceMap* surface_map,
- GdkPixbuf* pixbuf,
- GtkWidget* widget_on_display);
-
- // Handles signal from GTK that our theme has been changed.
- CHROMEGTK_CALLBACK_1(GtkThemeProvider, void, OnStyleSet, GtkStyle*);
-
- // A notification from the GtkChromeButton GObject destructor that we should
- // remove it from our internal list.
- CHROMEGTK_CALLBACK_0(GtkThemeProvider, void, OnDestroyChromeButton);
-
- CHROMEGTK_CALLBACK_1(GtkThemeProvider, gboolean, OnSeparatorExpose,
- GdkEventExpose*);
-
- // Whether we should be using gtk rendering.
- bool use_gtk_;
-
- // GtkWidgets that exist only so we can look at their properties (and take
- // their colors).
- GtkWidget* fake_window_;
- GtkWidget* fake_frame_;
- OwnedWidgetGtk fake_label_;
- OwnedWidgetGtk fake_entry_;
- OwnedWidgetGtk fake_menu_item_;
-
- // A list of all GtkChromeButton instances. We hold on to these to notify
- // them of theme changes.
- std::vector<GtkWidget*> chrome_buttons_;
-
- // Tracks all the signals we have connected to on various widgets.
- scoped_ptr<GtkSignalRegistrar> signals_;
-
- // Tints and colors calculated by LoadGtkValues() that are given to the
- // caller while |use_gtk_| is true.
- ColorMap colors_;
- TintMap tints_;
-
- // Colors used to tint certain icons.
- color_utils::HSL button_tint_;
- color_utils::HSL entry_tint_;
- color_utils::HSL selected_entry_tint_;
-
- // Colors that we pass to WebKit. These are generated each time the theme
- // changes.
- SkColor focus_ring_color_;
- SkColor thumb_active_color_;
- SkColor thumb_inactive_color_;
- SkColor track_color_;
- SkColor active_selection_bg_color_;
- SkColor active_selection_fg_color_;
- SkColor inactive_selection_bg_color_;
- SkColor inactive_selection_fg_color_;
-
- // A GtkIconSet that has the tinted icons for the NORMAL and PRELIGHT states
- // of the IDR_FULLSCREEN_MENU_BUTTON tinted to the respective menu item label
- // colors.
- GtkIconSet* fullscreen_icon_set_;
-
- // Image cache of lazily created images, created when requested by
- // GetBitmapNamed().
- mutable ImageCache gtk_images_;
-
- // Cairo surfaces for each GdkDisplay.
- PerDisplaySurfaceMap per_display_surfaces_;
- PerDisplaySurfaceMap per_display_unthemed_surfaces_;
-
- PrefChangeRegistrar registrar_;
-
- // This is a dummy widget that only exists so we have something to pass to
- // gtk_widget_render_icon().
- static GtkWidget* icon_widget_;
-
- // The default folder icon and default bookmark icon for the GTK theme.
- // These are static because the system can only have one theme at a time.
- // They are cached when they are requested the first time, and cleared when
- // the system theme changes.
- static GdkPixbuf* default_folder_icon_;
- static GdkPixbuf* default_bookmark_icon_;
-};
+#include "chrome/browser/ui/gtk/gtk_theme_provider.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_GTK_THEME_PROVIDER_H_
diff --git a/chrome/browser/gtk/gtk_tree.h b/chrome/browser/gtk/gtk_tree.h
index ce4feee..ab63e70 100644
--- a/chrome/browser/gtk/gtk_tree.h
+++ b/chrome/browser/gtk/gtk_tree.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,202 +6,7 @@
#define CHROME_BROWSER_GTK_GTK_TREE_H_
#pragma once
-#include <gtk/gtk.h>
-#include <set>
-#include <vector>
-
-#include "app/table_model_observer.h"
-#include "app/tree_model.h"
-#include "base/basictypes.h"
-#include "chrome/browser/remove_rows_table_model.h"
-
-class TableModel;
-
-namespace gtk_tree {
-
-// Get the row number corresponding to |path|.
-gint GetRowNumForPath(GtkTreePath* path);
-
-// Get the row number corresponding to |iter|.
-gint GetRowNumForIter(GtkTreeModel* model, GtkTreeIter* iter);
-
-// Get the row number in the child tree model corresponding to |sort_path| in
-// the parent tree model.
-gint GetTreeSortChildRowNumForPath(GtkTreeModel* sort_model,
- GtkTreePath* sort_path);
-
-// Select the given row by number.
-void SelectAndFocusRowNum(int row, GtkTreeView* tree_view);
-
-// Remove the row and all its children from the |tree_store|. If there is a
-// following row, |iter| will be updated to point to the it and the return value
-// will be true, otherwise the return will be false and |iter| is no longer
-// valid.
-bool RemoveRecursively(GtkTreeStore* tree_store, GtkTreeIter* iter);
-
-// Writes all the indexes of selected rows into |out|.
-void GetSelectedIndices(GtkTreeSelection* selection, std::set<int>* out);
-
-// A helper class for populating a GtkListStore from a TableModel.
-class TableAdapter : public TableModelObserver {
- public:
-
- enum ColumnID {
- COL_TITLE = 0,
- COL_IS_HEADER,
- COL_IS_SEPARATOR,
- COL_GROUP_ID,
- COL_WEIGHT,
- COL_WEIGHT_SET,
- COL_LAST_ID
- };
-
- class Delegate {
- public:
- // Should fill in the column and row.
- virtual void SetColumnValues(int row, GtkTreeIter* iter) = 0;
-
- // Called after any change to the TableModel but before the corresponding
- // change to the GtkListStore.
- virtual void OnAnyModelUpdateStart() {}
-
- // Called after any change to the TableModel.
- virtual void OnAnyModelUpdate() {}
-
- // When the TableModel has been completely changed, called by OnModelChanged
- // after clearing the list store. Can be overriden by the delegate if it
- // needs to do extra initialization before the list store is populated.
- virtual void OnModelChanged() {}
-
- protected:
- virtual ~Delegate() {}
- };
-
- // |table_model| may be NULL.
- TableAdapter(Delegate* delegate,
- GtkListStore* list_store,
- TableModel* table_model);
- virtual ~TableAdapter() {}
-
- // Replace the TableModel with a different one. If the list store currenty
- // has items this would cause weirdness, so this should generally only be
- // called during the Delegate's OnModelChanged call, or if the adapter was
- // created with a NULL |table_model|.
- void SetModel(TableModel* table_model);
-
- // Add all model rows corresponding to the given list store indices to |rows|.
- void MapListStoreIndicesToModelRows(const std::set<int>& list_store_indices,
- RemoveRowsTableModel::Rows* model_rows);
-
- // GtkTreeModel callbacks:
- // Callback checking whether a row should be drawn as a separator.
- static gboolean OnCheckRowIsSeparator(GtkTreeModel* model,
- GtkTreeIter* iter,
- gpointer user_data);
-
- // Callback checking whether a row may be selected. We use some rows in the
- // table as headers/separators for the groups, which should not be selectable.
- static gboolean OnSelectionFilter(GtkTreeSelection* selection,
- GtkTreeModel* model,
- GtkTreePath* path,
- gboolean path_currently_selected,
- gpointer user_data);
-
- // TableModelObserver implementation.
- virtual void OnModelChanged();
- virtual void OnItemsChanged(int start, int length);
- virtual void OnItemsAdded(int start, int length);
- virtual void OnItemsRemoved(int start, int length);
-
- private:
- // Return whether the row pointed to by |iter| is a group row, i.e. a group
- // header, or a separator.
- bool IsGroupRow(GtkTreeIter* iter) const;
-
- // Return the index into the list store for the given model row.
- int GetListStoreIndexForModelRow(int model_row) const;
-
- // Add the values from |row| of the TableModel.
- void AddNodeToList(int row);
-
- Delegate* delegate_;
- GtkListStore* list_store_;
- TableModel* table_model_;
-
- DISALLOW_COPY_AND_ASSIGN(TableAdapter);
-};
-
-// A helper class for populating a GtkTreeStore from a TreeModel.
-// TODO(mattm): support SetRootShown(true)
-class TreeAdapter : public TreeModelObserver {
- public:
- // Column ids for |tree_store_|.
- enum {
- COL_ICON,
- COL_TITLE,
- COL_NODE_PTR,
- COL_COUNT,
- };
-
- class Delegate {
- public:
- // Called after any change to the TreeModel but before the corresponding
- // change to the GtkTreeStore.
- virtual void OnAnyModelUpdateStart() {}
-
- // Called after any change to the GtkTreeStore.
- virtual void OnAnyModelUpdate() {}
-
- protected:
- virtual ~Delegate() {}
- };
-
- TreeAdapter(Delegate* delegate, TreeModel* tree_model);
- virtual ~TreeAdapter();
-
- // Populate the tree store from the |tree_model_|.
- void Init();
-
- // Return the tree store.
- GtkTreeStore* tree_store() { return tree_store_; }
-
- // Get the TreeModelNode corresponding to iter in the tree store.
- TreeModelNode* GetNode(GtkTreeIter* iter);
-
- // Begin TreeModelObserver implementation.
- virtual void TreeNodesAdded(TreeModel* model,
- TreeModelNode* parent,
- int start,
- int count);
- virtual void TreeNodesRemoved(TreeModel* model,
- TreeModelNode* parent,
- int start,
- int count);
- virtual void TreeNodeChanged(TreeModel* model, TreeModelNode* node);
- // End TreeModelObserver implementation.
-
- private:
- // Fill the tree store values for a given node.
- void FillRow(GtkTreeIter* iter, TreeModelNode* node);
-
- // Fill the tree store for a row and all its descendants.
- void Fill(GtkTreeIter* parent_iter, TreeModelNode* parent_node);
-
- // Get the GtkTreePath in the tree store for the given node.
- // The returned path should be freed with gtk_tree_path_free.
- GtkTreePath* GetTreePath(TreeModelNode* node);
-
- // Get the GtkTreeIter in the tree store for the given node.
- bool GetTreeIter(TreeModelNode* node, GtkTreeIter* iter);
-
- Delegate* delegate_;
- GtkTreeStore* tree_store_;
- TreeModel* tree_model_;
- std::vector<GdkPixbuf*> pixbufs_;
-
- DISALLOW_COPY_AND_ASSIGN(TreeAdapter);
-};
-
-} // namespace gtk_tree
+#include "chrome/browser/ui/gtk/gtk_tree.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_GTK_TREE_H_
diff --git a/chrome/browser/gtk/gtk_util.h b/chrome/browser/gtk/gtk_util.h
index 894abc6..f6e5f1f 100644
--- a/chrome/browser/gtk/gtk_util.h
+++ b/chrome/browser/gtk/gtk_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,375 +6,7 @@
#define CHROME_BROWSER_GTK_GTK_UTIL_H_
#pragma once
-#include <gtk/gtk.h>
-#include <string>
-#include <vector>
-
-#include "app/x11_util.h"
-#include "base/string16.h"
-#include "gfx/point.h"
-#include "gfx/rect.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h"
-#include "webkit/glue/window_open_disposition.h"
-
-typedef struct _cairo cairo_t;
-typedef struct _GdkColor GdkColor;
-typedef struct _GtkWidget GtkWidget;
-
-class BrowserWindow;
-class GtkThemeProvider;
-class GURL;
-class Profile;
-struct RendererPreferences; // from common/renderer_preferences.h
-
-const int kSkiaToGDKMultiplier = 257;
-
-// Define a macro for creating GdkColors from RGB values. This is a macro to
-// allow static construction of literals, etc. Use this like:
-// GdkColor white = GDK_COLOR_RGB(0xff, 0xff, 0xff);
-#define GDK_COLOR_RGB(r, g, b) {0, r * kSkiaToGDKMultiplier, \
- g * kSkiaToGDKMultiplier, b * kSkiaToGDKMultiplier}
-
-namespace event_utils {
-
-// Translates event flags into what kind of disposition they represent.
-// For example, a middle click would mean to open a background tab.
-// event_flags are the state in the GdkEvent structure.
-WindowOpenDisposition DispositionFromEventFlags(guint state);
-
-} // namespace event_utils
-
-namespace gtk_util {
-
-extern const GdkColor kGdkWhite;
-extern const GdkColor kGdkGray;
-extern const GdkColor kGdkBlack;
-extern const GdkColor kGdkGreen;
-
-// Constants relating to the layout of dialog windows:
-// (See http://library.gnome.org/devel/hig-book/stable/design-window.html.en)
-
-// Spacing between controls of the same group.
-const int kControlSpacing = 6;
-
-// Horizontal spacing between a label and its control.
-const int kLabelSpacing = 12;
-
-// Indent of the controls within each group.
-const int kGroupIndent = 12;
-
-// Space around the outside of a dialog's contents.
-const int kContentAreaBorder = 12;
-
-// Spacing between groups of controls.
-const int kContentAreaSpacing = 18;
-
-// Horizontal Spacing between controls in a form.
-const int kFormControlSpacing = 10;
-
-// Create a table of labeled controls, using proper spacing and alignment.
-// Arguments should be pairs of const char*, GtkWidget*, concluding with a
-// NULL. The first argument is a vector in which to place all labels
-// produced. It can be NULL if you don't need to keep track of the label
-// widgets. The second argument is a color to force the label text to. It can
-// be NULL to get the system default.
-//
-// For example:
-// controls = CreateLabeledControlsGroup(NULL,
-// "Name:", title_entry_,
-// "Folder:", folder_combobox_,
-// NULL);
-GtkWidget* CreateLabeledControlsGroup(
- std::vector<GtkWidget*>* labels,
- const char* text, ...);
-
-// Create a GtkBin with |child| as its child widget. This bin will paint a
-// border of color |color| with the sizes specified in pixels.
-GtkWidget* CreateGtkBorderBin(GtkWidget* child, const GdkColor* color,
- int top, int bottom, int left, int right);
-
-// Left-align the given GtkMisc and return the same pointer.
-GtkWidget* LeftAlignMisc(GtkWidget* misc);
-
-// Create a left-aligned label with the given text in bold.
-GtkWidget* CreateBoldLabel(const std::string& text);
-
-// As above, but uses number of characters/lines directly rather than looking up
-// a resource.
-void GetWidgetSizeFromCharacters(GtkWidget* widget,
- double width_chars, double height_lines,
- int* width, int* height);
-
-// Calculates the size of given widget based on the size specified in number of
-// characters/lines (in locale specific resource file) and font metrics.
-// NOTE: Make sure to realize |widget| before using this method, or a default
-// font size will be used instead of the actual font size.
-void GetWidgetSizeFromResources(GtkWidget* widget,
- int width_chars, int height_lines,
- int* width, int* height);
-
-// As above, but a convenience method for configuring dialog size.
-// |width_id| and |height_id| are resource IDs for the size. If either of these
-// are set to -1, the respective size will be set to the widget default.
-// |resizable| also controls whether the dialog will be resizable
-// (this info is also necessary for getting the width-setting code
-// right).
-void SetWindowSizeFromResources(GtkWindow* window,
- int width_id, int height_id, bool resizable);
-
-// Places |window| approximately over center of |parent|, it also moves window
-// to parent's desktop. Use this only for non-modal dialogs, such as the
-// options window and content settings window; otherwise you should be using
-// transient_for.
-void CenterOverWindow(GtkWindow* window, GtkWindow* parent);
-
-// Puts all browser windows in one window group; this will make any dialog
-// spawned app modal.
-void MakeAppModalWindowGroup();
-
-// Called after an app modal dialog that used MakeAppModalWindowGroup() was
-// dismissed. Returns each browser window to its own window group.
-void AppModalDismissedUngroupWindows();
-
-// Remove all children from this container.
-void RemoveAllChildren(GtkWidget* container);
-
-// Force the font size of the widget to |size_pixels|.
-void ForceFontSizePixels(GtkWidget* widget, double size_pixels);
-
-// Undoes the effects of a previous ForceFontSizePixels() call. Safe to call
-// even if ForceFontSizePixels() was never called.
-void UndoForceFontSize(GtkWidget* widget);
-
-// Gets the position of a gtk widget in screen coordinates.
-gfx::Point GetWidgetScreenPosition(GtkWidget* widget);
-
-// Returns the bounds of the specified widget in screen coordinates.
-gfx::Rect GetWidgetScreenBounds(GtkWidget* widget);
-
-// Retuns size of the |widget| without window manager decorations.
-gfx::Size GetWidgetSize(GtkWidget* widget);
-
-// Converts a point in a widget to screen coordinates. The point |p| is
-// relative to the widget's top-left origin.
-void ConvertWidgetPointToScreen(GtkWidget* widget, gfx::Point* p);
-
-// Initialize some GTK settings so that our dialogs are consistent.
-void InitRCStyles();
-
-// Stick the widget in the given hbox without expanding vertically. The widget
-// is packed at the start of the hbox. This is useful for widgets that would
-// otherwise expand to fill the vertical space of the hbox
-// (e.g. buttons). Returns the vbox that widget was packed in.
-GtkWidget* CenterWidgetInHBox(GtkWidget* hbox, GtkWidget* widget,
- bool pack_at_end, int padding);
-
-// Returns true if the screen is composited, false otherwise.
-bool IsScreenComposited();
-
-// Enumerates the top-level gdk windows of the current display.
-void EnumerateTopLevelWindows(x11_util::EnumerateWindowsDelegate* delegate);
-
-// Set that clicking the button with the given mouse buttons will cause a click
-// event.
-// NOTE: If you need to connect to the button-press-event or
-// button-release-event signals, do so before calling this function.
-void SetButtonClickableByMouseButtons(GtkWidget* button,
- bool left, bool middle, bool right);
-
-// Set that a button causes a page navigation. In particular, it will accept
-// middle clicks. Warning: only call this *after* you have connected your
-// own handlers for button-press and button-release events, or you will not get
-// those events.
-void SetButtonTriggersNavigation(GtkWidget* button);
-
-// Returns the mirrored x value for |bounds| if the layout is RTL; otherwise,
-// the original value is returned unchanged.
-int MirroredLeftPointForRect(GtkWidget* widget, const gfx::Rect& bounds);
-
-// Returns the mirrored x value for the point |x| if the layout is RTL;
-// otherwise, the original value is returned unchanged.
-int MirroredXCoordinate(GtkWidget* widget, int x);
-
-// Returns true if the pointer is currently inside the widget.
-bool WidgetContainsCursor(GtkWidget* widget);
-
-// Sets the icon of |window| to the product icon (potentially used in window
-// border or alt-tab list).
-void SetWindowIcon(GtkWindow* window);
-
-// Sets the default window icon for windows created in this app.
-void SetDefaultWindowIcon();
-
-// Adds an action button with the given text to the dialog. Only useful when you
-// want a stock icon but not the stock text to go with it. Returns the button.
-GtkWidget* AddButtonToDialog(GtkWidget* dialog, const gchar* text,
- const gchar* stock_id, gint response_id);
-
-GtkWidget* BuildDialogButton(GtkWidget* dialog, int ids_id,
- const gchar* stock_id);
-
-GtkWidget* CreateEntryImageHBox(GtkWidget* entry, GtkWidget* image);
-
-// Sets all the foreground color states of |label| to |color|.
-void SetLabelColor(GtkWidget* label, const GdkColor* color);
-
-// Adds the given widget to an alignment identing it by |kGroupIndent|.
-GtkWidget* IndentWidget(GtkWidget* content);
-
-// Sets (or resets) the font settings in |prefs| (used when creating new
-// renderers) based on GtkSettings (which itself comes from XSETTINGS).
-void UpdateGtkFontSettings(RendererPreferences* prefs);
-
-// Get the current location of the mouse cursor relative to the screen.
-gfx::Point ScreenPoint(GtkWidget* widget);
-
-// Get the current location of the mouse cursor relative to the widget.
-gfx::Point ClientPoint(GtkWidget* widget);
-
-// Reverses a point in RTL mode. Used in making vectors of GdkPoints for window
-// shapes.
-GdkPoint MakeBidiGdkPoint(gint x, gint y, gint width, bool ltr);
-
-// Draws a GTK text entry with the style parameters of GtkEntry
-// |offscreen_entry| onto |widget_to_draw_on| in the rectangle |rec|. Drawing
-// is only done in the clip rectangle |dirty_rec|.
-void DrawTextEntryBackground(GtkWidget* offscreen_entry,
- GtkWidget* widget_to_draw_on,
- GdkRectangle* dirty_rec,
- GdkRectangle* rec);
-
-// Draws the background of the toolbar area subject to the expose rectangle
-// |event| and starting image tiling from |tabstrip_origin|.
-void DrawThemedToolbarBackground(GtkWidget* widget,
- cairo_t* cr,
- GdkEventExpose* event,
- const gfx::Point& tabstrip_origin,
- GtkThemeProvider* provider);
-
-// Returns the two colors averaged together.
-GdkColor AverageColors(GdkColor color_one, GdkColor color_two);
-
-// Show the image for the given menu item, even if the user's default is to not
-// show images. Only to be used for favicons or other menus where the image is
-// crucial to its functionality.
-void SetAlwaysShowImage(GtkWidget* image_menu_item);
-
-// Stacks a |popup| window directly on top of a |toplevel| window.
-void StackPopupWindow(GtkWidget* popup, GtkWidget* toplevel);
-
-// Get a rectangle corresponding to a widget's allocation relative to its
-// toplevel window's origin.
-gfx::Rect GetWidgetRectRelativeToToplevel(GtkWidget* widget);
-
-// Don't allow the widget to paint anything, and instead propagate the expose
-// to its children. This is similar to calling
-//
-// gtk_widget_set_app_paintable(container, TRUE);
-//
-// except that it will always work, and it should be called after any custom
-// expose events are connected.
-void SuppressDefaultPainting(GtkWidget* container);
-
-// Get the window open disposition from the state in gtk_get_current_event().
-// This is designed to be called inside a "clicked" event handler. It is an
-// error to call it when gtk_get_current_event() won't return a GdkEventButton*.
-WindowOpenDisposition DispositionForCurrentButtonPressEvent();
-
-// Safely grabs all input (with X grabs and an application grab), returning true
-// for success.
-bool GrabAllInput(GtkWidget* widget);
-
-// Returns a rectangle that represents the widget's bounds. The rectangle it
-// returns is the same as widget->allocation, but anchored at (0, 0).
-gfx::Rect WidgetBounds(GtkWidget* widget);
-
-// Update the timestamp for the given window. This is usually the time of the
-// last user event, but on rare occasions we wish to update it despite not
-// receiving a user event.
-void SetWMLastUserActionTime(GtkWindow* window);
-
-// The current system time, using the format expected by the X server, but not
-// retrieved from the X server. NOTE: You should almost never need to use this
-// function, instead using the timestamp from the latest GDK event.
-guint32 XTimeNow();
-
-// Uses the autocomplete controller for |profile| to convert the contents of the
-// PRIMARY selection to a parsed URL. Returns true and sets |url| on success,
-// otherwise returns false.
-bool URLFromPrimarySelection(Profile* profile, GURL* url);
-
-// Set the colormap of the given window to rgba to allow transparency.
-bool AddWindowAlphaChannel(GtkWidget* window);
-
-// Get the default colors for a text entry. Parameters may be NULL.
-void GetTextColors(GdkColor* normal_base,
- GdkColor* selected_base,
- GdkColor* normal_text,
- GdkColor* selected_text);
-
-// Wrappers to show a GtkDialog. On Linux, it merely calls gtk_widget_show_all.
-// On ChromeOs, it calls ShowNativeDialog which hosts the its vbox
-// in a view based Window.
-void ShowDialog(GtkWidget* dialog);
-void ShowDialogWithLocalizedSize(GtkWidget* dialog,
- int width_id,
- int height_id,
- bool resizeable);
-void ShowModalDialogWithMinLocalizedWidth(GtkWidget* dialog,
- int width_id);
-
-// Wrapper to present a window. On Linux, it just calls gtk_window_present or
-// gtk_window_present_with_time for non-zero timestamp. For ChromeOS, it first
-// finds the host window of the dialog contents and then present it.
-void PresentWindow(GtkWidget* window, int timestamp);
-
-// Get real window for given dialog. On ChromeOS, this gives the native dialog
-// host window. On Linux, it merely returns the passed in dialog.
-GtkWindow* GetDialogWindow(GtkWidget* dialog);
-
-// Gets dialog window bounds.
-gfx::Rect GetDialogBounds(GtkWidget* dialog);
-
-// Returns the stock menu item label for the "preferences" item - returns an
-// empty string if no stock item found.
-string16 GetStockPreferencesMenuLabel();
-
-// Checks whether a widget is actually visible, i.e. whether it and all its
-// ancestors up to its toplevel are visible.
-bool IsWidgetAncestryVisible(GtkWidget* widget);
-
-// Sets the GTK font from the given font name (ex. "Arial Black, 10").
-void SetGtkFont(const std::string& font_name);
-
-// Sets the given label's size request to |pixel_width|. This will cause the
-// label to wrap if it needs to. The reason for this function is that some
-// versions of GTK mis-align labels that have a size request and line wrapping,
-// and this function hides the complexity of the workaround.
-void SetLabelWidth(GtkWidget* label, int pixel_width);
-
-// Make the |label| shrinkable within a GthChromeShrinkableHBox
-// It calculates the real size request of a label and set its ellipsize mode to
-// PANGO_ELLIPSIZE_END.
-// It must be done when the label is mapped (become visible on the screen),
-// to make sure the pango can get correct font information for the calculation.
-void InitLabelSizeRequestAndEllipsizeMode(GtkWidget* label);
-
-// Convenience methods for converting between web drag operations and the GDK
-// equivalent.
-GdkDragAction WebDragOpToGdkDragAction(WebKit::WebDragOperationsMask op);
-WebKit::WebDragOperationsMask GdkDragActionToWebDragOp(GdkDragAction action);
-
-// A helper function for gtk_message_dialog_new() to work around a few KDE 3
-// window manager bugs. You should always call it after creating a dialog with
-// gtk_message_dialog_new.
-void ApplyMessageDialogQuirks(GtkWidget* dialog);
-
-// Performs Cut/Copy/Paste operation on the |window|.
-void DoCut(BrowserWindow* window);
-void DoCopy(BrowserWindow* window);
-void DoPaste(BrowserWindow* window);
-
-} // namespace gtk_util
+#include "chrome/browser/ui/gtk/gtk_util.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_GTK_UTIL_H_
diff --git a/chrome/browser/gtk/hover_controller_gtk.h b/chrome/browser/gtk/hover_controller_gtk.h
index 9172167..40206ed 100644
--- a/chrome/browser/gtk/hover_controller_gtk.h
+++ b/chrome/browser/gtk/hover_controller_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,62 +6,7 @@
#define CHROME_BROWSER_GTK_HOVER_CONTROLLER_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "app/gtk_signal_registrar.h"
-#include "ui/base/animation/animation_delegate.h"
-#include "ui/base/animation/slide_animation.h"
-#include "ui/base/animation/throb_animation.h"
-
-// This class handles the "throbbing" of a GtkChromeButton. The visual effect
-// of throbbing is created by painting partially transparent hover effects. It
-// only works in non-gtk theme mode. This class mainly exists to glue an
-// AnimationDelegate (C++ class) to a GtkChromeButton* (GTK/c object).
-class HoverControllerGtk : public ui::AnimationDelegate {
- public:
- virtual ~HoverControllerGtk();
-
- GtkWidget* button() { return button_; }
-
- // Throb for |cycles| cycles. This will override the current remaining
- // number of cycles. Note that a "cycle" is (somewhat unintuitively) half of
- // a complete throb revolution.
- void StartThrobbing(int cycles);
-
- // Get the HoverControllerGtk for a given GtkChromeButton*. It is an error
- // to call this on a widget that is not a GtkChromeButton*.
- static HoverControllerGtk* GetHoverControllerGtk(GtkWidget* button);
-
- // Creates a GtkChromeButton and adds a HoverControllerGtk for it.
- static GtkWidget* CreateChromeButton();
-
- // Stop throbbing and delete |this|.
- void Destroy();
-
- private:
- explicit HoverControllerGtk(GtkWidget* button);
-
- // Overridden from ui::AnimationDelegate.
- virtual void AnimationProgressed(const ui::Animation* animation);
- virtual void AnimationEnded(const ui::Animation* animation);
- virtual void AnimationCanceled(const ui::Animation* animation);
-
- CHROMEGTK_CALLBACK_1(HoverControllerGtk, gboolean, OnEnter,
- GdkEventCrossing*);
- CHROMEGTK_CALLBACK_1(HoverControllerGtk, gboolean, OnLeave,
- GdkEventCrossing*);
- CHROMEGTK_CALLBACK_1(HoverControllerGtk, void, OnHierarchyChanged,
- GtkWidget*);
- CHROMEGTK_CALLBACK_0(HoverControllerGtk, void, OnDestroy);
-
- ui::ThrobAnimation throb_animation_;
- ui::SlideAnimation hover_animation_;
- GtkWidget* button_;
-
- GtkSignalRegistrar signals_;
-
- DISALLOW_COPY_AND_ASSIGN(HoverControllerGtk);
-};
+#include "chrome/browser/ui/gtk/hover_controller_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_HOVER_CONTROLLER_GTK_H_
diff --git a/chrome/browser/gtk/html_dialog_gtk.h b/chrome/browser/gtk/html_dialog_gtk.h
index 6b4ddda..d58fb0b 100644
--- a/chrome/browser/gtk/html_dialog_gtk.h
+++ b/chrome/browser/gtk/html_dialog_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,70 +6,7 @@
#define CHROME_BROWSER_GTK_HTML_DIALOG_GTK_H_
#pragma once
-#include <string>
-#include <vector>
-
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/dom_ui/html_dialog_ui.h"
-#include "chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h"
-#include "gfx/native_widget_types.h"
-#include "gfx/size.h"
-
-typedef struct _GtkWidget GtkWidget;
-
-class Browser;
-class Profile;
-class TabContents;
-class TabContentsContainerGtk;
-
-class HtmlDialogGtk : public HtmlDialogTabContentsDelegate,
- public HtmlDialogUIDelegate {
- public:
- HtmlDialogGtk(Profile* profile, HtmlDialogUIDelegate* delegate,
- gfx::NativeWindow parent_window);
- virtual ~HtmlDialogGtk();
-
- static void ShowHtmlDialogGtk(Browser* browser,
- HtmlDialogUIDelegate* delegate,
- gfx::NativeWindow parent_window);
- // Initializes the contents of the dialog (the DOMView and the callbacks).
- void InitDialog();
-
- // Overridden from HtmlDialogUI::Delegate:
- virtual bool IsDialogModal() const;
- virtual std::wstring GetDialogTitle() const;
- virtual GURL GetDialogContentURL() const;
- virtual void GetDOMMessageHandlers(
- std::vector<DOMMessageHandler*>* handlers) const;
- virtual void GetDialogSize(gfx::Size* size) const;
- virtual std::string GetDialogArgs() const;
- virtual void OnDialogClosed(const std::string& json_retval);
- virtual void OnCloseContents(TabContents* source, bool* out_close_dialog) { }
- virtual bool ShouldShowDialogTitle() const;
-
- // Overridden from TabContentsDelegate:
- virtual void MoveContents(TabContents* source, const gfx::Rect& pos);
- virtual void ToolbarSizeChanged(TabContents* source, bool is_animating);
- virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event);
-
- private:
- CHROMEGTK_CALLBACK_1(HtmlDialogGtk, void, OnResponse, int);
-
- // This view is a delegate to the HTML content since it needs to get notified
- // about when the dialog is closing. For all other actions (besides dialog
- // closing) we delegate to the creator of this view, which we keep track of
- // using this variable.
- HtmlDialogUIDelegate* delegate_;
-
- gfx::NativeWindow parent_window_;
-
- GtkWidget* dialog_;
-
- scoped_ptr<TabContents> tab_contents_;
- scoped_ptr<TabContentsContainerGtk> tab_contents_container_;
-
- DISALLOW_COPY_AND_ASSIGN(HtmlDialogGtk);
-};
+#include "chrome/browser/ui/gtk/html_dialog_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_HTML_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/import_dialog_gtk.h b/chrome/browser/gtk/import_dialog_gtk.h
index f52b845..7660e55 100644
--- a/chrome/browser/gtk/import_dialog_gtk.h
+++ b/chrome/browser/gtk/import_dialog_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,84 +6,7 @@
#define CHROME_BROWSER_GTK_IMPORT_DIALOG_GTK_H_
#pragma once
-#include "app/gtk_signal.h"
-#include "chrome/browser/importer/importer.h"
-
-class AccessibleWidgetHelper;
-class Profile;
-
-class ImportDialogGtk : public ImportObserver,
- public ImporterList::Observer {
- public:
- // Displays the import box to import data from another browser into |profile|
- // |initial_state| is a bitmask of ImportItems. Each checkbox for the bits in
- // is checked.
- static void Show(GtkWindow* parent, Profile* profile, int initial_state);
-
- // ImportObserver implementation.
- virtual void ImportCanceled();
- virtual void ImportComplete();
-
- private:
- ImportDialogGtk(GtkWindow* parent, Profile* profile, int initial_state);
- ~ImportDialogGtk();
-
- // ImporterList::Observer implementation.
- virtual void SourceProfilesLoaded();
-
- // Handler to respond to OK or Cancel responses from the dialog.
- CHROMEGTK_CALLBACK_1(ImportDialogGtk, void, OnDialogResponse, int);
-
- // Handler to respond to widget clicked actions from the dialog.
- CHROMEGTK_CALLBACK_0(ImportDialogGtk, void, OnDialogWidgetClicked);
-
- // Enable or disable the dialog buttons depending on the state of the
- // checkboxes.
- void UpdateDialogButtons();
-
- // Sets the sensitivity of all controls on the dialog except the cancel
- // button.
- void SetDialogControlsSensitive(bool sensitive);
-
- // Create a bitmask from the checkboxes of the dialog.
- uint16 GetCheckedItems();
-
- // Parent window
- GtkWindow* parent_;
-
- // Import Dialog
- GtkWidget* dialog_;
-
- // Combo box that displays list of profiles from which we can import.
- GtkWidget* combo_;
-
- // Bookmarks/Favorites checkbox
- GtkWidget* bookmarks_;
-
- // Search Engines checkbox
- GtkWidget* search_engines_;
-
- // Passwords checkbox
- GtkWidget* passwords_;
-
- // History checkbox
- GtkWidget* history_;
-
- // Import button.
- GtkWidget* import_button_;
-
- // Our current profile
- Profile* profile_;
-
- // Utility class that does the actual import.
- scoped_refptr<ImporterHost> importer_host_;
-
- int initial_state_;
-
- // Helper object to manage accessibility metadata.
- scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
-
- DISALLOW_COPY_AND_ASSIGN(ImportDialogGtk);
-};
+#include "chrome/browser/ui/gtk/import_dialog_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_IMPORT_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/import_lock_dialog_gtk.h b/chrome/browser/gtk/import_lock_dialog_gtk.h
index e22e823..484c881 100644
--- a/chrome/browser/gtk/import_lock_dialog_gtk.h
+++ b/chrome/browser/gtk/import_lock_dialog_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,32 +6,7 @@
#define CHROME_BROWSER_GTK_IMPORT_LOCK_DIALOG_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "base/ref_counted.h"
-
-class ImporterHost;
-
-class ImportLockDialogGtk {
- public:
- // Displays the Firefox profile locked warning
- static void Show(GtkWindow* parent, ImporterHost* importer_host);
-
- private:
- ImportLockDialogGtk(GtkWindow* parent, ImporterHost* importer_host);
- ~ImportLockDialogGtk();
-
- CHROMEGTK_CALLBACK_1(ImportLockDialogGtk, void, OnDialogResponse, int);
-
- // Dialog box
- GtkWidget* dialog_;
-
- // Utility class that does the actual import.
- scoped_refptr<ImporterHost> importer_host_;
-
- DISALLOW_COPY_AND_ASSIGN(ImportLockDialogGtk);
-};
+#include "chrome/browser/ui/gtk/import_lock_dialog_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_IMPORT_LOCK_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/import_progress_dialog_gtk.h b/chrome/browser/gtk/import_progress_dialog_gtk.h
index 360b0de..2aed200 100644
--- a/chrome/browser/gtk/import_progress_dialog_gtk.h
+++ b/chrome/browser/gtk/import_progress_dialog_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,78 +6,7 @@
#define CHROME_BROWSER_GTK_IMPORT_PROGRESS_DIALOG_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/importer/importer_data_types.h"
-
-class Profile;
-
-class ImportProgressDialogGtk : public ImporterHost::Observer {
- public:
- // Displays the import progress dialog box and starts the import
- static void StartImport(GtkWindow* parent, int16 items,
- ImporterHost* importer_host,
- const ProfileInfo& browser_profile,
- Profile* profile,
- ImportObserver* observer, bool first_run);
-
- // Overridden from ImporterHost::Observer:
- virtual void ImportItemStarted(importer::ImportItem item);
- virtual void ImportItemEnded(importer::ImportItem item);
- virtual void ImportStarted();
- virtual void ImportEnded();
-
- private:
- ImportProgressDialogGtk(const string16& source_profile, int16 items,
- ImporterHost* importer_host, ImportObserver* observer,
- GtkWindow* parent, bool bookmarks_import);
- virtual ~ImportProgressDialogGtk();
-
- static void HandleOnResponseDialog(GtkWidget* widget,
- int response,
- gpointer user_data) {
- reinterpret_cast<ImportProgressDialogGtk*>(user_data)->OnDialogResponse(
- widget, response);
- }
-
- void CloseDialog();
-
- void OnDialogResponse(GtkWidget* widget, int response);
-
- void ShowDialog();
-
- // Parent window
- GtkWindow* parent_;
-
- // Import progress dialog
- GtkWidget* dialog_;
-
- // Bookmarks/Favorites checkbox
- GtkWidget* bookmarks_;
-
- // Search Engines checkbox
- GtkWidget* search_engines_;
-
- // Passwords checkbox
- GtkWidget* passwords_;
-
- // History checkbox
- GtkWidget* history_;
-
- // Boolean that tells whether we are currently in the mid of import process
- bool importing_;
-
- // Observer that we need to notify about import events
- ImportObserver* observer_;
-
- // Items to import from the other browser.
- int16 items_;
-
- // Utility class that does the actual import.
- scoped_refptr<ImporterHost> importer_host_;
-
- DISALLOW_COPY_AND_ASSIGN(ImportProgressDialogGtk);
-};
+#include "chrome/browser/ui/gtk/import_progress_dialog_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_IMPORT_PROGRESS_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/info_bubble_accelerators_gtk.h b/chrome/browser/gtk/info_bubble_accelerators_gtk.h
index e208ee3..6bfec81 100644
--- a/chrome/browser/gtk/info_bubble_accelerators_gtk.h
+++ b/chrome/browser/gtk/info_bubble_accelerators_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,34 +6,7 @@
#define CHROME_BROWSER_GTK_INFO_BUBBLE_ACCELERATORS_GTK_H_
#pragma once
-#include <gdk/gdktypes.h>
-#include <glib.h>
-#include <vector>
-
-#include "base/basictypes.h"
-
-struct InfoBubbleAcceleratorGtk {
- guint keyval;
- GdkModifierType modifier_type;
-};
-
-typedef std::vector<struct InfoBubbleAcceleratorGtk>
- InfoBubbleAcceleratorGtkList;
-
-// This class contains a list of accelerators that an InfoBubbleGtk
-// is expected to either catch and respond to or catch and forward to the
-// root browser window. This list is expected to be a subset of the
-// accelerators that are handled by the root browser window, but the
-// specific accelerators to be handled has not yet been fully specified. The
-// common use case for this class has code that uses it needing the entire
-// list and not needing extra processing, so the only get method gives you the
-// entire list.
-class InfoBubbleAcceleratorsGtk {
- public:
- static InfoBubbleAcceleratorGtkList GetList();
-
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(InfoBubbleAcceleratorsGtk);
-};
+#include "chrome/browser/ui/gtk/info_bubble_accelerators_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_INFO_BUBBLE_ACCELERATORS_GTK_H_
diff --git a/chrome/browser/gtk/info_bubble_gtk.h b/chrome/browser/gtk/info_bubble_gtk.h
index ead0b18..177eaef 100644
--- a/chrome/browser/gtk/info_bubble_gtk.h
+++ b/chrome/browser/gtk/info_bubble_gtk.h
@@ -1,215 +1,12 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// This is the GTK implementation of InfoBubbles. InfoBubbles are like
-// dialogs, but they point to a given element on the screen. You should call
-// InfoBubbleGtk::Show, which will create and display a bubble. The object is
-// self deleting, when the bubble is closed, you will be notified via
-// InfoBubbleGtkDelegate::InfoBubbleClosing(). Then the widgets and the
-// underlying object will be destroyed. You can also close and destroy the
-// bubble by calling Close().
-
#ifndef CHROME_BROWSER_GTK_INFO_BUBBLE_GTK_H_
#define CHROME_BROWSER_GTK_INFO_BUBBLE_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-#include <vector>
-
-#include "app/gtk_signal.h"
-#include "app/gtk_signal_registrar.h"
-#include "base/basictypes.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "gfx/point.h"
-#include "gfx/rect.h"
-
-class GtkThemeProvider;
-class InfoBubbleGtk;
-namespace gfx {
-class Rect;
-}
-
-class InfoBubbleGtkDelegate {
- public:
- // Called when the InfoBubble is closing and is about to be deleted.
- // |closed_by_escape| is true if the close is the result of pressing escape.
- virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble,
- bool closed_by_escape) = 0;
-
- // NOTE: The Views interface has CloseOnEscape, except I can't find a place
- // where it ever returns false, so we always allow you to close via escape.
-
- protected:
- virtual ~InfoBubbleGtkDelegate() {}
-};
-
-class InfoBubbleGtk : public NotificationObserver {
- public:
- // Where should the arrow be placed relative to the bubble?
- enum ArrowLocationGtk {
- // TODO(derat): Support placing arrows on the bottoms of the bubbles.
- ARROW_LOCATION_TOP_LEFT,
- ARROW_LOCATION_TOP_RIGHT,
- };
-
- // Show an InfoBubble, pointing at the area |rect| (in coordinates relative to
- // |anchor_widget|'s origin). An info bubble will try to fit on the screen,
- // so it can point to any edge of |rect|. If |rect| is NULL, the widget's
- // entire area will be used. The bubble will host the |content|
- // widget. Its arrow will be drawn at |arrow_location| if possible. The
- // |delegate| will be notified when the bubble is closed. The bubble will
- // perform an X grab of the pointer and keyboard, and will close itself if a
- // click is received outside of the bubble.
- static InfoBubbleGtk* Show(GtkWidget* anchor_widget,
- const gfx::Rect* rect,
- GtkWidget* content,
- ArrowLocationGtk arrow_location,
- bool match_system_theme,
- bool grab_input,
- GtkThemeProvider* provider,
- InfoBubbleGtkDelegate* delegate);
-
- // Close the bubble if it's open. This will delete the widgets and object,
- // so you shouldn't hold a InfoBubbleGtk pointer after calling Close().
- void Close();
-
- // NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // If the content contains widgets that can steal our pointer and keyboard
- // grabs (e.g. GtkComboBox), this method should be called after a widget
- // releases the grabs so we can reacquire them. Note that this causes a race
- // condition; another client could grab them before we do (ideally, GDK would
- // transfer the grabs back to us when the widget releases them). The window
- // is small, though, and the worst-case scenario for this seems to just be
- // that the content's widgets will appear inactive even after the user clicks
- // in them.
- void HandlePointerAndKeyboardUngrabbedByContent();
-
- private:
- enum FrameType {
- FRAME_MASK,
- FRAME_STROKE,
- };
-
- explicit InfoBubbleGtk(GtkThemeProvider* provider, bool match_system_theme);
- virtual ~InfoBubbleGtk();
-
- // Creates the InfoBubble.
- void Init(GtkWidget* anchor_widget,
- const gfx::Rect* rect,
- GtkWidget* content,
- ArrowLocationGtk arrow_location,
- bool grab_input);
-
- // Make the points for our polygon frame, either for fill (the mask), or for
- // when we stroke the border.
- static std::vector<GdkPoint> MakeFramePolygonPoints(
- ArrowLocationGtk arrow_location,
- int width,
- int height,
- FrameType type);
-
- // Get the location where the arrow should be placed (which is a function of
- // the preferred location and of the direction that the bubble should be
- // facing to fit onscreen). |arrow_x| is the X component in screen
- // coordinates of the point at which the bubble's arrow should be aimed, and
- // |width| is the bubble's width.
- static ArrowLocationGtk GetArrowLocation(
- ArrowLocationGtk preferred_location, int arrow_x, int width);
-
- // Updates |arrow_location_| based on the toplevel window's current position
- // and the bubble's size. If the |force_move_and_reshape| is true or the
- // location changes, moves and reshapes the window and returns true.
- bool UpdateArrowLocation(bool force_move_and_reshape);
-
- // Reshapes the window and updates |mask_region_|.
- void UpdateWindowShape();
-
- // Calculate the current screen position for the bubble's window (per
- // |toplevel_window_|'s position as of its most-recent ConfigureNotify event
- // and |rect_|) and move it there.
- void MoveWindow();
-
- // Restack the bubble's window directly above |toplevel_window_|.
- void StackWindow();
-
- // Sets the delegate.
- void set_delegate(InfoBubbleGtkDelegate* delegate) { delegate_ = delegate; }
-
- // Grab (in the X sense) the pointer and keyboard. This is needed to make
- // sure that we have the input focus.
- void GrabPointerAndKeyboard();
-
- CHROMEG_CALLBACK_3(InfoBubbleGtk, gboolean, OnGtkAccelerator, GtkAccelGroup*,
- GObject*, guint, GdkModifierType);
-
- CHROMEGTK_CALLBACK_1(InfoBubbleGtk, gboolean, OnExpose, GdkEventExpose*);
- CHROMEGTK_CALLBACK_1(InfoBubbleGtk, void, OnSizeAllocate, GtkAllocation*);
- CHROMEGTK_CALLBACK_1(InfoBubbleGtk, gboolean, OnButtonPress, GdkEventButton*);
- CHROMEGTK_CALLBACK_0(InfoBubbleGtk, gboolean, OnDestroy);
- CHROMEGTK_CALLBACK_0(InfoBubbleGtk, void, OnHide);
- CHROMEGTK_CALLBACK_1(InfoBubbleGtk, gboolean, OnToplevelConfigure,
- GdkEventConfigure*);
- CHROMEGTK_CALLBACK_1(InfoBubbleGtk, gboolean, OnToplevelUnmap, GdkEvent*);
- CHROMEGTK_CALLBACK_1(InfoBubbleGtk, void, OnAnchorAllocate, GtkAllocation*);
-
- // The caller supplied delegate, can be NULL.
- InfoBubbleGtkDelegate* delegate_;
-
- // Our GtkWindow popup window, we don't technically "own" the widget, since
- // it deletes us when it is destroyed.
- GtkWidget* window_;
-
- // Provides colors and stuff.
- GtkThemeProvider* theme_provider_;
-
- // The accel group attached to |window_|, to handle closing with escape.
- GtkAccelGroup* accel_group_;
-
- // The window for which we're being shown (and to which |rect_| is relative).
- // Note that it's possible for |toplevel_window_| to be NULL if the
- // window is destroyed before this object is destroyed, so it's important
- // to check for that case.
- GtkWindow* toplevel_window_;
-
- // The widget that we use to relatively position the popup window.
- GtkWidget* anchor_widget_;
-
- // Provides an offset from |anchor_widget_|'s origin for MoveWindow() to
- // use.
- gfx::Rect rect_;
-
- // The current shape of |window_| (used to test whether clicks fall in it or
- // not).
- GdkRegion* mask_region_;
-
- // Where would we prefer for the arrow be drawn relative to the bubble, and
- // where is it currently drawn?
- ArrowLocationGtk preferred_arrow_location_;
- ArrowLocationGtk current_arrow_location_;
-
- // Whether the background should match the system theme, when the system theme
- // is being used. For example, the bookmark bubble does, but extension popups
- // do not.
- bool match_system_theme_;
-
- // If true, the popup owns all X input for the duration of its existence.
- // This will usually be true, the exception being when inspecting extension
- // popups with dev tools.
- bool grab_input_;
-
- bool closed_by_escape_;
-
- NotificationRegistrar registrar_;
-
- GtkSignalRegistrar signals_;
-
- DISALLOW_COPY_AND_ASSIGN(InfoBubbleGtk);
-};
+#include "chrome/browser/ui/gtk/info_bubble_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_INFO_BUBBLE_GTK_H_
diff --git a/chrome/browser/gtk/infobar_arrow_model.h b/chrome/browser/gtk/infobar_arrow_model.h
index 331089b..3283565 100644
--- a/chrome/browser/gtk/infobar_arrow_model.h
+++ b/chrome/browser/gtk/infobar_arrow_model.h
@@ -1,78 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_GTK_INFOBAR_ARROW_MODEL_H_
#define CHROME_BROWSER_GTK_INFOBAR_ARROW_MODEL_H_
+#pragma once
-#include <gtk/gtk.h>
-
-#include "third_party/skia/include/core/SkPaint.h"
-#include "ui/base/animation/animation_delegate.h"
-#include "ui/base/animation/slide_animation.h"
-
-namespace gfx {
-class Point;
-}
-
-class InfoBar;
-
-// A helper class that tracks the state of an infobar arrow and provides a
-// utility to draw it.
-class InfoBarArrowModel : public ui::AnimationDelegate {
- public:
- class Observer {
- public:
- // The arrow has changed states; relevant widgets need to be repainted.
- virtual void PaintStateChanged() = 0;
- };
-
- explicit InfoBarArrowModel(Observer* observer);
- virtual ~InfoBarArrowModel();
-
- // An infobar has been added or removed that will affect the state of this
- // arrow.
- void ShowArrowFor(InfoBar* bar, bool animate);
-
- // Returns true if the arrow is showing at all.
- bool NeedToDrawInfoBarArrow();
-
- // Paints the arrow on |widget|, in response to |expose|, with the bottom
- // center of the arrow at |origin|, drawing a border with |border_color|.
- void Paint(GtkWidget* widget,
- GdkEventExpose* expose,
- const gfx::Point& origin,
- const GdkColor& border_color);
-
- // Overridden from ui::AnimationDelegate.
- virtual void AnimationEnded(const ui::Animation* animation);
- virtual void AnimationProgressed(const ui::Animation* animation);
- virtual void AnimationCanceled(const ui::Animation* animation);
-
- private:
- // A pair of colors used to draw a gradient for an arrow.
- struct InfoBarColors {
- SkColor top;
- SkColor bottom;
- };
-
- // Calculates the currently showing arrow color, which is a blend of the new
- // arrow color and the old arrow color.
- InfoBarColors CurrentInfoBarColors();
-
- // The view that owns us.
- Observer* observer_;
-
- // An animation that tracks the progress of the transition from the last color
- // to the new color.
- ui::SlideAnimation animation_;
-
- // The color we are animating towards.
- InfoBarColors target_colors_;
- // The last color we showed (the one we are animating away from).
- InfoBarColors previous_colors_;
-
- DISALLOW_COPY_AND_ASSIGN(InfoBarArrowModel);
-};
+#include "chrome/browser/ui/gtk/infobar_arrow_model.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_INFOBAR_ARROW_MODEL_H_
diff --git a/chrome/browser/gtk/infobar_container_gtk.h b/chrome/browser/gtk/infobar_container_gtk.h
index ba676a9..fc0ff53 100644
--- a/chrome/browser/gtk/infobar_container_gtk.h
+++ b/chrome/browser/gtk/infobar_container_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,80 +6,7 @@
#define CHROME_BROWSER_GTK_INFOBAR_CONTAINER_GTK_H_
#pragma once
-#include "base/basictypes.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-
-class InfoBar;
-class InfoBarDelegate;
-class Profile;
-class TabContents;
-
-typedef struct _GtkWidget GtkWidget;
-
-class InfoBarContainerGtk : public NotificationObserver {
- public:
- explicit InfoBarContainerGtk(Profile* profile);
- virtual ~InfoBarContainerGtk();
-
- // Get the native widget.
- GtkWidget* widget() const { return container_.get(); }
-
- // Changes the TabContents for which this container is showing InfoBars. Can
- // be NULL, in which case we will simply detach ourselves from the old tab
- // contents.
- void ChangeTabContents(TabContents* contents);
-
- // Remove the specified InfoBarDelegate from the selected TabContents. This
- // will notify us back and cause us to close the View. This is called from
- // the InfoBar's close button handler.
- void RemoveDelegate(InfoBarDelegate* delegate);
-
- // Returns the total pixel height of all infobars in this container that
- // are currently animating.
- int TotalHeightOfAnimatingBars() const;
-
- private:
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Constructs the InfoBars needed to reflect the state of the current
- // TabContents associated with this container. No animations are run during
- // this process.
- void UpdateInfoBars();
-
- // Makes the calls to show an arrow for |delegate| (either on the browser
- // toolbar or on the next infobar up).
- void ShowArrowForDelegate(InfoBarDelegate* delegate, bool animate);
-
- // Adds an InfoBar for the specified delegate, in response to a notification
- // from the selected TabContents.
- void AddInfoBar(InfoBarDelegate* delegate, bool animate);
-
- // Removes an InfoBar for the specified delegate, in response to a
- // notification from the selected TabContents. The InfoBar's disappearance
- // will be animated.
- void RemoveInfoBar(InfoBarDelegate* delegate, bool animate);
-
- // Tells the browser window about our state so it can draw the arrow
- // appropriately.
- void UpdateToolbarInfoBarState(InfoBar* infobar, bool animate);
-
- NotificationRegistrar registrar_;
-
- // The profile for the browser that hosts this InfoBarContainer.
- Profile* profile_;
-
- // The TabContents for which we are currently showing InfoBars.
- TabContents* tab_contents_;
-
- // VBox that holds the info bars.
- OwnedWidgetGtk container_;
-
- DISALLOW_COPY_AND_ASSIGN(InfoBarContainerGtk);
-};
+#include "chrome/browser/ui/gtk/infobar_container_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_INFOBAR_CONTAINER_GTK_H_
diff --git a/chrome/browser/gtk/infobar_gtk.h b/chrome/browser/gtk/infobar_gtk.h
index d0dd542..35016e6 100644
--- a/chrome/browser/gtk/infobar_gtk.h
+++ b/chrome/browser/gtk/infobar_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,139 +6,7 @@
#define CHROME_BROWSER_GTK_INFOBAR_GTK_H_
#pragma once
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/gtk/infobar_arrow_model.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/browser/gtk/slide_animator_gtk.h"
-#include "chrome/browser/tab_contents/infobar_delegate.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "third_party/skia/include/core/SkPaint.h"
-
-class CustomDrawButton;
-class GtkThemeProvider;
-class InfoBarContainerGtk;
-class InfoBarDelegate;
-
-class InfoBar : public SlideAnimatorGtk::Delegate,
- public NotificationObserver,
- public InfoBarArrowModel::Observer {
- public:
- explicit InfoBar(InfoBarDelegate* delegate);
- virtual ~InfoBar();
-
- InfoBarDelegate* delegate() const { return delegate_; }
-
- // Get the top level native GTK widget for this infobar.
- GtkWidget* widget();
-
- // Set a link to the parent InfoBarContainer. This must be set before the
- // InfoBar is added to the view hierarchy.
- void set_container(InfoBarContainerGtk* container) { container_ = container; }
-
- // Starts animating the InfoBar open.
- void AnimateOpen();
-
- // Opens the InfoBar immediately.
- void Open();
-
- // Starts animating the InfoBar closed. It will not be closed until the
- // animation has completed, when |Close| will be called.
- void AnimateClose();
-
- // Closes the InfoBar immediately and removes it from its container. Notifies
- // the delegate that it has closed. The InfoBar is deleted after this function
- // is called.
- void Close();
-
- // Returns true if the infobar is showing the its open or close animation.
- bool IsAnimating();
-
- // Returns true if the infobar is showing the close animation.
- bool IsClosing();
-
- void SetThemeProvider(GtkThemeProvider* theme_provider);
-
- // Show an arrow that originates from another infobar (i.e. a bar was added
- // below this one). If |other| is NULL, stop showing the arrow.
- void ShowArrowFor(InfoBar* other, bool animate);
-
- // InfoBarArrowModel::Observer implementation.
- virtual void PaintStateChanged();
-
- // SlideAnimatorGtk::Delegate implementation.
- virtual void Closed();
-
- // NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Retrieves the component colors for the infobar's background
- // gradient. (This varies by infobars and can be animated to change).
- virtual void GetTopColor(InfoBarDelegate::Type type,
- double* r, double* g, double *b);
- virtual void GetBottomColor(InfoBarDelegate::Type type,
- double* r, double* g, double *b);
-
- // The total height of the info bar.
- static const int kInfoBarHeight;
-
- protected:
- // Removes our associated InfoBarDelegate from the associated TabContents.
- // (Will lead to this InfoBar being closed).
- void RemoveInfoBar() const;
-
- // Adds |display_text| to the infobar. If |link_text| is not empty, it is
- // rendered as a hyperlink and inserted into |display_text| at |link_offset|,
- // or right aligned in the infobar if |link_offset| is |npos|. If a link is
- // supplied, |link_callback| must not be null. It will be invoked on click.
- void AddLabelWithInlineLink(const string16& display_text,
- const string16& link_text,
- size_t link_offset,
- GCallback callback);
-
- // Adds |display_text| to the infobar. If |link_text| is not empty, it is
- // right aligned in the infobar.
- void AddLabelAndLink(const string16& display_text,
- const string16& link_text,
- GCallback callback);
- // The top level widget of the infobar.
- scoped_ptr<SlideAnimatorGtk> slide_widget_;
-
- // The second highest widget in the hierarchy (after the slide widget).
- GtkWidget* bg_box_;
-
- // The hbox that holds infobar elements (button, text, icon, etc.).
- GtkWidget* hbox_;
-
- // The x that closes the bar.
- scoped_ptr<CustomDrawButton> close_button_;
-
- // The InfoBar's container
- InfoBarContainerGtk* container_;
-
- // The InfoBar's delegate.
- InfoBarDelegate* delegate_;
-
- // The theme provider, used for getting border colors.
- GtkThemeProvider* theme_provider_;
-
- // The model that tracks the paint state of the arrow for the infobar
- // below this one (if it exists).
- InfoBarArrowModel arrow_model_;
-
- NotificationRegistrar registrar_;
-
- private:
- CHROMEGTK_CALLBACK_0(InfoBar, void, OnCloseButton);
- CHROMEGTK_CALLBACK_1(InfoBar, gboolean, OnBackgroundExpose, GdkEventExpose*);
-
- void UpdateBorderColor();
-
- DISALLOW_COPY_AND_ASSIGN(InfoBar);
-};
+#include "chrome/browser/ui/gtk/infobar_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_INFOBAR_GTK_H_
diff --git a/chrome/browser/gtk/instant_confirm_dialog_gtk.h b/chrome/browser/gtk/instant_confirm_dialog_gtk.h
index 29a184e..7b42ec8 100644
--- a/chrome/browser/gtk/instant_confirm_dialog_gtk.h
+++ b/chrome/browser/gtk/instant_confirm_dialog_gtk.h
@@ -1,31 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_GTK_INSTANT_CONFIRM_DIALOG_GTK_H_
#define CHROME_BROWSER_GTK_INSTANT_CONFIRM_DIALOG_GTK_H_
+#pragma once
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-
-class Profile;
-typedef struct _GtkWindow GtkWindow;
-
-// A dialog that explains some of the privacy implications surrounding instant.
-// Shown when the user enables instant for the first time.
-class InstantConfirmDialogGtk {
- public:
- InstantConfirmDialogGtk(GtkWindow* parent, Profile* profile);
- ~InstantConfirmDialogGtk();
-
- private:
- CHROMEGTK_CALLBACK_1(InstantConfirmDialogGtk, void, OnDialogResponse, int);
- CHROMEGTK_CALLBACK_0(InstantConfirmDialogGtk, void, OnLinkButtonClicked);
-
- GtkWidget* dialog_;
- Profile* profile_;
-
- DISALLOW_COPY_AND_ASSIGN(InstantConfirmDialogGtk);
-};
+#include "chrome/browser/ui/gtk/instant_confirm_dialog_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_INSTANT_CONFIRM_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/js_modal_dialog_gtk.h b/chrome/browser/gtk/js_modal_dialog_gtk.h
index a6a132b9..f3708c7 100644
--- a/chrome/browser/gtk/js_modal_dialog_gtk.h
+++ b/chrome/browser/gtk/js_modal_dialog_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,37 +6,7 @@
#define CHROME_BROWSER_GTK_JS_MODAL_DIALOG_GTK_H_
#pragma once
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
-#include "gfx/native_widget_types.h"
-
-typedef struct _GtkWidget GtkWidget;
-
-class JavaScriptAppModalDialog;
-
-class JSModalDialogGtk : public NativeAppModalDialog {
- public:
- JSModalDialogGtk(JavaScriptAppModalDialog* dialog,
- gfx::NativeWindow parent_window);
- virtual ~JSModalDialogGtk();
-
- // Overridden from NativeAppModalDialog:
- virtual int GetAppModalDialogButtons() const;
- virtual void ShowAppModalDialog();
- virtual void ActivateAppModalDialog();
- virtual void CloseAppModalDialog();
- virtual void AcceptAppModalDialog();
- virtual void CancelAppModalDialog();
-
- private:
- CHROMEGTK_CALLBACK_1(JSModalDialogGtk, void, OnDialogResponse, int);
-
- scoped_ptr<JavaScriptAppModalDialog> dialog_;
- GtkWidget* gtk_dialog_;
-
- DISALLOW_COPY_AND_ASSIGN(JSModalDialogGtk);
-};
+#include "chrome/browser/ui/gtk/js_modal_dialog_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_JS_MODAL_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/keyword_editor_view.h b/chrome/browser/gtk/keyword_editor_view.h
index 451d635..eb459a6 100644
--- a/chrome/browser/gtk/keyword_editor_view.h
+++ b/chrome/browser/gtk/keyword_editor_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,162 +6,7 @@
#define CHROME_BROWSER_GTK_KEYWORD_EDITOR_VIEW_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/table_model_observer.h"
-#include "base/basictypes.h"
-#include "base/gtest_prod_util.h"
-#include "base/scoped_ptr.h"
-#include "base/string16.h"
-#include "chrome/browser/search_engines/edit_search_engine_controller.h"
-#include "chrome/browser/search_engines/template_url_model_observer.h"
-
-class AccessibleWidgetHelper;
-class KeywordEditorController;
-class Profile;
-class TemplateURLTableModel;
-
-class KeywordEditorView : public TableModelObserver,
- public TemplateURLModelObserver,
- public EditSearchEngineControllerDelegate {
- public:
- virtual ~KeywordEditorView();
-
- // Create (if necessary) and show the keyword editor window.
- static void Show(Profile* profile);
-
- // Overriden from EditSearchEngineControllerDelegate.
- virtual void OnEditedKeyword(const TemplateURL* template_url,
- const string16& title,
- const string16& keyword,
- const std::string& url);
- private:
- // Column ids for |list_store_|.
- enum {
- COL_FAVICON,
- COL_TITLE,
- COL_KEYWORD,
- COL_IS_HEADER,
- COL_IS_SEPARATOR,
- COL_WEIGHT,
- COL_WEIGHT_SET,
- COL_COUNT,
- };
-
- explicit KeywordEditorView(Profile* profile);
- void Init();
-
- // Enable buttons based on selection state.
- void EnableControls();
-
- // Set the column values for |row| of |table_model_| in the |list_store_| at
- // |iter|.
- void SetColumnValues(int row, GtkTreeIter* iter);
-
- // Get the row number in the GtkListStore corresponding to |model_row|.
- int GetListStoreRowForModelRow(int model_row) const;
-
- // Get the row number in the TemplateURLTableModel corresponding to |path|.
- int GetModelRowForPath(GtkTreePath* path) const;
-
- // Get the row number in the TemplateURLTableModel corresponding to |iter|.
- int GetModelRowForIter(GtkTreeIter* iter) const;
-
- // Get the row number in the TemplateURLTableModel of the current selection,
- // or -1 if no row is selected.
- int GetSelectedModelRow() const;
-
- // Select the row in the |tree_| corresponding to |model_row|.
- void SelectModelRow(int model_row);
-
- // Add the values from |row| of |table_model_|.
- void AddNodeToList(int row);
-
- // TableModelObserver implementation.
- virtual void OnModelChanged();
- virtual void OnItemsChanged(int start, int length);
- virtual void OnItemsAdded(int start, int length);
- virtual void OnItemsRemoved(int start, int length);
-
- // TemplateURLModelObserver notification.
- virtual void OnTemplateURLModelChanged();
-
- // Callback for window destruction.
- static void OnWindowDestroy(GtkWidget* widget, KeywordEditorView* window);
-
- // Callback for dialog buttons.
- static void OnResponse(GtkDialog* dialog, int response_id,
- KeywordEditorView* window);
-
- // Callback checking whether a row should be drawn as a separator.
- static gboolean OnCheckRowIsSeparator(GtkTreeModel* model,
- GtkTreeIter* iter,
- gpointer user_data);
-
- // Callback checking whether a row may be selected. We use some rows in the
- // table as headers/separators for the groups, which should not be selectable.
- static gboolean OnSelectionFilter(GtkTreeSelection* selection,
- GtkTreeModel* model,
- GtkTreePath* path,
- gboolean path_currently_selected,
- gpointer user_data);
-
- // Callback for when user selects something.
- static void OnSelectionChanged(GtkTreeSelection* selection,
- KeywordEditorView* editor);
-
- // Callbacks for user actions modifying the table.
- static void OnRowActivated(GtkTreeView* tree_view,
- GtkTreePath* path,
- GtkTreeViewColumn* column,
- KeywordEditorView* editor);
- static void OnAddButtonClicked(GtkButton* button,
- KeywordEditorView* editor);
- static void OnEditButtonClicked(GtkButton* button,
- KeywordEditorView* editor);
- static void OnRemoveButtonClicked(GtkButton* button,
- KeywordEditorView* editor);
- static void OnMakeDefaultButtonClicked(GtkButton* button,
- KeywordEditorView* editor);
-
- // The table listing the search engines.
- GtkWidget* tree_;
- GtkListStore* list_store_;
- GtkTreeSelection* selection_;
-
- // Buttons for acting on the table.
- GtkWidget* add_button_;
- GtkWidget* edit_button_;
- GtkWidget* remove_button_;
- GtkWidget* make_default_button_;
-
- // The containing dialog.
- GtkWidget* dialog_;
-
- // The profile.
- Profile* profile_;
-
- scoped_ptr<KeywordEditorController> controller_;
-
- TemplateURLTableModel* table_model_;
-
- // We store our own index of the start of the second group within the model,
- // as when OnItemsRemoved is called the value in the model is already updated
- // but we need the old value to know which row to remove from the
- // |list_store_|.
- int model_second_group_index_;
-
- // Helper object to manage accessibility metadata.
- scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
-
- friend class KeywordEditorViewTest;
- FRIEND_TEST_ALL_PREFIXES(KeywordEditorViewTest, Empty);
- FRIEND_TEST_ALL_PREFIXES(KeywordEditorViewTest, Add);
- FRIEND_TEST_ALL_PREFIXES(KeywordEditorViewTest, MakeDefault);
- FRIEND_TEST_ALL_PREFIXES(KeywordEditorViewTest, Remove);
- FRIEND_TEST_ALL_PREFIXES(KeywordEditorViewTest, Edit);
-
- DISALLOW_COPY_AND_ASSIGN(KeywordEditorView);
-};
+#include "chrome/browser/ui/gtk/keyword_editor_view.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_KEYWORD_EDITOR_VIEW_H_
diff --git a/chrome/browser/gtk/location_bar_view_gtk.h b/chrome/browser/gtk/location_bar_view_gtk.h
index f1b1534..a9d6e75 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.h
+++ b/chrome/browser/gtk/location_bar_view_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,430 +6,7 @@
#define CHROME_BROWSER_GTK_LOCATION_BAR_VIEW_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <map>
-#include <string>
-
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "base/scoped_vector.h"
-#include "chrome/browser/autocomplete/autocomplete_edit.h"
-#include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h"
-#include "chrome/browser/extensions/extension_context_menu_model.h"
-#include "chrome/browser/extensions/image_loading_tracker.h"
-#include "chrome/browser/first_run/first_run.h"
-#include "chrome/browser/gtk/info_bubble_gtk.h"
-#include "chrome/browser/gtk/menu_gtk.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/browser/ui/omnibox/location_bar.h"
-#include "chrome/common/content_settings_types.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "chrome/common/page_transition_types.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "webkit/glue/window_open_disposition.h"
-
-class AutocompleteEditViewGtk;
-class Browser;
-class CommandUpdater;
-class ContentSettingImageModel;
-class ContentSettingBubbleGtk;
-class ExtensionAction;
-class GtkThemeProvider;
-class Profile;
-class SkBitmap;
-class TabContents;
-class ToolbarModel;
-
-class LocationBarViewGtk : public AutocompleteEditController,
- public LocationBar,
- public LocationBarTesting,
- public NotificationObserver {
- public:
- explicit LocationBarViewGtk(Browser* browser);
- virtual ~LocationBarViewGtk();
-
- void Init(bool popup_window_mode);
-
- void SetProfile(Profile* profile);
-
- // Returns the widget the caller should host. You must call Init() first.
- GtkWidget* widget() { return hbox_.get(); }
-
- // Returns the widget the page info bubble should point to.
- GtkWidget* location_icon_widget() const { return location_icon_image_; }
-
- // Returns the widget the extension installed bubble should point to.
- GtkWidget* location_entry_widget() const { return entry_box_; }
-
- // Returns the current TabContents.
- TabContents* GetTabContents() const;
-
- // Sets |preview_enabled| for the PageActionViewGtk associated with this
- // |page_action|. If |preview_enabled| is true, the view will display the
- // page action's icon even though it has not been activated by the extension.
- // This is used by the ExtensionInstalledBubbleGtk to preview what the icon
- // will look like for the user upon installation of the extension.
- void SetPreviewEnabledPageAction(ExtensionAction *page_action,
- bool preview_enabled);
-
- // Retrieves the GtkWidget which is associated with PageActionView
- // corresponding to |page_action|.
- GtkWidget* GetPageActionWidget(ExtensionAction* page_action);
-
- // Updates the location bar. We also reset the bar's permanent text and
- // security style, and, if |tab_for_state_restoring| is non-NULL, also
- // restore saved state that the tab holds.
- void Update(const TabContents* tab_for_state_restoring);
-
- // Show the bookmark bubble.
- void ShowStarBubble(const GURL& url, bool newly_boomkarked);
-
- // Set the starred state of the bookmark star.
- void SetStarred(bool starred);
-
- // Implement the AutocompleteEditController interface.
- virtual void OnAutocompleteWillClosePopup();
- virtual void OnAutocompleteLosingFocus(gfx::NativeView view_gaining_focus);
- virtual void OnAutocompleteWillAccept();
- // For this implementation, the parameter is ignored.
- virtual bool OnCommitSuggestedText(const std::wstring& typed_text);
- virtual bool AcceptCurrentInstantPreview();
- virtual void OnSetSuggestedSearchText(const string16& suggested_text);
- virtual void OnPopupBoundsChanged(const gfx::Rect& bounds);
- virtual void OnAutocompleteAccept(const GURL& url,
- WindowOpenDisposition disposition,
- PageTransition::Type transition,
- const GURL& alternate_nav_url);
- virtual void OnChanged();
- virtual void OnSelectionBoundsChanged();
- virtual void OnKillFocus();
- virtual void OnSetFocus();
- virtual void OnInputInProgress(bool in_progress);
- virtual SkBitmap GetFavIcon() const;
- virtual std::wstring GetTitle() const;
-
- // Implement the LocationBar interface.
- virtual void ShowFirstRunBubble(FirstRun::BubbleType bubble_type);
- virtual void SetSuggestedText(const string16& text);
- virtual std::wstring GetInputString() const;
- virtual WindowOpenDisposition GetWindowOpenDisposition() const;
- virtual PageTransition::Type GetPageTransition() const;
- virtual void AcceptInput();
- virtual void FocusLocation(bool select_all);
- virtual void FocusSearch();
- virtual void UpdateContentSettingsIcons();
- virtual void UpdatePageActions();
- virtual void InvalidatePageActions();
- virtual void SaveStateToContents(TabContents* contents);
- virtual void Revert();
- virtual const AutocompleteEditView* location_entry() const;
- virtual AutocompleteEditView* location_entry();
- virtual LocationBarTesting* GetLocationBarForTesting();
-
- // Implement the LocationBarTesting interface.
- virtual int PageActionCount();
- virtual int PageActionVisibleCount();
- virtual ExtensionAction* GetPageAction(size_t index);
- virtual ExtensionAction* GetVisiblePageAction(size_t index);
- virtual void TestPageActionPressed(size_t index);
-
- // Implement the NotificationObserver interface.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Edit background color.
- static const GdkColor kBackgroundColor;
-
- private:
- class ContentSettingImageViewGtk : public InfoBubbleGtkDelegate {
- public:
- ContentSettingImageViewGtk(ContentSettingsType content_type,
- const LocationBarViewGtk* parent,
- Profile* profile);
- virtual ~ContentSettingImageViewGtk();
-
- GtkWidget* widget() { return event_box_.get(); }
-
- void set_profile(Profile* profile) { profile_ = profile; }
-
- bool IsVisible() { return GTK_WIDGET_VISIBLE(widget()); }
- void UpdateFromTabContents(TabContents* tab_contents);
-
- private:
- CHROMEGTK_CALLBACK_1(ContentSettingImageViewGtk, gboolean, OnButtonPressed,
- GdkEvent*);
-
- // InfoBubbleDelegate overrides:
- virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble,
- bool closed_by_escape);
-
- scoped_ptr<ContentSettingImageModel> content_setting_image_model_;
-
- // The widgets for this content settings view.
- OwnedWidgetGtk event_box_;
- OwnedWidgetGtk image_;
-
- // The owning LocationBarViewGtk.
- const LocationBarViewGtk* parent_;
-
- // The currently active profile.
- Profile* profile_;
-
- // The currently shown info bubble if any.
- ContentSettingBubbleGtk* info_bubble_;
-
- DISALLOW_COPY_AND_ASSIGN(ContentSettingImageViewGtk);
- };
-
- class PageActionViewGtk : public ImageLoadingTracker::Observer,
- public ExtensionContextMenuModel::PopupDelegate {
- public:
- PageActionViewGtk(
- LocationBarViewGtk* owner, Profile* profile,
- ExtensionAction* page_action);
- virtual ~PageActionViewGtk();
-
- GtkWidget* widget() { return event_box_.get(); }
-
- ExtensionAction* page_action() { return page_action_; }
-
- void set_preview_enabled(bool preview_enabled) {
- preview_enabled_ = preview_enabled;
- }
-
- bool IsVisible() { return GTK_WIDGET_VISIBLE(widget()); }
-
- // Called to notify the PageAction that it should determine whether to be
- // visible or hidden. |contents| is the TabContents that is active, |url|
- // is the current page URL.
- void UpdateVisibility(TabContents* contents, GURL url);
-
- // A callback from ImageLoadingTracker for when the image has loaded.
- virtual void OnImageLoaded(
- SkBitmap* image, ExtensionResource resource, int index);
-
- // Simulate left mouse click on the page action button.
- void TestActivatePageAction();
-
- // Overridden from ExtensionContextMenuModel::PopupDelegate:
- virtual void InspectPopup(ExtensionAction* action);
-
- private:
- // Show the popup for this page action. If |devtools| is true, show it
- // with a debugger window attached. Returns true if a popup was shown.
- bool ShowPopup(bool devtools);
-
- CHROMEGTK_CALLBACK_1(PageActionViewGtk, gboolean, OnButtonPressed,
- GdkEvent*);
- CHROMEGTK_CALLBACK_1(PageActionViewGtk, gboolean, OnExposeEvent,
- GdkEventExpose*);
-
- // The location bar view that owns us.
- LocationBarViewGtk* owner_;
-
- // The current profile (not owned by us).
- Profile* profile_;
-
- // The PageAction that this view represents. The PageAction is not owned by
- // us, it resides in the extension of this particular profile.
- ExtensionAction* page_action_;
-
- // A cache of all the different icon paths associated with this page action.
- typedef std::map<std::string, GdkPixbuf*> PixbufMap;
- PixbufMap pixbufs_;
-
- // A cache of the last dynamically generated bitmap and the pixbuf that
- // corresponds to it. We keep track of both so we can free old pixbufs as
- // their icons are replaced.
- SkBitmap last_icon_skbitmap_;
- GdkPixbuf* last_icon_pixbuf_;
-
- // The object that is waiting for the image loading to complete
- // asynchronously.
- ImageLoadingTracker tracker_;
-
- // The widgets for this page action.
- OwnedWidgetGtk event_box_;
- OwnedWidgetGtk image_;
-
- // The tab id we are currently showing the icon for.
- int current_tab_id_;
-
- // The URL we are currently showing the icon for.
- GURL current_url_;
-
- // This is used for post-install visual feedback. The page_action icon
- // is briefly shown even if it hasn't been enabled by its extension.
- bool preview_enabled_;
-
- // The context menu view and model for this extension action.
- scoped_ptr<MenuGtk> context_menu_;
- scoped_refptr<ExtensionContextMenuModel> context_menu_model_;
-
- DISALLOW_COPY_AND_ASSIGN(PageActionViewGtk);
- };
- friend class PageActionViewGtk;
-
- // Creates, initializes, and packs the location icon, EV certificate name,
- // and optional border.
- void BuildSiteTypeArea();
-
- // Enable or disable the location icon/EV certificate as a drag source for
- // the URL.
- void SetSiteTypeDragSource();
-
- GtkWidget* site_type_area() { return site_type_alignment_; }
-
- CHROMEGTK_CALLBACK_1(LocationBarViewGtk, gboolean, HandleExpose,
- GdkEventExpose*);
- CHROMEGTK_CALLBACK_1(LocationBarViewGtk, gboolean, OnIconReleased,
- GdkEventButton*);
- CHROMEGTK_CALLBACK_4(LocationBarViewGtk, void, OnIconDragData,
- GdkDragContext*, GtkSelectionData*, guint, guint);
- CHROMEGTK_CALLBACK_1(LocationBarViewGtk, void, OnIconDragBegin,
- GdkDragContext*);
- CHROMEGTK_CALLBACK_1(LocationBarViewGtk, void, OnIconDragEnd,
- GdkDragContext*);
- CHROMEGTK_CALLBACK_1(LocationBarViewGtk, void, OnHboxSizeAllocate,
- GtkAllocation*);
- CHROMEGTK_CALLBACK_1(LocationBarViewGtk, void, OnEntryBoxSizeAllocate,
- GtkAllocation*);
- CHROMEGTK_CALLBACK_1(LocationBarViewGtk, gboolean, OnStarButtonPress,
- GdkEventButton*);
-
- // Updates the site type area: changes the icon and shows/hides the EV
- // certificate information.
- void UpdateSiteTypeArea();
-
- // Updates the maximum size of the EV certificate label.
- void UpdateEVCertificateLabelSize();
-
- // Sets the text that should be displayed in the info label and its associated
- // tooltip text. Call with an empty string if the info label should be
- // hidden.
- void SetInfoText();
-
- // Set the keyword text for the Search BLAH: keyword box.
- void SetKeywordLabel(const std::wstring& keyword);
-
- // Set the keyword text for the "Press tab to search BLAH" hint box.
- void SetKeywordHintLabel(const std::wstring& keyword);
-
- void ShowFirstRunBubbleInternal(FirstRun::BubbleType bubble_type);
-
- // Show or hide |tab_to_search_box_| and |tab_to_search_hint_| according to
- // the value of |show_selected_keyword_|, |show_keyword_hint_|, and the
- // available horizontal space in the location bar.
- void AdjustChildrenVisibility();
-
- // Build the star icon.
- void CreateStarButton();
-
- // Update the star icon after it is toggled or the theme changes.
- void UpdateStarIcon();
-
- // Returns true if we should only show the URL and none of the extras like
- // the star button or page actions.
- bool ShouldOnlyShowLocation();
-
- // The outermost widget we want to be hosted.
- OwnedWidgetGtk hbox_;
-
- // Star button.
- OwnedWidgetGtk star_;
- GtkWidget* star_image_;
- bool starred_;
-
- // An icon to the left of the address bar.
- GtkWidget* site_type_alignment_;
- GtkWidget* site_type_event_box_;
- GtkWidget* location_icon_image_;
- GtkWidget* drag_icon_;
- bool enable_location_drag_;
- // TODO(pkasting): Split this label off and move the rest of the items to the
- // left of the address bar.
- GtkWidget* security_info_label_;
-
- // Content setting icons.
- OwnedWidgetGtk content_setting_hbox_;
- ScopedVector<ContentSettingImageViewGtk> content_setting_views_;
-
- // Extension page action icons.
- OwnedWidgetGtk page_action_hbox_;
- ScopedVector<PageActionViewGtk> page_action_views_;
-
- // The widget that contains our tab hints and the location bar.
- GtkWidget* entry_box_;
-
- // Area on the left shown when in tab to search mode.
- GtkWidget* tab_to_search_box_;
- GtkWidget* tab_to_search_magnifier_;
- GtkWidget* tab_to_search_full_label_;
- GtkWidget* tab_to_search_partial_label_;
-
- // Hint to user that they can tab-to-search by hitting tab.
- GtkWidget* tab_to_search_hint_;
- GtkWidget* tab_to_search_hint_leading_label_;
- GtkWidget* tab_to_search_hint_icon_;
- GtkWidget* tab_to_search_hint_trailing_label_;
-
- scoped_ptr<AutocompleteEditViewGtk> location_entry_;
-
- // Alignment used to wrap |location_entry_|.
- GtkWidget* location_entry_alignment_;
-
- Profile* profile_;
- CommandUpdater* command_updater_;
- ToolbarModel* toolbar_model_;
- Browser* browser_;
-
- // When we get an OnAutocompleteAccept notification from the autocomplete
- // edit, we save the input string so we can give it back to the browser on
- // the LocationBar interface via GetInputString().
- std::wstring location_input_;
-
- // The user's desired disposition for how their input should be opened.
- WindowOpenDisposition disposition_;
-
- // The transition type to use for the navigation.
- PageTransition::Type transition_;
-
- // Used to schedule a task for the first run info bubble.
- ScopedRunnableMethodFactory<LocationBarViewGtk> first_run_bubble_;
-
- // When true, the location bar view is read only and also is has a slightly
- // different presentation (font size / color). This is used for popups.
- bool popup_window_mode_;
-
- // Provides colors and rendering mode.
- GtkThemeProvider* theme_provider_;
-
- NotificationRegistrar registrar_;
-
- // Width of the main |hbox_|. Used to properly elide the EV certificate.
- int hbox_width_;
-
- // Width of the hbox that holds |tab_to_search_box_|, |location_entry_| and
- // |tab_to_search_hint_|.
- int entry_box_width_;
-
- // Indicate if |tab_to_search_box_| should be shown.
- bool show_selected_keyword_;
-
- // Indicate if |tab_to_search_hint_| should be shown.
- bool show_keyword_hint_;
-
- // The last search keyword that was shown via the |tab_to_search_box_|.
- std::wstring last_keyword_;
-
- // True if we should update the instant controller when the edit text changes.
- bool update_instant_;
-
- DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk);
-};
+#include "chrome/browser/ui/gtk/location_bar_view_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_LOCATION_BAR_VIEW_GTK_H_
diff --git a/chrome/browser/gtk/menu_bar_helper.h b/chrome/browser/gtk/menu_bar_helper.h
index e6f0ef4..32214e6 100644
--- a/chrome/browser/gtk/menu_bar_helper.h
+++ b/chrome/browser/gtk/menu_bar_helper.h
@@ -1,78 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-//
-// This class replicates some menubar behaviors that are tricky to get right.
-// It is used to create a more native feel for the bookmark bar.
#ifndef CHROME_BROWSER_GTK_MENU_BAR_HELPER_H_
#define CHROME_BROWSER_GTK_MENU_BAR_HELPER_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <vector>
-
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-
-class GtkSignalRegistrar;
-
-class MenuBarHelper {
- public:
- class Delegate {
- public:
- virtual ~Delegate() {}
-
- // Called when a the menu for a button ought to be triggered.
- virtual void PopupForButton(GtkWidget* button) = 0;
- virtual void PopupForButtonNextTo(GtkWidget* button,
- GtkMenuDirectionType dir) = 0;
- };
-
- // |delegate| cannot be null.
- explicit MenuBarHelper(Delegate* delegate);
- virtual ~MenuBarHelper();
-
- // Must be called whenever a button's menu starts showing. It triggers the
- // MenuBarHelper to start listening for certain events.
- void MenuStartedShowing(GtkWidget* button, GtkWidget* menu);
-
- // Add |button| to the set of buttons we care about.
- void Add(GtkWidget* button);
-
- // Remove |button| from the set of buttons we care about.
- void Remove(GtkWidget* button);
-
- // Clear all buttons from the set.
- void Clear();
-
- private:
- CHROMEGTK_CALLBACK_0(MenuBarHelper, void, OnMenuHiddenOrDestroyed);
- CHROMEGTK_CALLBACK_1(MenuBarHelper, gboolean, OnMenuMotionNotify,
- GdkEventMotion*);
- CHROMEGTK_CALLBACK_1(MenuBarHelper, void, OnMenuMoveCurrent,
- GtkMenuDirectionType);
-
- // The buttons for which we pop up menus. We do not own these, or even add
- // refs to them.
- std::vector<GtkWidget*> buttons_;
-
- // The button that is currently showing a menu, or NULL.
- GtkWidget* button_showing_menu_;
-
- // The highest level menu that is currently showing, or NULL.
- GtkWidget* showing_menu_;
-
- // All the submenus of |showing_menu_|. We connect to motion events on all
- // of them.
- std::vector<GtkWidget*> submenus_;
-
- // Signal handlers that are attached only between the "show" and "hide" events
- // for the menu.
- scoped_ptr<GtkSignalRegistrar> signal_handlers_;
-
- Delegate* delegate_;
-};
+#include "chrome/browser/ui/gtk/menu_bar_helper.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_MENU_BAR_HELPER_H_
diff --git a/chrome/browser/gtk/menu_gtk.h b/chrome/browser/gtk/menu_gtk.h
index 7e4185b..c88345f 100644
--- a/chrome/browser/gtk/menu_gtk.h
+++ b/chrome/browser/gtk/menu_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,194 +6,7 @@
#define CHROME_BROWSER_GTK_MENU_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <string>
-#include <vector>
-
-#include "app/gtk_signal.h"
-#include "base/task.h"
-#include "gfx/point.h"
-
-class SkBitmap;
-
-namespace menus {
-class ButtonMenuItemModel;
-class MenuModel;
-}
-
-class MenuGtk {
- public:
- // Delegate class that lets another class control the status of the menu.
- class Delegate {
- public:
- virtual ~Delegate() { }
-
- // Called before a command is executed. This exists for the case where a
- // model is handling the actual execution of commands, but the delegate
- // still needs to know that some command got executed. This is called before
- // and not after the command is executed because its execution may delete
- // the menu and/or the delegate.
- virtual void CommandWillBeExecuted() {}
-
- // Called when the menu stops showing. This will be called before
- // ExecuteCommand if the user clicks an item, but will also be called when
- // the user clicks away from the menu.
- virtual void StoppedShowing() {}
-
- // Return true if we should override the "gtk-menu-images" system setting
- // when showing image menu items for this menu.
- virtual bool AlwaysShowIconForCmd(int command_id) const { return false; }
-
- // Returns a tinted image used in button in a menu.
- virtual GtkIconSet* GetIconSetForId(int idr) { return NULL; }
-
- // Returns an icon for the menu item, if available.
- virtual GtkWidget* GetImageForCommandId(int command_id) const;
-
- static GtkWidget* GetDefaultImageForCommandId(int command_id);
- };
-
- MenuGtk(MenuGtk::Delegate* delegate, menus::MenuModel* model);
- ~MenuGtk();
-
- // Initialize GTK signal handlers.
- void ConnectSignalHandlers();
-
- // These methods are used to build the menu dynamically. The return value
- // is the new menu item.
- GtkWidget* AppendMenuItemWithLabel(int command_id, const std::string& label);
- GtkWidget* AppendMenuItemWithIcon(int command_id, const std::string& label,
- const SkBitmap& icon);
- GtkWidget* AppendCheckMenuItemWithLabel(int command_id,
- const std::string& label);
- GtkWidget* AppendSeparator();
- GtkWidget* AppendMenuItem(int command_id, GtkWidget* menu_item);
- GtkWidget* AppendMenuItemToMenu(int index,
- menus::MenuModel* model,
- GtkWidget* menu_item,
- GtkWidget* menu,
- bool connect_to_activate);
-
- // Displays the menu. |timestamp| is the time of activation. The popup is
- // statically positioned at |widget|.
- void Popup(GtkWidget* widget, gint button_type, guint32 timestamp);
-
- // Displays the menu using the button type and timestamp of |event|. The popup
- // is statically positioned at |widget|.
- void Popup(GtkWidget* widget, GdkEvent* event);
-
- // Displays the menu as a context menu, i.e. at the current cursor location.
- // |event_time| is the time of the event that triggered the menu's display.
- void PopupAsContext(guint32 event_time);
-
- // Displays the menu at the given coords. |point| is intentionally not const.
- void PopupAsContextAt(guint32 event_time, gfx::Point point);
-
- // Displays the menu as a context menu for the passed status icon.
- void PopupAsContextForStatusIcon(guint32 event_time, guint32 button,
- GtkStatusIcon* icon);
-
- // Displays the menu following a keyboard event (such as selecting |widget|
- // and pressing "enter").
- void PopupAsFromKeyEvent(GtkWidget* widget);
-
- // Closes the menu.
- void Cancel();
-
- // Repositions the menu to be right under the button. Alignment is set as
- // object data on |void_widget| with the tag "left_align". If "left_align"
- // is true, it aligns the left side of the menu with the left side of the
- // button. Otherwise it aligns the right side of the menu with the right side
- // of the button. Public since some menus have odd requirements that don't
- // belong in a public class.
- static void WidgetMenuPositionFunc(GtkMenu* menu,
- int* x,
- int* y,
- gboolean* push_in,
- void* void_widget);
-
- // Positions the menu to appear at the gfx::Point represented by |userdata|.
- static void PointMenuPositionFunc(GtkMenu* menu,
- int* x,
- int* y,
- gboolean* push_in,
- gpointer userdata);
-
- GtkWidget* widget() const { return menu_; }
-
- // Updates all the enabled/checked states and the dynamic labels.
- void UpdateMenu();
-
- private:
- // Builds a GtkImageMenuItem.
- GtkWidget* BuildMenuItemWithImage(const std::string& label,
- const SkBitmap& icon);
-
- GtkWidget* BuildMenuItemWithImage(const std::string& label,
- GtkWidget* image);
-
- GtkWidget* BuildMenuItemWithLabel(const std::string& label,
- int command_id);
-
- // A function that creates a GtkMenu from |model_|.
- void BuildMenuFromModel();
- // Implementation of the above; called recursively.
- void BuildSubmenuFromModel(menus::MenuModel* model, GtkWidget* menu);
- // Builds a menu item with buttons in it from the data in the model.
- GtkWidget* BuildButtomMenuItem(menus::ButtonMenuItemModel* model,
- GtkWidget* menu);
-
- void ExecuteCommand(menus::MenuModel* model, int id);
-
- // Callback for when a menu item is clicked.
- CHROMEGTK_CALLBACK_0(MenuGtk, void, OnMenuItemActivated);
-
- // Called when one of the buttons are pressed.
- CHROMEGTK_CALLBACK_1(MenuGtk, void, OnMenuButtonPressed, int);
-
- // Called to maybe activate a button if that button isn't supposed to dismiss
- // the menu.
- CHROMEGTK_CALLBACK_1(MenuGtk, gboolean, OnMenuTryButtonPressed, int);
-
- // Updates all the menu items' state.
- CHROMEGTK_CALLBACK_0(MenuGtk, void, OnMenuShow);
-
- // Sets the activating widget back to a normal appearance.
- CHROMEGTK_CALLBACK_0(MenuGtk, void, OnMenuHidden);
-
- // Sets the enable/disabled state and dynamic labels on our menu items.
- static void SetButtonItemInfo(GtkWidget* button, gpointer userdata);
-
- // Sets the check mark, enabled/disabled state and dynamic labels on our menu
- // items.
- static void SetMenuItemInfo(GtkWidget* widget, void* raw_menu);
-
- // Queries this object about the menu state.
- MenuGtk::Delegate* delegate_;
-
- // If non-NULL, the MenuModel that we use to populate and control the GTK
- // menu (overriding the delegate as a controller).
- menus::MenuModel* model_;
-
- // For some menu items, we want to show the accelerator, but not actually
- // explicitly handle it. To this end we connect those menu items' accelerators
- // to this group, but don't attach this group to any top level window.
- GtkAccelGroup* dummy_accel_group_;
-
- // gtk_menu_popup() does not appear to take ownership of popup menus, so
- // MenuGtk explicitly manages the lifetime of the menu.
- GtkWidget* menu_;
-
- // True when we should ignore "activate" signals. Used to prevent
- // menu items from getting activated when we are setting up the
- // menu.
- static bool block_activation_;
-
- // We must free these at shutdown.
- std::vector<MenuGtk*> submenus_we_own_;
-
- ScopedRunnableMethodFactory<MenuGtk> factory_;
-};
+#include "chrome/browser/ui/gtk/menu_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_MENU_GTK_H_
diff --git a/chrome/browser/gtk/nine_box.h b/chrome/browser/gtk/nine_box.h
index ecdf44a..bcd2f62 100644
--- a/chrome/browser/gtk/nine_box.h
+++ b/chrome/browser/gtk/nine_box.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,56 +6,7 @@
#define CHROME_BROWSER_GTK_NINE_BOX_H_
#pragma once
-#include <gtk/gtk.h>
-
-// A NineBox manages a set of source images representing a 3x3 grid, where
-// non-corner images can be tiled to make a larger image. It's used to
-// use bitmaps for constructing image-based resizable widgets like buttons.
-//
-// If you want just a vertical image that stretches in height but is fixed
-// in width, only pass in images for the left column (leave others NULL).
-// Similarly, for a horizontal image that stretches in width but is fixed in
-// height, only pass in images for the top row.
-//
-// TODO(port): add support for caching server-side pixmaps of prerendered
-// nineboxes.
-class NineBox {
- public:
- // Construct a NineBox with nine images. Images are specified using resource
- // ids that will be passed to the resource bundle. Use 0 for no image.
- NineBox(int top_left, int top, int top_right, int left, int center, int right,
- int bottom_left, int bottom, int bottom_right);
-
- // Construct a NineBox from a single image and insets indicating the sizes
- // of the edges and corners.
- NineBox(int image, int top_margin, int bottom_margin, int left_margin,
- int right_margin);
- ~NineBox();
-
- // Render the NineBox to |dst|.
- // The images will be tiled to fit into the widget.
- void RenderToWidget(GtkWidget* dst) const;
-
- // As above, but rendered partially transparent.
- void RenderToWidgetWithOpacity(GtkWidget* dst, double opacity) const;
-
- // Render the top row of images to |dst| between |x1| and |x1| + |width|.
- // This is split from RenderToWidget so the toolbar can use it.
- void RenderTopCenterStrip(cairo_t* cr, int x, int y, int width) const;
-
- // Change all pixels that are white in |images_| to have 0 opacity.
- void ChangeWhiteToTransparent();
-
- // Set the shape of |widget| to match that of the ninebox. Note that |widget|
- // must have its own window and be allocated. Also, currently only the top
- // three images are used.
- // TODO(estade): extend this function to use all 9 images (if it's ever
- // needed).
- void ContourWidget(GtkWidget* widget) const;
-
- private:
- GdkPixbuf* images_[9];
- bool unref_pixbufs_on_destroy_;
-};
+#include "chrome/browser/ui/gtk/nine_box.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_NINE_BOX_H_
diff --git a/chrome/browser/gtk/notifications/balloon_view_gtk.h b/chrome/browser/gtk/notifications/balloon_view_gtk.h
index 0db221b..842f938 100644
--- a/chrome/browser/gtk/notifications/balloon_view_gtk.h
+++ b/chrome/browser/gtk/notifications/balloon_view_gtk.h
@@ -1,130 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Draws the view for the balloons.
-
#ifndef CHROME_BROWSER_GTK_NOTIFICATIONS_BALLOON_VIEW_GTK_H_
#define CHROME_BROWSER_GTK_NOTIFICATIONS_BALLOON_VIEW_GTK_H_
#pragma once
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/gtk/menu_gtk.h"
-#include "chrome/browser/gtk/notifications/balloon_view_host_gtk.h"
-#include "chrome/browser/notifications/balloon.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "gfx/point.h"
-#include "gfx/rect.h"
-#include "gfx/size.h"
-#include "ui/base/animation/animation_delegate.h"
-
-class BalloonCollection;
-class CustomDrawButton;
-class GtkThemeProvider;
-class MenuGtk;
-class NotificationDetails;
-class NotificationOptionsMenuModel;
-class NotificationSource;
-
-namespace ui {
-class SlideAnimation;
-}
-
-// A balloon view is the UI component for desktop notification toasts.
-// It draws a border, and within the border an HTML renderer.
-class BalloonViewImpl : public BalloonView,
- public MenuGtk::Delegate,
- public NotificationObserver,
- public ui::AnimationDelegate {
- public:
- explicit BalloonViewImpl(BalloonCollection* collection);
- ~BalloonViewImpl();
-
- // BalloonView interface.
- virtual void Show(Balloon* balloon);
- virtual void Update();
- virtual void RepositionToBalloon();
- virtual void Close(bool by_user);
- virtual gfx::Size GetSize() const;
- virtual BalloonHost* GetHost() const;
-
- private:
- // NotificationObserver interface.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // ui::AnimationDelegate interface.
- virtual void AnimationProgressed(const ui::Animation* animation);
-
- // Do the delayed close work.
- void DelayedClose(bool by_user);
-
- // The height of the balloon's shelf.
- // The shelf is where is close button is located.
- int GetShelfHeight() const;
-
- // The width and height that the frame should be. If the balloon inside
- // changes size, this will not be the same as the actual frame size until
- // RepositionToBalloon() has been called and the animation completes.
- int GetDesiredTotalWidth() const;
- int GetDesiredTotalHeight() const;
-
- // Where the balloon contents should be placed with respect to the top left
- // of the frame.
- gfx::Point GetContentsOffset() const;
-
- // Where the balloon contents should be in screen coordinates.
- gfx::Rect GetContentsRectangle() const;
-
- CHROMEGTK_CALLBACK_0(BalloonViewImpl, void, OnCloseButton);
- CHROMEGTK_CALLBACK_1(BalloonViewImpl, gboolean, OnExpose, GdkEventExpose*);
- CHROMEGTK_CALLBACK_0(BalloonViewImpl, void, OnOptionsMenuButton);
- CHROMEGTK_CALLBACK_0(BalloonViewImpl, gboolean, OnDestroy);
-
- // Non-owned pointer to the balloon which owns this object.
- Balloon* balloon_;
-
- GtkThemeProvider* theme_provider_;
-
- // The window that contains the frame of the notification.
- GtkWidget* frame_container_;
-
- // The widget that contains the shelf.
- GtkWidget* shelf_;
-
- // The hbox within the shelf that contains the buttons.
- GtkWidget* hbox_;
-
- // The window that contains the contents of the notification.
- GtkWidget* html_container_;
-
- // The renderer of the HTML contents.
- scoped_ptr<BalloonViewHost> html_contents_;
-
- // The following factory is used to call methods at a later time.
- ScopedRunnableMethodFactory<BalloonViewImpl> method_factory_;
-
- // Close button.
- scoped_ptr<CustomDrawButton> close_button_;
-
- // An animation to move the balloon on the screen as its position changes.
- scoped_ptr<ui::SlideAnimation> animation_;
- gfx::Rect anim_frame_start_;
- gfx::Rect anim_frame_end_;
-
- // The options menu.
- scoped_ptr<MenuGtk> options_menu_;
- scoped_ptr<NotificationOptionsMenuModel> options_menu_model_;
- // The button to open the options menu.
- scoped_ptr<CustomDrawButton> options_menu_button_;
-
- NotificationRegistrar notification_registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(BalloonViewImpl);
-};
+#include "chrome/browser/ui/gtk/notifications/balloon_view_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_NOTIFICATIONS_BALLOON_VIEW_GTK_H_
diff --git a/chrome/browser/gtk/notifications/balloon_view_host_gtk.h b/chrome/browser/gtk/notifications/balloon_view_host_gtk.h
index 75dfb92..b337ce9 100644
--- a/chrome/browser/gtk/notifications/balloon_view_host_gtk.h
+++ b/chrome/browser/gtk/notifications/balloon_view_host_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,38 +6,7 @@
#define CHROME_BROWSER_GTK_NOTIFICATIONS_BALLOON_VIEW_HOST_GTK_H_
#pragma once
-#include "chrome/browser/notifications/balloon_host.h"
-#include "gfx/native_widget_types.h"
-
-class RenderWidgetHostViewGtk;
-
-// BalloonViewHost class is a delegate to the renderer host for the HTML
-// notification. When initialized it creates a new RenderViewHost and loads
-// the contents of the toast into it. It also handles links within the toast,
-// loading them into a new tab.
-class BalloonViewHost : public BalloonHost {
- public:
- explicit BalloonViewHost(Balloon* balloon);
-
- ~BalloonViewHost() {
- Shutdown();
- }
-
- // Changes the size of the balloon.
- void UpdateActualSize(const gfx::Size& new_size);
-
- // Accessors.
- gfx::NativeView native_view() const;
-
- protected:
- virtual void InitRenderWidgetHostView();
- virtual RenderWidgetHostView* render_widget_host_view() const;
-
- private:
- // The GTK-specific widget host view. Owned by its native view.
- RenderWidgetHostViewGtk* render_widget_host_view_;
-
- DISALLOW_COPY_AND_ASSIGN(BalloonViewHost);
-};
+#include "chrome/browser/ui/gtk/notifications/balloon_view_host_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_NOTIFICATIONS_BALLOON_VIEW_HOST_GTK_H_
diff --git a/chrome/browser/gtk/options/advanced_contents_gtk.h b/chrome/browser/gtk/options/advanced_contents_gtk.h
index 28eb3bd..c0289d6 100644
--- a/chrome/browser/gtk/options/advanced_contents_gtk.h
+++ b/chrome/browser/gtk/options/advanced_contents_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,46 +6,7 @@
#define CHROME_BROWSER_GTK_OPTIONS_ADVANCED_CONTENTS_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-
-class Profile;
-class DownloadSection;
-class NetworkSection;
-class PrivacySection;
-class SecuritySection;
-class TranslateSection;
-class WebContentSection;
-
-class AdvancedContentsGtk {
- public:
- explicit AdvancedContentsGtk(Profile* profile);
- virtual ~AdvancedContentsGtk();
-
- GtkWidget* get_page_widget() const {
- return page_;
- }
-
- private:
- void Init();
-
- // The profile.
- Profile* profile_;
-
- // The sections of the page.
- scoped_ptr<DownloadSection> download_section_;
- scoped_ptr<NetworkSection> network_section_;
- scoped_ptr<TranslateSection> translate_section_;
- scoped_ptr<PrivacySection> privacy_section_;
- scoped_ptr<SecuritySection> security_section_;
- scoped_ptr<WebContentSection> web_content_section_;
-
- // The widget containing the advanced options sections.
- GtkWidget* page_;
-
- DISALLOW_COPY_AND_ASSIGN(AdvancedContentsGtk);
-};
+#include "chrome/browser/ui/gtk/options/advanced_contents_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_ADVANCED_CONTENTS_GTK_H_
diff --git a/chrome/browser/gtk/options/advanced_page_gtk.h b/chrome/browser/gtk/options/advanced_page_gtk.h
index f1345c8..7973a54 100644
--- a/chrome/browser/gtk/options/advanced_page_gtk.h
+++ b/chrome/browser/gtk/options/advanced_page_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,44 +6,7 @@
#define CHROME_BROWSER_GTK_OPTIONS_ADVANCED_PAGE_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "chrome/browser/gtk/options/advanced_contents_gtk.h"
-#include "chrome/browser/gtk/options/managed_prefs_banner_gtk.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/browser/ui/options/options_page_base.h"
-
-class Profile;
-
-class AdvancedPageGtk : public OptionsPageBase {
- public:
- explicit AdvancedPageGtk(Profile* profile);
- virtual ~AdvancedPageGtk();
-
- GtkWidget* get_page_widget() const {
- return page_;
- }
-
- private:
- void Init();
-
- // Callback for reset to default button.
- CHROMEGTK_CALLBACK_0(AdvancedPageGtk, void, OnResetToDefaultsClicked);
-
- // Callback for reset to default confirmation dialog.
- CHROMEGTK_CALLBACK_1(AdvancedPageGtk, void, OnResetToDefaultsResponse, int);
-
- // The contents of the scroll box.
- AdvancedContentsGtk advanced_contents_;
-
- // The widget containing the options for this page.
- GtkWidget* page_;
-
- // Tracks managed preference warning banner state.
- ManagedPrefsBannerGtk managed_prefs_banner_;
-
- DISALLOW_COPY_AND_ASSIGN(AdvancedPageGtk);
-};
+#include "chrome/browser/ui/gtk/options/advanced_page_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_ADVANCED_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/content_exception_editor.h b/chrome/browser/gtk/options/content_exception_editor.h
index 4ed5ad3..47e3e55 100644
--- a/chrome/browser/gtk/options/content_exception_editor.h
+++ b/chrome/browser/gtk/options/content_exception_editor.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,76 +6,7 @@
#define CHROME_BROWSER_GTK_OPTIONS_CONTENT_EXCEPTION_EDITOR_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "chrome/browser/content_exceptions_table_model.h"
-#include "chrome/browser/content_setting_combo_model.h"
-#include "chrome/common/content_settings.h"
-#include "chrome/common/content_settings_types.h"
-
-// An editor which lets the user create or edit an individual exception to the
-// current content setting policy. (i.e. let www.google.com always show
-// images). Modal to parent.
-class ContentExceptionEditor {
- public:
- class Delegate {
- public:
- // Invoked when the user accepts the edit.
- virtual void AcceptExceptionEdit(
- const ContentSettingsPattern& pattern,
- ContentSetting setting,
- bool is_off_the_record,
- int index,
- bool is_new) = 0;
-
- protected:
- virtual ~Delegate() {}
- };
-
- ContentExceptionEditor(GtkWindow* parent,
- Delegate* delegate,
- ContentExceptionsTableModel* model,
- bool allow_off_the_record,
- int index,
- const ContentSettingsPattern& pattern,
- ContentSetting setting,
- bool is_off_the_record);
- virtual ~ContentExceptionEditor() {}
-
- private:
- // Returns true if we're adding a new item.
- bool is_new() const { return index_ == -1; }
-
- bool IsPatternValid(const ContentSettingsPattern& pattern,
- bool is_off_the_record) const;
-
- void UpdateImage(GtkWidget* image, bool is_valid);
-
- // GTK callbacks
- CHROMEGTK_CALLBACK_0(ContentExceptionEditor, void, OnEntryChanged);
- CHROMEGTK_CALLBACK_1(ContentExceptionEditor, void, OnResponse, int);
- CHROMEGTK_CALLBACK_0(ContentExceptionEditor, void, OnWindowDestroy);
-
- Delegate* delegate_;
- ContentExceptionsTableModel* model_;
-
- // The model for Combobox widget.
- ContentSettingComboModel cb_model_;
-
- // Index of the item being edited. If -1, indicates this is a new entry.
- const int index_;
- const ContentSettingsPattern pattern_;
- const ContentSetting setting_;
-
- // UI widgets.
- GtkWidget* dialog_;
- GtkWidget* entry_;
- GtkWidget* pattern_image_;
- GtkWidget* action_combo_;
- GtkWidget* otr_checkbox_;
-
- DISALLOW_COPY_AND_ASSIGN(ContentExceptionEditor);
-};
+#include "chrome/browser/ui/gtk/options/content_exception_editor.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_CONTENT_EXCEPTION_EDITOR_H_
diff --git a/chrome/browser/gtk/options/content_exceptions_window_gtk.h b/chrome/browser/gtk/options/content_exceptions_window_gtk.h
index 0f70c90..577dd00 100644
--- a/chrome/browser/gtk/options/content_exceptions_window_gtk.h
+++ b/chrome/browser/gtk/options/content_exceptions_window_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,115 +6,7 @@
#define CHROME_BROWSER_GTK_OPTIONS_CONTENT_EXCEPTIONS_WINDOW_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <string>
-
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/content_exceptions_table_model.h"
-#include "chrome/browser/gtk/gtk_tree.h"
-#include "chrome/browser/gtk/options/content_exception_editor.h"
-#include "chrome/common/content_settings.h"
-#include "chrome/common/content_settings_types.h"
-
-class HostContentSettingsMap;
-
-// Dialog that lists each of the exceptions to the current content policy, and
-// has options for adding/editing/removing entries. Modal to parrent.
-class ContentExceptionsWindowGtk : public gtk_tree::TableAdapter::Delegate,
- public ContentExceptionEditor::Delegate {
- public:
- static void ShowExceptionsWindow(GtkWindow* window,
- HostContentSettingsMap* map,
- HostContentSettingsMap* off_the_record_map,
- ContentSettingsType content_type);
-
- ~ContentExceptionsWindowGtk();
-
- // gtk_tree::TableAdapter::Delegate implementation:
- virtual void SetColumnValues(int row, GtkTreeIter* iter);
-
- // ContentExceptionEditor::Delegate implementation:
- virtual void AcceptExceptionEdit(
- const ContentSettingsPattern& pattern,
- ContentSetting setting,
- bool is_off_the_record,
- int index,
- bool is_new);
-
- private:
- // Column ids for |list_store_|.
- enum {
- COL_PATTERN,
- COL_ACTION,
- COL_OTR,
- COL_COUNT
- };
-
- ContentExceptionsWindowGtk(GtkWindow* parent,
- HostContentSettingsMap* map,
- HostContentSettingsMap* off_the_record_map,
- ContentSettingsType type);
-
- // Updates which buttons are enabled.
- void UpdateButtonState();
-
- // Callbacks for the buttons.
- CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, Add);
- CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, Edit);
- CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, Remove);
- CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, RemoveAll);
-
- // Returns the title of the window (changes based on what ContentSettingsType
- // was set to in the constructor).
- std::string GetWindowTitle() const;
-
- // Gets the selected indicies in the two list stores. Indicies are returned
- // in <list_store_, sort_list_store_> order.
- void GetSelectedModelIndices(std::set<std::pair<int, int> >* indices);
-
- // GTK Callbacks
- CHROMEGTK_CALLBACK_2(ContentExceptionsWindowGtk, void,
- OnTreeViewRowActivate, GtkTreePath*, GtkTreeViewColumn*);
- CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, OnWindowDestroy);
- CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void,
- OnTreeSelectionChanged);
-
- // The list presented in |treeview_|. Separate from |list_store_|, the list
- // that backs |sort_model_|. This separation comes so the user can sort the
- // data on screen without changing the underlying |list_store_|.
- GtkTreeModel* sort_list_store_;
-
- // The backing to |sort_list_store_|. Doesn't change when sorted.
- GtkListStore* list_store_;
-
- // The C++, views-ish, cross-platform model class that actually contains the
- // gold standard data.
- scoped_ptr<ContentExceptionsTableModel> model_;
-
- // True if we also show exceptions from an OTR profile.
- bool allow_off_the_record_;
-
- // The adapter that ferries data back and forth between |model_| and
- // |list_store_| whenever either of them change.
- scoped_ptr<gtk_tree::TableAdapter> model_adapter_;
-
- // The exception window.
- GtkWidget* dialog_;
-
- // The treeview that presents the site/action pairs.
- GtkWidget* treeview_;
-
- // The current user selection from |treeview_|.
- GtkTreeSelection* treeview_selection_;
-
- // Buttons.
- GtkWidget* edit_button_;
- GtkWidget* remove_button_;
- GtkWidget* remove_all_button_;
-
- friend class ContentExceptionsWindowGtkUnittest;
-};
+#include "chrome/browser/ui/gtk/options/content_exceptions_window_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_CONTENT_EXCEPTIONS_WINDOW_GTK_H_
diff --git a/chrome/browser/gtk/options/content_filter_page_gtk.h b/chrome/browser/gtk/options/content_filter_page_gtk.h
index d5d3de2..8d8a693 100644
--- a/chrome/browser/gtk/options/content_filter_page_gtk.h
+++ b/chrome/browser/gtk/options/content_filter_page_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,67 +6,7 @@
#define CHROME_BROWSER_GTK_OPTIONS_CONTENT_FILTER_PAGE_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "chrome/browser/content_settings/host_content_settings_map.h"
-#include "chrome/browser/ui/options/options_page_base.h"
-#include "chrome/common/content_settings.h"
-#include "chrome/common/content_settings_types.h"
-#include "chrome/common/notification_registrar.h"
-
-class ContentSettingsDetails;
-
-// A page in the content settings window. Used for everything but the Cookies
-// page (which has a much more complex dialog). A |content_type| is passed into
-// the constructor and the correct strings and settings are used.
-class ContentFilterPageGtk : public OptionsPageBase {
- public:
- ContentFilterPageGtk(Profile* profile, ContentSettingsType content_type);
- virtual ~ContentFilterPageGtk();
-
- GtkWidget* get_page_widget() const {
- return page_;
- }
-
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- private:
- // This method is called during initialization to set the initial state of the
- // buttons and called after a default content setting change (either value
- // change or "is managed" state).
- virtual void UpdateButtonsState();
-
- virtual void NotifyContentSettingsChanged(
- const ContentSettingsDetails* details);
-
- // Builds the content of the dialog.
- GtkWidget* InitGroup();
-
- CHROMEGTK_CALLBACK_0(ContentFilterPageGtk, void, OnAllowToggled);
- CHROMEGTK_CALLBACK_0(ContentFilterPageGtk, void, OnExceptionsClicked);
- CHROMEGTK_CALLBACK_0(ContentFilterPageGtk, void, OnPluginsPageLinkClicked);
-
- ContentSettingsType content_type_;
-
- GtkWidget* page_;
-
- // Controls for the content filter tab page.
- GtkWidget* allow_radio_;
- GtkWidget* ask_radio_;
- GtkWidget* block_radio_;
-
- GtkWidget* exceptions_button_;
-
- NotificationRegistrar registrar_;
-
- // If state of the UI is not changed by a user-action we need to ignore
- // "toggled" events.
- bool ignore_toggle_;
-
- DISALLOW_COPY_AND_ASSIGN(ContentFilterPageGtk);
-};
+#include "chrome/browser/ui/gtk/options/content_filter_page_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_CONTENT_FILTER_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/content_page_gtk.h b/chrome/browser/gtk/options/content_page_gtk.h
index eb840b9..533c432 100644
--- a/chrome/browser/gtk/options/content_page_gtk.h
+++ b/chrome/browser/gtk/options/content_page_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,115 +6,7 @@
#define CHROME_BROWSER_GTK_OPTIONS_CONTENT_PAGE_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <string>
-
-#include "app/gtk_signal.h"
-#include "chrome/browser/autofill/personal_data_manager.h"
-#include "chrome/browser/gtk/options/managed_prefs_banner_gtk.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/browser/sync/profile_sync_service.h"
-#include "chrome/browser/ui/options/options_page_base.h"
-
-class Profile;
-
-class ContentPageGtk : public OptionsPageBase,
- public ProfileSyncServiceObserver {
- public:
- explicit ContentPageGtk(Profile* profile);
- ~ContentPageGtk();
-
- GtkWidget* get_page_widget() const {
- return page_;
- }
-
- // ProfileSyncServiceObserver method.
- virtual void OnStateChanged();
-
- private:
- // Updates various sync controls based on the current sync state.
- void UpdateSyncControls();
-
- // Overridden from OptionsPageBase.
- virtual void NotifyPrefChanged(const std::string* pref_name);
-
- // Overridden from OptionsPageBase.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Update content area after a theme changed.
- void ObserveThemeChanged();
-
- // Initialize the option group widgets, return their container.
- GtkWidget* InitPasswordSavingGroup();
- GtkWidget* InitFormAutoFillGroup();
- GtkWidget* InitBrowsingDataGroup();
- GtkWidget* InitThemesGroup();
- GtkWidget* InitSyncGroup();
-
- CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnImportButtonClicked);
- CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnGtkThemeButtonClicked);
- CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnResetDefaultThemeButtonClicked);
- CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnGetThemesButtonClicked);
- CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnSystemTitleBarRadioToggled);
- CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnShowPasswordsButtonClicked);
- CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnPasswordRadioToggled);
- CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnAutoFillButtonClicked);
- CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnSyncStartStopButtonClicked);
- CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnSyncCustomizeButtonClicked);
- CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnSyncActionLinkClicked);
- CHROMEGTK_CALLBACK_1(ContentPageGtk, void, OnStopSyncDialogResponse, int);
- CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnPrivacyDashboardLinkClicked);
-
- // Widgets for the Password saving group.
- GtkWidget* passwords_asktosave_radio_;
- GtkWidget* passwords_neversave_radio_;
- GtkWidget* show_passwords_button_;
-
- // Widgets for the AutoFill group.
- GtkWidget* autofill_button_;
-
- // Widgets for the Appearance group.
- GtkWidget* system_title_bar_show_radio_;
- GtkWidget* system_title_bar_hide_radio_;
- GtkWidget* themes_reset_button_;
-#if defined(TOOLKIT_GTK)
- GtkWidget* gtk_theme_button_;
-#endif
-
- // Widgets for the Sync group.
- GtkWidget* sync_status_label_background_;
- GtkWidget* sync_status_label_;
- GtkWidget* sync_action_link_background_;
- GtkWidget* sync_action_link_;
- GtkWidget* sync_start_stop_button_;
- GtkWidget* sync_customize_button_;
- GtkWidget* privacy_dashboard_link_;
-
- // The parent GtkTable widget
- GtkWidget* page_;
-
- // Pref members.
- BooleanPrefMember ask_to_save_passwords_;
- BooleanPrefMember form_autofill_enabled_;
- BooleanPrefMember use_custom_chrome_frame_;
-
- // Flag to ignore gtk callbacks while we are loading prefs, to avoid
- // then turning around and saving them again.
- bool initializing_;
-
- NotificationRegistrar registrar_;
-
- // Cached pointer to ProfileSyncService, if it exists. Kept up to date
- // and NULL-ed out on destruction.
- ProfileSyncService* sync_service_;
-
- // Tracks managed preference warning banner state.
- ManagedPrefsBannerGtk managed_prefs_banner_;
-
- DISALLOW_COPY_AND_ASSIGN(ContentPageGtk);
-};
+#include "chrome/browser/ui/gtk/options/content_page_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_CONTENT_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/content_settings_window_gtk.h b/chrome/browser/gtk/options/content_settings_window_gtk.h
index 6e32f4a4..509ea0c 100644
--- a/chrome/browser/gtk/options/content_settings_window_gtk.h
+++ b/chrome/browser/gtk/options/content_settings_window_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,68 +6,7 @@
#define CHROME_BROWSER_GTK_OPTIONS_CONTENT_SETTINGS_WINDOW_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/gtk/options/cookie_filter_page_gtk.h"
-#include "chrome/browser/gtk/options/content_filter_page_gtk.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/common/content_settings_types.h"
-
-class AccessibleWidgetHelper;
-
-// A window that presents options to the user for blocking various kinds of
-// content in webpages (cookies, javascript, images, popups).
-class ContentSettingsWindowGtk {
- public:
- // Shows the current content settings page, opening a new one if it doesn't
- // exist.
- static void Show(GtkWindow* parent, ContentSettingsType page,
- Profile* profile);
- static void RegisterUserPrefs(PrefService* prefs);
-
- explicit ContentSettingsWindowGtk(GtkWindow* parent, Profile* profile);
- virtual ~ContentSettingsWindowGtk();
-
- private:
- // Shows the Tab corresponding to the specified Content Settings page.
- void ShowContentSettingsTab(ContentSettingsType page);
-
- CHROMEGTK_CALLBACK_2(ContentSettingsWindowGtk, void, OnSwitchPage,
- GtkNotebookPage*, guint);
- CHROMEGTK_CALLBACK_0(ContentSettingsWindowGtk, void, OnWindowDestroy);
- CHROMEG_CALLBACK_0(ContentSettingsWindowGtk, void, OnListSelectionChanged,
- GtkTreeSelection*);
-
- // The options dialog.
- GtkWidget* dialog_;
-
- // The container of the option pages.
- GtkWidget* notebook_;
- GtkWidget* list_;
-
- // The Profile associated with these options.
- Profile* profile_;
-
- // The last page the user was on when they opened the ContentSettings window.
- IntegerPrefMember last_selected_page_;
-
- // The individual page implementations. Note that we have a specialized one
- // for cookies (which have more complex rules) and use the same basic page
- // layout for each other type.
- CookieFilterPageGtk cookie_page_;
- ContentFilterPageGtk image_page_;
- ContentFilterPageGtk javascript_page_;
- ContentFilterPageGtk plugin_page_;
- ContentFilterPageGtk popup_page_;
- ContentFilterPageGtk geolocation_page_;
- ContentFilterPageGtk notifications_page_;
-
- // Helper object to manage accessibility metadata.
- scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
-
- DISALLOW_COPY_AND_ASSIGN(ContentSettingsWindowGtk);
-};
+#include "chrome/browser/ui/gtk/options/content_settings_window_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_CONTENT_SETTINGS_WINDOW_GTK_H_
diff --git a/chrome/browser/gtk/options/cookie_filter_page_gtk.h b/chrome/browser/gtk/options/cookie_filter_page_gtk.h
index f07cbdb..2953f3f 100644
--- a/chrome/browser/gtk/options/cookie_filter_page_gtk.h
+++ b/chrome/browser/gtk/options/cookie_filter_page_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,72 +6,7 @@
#define CHROME_BROWSER_GTK_OPTIONS_COOKIE_FILTER_PAGE_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <string>
-
-#include "app/gtk_signal.h"
-#include "chrome/browser/content_settings/host_content_settings_map.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/browser/ui/options/options_page_base.h"
-
-class Profile;
-
-// A page in the content settings window for cookie options. This dialog has
-// more options as is more complicated then all the other pages implemented
-// with ContentPageGtk.
-class CookieFilterPageGtk : public OptionsPageBase {
- public:
- explicit CookieFilterPageGtk(Profile* profile);
- virtual ~CookieFilterPageGtk();
-
- GtkWidget* get_page_widget() const {
- return page_;
- }
-
- private:
- // Updates the UI state.
- virtual void UpdateUiState();
-
- // Overridden from OptionsPageBase
- virtual void NotifyPrefChanged(const std::string* pref_name);
- virtual void HighlightGroup(OptionsGroup highlight_group);
-
- CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnCookiesAllowToggled);
- CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnExceptionsClicked);
- CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnBlockThirdPartyToggled);
- CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnClearOnCloseToggled);
- CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnShowCookiesClicked);
- CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnFlashLinkClicked);
-
- GtkWidget* InitCookieStoringGroup();
-
- // Widgets of the cookie storing group
- GtkWidget* allow_radio_;
- GtkWidget* block_radio_;
-
- GtkWidget* exceptions_button_;
- GtkWidget* block_3rdparty_check_;
- GtkWidget* clear_on_close_check_;
- GtkWidget* show_cookies_button_;
-
- // The parent GtkTable widget
- GtkWidget* page_;
-
- // If state of the UI is not changed by a user-action we need to ignore
- // "toggled" events.
- bool ignore_toggle_;
-
- // Clear locally stored site data on exit pref.
- BooleanPrefMember clear_site_data_on_exit_;
-
- // Block third-party-cookies.
- BooleanPrefMember block_third_party_cookies_;
-
- // Managed default-cookies-setting.
- IntegerPrefMember managed_default_cookies_setting_;
-
- DISALLOW_COPY_AND_ASSIGN(CookieFilterPageGtk);
-};
+#include "chrome/browser/ui/gtk/options/cookie_filter_page_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_COOKIE_FILTER_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/cookies_view.h b/chrome/browser/gtk/options/cookies_view.h
index 27c0e0f..cc89bc1 100644
--- a/chrome/browser/gtk/options/cookies_view.h
+++ b/chrome/browser/gtk/options/cookies_view.h
@@ -1,151 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// This is the Gtk implementation of the Cookie Manager dialog.
-
#ifndef CHROME_BROWSER_GTK_OPTIONS_COOKIES_VIEW_H_
#define CHROME_BROWSER_GTK_OPTIONS_COOKIES_VIEW_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "base/gtest_prod_util.h"
-#include "base/scoped_ptr.h"
-#include "base/task.h"
-#include "chrome/browser/browsing_data_appcache_helper.h"
-#include "chrome/browser/browsing_data_database_helper.h"
-#include "chrome/browser/browsing_data_indexed_db_helper.h"
-#include "chrome/browser/browsing_data_local_storage_helper.h"
-#include "chrome/browser/gtk/gtk_chrome_cookie_view.h"
-#include "chrome/browser/gtk/gtk_tree.h"
-#include "net/base/cookie_monster.h"
-
-class CookieDisplayGtk;
-class CookiesTreeModel;
-class CookiesViewTest;
-class Profile;
-
-// CookiesView is thread-hostile, and should only be called on the UI thread.
-// Usage:
-// CookiesView::Show(profile);
-// Once the CookiesView is shown, it is responsible for deleting itself when the
-// user closes the dialog.
-
-class CookiesView : public gtk_tree::TreeAdapter::Delegate {
- public:
- virtual ~CookiesView();
-
- // Create (if necessary) and show the cookie manager window.
- static void Show(
- GtkWindow* parent,
- Profile* profile,
- BrowsingDataDatabaseHelper* browsing_data_database_helper,
- BrowsingDataLocalStorageHelper* browsing_data_local_storage_helper,
- BrowsingDataAppCacheHelper* browsing_data_appcache_helper,
- BrowsingDataIndexedDBHelper* browsing_data_indexed_db_helper);
-
- // gtk_tree::TreeAdapter::Delegate implementation.
- virtual void OnAnyModelUpdateStart();
- virtual void OnAnyModelUpdate();
-
- private:
- CookiesView(
- GtkWindow* parent,
- Profile* profile,
- BrowsingDataDatabaseHelper* browsing_data_database_helper,
- BrowsingDataLocalStorageHelper* browsing_data_local_storage_helper,
- BrowsingDataAppCacheHelper* browsing_data_appcache_helper,
- BrowsingDataIndexedDBHelper* browsing_data_indexed_db_helper);
-
- // A method only used in unit tests that sets a bit inside this class that
- // lets it be stack allocated.
- void TestDestroySynchronously();
-
- // Initialize the dialog contents and layout.
- void Init(GtkWindow* parent);
-
- // Set the initial selection and tree expanded state.
- void SetInitialTreeState();
-
- // Set sensitivity of buttons based on selection and filter state.
- void EnableControls();
-
- // Remove any cookies that are currently selected.
- void RemoveSelectedItems();
-
- CHROMEGTK_CALLBACK_1(CookiesView, void, OnResponse, int);
- CHROMEGTK_CALLBACK_0(CookiesView, void, OnWindowDestroy);
- // Callback for the table.
- CHROMEGTK_CALLBACK_0(CookiesView, void, OnTreeViewSelectionChange);
- CHROMEGTK_CALLBACK_1(CookiesView, gboolean, OnTreeViewKeyPress,
- GdkEventKey*);
- CHROMEGTK_CALLBACK_2(CookiesView, void, OnTreeViewRowExpanded,
- GtkTreeIter*, GtkTreePath*);
- // Callbacks for user actions filtering the list.
- CHROMEGTK_CALLBACK_0(CookiesView, void, OnFilterEntryActivated);
- CHROMEGTK_CALLBACK_0(CookiesView, void, OnFilterEntryChanged);
- CHROMEGTK_CALLBACK_0(CookiesView, void, OnFilterClearButtonClicked);
-
- // Filter the list against the text in |filter_entry_|.
- void UpdateFilterResults();
-
-
- // The parent widget.
- GtkWidget* dialog_;
-
- // Widgets of the dialog.
- GtkWidget* description_label_;
- GtkWidget* filter_entry_;
- GtkWidget* filter_clear_button_;
- GtkWidget* remove_button_;
- GtkWidget* remove_all_button_;
-
- // The table listing the cookies.
- GtkWidget* tree_;
- GtkTreeSelection* selection_;
-
- GtkWidget* cookie_display_;
-
- // The profile and related helpers.
- Profile* profile_;
- scoped_refptr<BrowsingDataDatabaseHelper> browsing_data_database_helper_;
- scoped_refptr<BrowsingDataLocalStorageHelper>
- browsing_data_local_storage_helper_;
- scoped_refptr<BrowsingDataAppCacheHelper> browsing_data_appcache_helper_;
- scoped_refptr<BrowsingDataIndexedDBHelper> browsing_data_indexed_db_helper_;
-
- // A factory to construct Runnable Methods so that we can be called back to
- // re-evaluate the model after the search query string changes.
- ScopedRunnableMethodFactory<CookiesView> filter_update_factory_;
-
- // The Cookies Table model.
- scoped_ptr<CookiesTreeModel> cookies_tree_model_;
- scoped_ptr<gtk_tree::TreeAdapter> cookies_tree_adapter_;
-
- // A reference to the "destroy" signal handler for this object. We disconnect
- // from this signal if we need to be destroyed synchronously.
- gulong destroy_handler_;
-
- // Whether we own |dialog_| or the other way around.
- bool destroy_dialog_in_destructor_;
-
- friend class CookiesViewTest;
- FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, Empty);
- FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, Noop);
- FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, RemoveAll);
- FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, RemoveAllWithDefaultSelected);
- FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, Remove);
- FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, RemoveCookiesByType);
- FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, RemoveByDomain);
- FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, RemoveDefaultSelection);
- FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, Filter);
- FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, FilterRemoveAll);
- FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, FilterRemove);
-
- DISALLOW_COPY_AND_ASSIGN(CookiesView);
-};
+#include "chrome/browser/ui/gtk/options/cookies_view.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_COOKIES_VIEW_H_
diff --git a/chrome/browser/gtk/options/fonts_page_gtk.h b/chrome/browser/gtk/options/fonts_page_gtk.h
index 3dbdf5a..9b6f029 100644
--- a/chrome/browser/gtk/options/fonts_page_gtk.h
+++ b/chrome/browser/gtk/options/fonts_page_gtk.h
@@ -1,75 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// The fonts page of the fonts & languages options dialog, which contains font
-// family and size settings, as well as the default encoding option.
-
#ifndef CHROME_BROWSER_GTK_OPTIONS_FONTS_PAGE_GTK_H_
#define CHROME_BROWSER_GTK_OPTIONS_FONTS_PAGE_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/character_encoding.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/browser/ui/options/options_page_base.h"
-
-class DefaultEncodingComboboxModel;
-
-class FontsPageGtk : public OptionsPageBase {
- public:
- explicit FontsPageGtk(Profile* profile);
- virtual ~FontsPageGtk();
-
- GtkWidget* get_page_widget() const { return page_; }
-
- private:
- void Init();
- void InitDefaultEncodingComboBox();
-
- // Overridden from OptionsPageBase.
- virtual void NotifyPrefChanged(const std::string* pref_name);
-
- // Retrieve the font selection from the button and save it to the prefs. Also
- // ensure the button(s) are displayed in the proper size, as the
- // GtkFontSelector returns the value in points not pixels.
- void SetFontsFromButton(StringPrefMember* name_pref,
- IntegerPrefMember* size_pref,
- GtkWidget* font_button);
-
- CHROMEGTK_CALLBACK_0(FontsPageGtk, void, OnSerifFontSet);
- CHROMEGTK_CALLBACK_0(FontsPageGtk, void, OnSansFontSet);
- CHROMEGTK_CALLBACK_0(FontsPageGtk, void, OnFixedFontSet);
- CHROMEGTK_CALLBACK_0(FontsPageGtk, void, OnDefaultEncodingChanged);
-
- // The font chooser widgets
- GtkWidget* serif_font_button_;
- GtkWidget* sans_font_button_;
- GtkWidget* fixed_font_button_;
-
- // The default encoding combobox widget.
- GtkWidget* default_encoding_combobox_;
- scoped_ptr<DefaultEncodingComboboxModel> default_encoding_combobox_model_;
-
- // The widget containing the options for this page.
- GtkWidget* page_;
-
- // Font name preferences.
- StringPrefMember serif_name_;
- StringPrefMember sans_serif_name_;
- StringPrefMember fixed_width_name_;
-
- // Font size preferences, in pixels.
- IntegerPrefMember variable_width_size_;
- IntegerPrefMember fixed_width_size_;
-
- // Default encoding preference.
- StringPrefMember default_encoding_;
-
- DISALLOW_COPY_AND_ASSIGN(FontsPageGtk);
-};
+#include "chrome/browser/ui/gtk/options/fonts_page_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_FONTS_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/general_page_gtk.h b/chrome/browser/gtk/options/general_page_gtk.h
index 05dac88..23ee51c0 100644
--- a/chrome/browser/gtk/options/general_page_gtk.h
+++ b/chrome/browser/gtk/options/general_page_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,174 +6,7 @@
#define CHROME_BROWSER_GTK_OPTIONS_GENERAL_PAGE_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <string>
-
-#include "app/gtk_signal.h"
-#include "chrome/browser/gtk/gtk_tree.h"
-#include "chrome/browser/gtk/options/managed_prefs_banner_gtk.h"
-#include "chrome/browser/prefs/pref_change_registrar.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/browser/search_engines/template_url_model_observer.h"
-#include "chrome/browser/shell_integration.h"
-#include "chrome/browser/ui/options/options_page_base.h"
-#include "googleurl/src/gurl.h"
-
-class AccessibleWidgetHelper;
-class CustomHomePagesTableModel;
-class Profile;
-class TemplateURLModel;
-
-class GeneralPageGtk : public OptionsPageBase,
- public TemplateURLModelObserver,
- public ShellIntegration::DefaultBrowserObserver,
- public gtk_tree::TableAdapter::Delegate {
- public:
- explicit GeneralPageGtk(Profile* profile);
- ~GeneralPageGtk();
-
- GtkWidget* get_page_widget() const { return page_; }
-
- private:
- GtkWindow* GetWindow();
-
- // Overridden from OptionsPageBase
- virtual void NotifyPrefChanged(const std::string* pref_name);
- virtual void HighlightGroup(OptionsGroup highlight_group);
-
- // Initialize the option group widgets, return their container
- GtkWidget* InitStartupGroup();
- GtkWidget* InitHomepageGroup();
- GtkWidget* InitDefaultSearchGroup();
- GtkWidget* InitDefaultBrowserGroup();
-
- // Saves the startup preference from the values in the ui
- void SaveStartupPref();
-
- // Set the custom url list using the pages currently open
- void SetCustomUrlListFromCurrentPages();
-
- // Callback from UrlPickerDialogGtk, for adding custom urls manually.
- // If a single row in the list is selected, the new url will be inserted
- // before that row. Otherwise the new row will be added to the end.
- void OnAddCustomUrl(const GURL& url);
-
- // Removes urls that are currently selected
- void RemoveSelectedCustomUrls();
-
- // Overridden from TemplateURLModelObserver.
- // Populates the default search engine combobox from the model.
- virtual void OnTemplateURLModelChanged();
-
- // Set the default search engine pref to the combo box active item.
- void SetDefaultSearchEngineFromComboBox();
-
- // Set the default search engine combo box state.
- void EnableDefaultSearchEngineComboBox(bool enable);
-
- // Copies the home page preferences from the gui controls to
- // kNewTabPageIsHomePage and kHomePage. If an empty or null-host
- // URL is specified, then we revert to using NewTab page as the Homepage.
- void UpdateHomepagePrefs();
-
- // Enables or disables the field for entering a custom homepage URL.
- void EnableHomepageURLField(bool enabled);
-
- // Sets the state and enables/disables the radio buttons that control
- // if the home page is the new tab page.
- void UpdateHomepageIsNewTabRadio(bool homepage_is_new_tab, bool enabled);
-
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnStartupRadioToggled);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnStartupAddCustomPageClicked);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnStartupRemoveCustomPageClicked);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnStartupUseCurrentPageClicked);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnNewTabIsHomePageToggled);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnHomepageUseUrlEntryChanged);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnShowHomeButtonToggled);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnDefaultSearchEngineChanged);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void,
- OnDefaultSearchManageEnginesClicked);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnInstantToggled);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnBrowserUseAsDefaultClicked);
- CHROMEGTK_CALLBACK_1(GeneralPageGtk, void, OnInstantLabelSizeAllocate,
- GtkAllocation*);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnSearchLearnMoreClicked);
-
- CHROMEG_CALLBACK_0(GeneralPageGtk, void, OnStartupPagesSelectionChanged,
- GtkTreeSelection*);
-
- // Enables/Disables the controls associated with the custom start pages
- // option if that preference is not selected.
- void EnableCustomHomepagesControls(bool enable);
-
- // ShellIntegration::DefaultBrowserObserver implementation.
- virtual void SetDefaultBrowserUIState(
- ShellIntegration::DefaultBrowserUIState state);
-
- // gtk_tree::TableAdapter::Delegate implementation.
- virtual void SetColumnValues(int row, GtkTreeIter* iter);
-
- // Widgets of the startup group
- GtkWidget* startup_homepage_radio_;
- GtkWidget* startup_last_session_radio_;
- GtkWidget* startup_custom_radio_;
- GtkWidget* startup_custom_pages_tree_;
- GtkListStore* startup_custom_pages_store_;
- GtkTreeSelection* startup_custom_pages_selection_;
- GtkWidget* startup_add_custom_page_button_;
- GtkWidget* startup_remove_custom_page_button_;
- GtkWidget* startup_use_current_page_button_;
-
- // The model for |startup_custom_pages_store_|.
- scoped_ptr<CustomHomePagesTableModel> startup_custom_pages_table_model_;
- scoped_ptr<gtk_tree::TableAdapter> startup_custom_pages_table_adapter_;
-
- // Widgets and prefs of the homepage group
- GtkWidget* homepage_use_newtab_radio_;
- GtkWidget* homepage_use_url_radio_;
- GtkWidget* homepage_use_url_entry_;
- GtkWidget* homepage_show_home_button_checkbox_;
- BooleanPrefMember new_tab_page_is_home_page_;
- StringPrefMember homepage_;
- BooleanPrefMember show_home_button_;
-
- // Widgets and data of the default search group
- GtkWidget* default_search_engine_combobox_;
- GtkListStore* default_search_engines_model_;
- GtkWidget* default_search_manage_engines_button_;
- TemplateURLModel* template_url_model_;
- GtkWidget* instant_checkbox_;
- // This widget acts as the indent for the instant warning label.
- GtkWidget* instant_indent_;
- BooleanPrefMember instant_;
-
- // Widgets of the default browser group
- GtkWidget* default_browser_status_label_;
- GtkWidget* default_browser_use_as_default_button_;
-
- // The parent GtkTable widget
- GtkWidget* page_;
-
- // Flag to ignore gtk callbacks while we are populating default search urls.
- bool default_search_initializing_;
-
- // Flag to ignore gtk callbacks while we are loading prefs, to avoid
- // then turning around and saving them again.
- bool initializing_;
-
- // The helper object that performs default browser set/check tasks.
- scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_;
-
- // Helper object to manage accessibility metadata.
- scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
-
- // Tracks managed preference warning banner state.
- ManagedPrefsBannerGtk managed_prefs_banner_;
-
- PrefChangeRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(GeneralPageGtk);
-};
+#include "chrome/browser/ui/gtk/options/general_page_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_GENERAL_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/languages_page_gtk.h b/chrome/browser/gtk/options/languages_page_gtk.h
index 5fb41bb..1433e82 100644
--- a/chrome/browser/gtk/options/languages_page_gtk.h
+++ b/chrome/browser/gtk/options/languages_page_gtk.h
@@ -1,132 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// The languages page of the Languages & languages options dialog, which
-// contains accept-languages and spellchecker language options.
-//
-// Note that we intentionally do not implement the application locale setting,
-// as it does not make sense on Linux, where locale is set through the LANG and
-// LC_* environment variables.
-
#ifndef CHROME_BROWSER_GTK_OPTIONS_LANGUAGES_PAGE_GTK_H_
#define CHROME_BROWSER_GTK_OPTIONS_LANGUAGES_PAGE_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <string>
-
-#include "app/gtk_signal.h"
-#include "base/gtest_prod_util.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/gtk/gtk_tree.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/browser/ui/options/options_page_base.h"
-
-class LanguageComboboxModel;
-class LanguageOrderTableModel;
-
-class LanguagesPageGtk
- : public OptionsPageBase,
- public gtk_tree::TableAdapter::Delegate {
- public:
- explicit LanguagesPageGtk(Profile* profile);
- virtual ~LanguagesPageGtk();
-
- GtkWidget* get_page_widget() const { return page_; }
-
- // gtk_tree::TableAdapter::Delegate implementation.
- virtual void OnAnyModelUpdate();
- virtual void SetColumnValues(int row, GtkTreeIter* iter);
-
- // Callback from AddLanguageDialog.
- void OnAddLanguage(const std::string& new_language);
-
- private:
- // Column ids for |language_order_store_|.
- enum {
- COL_LANG,
- COL_COUNT,
- };
-
- void Init();
-
- // Enable buttons based on selection state.
- void EnableControls();
-
- // Get the row number of the first selected row or -1 if no row is selected.
- int FirstSelectedRowNum();
-
- // Overridden from OptionsPageBase.
- virtual void NotifyPrefChanged(const std::string* pref_name);
-
- // Callbacks for accept languages widgets.
- CHROMEG_CALLBACK_0(LanguagesPageGtk, void, OnSelectionChanged,
- GtkTreeSelection*);
- CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnAddButtonClicked);
- CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnRemoveButtonClicked);
- CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnMoveUpButtonClicked);
- CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnMoveDownButtonClicked);
-
- // Callbacks for spellchecker option widgets.
- CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnEnableSpellCheckingToggled);
- CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void,
- OnEnableAutoSpellCheckingToggled);
- CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnDictionaryLanguageChanged);
-
- // The accept languages widgets.
- GtkListStore* language_order_store_;
- GtkWidget* language_order_tree_;
- GtkTreeSelection* language_order_selection_;
- GtkWidget* move_up_button_;
- GtkWidget* move_down_button_;
- GtkWidget* add_button_;
- GtkWidget* remove_button_;
-
- // The spell checking widgets.
- GtkWidget* dictionary_language_combobox_;
- GtkWidget* enable_autospellcorrect_checkbox_;
- GtkWidget* enable_spellchecking_checkbox_;
-
- // The widget containing the options for this page.
- GtkWidget* page_;
-
- // The model for |language_order_store_|.
- scoped_ptr<LanguageOrderTableModel> language_order_table_model_;
- scoped_ptr<gtk_tree::TableAdapter> language_order_table_adapter_;
-
- // Accept languages pref.
- StringPrefMember accept_languages_;
-
- // The spellchecker "dictionary language" pref and model.
- StringPrefMember dictionary_language_;
- scoped_ptr<LanguageComboboxModel> dictionary_language_model_;
-
- // If a language was auto-added to accept_languages_ due to being selected as
- // the dictionary language, it is saved in this string, so that it can be
- // removed if the dictionary language is changed again.
- std::string spellcheck_language_added_;
-
- // SpellChecker enable pref.
- BooleanPrefMember enable_spellcheck_;
-
- // Auto spell correction pref.
- BooleanPrefMember enable_autospellcorrect_;
-
- // Flag to ignore gtk callbacks while we are loading prefs, to avoid
- // then turning around and saving them again.
- bool initializing_;
-
- friend class LanguagesPageGtkTest;
- FRIEND_TEST_ALL_PREFIXES(LanguagesPageGtkTest, RemoveAcceptLang);
- FRIEND_TEST_ALL_PREFIXES(LanguagesPageGtkTest, RemoveMultipleAcceptLang);
- FRIEND_TEST_ALL_PREFIXES(LanguagesPageGtkTest, MoveAcceptLang);
- FRIEND_TEST_ALL_PREFIXES(LanguagesPageGtkTest, AddAcceptLang);
- FRIEND_TEST_ALL_PREFIXES(LanguagesPageGtkTest, EnableSpellChecking);
- FRIEND_TEST_ALL_PREFIXES(LanguagesPageGtkTest, DictionaryLanguage);
-
- DISALLOW_COPY_AND_ASSIGN(LanguagesPageGtk);
-};
+#include "chrome/browser/ui/gtk/options/languages_page_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_LANGUAGES_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/managed_prefs_banner_gtk.h b/chrome/browser/gtk/options/managed_prefs_banner_gtk.h
index cd7f9c6..5681387 100644
--- a/chrome/browser/gtk/options/managed_prefs_banner_gtk.h
+++ b/chrome/browser/gtk/options/managed_prefs_banner_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,31 +6,7 @@
#define CHROME_BROWSER_GTK_OPTIONS_MANAGED_PREFS_BANNER_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "chrome/browser/policy/managed_prefs_banner_base.h"
-
-// Constructs and maintains a GTK widget displaying a warning banner. The banner
-// is displayed on the preferences dialog whenever there are options that are
-// not settable by the user due to policy.
-class ManagedPrefsBannerGtk : public policy::ManagedPrefsBannerBase {
- public:
- ManagedPrefsBannerGtk(PrefService* prefs, OptionsPage page);
- virtual ~ManagedPrefsBannerGtk() { }
-
- GtkWidget* banner_widget() { return banner_widget_; }
-
- protected:
- // Update widget visibility.
- virtual void OnUpdateVisibility();
-
- private:
- // Construct the widget.
- void InitWidget();
-
- GtkWidget* banner_widget_;
-
- DISALLOW_COPY_AND_ASSIGN(ManagedPrefsBannerGtk);
-};
+#include "chrome/browser/ui/gtk/options/managed_prefs_banner_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_MANAGED_PREFS_BANNER_GTK_H_
diff --git a/chrome/browser/gtk/options/options_layout_gtk.h b/chrome/browser/gtk/options/options_layout_gtk.h
index 5bf2d3e..d7e8196 100644
--- a/chrome/browser/gtk/options/options_layout_gtk.h
+++ b/chrome/browser/gtk/options/options_layout_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,41 +6,7 @@
#define CHROME_BROWSER_GTK_OPTIONS_OPTIONS_LAYOUT_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-#include <string>
-
-#include "base/basictypes.h"
-
-class OptionsLayoutBuilderGtk {
- public:
- virtual ~OptionsLayoutBuilderGtk() {}
-
- GtkWidget* get_page_widget() {
- return page_;
- }
-
- // Adds an option group to the table. Handles layout and the placing of
- // separators between groups. If expandable is true, the content widget will
- // be allowed to expand and fill any extra space when the dialog is resized.
- virtual void AddOptionGroup(const std::string& title, GtkWidget* content,
- bool expandable) = 0;
-
- // Adds a widget without title or special layout. If expandable is true, the
- // content widget will be allowed to expand and fill any extra space when the
- // dialog is resized.
- virtual void AddWidget(GtkWidget* content, bool expandable) = 0;
-
- // Creates a default option layout builder. The default layout builder
- // follows the GNOME HIG.
- static OptionsLayoutBuilderGtk* Create();
-
- // Creates a compact option layout builder, if the screen is compact.
- // Otherwise, creates a default one.
- static OptionsLayoutBuilderGtk* CreateOptionallyCompactLayout();
-
- protected:
- // The parent widget
- GtkWidget* page_;
-};
+#include "chrome/browser/ui/gtk/options/options_layout_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_OPTIONS_LAYOUT_GTK_H_
diff --git a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h
index 0179501..6aedc68 100644
--- a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h
+++ b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,90 +6,7 @@
#define CHROME_BROWSER_GTK_OPTIONS_PASSWORDS_EXCEPTIONS_PAGE_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <vector>
-
-#include "app/gtk_signal.h"
-#include "chrome/browser/password_manager/password_store.h"
-
-class Profile;
-
-// A page in the show saved passwords dialog that lists what sites we never
-// show passwords for, with controls for the user to add/remove sites from that
-// list.
-class PasswordsExceptionsPageGtk {
- public:
- explicit PasswordsExceptionsPageGtk(Profile* profile);
- virtual ~PasswordsExceptionsPageGtk();
-
- GtkWidget* get_page_widget() const { return page_; }
-
- private:
- // Initialize the exception tree widget, setting the member variables.
- void InitExceptionTree();
-
- // The password store associated with the currently active profile.
- PasswordStore* GetPasswordStore();
-
- // Sets the exception list contents to the given data. We take ownership of
- // the PasswordForms in the vector.
- void SetExceptionList(const std::vector<webkit_glue::PasswordForm*>& result);
-
- CHROMEGTK_CALLBACK_0(PasswordsExceptionsPageGtk, void, OnRemoveButtonClicked);
- CHROMEGTK_CALLBACK_0(PasswordsExceptionsPageGtk, void,
- OnRemoveAllButtonClicked);
-
- CHROMEG_CALLBACK_0(PasswordsExceptionsPageGtk, void,
- OnExceptionSelectionChanged, GtkTreeSelection*);
-
- // Sorting function.
- static gint CompareSite(GtkTreeModel* model,
- GtkTreeIter* a, GtkTreeIter* b,
- gpointer window);
-
- // A short class to mediate requests to the password store.
- class ExceptionListPopulater : public PasswordStoreConsumer {
- public:
- explicit ExceptionListPopulater(PasswordsExceptionsPageGtk* page)
- : page_(page),
- pending_login_query_(0) {
- }
-
- // Send a query to the password store to populate an
- // PasswordsExceptionsPageGtk.
- void populate();
-
- // PasswordStoreConsumer implementation.
- // Send the password store's reply back to the PasswordsExceptionsPageGtk.
- virtual void OnPasswordStoreRequestDone(
- int handle, const std::vector<webkit_glue::PasswordForm*>& result);
-
- private:
- PasswordsExceptionsPageGtk* page_;
- int pending_login_query_;
- };
-
- // Password store consumer for populating the exception list.
- ExceptionListPopulater populater;
-
- // Widgets for the buttons.
- GtkWidget* remove_button_;
- GtkWidget* remove_all_button_;
-
- // Widgets for the exception table.
- GtkWidget* exception_tree_;
- GtkListStore* exception_list_store_;
- GtkTreeModel* exception_list_sort_;
- GtkTreeSelection* exception_selection_;
-
- // The parent GtkHBox widget.
- GtkWidget* page_;
-
- Profile* profile_;
- std::vector<webkit_glue::PasswordForm*> exception_list_;
-
- DISALLOW_COPY_AND_ASSIGN(PasswordsExceptionsPageGtk);
-};
+#include "chrome/browser/ui/gtk/options/passwords_exceptions_page_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_PASSWORDS_EXCEPTIONS_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/passwords_exceptions_window_gtk.h b/chrome/browser/gtk/options/passwords_exceptions_window_gtk.h
index 1e5be39..5048098 100644
--- a/chrome/browser/gtk/options/passwords_exceptions_window_gtk.h
+++ b/chrome/browser/gtk/options/passwords_exceptions_window_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,8 +6,7 @@
#define CHROME_BROWSER_GTK_OPTIONS_PASSWORDS_EXCEPTIONS_WINDOW_GTK_H_
#pragma once
-class Profile;
-
-void ShowPasswordsExceptionsWindow(Profile* profile);
+#include "chrome/browser/ui/gtk/options/passwords_exceptions_window_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_PASSWORDS_EXCEPTIONS_WINDOW_GTK_H_
diff --git a/chrome/browser/gtk/options/passwords_page_gtk.h b/chrome/browser/gtk/options/passwords_page_gtk.h
index d2f9ddf..fd745af 100644
--- a/chrome/browser/gtk/options/passwords_page_gtk.h
+++ b/chrome/browser/gtk/options/passwords_page_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,110 +6,7 @@
#define CHROME_BROWSER_GTK_OPTIONS_PASSWORDS_PAGE_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <string>
-#include <vector>
-
-#include "app/gtk_signal.h"
-#include "chrome/browser/password_manager/password_store.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/common/notification_observer.h"
-
-class Profile;
-
-class PasswordsPageGtk : public NotificationObserver {
- public:
- explicit PasswordsPageGtk(Profile* profile);
- virtual ~PasswordsPageGtk();
-
- GtkWidget* get_page_widget() const { return page_; }
-
- private:
- // Initialize the password tree widget, setting the member variables.
- void InitPasswordTree();
-
- // The password store associated with the currently active profile.
- PasswordStore* GetPasswordStore();
-
- // Sets the password list contents to the given data. We take ownership of
- // the PasswordForms in the vector.
- void SetPasswordList(const std::vector<webkit_glue::PasswordForm*>& result);
-
- // Helper that hides the password.
- void HidePassword();
-
- // NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Handles changes to the observed preferences and updates the UI.
- void OnPrefChanged(const std::string& pref_name);
-
- CHROMEGTK_CALLBACK_0(PasswordsPageGtk, void, OnRemoveButtonClicked);
- CHROMEGTK_CALLBACK_0(PasswordsPageGtk, void, OnRemoveAllButtonClicked);
- CHROMEGTK_CALLBACK_1(PasswordsPageGtk, void, OnRemoveAllConfirmResponse, int);
- CHROMEGTK_CALLBACK_0(PasswordsPageGtk, void, OnShowPasswordButtonClicked);
- CHROMEGTK_CALLBACK_0(PasswordsPageGtk, void, OnShowPasswordButtonRealized);
-
- CHROMEG_CALLBACK_0(PasswordsPageGtk, void, OnPasswordSelectionChanged,
- GtkTreeSelection*);
-
- // Sorting functions.
- static gint CompareSite(GtkTreeModel* model,
- GtkTreeIter* a, GtkTreeIter* b,
- gpointer window);
- static gint CompareUsername(GtkTreeModel* model,
- GtkTreeIter* a, GtkTreeIter* b,
- gpointer window);
-
- // A short class to mediate requests to the password store.
- class PasswordListPopulater : public PasswordStoreConsumer {
- public:
- explicit PasswordListPopulater(PasswordsPageGtk* page)
- : page_(page),
- pending_login_query_(0) {
- }
-
- // Send a query to the password store to populate a PasswordsPageGtk.
- void populate();
-
- // Send the password store's reply back to the PasswordsPageGtk.
- virtual void OnPasswordStoreRequestDone(
- int handle, const std::vector<webkit_glue::PasswordForm*>& result);
-
- private:
- PasswordsPageGtk* page_;
- int pending_login_query_;
- };
-
- // Password store consumer for populating the password list.
- PasswordListPopulater populater;
-
- // Widgets for the buttons.
- GtkWidget* remove_button_;
- GtkWidget* remove_all_button_;
- GtkWidget* show_password_button_;
-
- // Widget for the shown password
- GtkWidget* password_;
- bool password_showing_;
-
- // Widgets for the password table.
- GtkWidget* password_tree_;
- GtkListStore* password_list_store_;
- GtkTreeModel* password_list_sort_;
- GtkTreeSelection* password_selection_;
-
- // The parent GtkHBox widget and GtkWindow window.
- GtkWidget* page_;
-
- Profile* profile_;
- BooleanPrefMember allow_show_passwords_;
- std::vector<webkit_glue::PasswordForm*> password_list_;
-
- DISALLOW_COPY_AND_ASSIGN(PasswordsPageGtk);
-};
+#include "chrome/browser/ui/gtk/options/passwords_page_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_PASSWORDS_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/simple_content_exceptions_window.h b/chrome/browser/gtk/options/simple_content_exceptions_window.h
index 2d3b068..df5c971 100644
--- a/chrome/browser/gtk/options/simple_content_exceptions_window.h
+++ b/chrome/browser/gtk/options/simple_content_exceptions_window.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,75 +6,7 @@
#define CHROME_BROWSER_GTK_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_WINDOW_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/gtk/gtk_tree.h"
-#include "chrome/browser/remove_rows_table_model.h"
-#include "chrome/common/content_settings.h"
-#include "chrome/common/content_settings_types.h"
-
-class SimpleContentExceptionsWindow
- : public gtk_tree::TableAdapter::Delegate {
- public:
- // Takes ownership of |model|.
- static void ShowExceptionsWindow(GtkWindow* parent,
- RemoveRowsTableModel* model,
- int tile_message_id);
-
- virtual ~SimpleContentExceptionsWindow();
-
- // gtk_tree::TableAdapter::Delegate implementation:
- virtual void SetColumnValues(int row, GtkTreeIter* iter);
- virtual void OnAnyModelUpdateStart();
- virtual void OnAnyModelUpdate();
-
- private:
- // Takes ownership of |model|.
- SimpleContentExceptionsWindow(GtkWindow* parent,
- RemoveRowsTableModel* model,
- int title_message_id);
-
- // Updates which buttons are enabled.
- void UpdateButtonState();
-
- // Callbacks for the buttons.
- CHROMEGTK_CALLBACK_0(SimpleContentExceptionsWindow, void, Remove);
- CHROMEGTK_CALLBACK_0(SimpleContentExceptionsWindow, void, RemoveAll);
-
- CHROMEGTK_CALLBACK_0(SimpleContentExceptionsWindow, void,
- OnWindowDestroy);
- CHROMEGTK_CALLBACK_0(SimpleContentExceptionsWindow, void,
- OnTreeSelectionChanged);
-
- // The list presented in |treeview_|; a gobject instead of a C++ object.
- GtkListStore* list_store_;
-
- // The C++, views-ish, cross-platform model class that actually contains the
- // gold standard data.
- scoped_ptr<RemoveRowsTableModel> model_;
-
- // The adapter that ferries data back and forth between |model_| and
- // |list_store_| whenever either of them change.
- scoped_ptr<gtk_tree::TableAdapter> model_adapter_;
-
- // The exception window.
- GtkWidget* dialog_;
-
- // The treeview that presents the site/action pairs.
- GtkWidget* treeview_;
-
- // The current user selection from |treeview_|.
- GtkTreeSelection* treeview_selection_;
-
- // Whether to ignore selection changes. This is set during model updates,
- // when the list store may be inconsistent with the table model.
- bool ignore_selection_changes_;
-
- // Buttons.
- GtkWidget* remove_button_;
- GtkWidget* remove_all_button_;
-};
+#include "chrome/browser/ui/gtk/options/simple_content_exceptions_window.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_WINDOW_H_
diff --git a/chrome/browser/gtk/options/url_picker_dialog_gtk.h b/chrome/browser/gtk/options/url_picker_dialog_gtk.h
index 6c4429b..9971437 100644
--- a/chrome/browser/gtk/options/url_picker_dialog_gtk.h
+++ b/chrome/browser/gtk/options/url_picker_dialog_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,88 +6,7 @@
#define CHROME_BROWSER_GTK_OPTIONS_URL_PICKER_DIALOG_GTK_H_
#pragma once
-#include <string>
-
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "base/callback.h"
-#include "chrome/browser/gtk/gtk_tree.h"
-#include "chrome/browser/history/history.h"
-
-class AccessibleWidgetHelper;
-class GURL;
-class Profile;
-class PossibleURLModel;
-
-class UrlPickerDialogGtk : public gtk_tree::TableAdapter::Delegate {
- public:
- typedef Callback1<const GURL&>::Type UrlPickerCallback;
-
- UrlPickerDialogGtk(UrlPickerCallback* callback,
- Profile* profile,
- GtkWindow* parent);
-
- ~UrlPickerDialogGtk();
-
- // gtk_tree::TableAdapter::Delegate implementation.
- virtual void SetColumnValues(int row, GtkTreeIter* iter);
-
- private:
- // Call the callback based on url entry.
- void AddURL();
-
- // Set sensitivity of buttons based on url entry state.
- void EnableControls();
-
- // Return the entry-formatted url for path in the sorted model.
- std::string GetURLForPath(GtkTreePath* path) const;
-
- // GTK sorting callbacks.
- static gint CompareTitle(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b,
- gpointer window);
- static gint CompareURL(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b,
- gpointer window);
-
- CHROMEGTK_CALLBACK_0(UrlPickerDialogGtk, void, OnUrlEntryChanged);
- CHROMEGTK_CALLBACK_2(UrlPickerDialogGtk, void, OnHistoryRowActivated,
- GtkTreePath*, GtkTreeViewColumn*);
- CHROMEGTK_CALLBACK_1(UrlPickerDialogGtk, void, OnResponse, int);
- CHROMEGTK_CALLBACK_0(UrlPickerDialogGtk, void, OnWindowDestroy);
-
- // Callback for user selecting rows in recent history list.
- CHROMEG_CALLBACK_0(UrlPickerDialogGtk, void, OnHistorySelectionChanged,
- GtkTreeSelection*)
-
- // The dialog window.
- GtkWidget* dialog_;
-
- // The text entry for manually adding an URL.
- GtkWidget* url_entry_;
-
- // The add button (we need a reference to it so we can de-activate it when the
- // |url_entry_| is empty.)
- GtkWidget* add_button_;
-
- // The recent history list.
- GtkWidget* history_tree_;
- GtkListStore* history_list_store_;
- GtkTreeModel* history_list_sort_;
- GtkTreeSelection* history_selection_;
-
- // Profile.
- Profile* profile_;
-
- // The table model.
- scoped_ptr<PossibleURLModel> url_table_model_;
- scoped_ptr<gtk_tree::TableAdapter> url_table_adapter_;
-
- // Called if the user selects an url.
- UrlPickerCallback* callback_;
-
- // Helper object to manage accessibility metadata.
- scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
-
- DISALLOW_COPY_AND_ASSIGN(UrlPickerDialogGtk);
-};
+#include "chrome/browser/ui/gtk/options/url_picker_dialog_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OPTIONS_URL_PICKER_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/overflow_button.h b/chrome/browser/gtk/overflow_button.h
index 66724f4..f7aea6c 100644
--- a/chrome/browser/gtk/overflow_button.h
+++ b/chrome/browser/gtk/overflow_button.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,33 +6,7 @@
#define CHROME_BROWSER_GTK_OVERFLOW_BUTTON_H_
#pragma once
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-
-typedef struct _GtkWidget GtkWidget;
-class Profile;
-
-// An overflow chevron button. The button itself is a plain gtk_chrome_button,
-// and this class handles theming it.
-class OverflowButton : public NotificationObserver {
- public:
- explicit OverflowButton(Profile* profile);
- virtual ~OverflowButton();
-
- GtkWidget* widget() { return widget_.get(); }
-
- private:
- // NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- OwnedWidgetGtk widget_;
-
- Profile* profile_;
-
- NotificationRegistrar registrar_;
-};
+#include "chrome/browser/ui/gtk/overflow_button.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OVERFLOW_BUTTON_H_
diff --git a/chrome/browser/gtk/owned_widget_gtk.h b/chrome/browser/gtk/owned_widget_gtk.h
index b5299c9..62f9c7e 100644
--- a/chrome/browser/gtk/owned_widget_gtk.h
+++ b/chrome/browser/gtk/owned_widget_gtk.h
@@ -1,90 +1,12 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// This class assists you in dealing with a specific situation when managing
-// ownership between a C++ object and a GTK widget. It is common to have a
-// C++ object which encapsulates a GtkWidget, and that widget is exposed from
-// the object for use outside of the class. In this situation, you commonly
-// want the GtkWidget's lifetime to match its C++ object's lifetime. Using an
-// OwnedWigetGtk will take ownership over the initial reference of the
-// GtkWidget, so that it is "owned" by the C++ object. Example usage:
-//
-// class FooViewGtk() {
-// public:
-// FooViewGtk() { }
-// ~FooViewGtk() { widget_.Destroy(); }
-// void Init() { vbox_.Own(gtk_vbox_new()); }
-// GtkWidget* widget() { return vbox_.get() }; // Host my widget!
-// private:
-// OwnedWidgetGtk vbox_;
-// };
-//
-// This design will ensure that the widget stays alive from the call to Own()
-// until the call to Destroy().
-//
-// - Details of the problem and OwnedWidgetGtk's solution:
-// In order to make passing ownership more convenient for newly created
-// widgets, GTK has a concept of a "floating" reference. All GtkObjects (and
-// thus GtkWidgets) inherit from GInitiallyUnowned. When they are created, the
-// object starts with a reference count of 1, but has its floating flag set.
-// When it is put into a container for the first time, that container will
-// "sink" the floating reference, and the count will still be 1. Now the
-// container owns the widget, and if we remove the widget from the container,
-// the widget is destroyed. This style of ownership often causes problems when
-// you have an object encapsulating the widget. If we just use a raw
-// GtkObject* with no specific ownership management, we push the widget's
-// ownership onto the user of the class. Now the C++ object can't depend on
-// the widget being valid, since it doesn't manage its lifetime. If the widget
-// was removed from a container, removing its only reference, it would be
-// destroyed (from the C++ object's perspective) unexpectantly destroyed. The
-// solution is fairly simple, make sure that the C++ object owns the widget,
-// and thus it is also responsible for destroying it. This boils down to:
-// GtkWidget* widget = gtk_widget_new();
-// g_object_ref_sink(widget); // Claim the initial floating reference.
-// ...
-// gtk_destroy_widget(widget); // Ask all code to destroy their references.
-// g_object_unref(widget); // Destroy the initial reference we had claimed.
-
#ifndef CHROME_BROWSER_GTK_OWNED_WIDGET_GTK_H_
#define CHROME_BROWSER_GTK_OWNED_WIDGET_GTK_H_
#pragma once
-#include "base/basictypes.h"
-
-typedef struct _GtkWidget GtkWidget;
-
-class OwnedWidgetGtk {
- public:
- // Create an instance that isn't managing any ownership.
- OwnedWidgetGtk() : widget_(NULL) { }
- // Create an instance that owns |widget|.
- explicit OwnedWidgetGtk(GtkWidget* widget) : widget_(NULL) { Own(widget); }
-
- ~OwnedWidgetGtk();
-
- // Return the currently owned widget, or NULL if no widget is owned.
- GtkWidget* get() const { return widget_; }
- GtkWidget* operator->() const { return widget_; }
-
- // Takes ownership of a widget, by taking the initial floating reference of
- // the GtkWidget. It is expected that Own() is called right after the widget
- // has been created, and before any other references to the widget might have
- // been added. It is valid to never call Own(), in which case Destroy() will
- // do nothing. If Own() has been called, you must explicitly call Destroy().
- void Own(GtkWidget* widget);
-
- // You must call Destroy() after you have called Own(). Calling Destroy()
- // will call gtk_widget_destroy(), and drop our reference to the widget.
- // After a call to Destroy(), you may call Own() again. NOTE: It is expected
- // that after gtk_widget_destroy we will be holding the only reference left
- // on the object. We assert this in debug mode to help catch any leaks.
- void Destroy();
-
- private:
- GtkWidget* widget_;
-
- DISALLOW_COPY_AND_ASSIGN(OwnedWidgetGtk);
-};
+#include "chrome/browser/ui/gtk/owned_widget_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_OWNED_WIDGET_GTK_H_
diff --git a/chrome/browser/gtk/process_singleton_dialog.h b/chrome/browser/gtk/process_singleton_dialog.h
index ec9641e..6206921 100644
--- a/chrome/browser/gtk/process_singleton_dialog.h
+++ b/chrome/browser/gtk/process_singleton_dialog.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,30 +6,7 @@
#define CHROME_BROWSER_GTK_PROCESS_SINGLETON_DIALOG_H_
#pragma once
-#include <string>
-
-#include <gtk/gtk.h>
-
-#include "base/basictypes.h"
-
-// Displays an error to the user when the ProcessSingleton cannot acquire the
-// lock. This runs the message loop itself as the browser message loop has not
-// started by that point in the startup process.
-class ProcessSingletonDialog {
- public:
- // Shows the dialog, and returns once the dialog has been closed.
- static void ShowAndRun(const std::string& message);
-
- private:
- explicit ProcessSingletonDialog(const std::string& message);
-
- static void OnResponse(GtkWidget* widget,
- int response,
- ProcessSingletonDialog* dialog);
-
- GtkWidget* dialog_;
-
- DISALLOW_COPY_AND_ASSIGN(ProcessSingletonDialog);
-};
+#include "chrome/browser/ui/gtk/process_singleton_dialog.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_PROCESS_SINGLETON_DIALOG_H_
diff --git a/chrome/browser/gtk/reload_button_gtk.h b/chrome/browser/gtk/reload_button_gtk.h
index b641a13..1188711 100644
--- a/chrome/browser/gtk/reload_button_gtk.h
+++ b/chrome/browser/gtk/reload_button_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,98 +6,7 @@
#define CHROME_BROWSER_GTK_RELOAD_BUTTON_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "base/timer.h"
-#include "chrome/browser/gtk/custom_button.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-
-class Browser;
-class GtkThemeProvider;
-class LocationBarViewGtk;
-class Task;
-
-class ReloadButtonGtk : public NotificationObserver {
- public:
- enum Mode { MODE_RELOAD = 0, MODE_STOP };
-
- ReloadButtonGtk(LocationBarViewGtk* location_bar, Browser* browser);
- ~ReloadButtonGtk();
-
- GtkWidget* widget() const { return widget_.get(); }
-
- // Ask for a specified button state. If |force| is true this will be applied
- // immediately.
- void ChangeMode(Mode mode, bool force);
-
- // Provide NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& /* details */);
-
- private:
- friend class ReloadButtonGtkTest;
-
- CHROMEGTK_CALLBACK_0(ReloadButtonGtk, void, OnClicked);
- CHROMEGTK_CALLBACK_1(ReloadButtonGtk, gboolean, OnExpose, GdkEventExpose*);
- CHROMEGTK_CALLBACK_1(ReloadButtonGtk,
- gboolean,
- OnLeaveNotify,
- GdkEventCrossing*);
- CHROMEGTK_CALLBACK_4(ReloadButtonGtk,
- gboolean,
- OnQueryTooltip,
- gint,
- gint,
- gboolean,
- GtkTooltip*);
-
- void UpdateThemeButtons();
-
- void OnDoubleClickTimer();
- void OnStopToReloadTimer();
-
- base::OneShotTimer<ReloadButtonGtk> double_click_timer_;
- base::OneShotTimer<ReloadButtonGtk> stop_to_reload_timer_;
-
- // These may be NULL when testing.
- LocationBarViewGtk* const location_bar_;
- Browser* const browser_;
-
- // The mode we should be in assuming no timers are running.
- Mode intended_mode_;
-
- // The currently-visible mode - this may differ from the intended mode.
- Mode visible_mode_;
-
- // Used to listen for theme change notifications.
- NotificationRegistrar registrar_;
-
- GtkThemeProvider* theme_provider_;
-
- CustomDrawButtonBase reload_;
- CustomDrawButtonBase stop_;
- CustomDrawHoverController hover_controller_;
-
- OwnedWidgetGtk widget_;
-
- // The delay times for the timers. These are members so that tests can modify
- // them.
- base::TimeDelta double_click_timer_delay_;
- base::TimeDelta stop_to_reload_timer_delay_;
-
- // TESTING ONLY
- // True if we should pretend the button is hovered.
- bool testing_mouse_hovered_;
- // Increments when we would tell the browser to "reload", so
- // test code can tell whether we did so (as there may be no |browser_|).
- int testing_reload_count_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(ReloadButtonGtk);
-};
+#include "chrome/browser/ui/gtk/reload_button_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_RELOAD_BUTTON_GTK_H_
diff --git a/chrome/browser/gtk/repost_form_warning_gtk.h b/chrome/browser/gtk/repost_form_warning_gtk.h
index 6b0f982..4d41711 100644
--- a/chrome/browser/gtk/repost_form_warning_gtk.h
+++ b/chrome/browser/gtk/repost_form_warning_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,46 +6,7 @@
#define CHROME_BROWSER_GTK_REPOST_FORM_WARNING_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/gtk/constrained_window_gtk.h"
-
-class RepostFormWarningController;
-
-// Displays a dialog that warns the user that they are about to resubmit
-// a form.
-// To display the dialog, allocate this object on the heap. It will open the
-// dialog from its constructor and then delete itself when the user dismisses
-// the dialog.
-class RepostFormWarningGtk : public ConstrainedDialogDelegate {
- public:
- RepostFormWarningGtk(GtkWindow* parent, TabContents* tab_contents);
-
- // ConstrainedDialogDelegate methods
- virtual GtkWidget* GetWidgetRoot();
-
- virtual void DeleteDelegate();
-
- private:
- virtual ~RepostFormWarningGtk();
-
- // Callbacks
- CHROMEGTK_CALLBACK_0(RepostFormWarningGtk, void, OnRefresh);
- CHROMEGTK_CALLBACK_0(RepostFormWarningGtk, void, OnCancel);
- CHROMEGTK_CALLBACK_1(RepostFormWarningGtk,
- void,
- OnHierarchyChanged,
- GtkWidget*);
-
- scoped_ptr<RepostFormWarningController> controller_;
-
- GtkWidget* dialog_;
- GtkWidget* ok_;
- GtkWidget* cancel_;
-
- DISALLOW_COPY_AND_ASSIGN(RepostFormWarningGtk);
-};
+#include "chrome/browser/ui/gtk/repost_form_warning_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_REPOST_FORM_WARNING_GTK_H_
diff --git a/chrome/browser/gtk/rounded_window.h b/chrome/browser/gtk/rounded_window.h
index d1788f8..63915e8 100644
--- a/chrome/browser/gtk/rounded_window.h
+++ b/chrome/browser/gtk/rounded_window.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,59 +6,7 @@
#define CHROME_BROWSER_GTK_ROUNDED_WINDOW_H_
#pragma once
-#include <gtk/gtk.h>
-
-namespace gtk_util {
-
-// Symbolic names for arguments to |rounded_edges| in ActAsRoundedWindow().
-enum RoundedBorders {
- ROUNDED_NONE = 0,
- ROUNDED_BOTTOM_LEFT = 1 << 0,
- ROUNDED_TOP_LEFT = 1 << 1,
- ROUNDED_TOP_RIGHT = 1 << 2,
- ROUNDED_TOP = (1 << 1) | (1 << 2),
- ROUNDED_BOTTOM_RIGHT = 1 << 3,
- ROUNDED_ALL = 0xF
-};
-
-// Symbolic names for arguments to |drawn_borders| in ActAsRoundedWindow().
-enum BorderEdge {
- BORDER_NONE = 0,
- BORDER_LEFT = 1 << 0,
- BORDER_TOP = 1 << 1,
- BORDER_RIGHT = 1 << 2,
- BORDER_BOTTOM = 1 << 3,
- BORDER_ALL = 0xF
-};
-
-// Sets up the passed in widget that has its own GdkWindow with an expose
-// handler that forces the window shape into roundness. Caller should not set
-// an "expose-event" handler on |widget|; if caller needs to do custom
-// rendering, use SetRoundedWindowExposeFunction() instead. |rounded_edges|
-// control which corners are rounded. |drawn_borders| border control which
-// sides have a visible border drawn in |color|.
-void ActAsRoundedWindow(
- GtkWidget* widget, const GdkColor& color, int corner_size,
- int rounded_edges, int drawn_borders);
-
-// Undoes most of the actions of ActAsRoundedWindow().
-void StopActingAsRoundedWindow(GtkWidget* widget);
-
-// Returns true if the window is rounded.
-bool IsActingAsRoundedWindow(GtkWidget* widget);
-
-// Sets edge and border properties on a widget that has already been configured
-// with ActAsRoundedWindow().
-void SetRoundedWindowEdgesAndBorders(GtkWidget* widget,
- int corner_size,
- int rounded_edges,
- int drawn_borders);
-
-// Sets the color of the border on a widget that has already been configured
-// with ActAsRoundedWindow().
-void SetRoundedWindowBorderColor(GtkWidget* widget, GdkColor color);
-
-
-} // namespace gtk_util
+#include "chrome/browser/ui/gtk/rounded_window.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_ROUNDED_WINDOW_H_
diff --git a/chrome/browser/gtk/sad_tab_gtk.h b/chrome/browser/gtk/sad_tab_gtk.h
index dafc835..ba9abfb 100644
--- a/chrome/browser/gtk/sad_tab_gtk.h
+++ b/chrome/browser/gtk/sad_tab_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,35 +6,7 @@
#define CHROME_BROWSER_GTK_SAD_TAB_GTK_H_
#pragma once
-typedef struct _GtkWidget GtkWidget;
-
-#include "app/gtk_signal.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-
-class TabContents;
-
-class SadTabGtk {
- public:
- enum Kind {
- CRASHED, // The tab crashed. Display the "Aw, Snap!" page.
- KILLED // The tab was killed. Display the killed tab page.
- };
-
- explicit SadTabGtk(TabContents* tab_contents, Kind kind);
- virtual ~SadTabGtk();
-
- GtkWidget* widget() const { return event_box_.get(); }
-
- private:
- CHROMEGTK_CALLBACK_0(SadTabGtk, void, OnLinkButtonClick);
-
- void OnLinkButtonClick();
-
- TabContents* tab_contents_;
- OwnedWidgetGtk event_box_;
- Kind kind_;
-
- DISALLOW_COPY_AND_ASSIGN(SadTabGtk);
-};
+#include "chrome/browser/ui/gtk/sad_tab_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_SAD_TAB_GTK_H_
diff --git a/chrome/browser/gtk/slide_animator_gtk.h b/chrome/browser/gtk/slide_animator_gtk.h
index b0f5c73..3b5dbed 100644
--- a/chrome/browser/gtk/slide_animator_gtk.h
+++ b/chrome/browser/gtk/slide_animator_gtk.h
@@ -1,123 +1,12 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-//
-// A helper class for animating the display of native widget content.
-// Currently only handle vertical sliding, but could be extended to handle
-// horizontal slides or other types of animations.
-//
-// NOTE: This does not handle clipping. If you are not careful, you will
-// wind up with visibly overlapping widgets. If you need clipping, you can
-// extend the constructor to take an option to give |fixed| its own GdkWindow
-// (via gtk_fixed_set_has_window).
#ifndef CHROME_BROWSER_GTK_SLIDE_ANIMATOR_GTK_H_
#define CHROME_BROWSER_GTK_SLIDE_ANIMATOR_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "base/scoped_ptr.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "ui/base/animation/animation_delegate.h"
-
-namespace ui {
-class SlideAnimation;
-}
-
-class SlideAnimatorGtk : public ui::AnimationDelegate {
- public:
- class Delegate {
- public:
- // Called when a call to Close() finishes animating.
- virtual void Closed() = 0;
-
- protected:
- virtual ~Delegate() {}
- };
-
- enum Direction {
- DOWN,
- UP
- };
-
- // |child| is the widget we pack into |widget_|.
- // |direction| indicates which side the contents will appear to come from.
- // |duration| is the duration of the slide in milliseconds, or 0 for default.
- // |linear| controls how the animation progresses. If true, the
- // velocity of the slide is constant over time, otherwise it goes a bit faster
- // at the beginning and slows to a halt.
- // |delegate| may be NULL.
- SlideAnimatorGtk(GtkWidget* child,
- Direction direction,
- int duration,
- bool linear,
- bool control_child_size,
- Delegate* delegate);
-
- virtual ~SlideAnimatorGtk();
-
- GtkWidget* widget() { return widget_.get(); }
-
- // Slide open.
- void Open();
-
- // Immediately show the widget.
- void OpenWithoutAnimation();
-
- // Slide shut.
- void Close();
-
- // End the current animation.
- void End();
-
- // Immediately hide the widget.
- void CloseWithoutAnimation();
-
- // Returns whether the widget is visible.
- bool IsShowing();
-
- // Returns whether the widget is currently showing the close animation.
- bool IsClosing();
-
- // Returns whether the widget is currently showing the open or close
- // animation.
- bool IsAnimating();
-
- // ui::AnimationDelegate implementation.
- virtual void AnimationProgressed(const ui::Animation* animation);
- virtual void AnimationEnded(const ui::Animation* animation);
-
- // Used during testing; disable or enable animations (default is enabled).
- static void SetAnimationsForTesting(bool enable);
-
- private:
- static void OnChildSizeAllocate(GtkWidget* child,
- GtkAllocation* allocation,
- SlideAnimatorGtk* slider);
-
- scoped_ptr<ui::SlideAnimation> animation_;
-
- // The top level widget of the SlideAnimatorGtk. It is a GtkFixed.
- OwnedWidgetGtk widget_;
-
- // The widget passed to us at construction time, and the only direct child of
- // |widget_|.
- GtkWidget* child_;
-
- // The direction of the slide.
- Direction direction_;
-
- // The object to inform about certain events. It may be NULL.
- Delegate* delegate_;
-
- // We need to move the child widget to (0, -height), but we don't know its
- // height until it has been allocated. This variable will be true until the
- // child widget has been allocated, at which point we will move it, and then
- // set this variable to false to indicate it should not be moved again.
- bool child_needs_move_;
-
- static bool animations_enabled_;
-};
+#include "chrome/browser/ui/gtk/slide_animator_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_SLIDE_ANIMATOR_GTK_H_
diff --git a/chrome/browser/gtk/status_bubble_gtk.h b/chrome/browser/gtk/status_bubble_gtk.h
index fcbf7a0..446f342 100644
--- a/chrome/browser/gtk/status_bubble_gtk.h
+++ b/chrome/browser/gtk/status_bubble_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,171 +6,7 @@
#define CHROME_BROWSER_GTK_STATUS_BUBBLE_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <string>
-
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-#include "base/timer.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/browser/ui/status_bubble.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "gfx/point.h"
-#include "googleurl/src/gurl.h"
-#include "ui/base/animation/animation_delegate.h"
-
-class GtkThemeProvider;
-class Profile;
-
-namespace ui {
-class SlideAnimation;
-}
-
-// GTK implementation of StatusBubble. Unlike Windows, our status bubble
-// doesn't have the nice leave-the-window effect since we can't rely on the
-// window manager to not try to be "helpful" and center our popups, etc.
-// We therefore position it absolutely in a GtkFixed, that we don't own.
-class StatusBubbleGtk : public StatusBubble,
- public NotificationObserver,
- public ui::AnimationDelegate {
- public:
- explicit StatusBubbleGtk(Profile* profile);
- virtual ~StatusBubbleGtk();
-
- bool flip_horizontally() const { return flip_horizontally_; }
- int y_offset() const { return y_offset_; }
-
- // StatusBubble implementation.
- virtual void SetStatus(const string16& status);
- virtual void SetURL(const GURL& url, const string16& languages);
- virtual void Hide();
- virtual void MouseMoved(const gfx::Point& location, bool left_content);
-
- // ui::AnimationDelegate implementation.
- virtual void AnimationEnded(const ui::Animation* animation);
- virtual void AnimationProgressed(const ui::Animation* animation);
-
- // Called when the download shelf becomes visible or invisible.
- // This is used by to ensure that the status bubble does not obscure
- // the download shelf, when it is visible.
- virtual void UpdateDownloadShelfVisibility(bool visible);
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Top of the widget hierarchy for a StatusBubble. This top level widget is
- // guarenteed to have its gtk_widget_name set to "status-bubble" for
- // identification.
- GtkWidget* widget() { return container_.get(); }
-
- private:
- // Sets the text of the label widget and controls visibility. (As contrasted
- // with setting the current status or URL text, which may be ignored for now).
- void SetStatusTextTo(const std::string& status_utf8);
-
- // Sets the status text to the current value of |url_|, eliding it as
- // necessary.
- void SetStatusTextToURL();
-
- // Sets the status bubble's location in the parent GtkFixed, shows the widget
- // and makes sure that the status bubble has the highest z-order.
- void Show();
-
- // Builds the widgets, containers, etc.
- void InitWidgets();
-
- // Notification from the window that we should retheme ourself.
- void UserChangedTheme();
-
- // Sets whether the bubble should be flipped horizontally and displayed on the
- // opposite side of the tab contents. Reshapes the container and queues a
- // redraw if necessary.
- void SetFlipHorizontally(bool flip_horizontally);
-
- // Expand the bubble up to the full width of the browser, so that the entire
- // URL may be seen. Called after the user hovers over a link for sufficient
- // time.
- void ExpandURL();
-
- // Adjust the actual size of the bubble by changing the label's size request.
- void UpdateLabelSizeRequest();
-
- // Returns true if the status bubble is in the expand-state (i.e., is
- // currently expanded or in the process of expanding).
- bool expanded() {
- return expand_animation_.get();
- }
-
- CHROMEGTK_CALLBACK_1(StatusBubbleGtk, gboolean, HandleMotionNotify,
- GdkEventMotion*);
-
- CHROMEGTK_CALLBACK_1(StatusBubbleGtk, gboolean, HandleEnterNotify,
- GdkEventCrossing*);
-
- NotificationRegistrar registrar_;
-
- // Provides colors.
- GtkThemeProvider* theme_provider_;
-
- // The toplevel event box.
- OwnedWidgetGtk container_;
-
- // The GtkAlignment holding |label_|.
- GtkWidget* padding_;
-
- // The GtkLabel holding the text.
- GtkWidget* label_;
-
- // The status text we want to display when there are no URLs to display.
- std::string status_text_;
-
- // The URL we are displaying for.
- GURL url_;
-
- // The possibly elided url text we want to display.
- std::string url_text_;
-
- // Used to determine the character set that the user can read (for eliding
- // the url text).
- string16 languages_;
-
- // A timer that hides our window after a delay.
- base::OneShotTimer<StatusBubbleGtk> hide_timer_;
-
- // A timer that expands our window after a delay.
- base::OneShotTimer<StatusBubbleGtk> expand_timer_;
-
- // The animation for resizing the status bubble on long hovers.
- scoped_ptr<ui::SlideAnimation> expand_animation_;
-
- // The start and end width of the current resize animation.
- int start_width_;
- int desired_width_;
-
- // Should the bubble be flipped horizontally (e.g. displayed on the right for
- // an LTR language)? We move the bubble to the other side of the tab contents
- // rather than sliding it down when the download shelf is visible.
- bool flip_horizontally_;
-
- // Vertical offset used to hide the status bubble as the pointer nears it.
- int y_offset_;
-
- // If the download shelf is visible, do not obscure it.
- bool download_shelf_is_visible_;
-
- // 'location' and 'left_content' values from the last invocation of
- // MouseMoved(). We hang onto these so we can move the bubble if necessary
- // when its text changes, triggering a size change.
- gfx::Point last_mouse_location_;
- bool last_mouse_left_content_;
-
- // Shortly after the cursor enters the status bubble, we'll get a message
- // that the cursor left the content area. This lets us ignore that.
- bool ignore_next_left_content_;
-};
+#include "chrome/browser/ui/gtk/status_bubble_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_STATUS_BUBBLE_GTK_H_
diff --git a/chrome/browser/gtk/status_icons/status_icon_gtk.h b/chrome/browser/gtk/status_icons/status_icon_gtk.h
index 7053ed5..216d65c 100644
--- a/chrome/browser/gtk/status_icons/status_icon_gtk.h
+++ b/chrome/browser/gtk/status_icons/status_icon_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,42 +6,7 @@
#define CHROME_BROWSER_GTK_STATUS_ICONS_STATUS_ICON_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "chrome/browser/status_icons/status_icon.h"
-
-class MenuGtk;
-class SkBitmap;
-
-class StatusIconGtk : public StatusIcon {
- public:
- StatusIconGtk();
- virtual ~StatusIconGtk();
-
- // Overridden from StatusIcon:
- virtual void SetImage(const SkBitmap& image);
- virtual void SetPressedImage(const SkBitmap& image);
- virtual void SetToolTip(const string16& tool_tip);
-
- // Exposed for testing.
- CHROMEGTK_CALLBACK_0(StatusIconGtk, void, OnClick);
-
- protected:
- // Overridden from StatusIcon.
- virtual void UpdatePlatformContextMenu(menus::MenuModel* menu);
-
- private:
- // Callback invoked when user right-clicks on the status icon.
- CHROMEGTK_CALLBACK_2(StatusIconGtk, void, OnPopupMenu, guint, guint);
-
- // The currently-displayed icon for the window.
- GtkStatusIcon* icon_;
-
- // The context menu for this icon (if any).
- scoped_ptr<MenuGtk> menu_;
-
- DISALLOW_COPY_AND_ASSIGN(StatusIconGtk);
-};
+#include "chrome/browser/ui/gtk/status_icons/status_icon_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_STATUS_ICONS_STATUS_ICON_GTK_H_
diff --git a/chrome/browser/gtk/status_icons/status_tray_gtk.h b/chrome/browser/gtk/status_icons/status_tray_gtk.h
index 5e0241b..a1873ad 100644
--- a/chrome/browser/gtk/status_icons/status_tray_gtk.h
+++ b/chrome/browser/gtk/status_icons/status_tray_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,19 +6,7 @@
#define CHROME_BROWSER_GTK_STATUS_ICONS_STATUS_TRAY_GTK_H_
#pragma once
-#include "chrome/browser/status_icons/status_tray.h"
-
-class StatusTrayGtk : public StatusTray {
- public:
- StatusTrayGtk();
- ~StatusTrayGtk();
-
- protected:
- // Overriden from StatusTray:
- virtual StatusIcon* CreatePlatformStatusIcon();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(StatusTrayGtk);
-};
+#include "chrome/browser/ui/gtk/status_icons/status_tray_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_STATUS_ICONS_STATUS_TRAY_GTK_H_
diff --git a/chrome/browser/gtk/tab_contents_container_gtk.h b/chrome/browser/gtk/tab_contents_container_gtk.h
index 13d6bf0..480104c 100644
--- a/chrome/browser/gtk/tab_contents_container_gtk.h
+++ b/chrome/browser/gtk/tab_contents_container_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,105 +6,7 @@
#define CHROME_BROWSER_GTK_TAB_CONTENTS_CONTAINER_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/browser/gtk/view_id_util.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-
-class RenderViewHost;
-class StatusBubbleGtk;
-class TabContents;
-
-typedef struct _GtkFloatingContainer GtkFloatingContainer;
-
-class TabContentsContainerGtk : public NotificationObserver,
- public ViewIDUtil::Delegate {
- public:
- explicit TabContentsContainerGtk(StatusBubbleGtk* status_bubble);
- ~TabContentsContainerGtk();
-
- void Init();
-
- // Make the specified tab visible.
- void SetTabContents(TabContents* tab_contents);
- TabContents* GetTabContents() const { return tab_contents_; }
-
- // Gets the tab contents currently being displayed (either |tab_contents_| or
- // |preview_contents_|).
- TabContents* GetVisibleTabContents();
-
- void SetPreviewContents(TabContents* preview);
- void PopPreviewContents();
-
- // Remove the tab from the hierarchy.
- void DetachTabContents(TabContents* tab_contents);
-
- // NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- GtkWidget* widget() { return floating_.get(); }
-
- // ViewIDUtil::Delegate implementation ---------------------------------------
- virtual GtkWidget* GetWidgetForViewID(ViewID id);
-
- private:
- // Called when a TabContents is destroyed. This gives us a chance to clean
- // up our internal state if the TabContents is somehow destroyed before we
- // get notified.
- void TabContentsDestroyed(TabContents* contents);
-
- // Handler for |floating_|'s "set-floating-position" signal. During this
- // callback, we manually set the position of the status bubble.
- static void OnSetFloatingPosition(
- GtkFloatingContainer* container, GtkAllocation* allocation,
- TabContentsContainerGtk* tab_contents_container);
-
- // Add |contents| to the container and start showing it.
- void PackTabContents(TabContents* contents);
-
- // Stop showing |contents|.
- void HideTabContents(TabContents* contents);
-
- // Removes |preview_contents_|.
- void RemovePreviewContents();
-
- // Handle focus traversal on the tab contents container. Focus should not
- // traverse to the preview contents.
- CHROMEGTK_CALLBACK_1(TabContentsContainerGtk, gboolean, OnFocus,
- GtkDirectionType);
-
- NotificationRegistrar registrar_;
-
- // The TabContents for the currently selected tab. This will be showing unless
- // there is a preview contents.
- TabContents* tab_contents_;
-
- // The current preview contents (for instant). If non-NULL, it will be
- // visible.
- TabContents* preview_contents_;
-
- // The status bubble manager. Always non-NULL.
- StatusBubbleGtk* status_bubble_;
-
- // Top of the TabContentsContainerGtk widget hierarchy. A cross between a
- // GtkBin and a GtkFixed, |floating_| has |expanded_| as its one "real" child,
- // and the various things that hang off the bottom (status bubble, etc) have
- // their positions manually set in OnSetFloatingPosition.
- OwnedWidgetGtk floating_;
-
- // We insert and remove TabContents GtkWidgets into this expanded_. This
- // should not be a GtkVBox since there were errors with timing where the vbox
- // was horizontally split with the top half displaying the current TabContents
- // and bottom half displaying the loading page.
- GtkWidget* expanded_;
-
- DISALLOW_COPY_AND_ASSIGN(TabContentsContainerGtk);
-};
+#include "chrome/browser/ui/gtk/tab_contents_container_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_TAB_CONTENTS_CONTAINER_GTK_H_
diff --git a/chrome/browser/gtk/tab_contents_drag_source.h b/chrome/browser/gtk/tab_contents_drag_source.h
index e1eb56e..70c4165 100644
--- a/chrome/browser/gtk/tab_contents_drag_source.h
+++ b/chrome/browser/gtk/tab_contents_drag_source.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,105 +6,7 @@
#define CHROME_BROWSER_GTK_TAB_CONTENTS_DRAG_SOURCE_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "app/gtk_signal_registrar.h"
-#include "base/basictypes.h"
-#include "base/file_path.h"
-#include "base/message_loop.h"
-#include "base/string16.h"
-#include "gfx/point.h"
-#include "gfx/native_widget_types.h"
-#include "googleurl/src/gurl.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h"
-
-class SkBitmap;
-class TabContents;
-class TabContentsView;
-struct WebDropData;
-
-// TabContentsDragSource takes care of managing the drag from a TabContents
-// with Gtk.
-class TabContentsDragSource : public MessageLoopForUI::Observer {
- public:
- explicit TabContentsDragSource(TabContentsView* tab_contents_view);
- ~TabContentsDragSource();
-
- TabContents* tab_contents() const;
-
- // Starts a drag for the tab contents this TabContentsDragSource was
- // created for.
- void StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask allowed_ops,
- GdkEventButton* last_mouse_down,
- const SkBitmap& image,
- const gfx::Point& image_offset);
-
- // MessageLoop::Observer implementation:
- virtual void WillProcessEvent(GdkEvent* event);
- virtual void DidProcessEvent(GdkEvent* event);
-
- private:
- CHROMEGTK_CALLBACK_2(TabContentsDragSource, gboolean, OnDragFailed,
- GdkDragContext*, GtkDragResult);
- CHROMEGTK_CALLBACK_1(TabContentsDragSource, void, OnDragBegin,
- GdkDragContext*);
- CHROMEGTK_CALLBACK_1(TabContentsDragSource, void, OnDragEnd,
- GdkDragContext*);
- CHROMEGTK_CALLBACK_4(TabContentsDragSource, void, OnDragDataGet,
- GdkDragContext*, GtkSelectionData*, guint, guint);
- CHROMEGTK_CALLBACK_1(TabContentsDragSource, gboolean, OnDragIconExpose,
- GdkEventExpose*);
-
- gfx::NativeView GetContentNativeView() const;
-
- // The view we're manging the drag for.
- TabContentsView* tab_contents_view_;
-
- // The drop data for the current drag (for drags that originate in the render
- // view). Non-NULL iff there is a current drag.
- scoped_ptr<WebDropData> drop_data_;
-
- // The image used for depicting the drag, and the offset between the cursor
- // and the top left pixel.
- GdkPixbuf* drag_pixbuf_;
- gfx::Point image_offset_;
-
- // The mime type for the file contents of the current drag (if any).
- GdkAtom drag_file_mime_type_;
-
- // Whether the current drag has failed. Meaningless if we are not the source
- // for a current drag.
- bool drag_failed_;
-
- // This is the widget we use to initiate drags. Since we don't use the
- // renderer widget, we can persist drags even when our contents is switched
- // out. We can't use an OwnedWidgetGtk because the GtkInvisible widget
- // initialization code sinks the reference.
- GtkWidget* drag_widget_;
-
- // Context created once drag starts. A NULL value indicates that there is
- // no drag currently in progress.
- GdkDragContext* drag_context_;
-
- // The file mime type for a drag-out download.
- string16 wide_download_mime_type_;
-
- // The file name to be saved to for a drag-out download.
- FilePath download_file_name_;
-
- // The URL to download from for a drag-out download.
- GURL download_url_;
-
- // The widget that provides visual feedback for the drag. We can't use
- // an OwnedWidgetGtk because the GtkWindow initialization code sinks
- // the reference.
- GtkWidget* drag_icon_;
-
- GtkSignalRegistrar signals_;
-
- DISALLOW_COPY_AND_ASSIGN(TabContentsDragSource);
-};
+#include "chrome/browser/ui/gtk/tab_contents_drag_source.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_TAB_CONTENTS_DRAG_SOURCE_H_
diff --git a/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.h b/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.h
index c421d69..c349be0 100644
--- a/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.h
+++ b/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,267 +6,7 @@
#define CHROME_BROWSER_GTK_TABS_DRAGGED_TAB_CONTROLLER_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <set>
-
-#include "app/x11_util.h"
-#include "base/scoped_ptr.h"
-#include "base/timer.h"
-#include "chrome/browser/tab_contents/tab_contents_delegate.h"
-#include "chrome/browser/ui/tabs/dock_info.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-
-class DraggedTabGtk;
-class TabGtk;
-class TabStripGtk;
-class TabContentsWrapper;
-
-class DraggedTabControllerGtk : public NotificationObserver,
- public TabContentsDelegate {
- public:
- DraggedTabControllerGtk(TabGtk* source_tab, TabStripGtk* source_tabstrip);
- virtual ~DraggedTabControllerGtk();
-
- // Capture information needed to be used during a drag session for this
- // controller's associated source Tab and TabStrip. |mouse_offset| is the
- // distance of the mouse pointer from the Tab's origin.
- void CaptureDragInfo(const gfx::Point& mouse_offset);
-
- // Responds to drag events subsequent to StartDrag. If the mouse moves a
- // sufficient distance before the mouse is released, a drag session is
- // initiated.
- void Drag();
-
- // Complete the current drag session. If the drag session was canceled
- // because the user pressed Escape or something interrupted it, |canceled|
- // is true so the helper can revert the state to the world before the drag
- // begun. Returns whether the tab has been destroyed.
- bool EndDrag(bool canceled);
-
- // Retrieve the source tab if the TabContents specified matches the one being
- // dragged by this controller, or NULL if the specified TabContents is not
- // the same as the one being dragged.
- TabGtk* GetDragSourceTabForContents(TabContents* contents) const;
-
- // Returns true if the specified tab matches the tab being dragged.
- bool IsDragSourceTab(const TabGtk* tab) const;
-
- // Returns true if the specified tab is detached.
- bool IsTabDetached(const TabGtk* tab) const;
-
- private:
- // Enumeration of the ways a drag session can end.
- enum EndDragType {
- // Drag session exited normally: the user released the mouse.
- NORMAL,
-
- // The drag session was canceled (alt-tab during drag, escape ...)
- CANCELED,
-
- // The tab (NavigationController) was destroyed during the drag.
- TAB_DESTROYED
- };
-
- // Overridden from TabContentsDelegate:
- virtual void OpenURLFromTab(TabContents* source,
- const GURL& url,
- const GURL& referrer,
- WindowOpenDisposition disposition,
- PageTransition::Type transition);
- virtual void NavigationStateChanged(const TabContents* source,
- unsigned changed_flags);
- virtual void AddNewContents(TabContents* source,
- TabContents* new_contents,
- WindowOpenDisposition disposition,
- const gfx::Rect& initial_pos,
- bool user_gesture);
- virtual void ActivateContents(TabContents* contents);
- virtual void DeactivateContents(TabContents* contents);
- virtual void LoadingStateChanged(TabContents* source);
- virtual void CloseContents(TabContents* source);
- virtual void MoveContents(TabContents* source, const gfx::Rect& pos);
- virtual bool IsPopup(TabContents* source);
- virtual void ToolbarSizeChanged(TabContents* source, bool is_animating);
- virtual void URLStarredChanged(TabContents* source, bool starred);
- virtual void UpdateTargetURL(TabContents* source, const GURL& url);
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Initialize the offset used to calculate the position to create windows
- // in |GetWindowCreatePoint|.
- void InitWindowCreatePoint();
-
- // Returns the point where a detached window should be created given the
- // current mouse position.
- gfx::Point GetWindowCreatePoint() const;
-
- // Sets the TabContents being dragged with the specified |new_contents|.
- void SetDraggedContents(TabContentsWrapper* new_contents);
-
- // Move the DraggedTabView according to the current mouse screen position,
- // potentially updating the source and other TabStrips.
- void ContinueDragging();
-
- // Handles moving the Tab within a TabStrip as well as updating the View.
- void MoveTab(const gfx::Point& screen_point);
-
- // Returns the compatible TabStrip that is under the specified point (screen
- // coordinates), or NULL if there is none.
- TabStripGtk* GetTabStripForPoint(const gfx::Point& screen_point);
-
- // Returns the specified |tabstrip| if it contains the specified point
- // (screen coordinates), NULL if it does not.
- TabStripGtk* GetTabStripIfItContains(TabStripGtk* tabstrip,
- const gfx::Point& screen_point) const;
-
- // Attach the dragged Tab to the specified TabStrip.
- void Attach(TabStripGtk* attached_tabstrip, const gfx::Point& screen_point);
-
- // Detach the dragged Tab from the current TabStrip.
- void Detach();
-
- // Converts a screen point to a point relative to the tab strip.
- gfx::Point ConvertScreenPointToTabStripPoint(TabStripGtk* tabstrip,
- const gfx::Point& screen_point);
-
- // Retrieve the bounds of the DraggedTabGtk, relative to the attached
- // TabStrip, given location of the dragged tab in screen coordinates.
- gfx::Rect GetDraggedTabTabStripBounds(const gfx::Point& screen_point);
-
- // Returns the index where the dragged TabContents should be inserted into
- // the attached TabStripModel given the DraggedTabView's bounds
- // |dragged_bounds| in coordinates relative to the attached TabStrip.
- // |is_tab_attached| is true if the tab has already been added.
- int GetInsertionIndexForDraggedBounds(const gfx::Rect& dragged_bounds,
- bool is_tab_attached) const;
-
- // Get the position of the dragged tab relative to the attached tab strip.
- gfx::Point GetDraggedTabPoint(const gfx::Point& screen_point);
-
- // Finds the Tab within the specified TabStrip that corresponds to the
- // dragged TabContents.
- TabGtk* GetTabMatchingDraggedContents(TabStripGtk* tabstrip) const;
-
- // Does the work for EndDrag. Returns whether the tab has been destroyed.
- bool EndDragImpl(EndDragType how_end);
-
- // If the drag was aborted for some reason, this function is called to un-do
- // the changes made during the drag operation.
- void RevertDrag();
-
- // Finishes the drag operation. Returns true if the drag controller should
- // be destroyed immediately, false otherwise.
- bool CompleteDrag();
-
- // Create the DraggedTabGtk if it does not yet exist.
- void EnsureDraggedTab();
-
- // Utility for getting the mouse position in screen coordinates.
- gfx::Point GetCursorScreenPoint() const;
-
- // Gets the screen bounds of a tab.
- static gfx::Rect GetTabScreenBounds(TabGtk* tab);
-
- // Utility to convert the specified TabStripModel index to something valid
- // for the attached TabStrip.
- int NormalizeIndexToAttachedTabStrip(int index) const;
-
- // Hides the window that contains the tab strip the current drag session was
- // initiated from.
- void HideWindow();
-
- // Presents the window that was hidden by HideWindow.
- void ShowWindow();
-
- // Closes a hidden frame at the end of a drag session.
- void CleanUpHiddenFrame();
-
- // Cleans up a source tab that is no longer used.
- void CleanUpSourceTab();
-
- // Completes the drag session after the view has animated to its final
- // position.
- void OnAnimateToBoundsComplete();
-
- // Activates whichever window is under the mouse.
- void BringWindowUnderMouseToFront();
-
- // Handles registering for notifications.
- NotificationRegistrar registrar_;
-
- // The TabContents being dragged.
- TabContentsWrapper* dragged_contents_;
-
- // The original TabContentsDelegate of |dragged_contents_|, before it was
- // detached from the browser window. We store this so that we can forward
- // certain delegate notifications back to it if we can't handle them locally.
- TabContentsDelegate* original_delegate_;
-
- // The tab that initiated the drag session.
- TabGtk* source_tab_;
-
- // The tab strip |source_tab_| originated from.
- TabStripGtk* source_tabstrip_;
-
- // This is the index of the |source_tab_| in |source_tabstrip_| when the drag
- // began. This is used to restore the previous state if the drag is aborted.
- int source_model_index_;
-
- // The TabStrip the dragged Tab is currently attached to, or NULL if the
- // dragged Tab is detached.
- TabStripGtk* attached_tabstrip_;
-
- // The visual representation of the dragged Tab.
- scoped_ptr<DraggedTabGtk> dragged_tab_;
-
- // The position of the mouse (in screen coordinates) at the start of the drag
- // operation. This is used to calculate minimum elasticity before a
- // DraggedTabView is constructed.
- gfx::Point start_screen_point_;
-
- // This is the offset of the mouse from the top left of the Tab where
- // dragging begun. This is used to ensure that the dragged view is always
- // positioned at the correct location during the drag, and to ensure that the
- // detached window is created at the right location.
- gfx::Point mouse_offset_;
-
- // A hint to use when positioning new windows created by detaching Tabs. This
- // is the distance of the mouse from the top left of the dragged tab as if it
- // were the distance of the mouse from the top left of the first tab in the
- // attached TabStrip from the top left of the window.
- gfx::Point window_create_point_;
-
- // Whether we're in the destructor or not. Makes sure we don't destroy the
- // drag controller more than once.
- bool in_destructor_;
-
- // The horizontal position of the mouse cursor in screen coordinates at the
- // time of the last re-order event.
- int last_move_screen_x_;
-
- // DockInfo for the tabstrip.
- DockInfo dock_info_;
-
- typedef std::set<GtkWidget*> DockWindows;
- DockWindows dock_windows_;
-
- // Is the tab mini?
- const bool mini_;
-
- // Is the tab pinned?
- const bool pinned_;
-
- // Timer used to bring the window under the cursor to front. If the user
- // stops moving the mouse for a brief time over a browser window, it is
- // brought to front.
- base::OneShotTimer<DraggedTabControllerGtk> bring_to_front_timer_;
-
- DISALLOW_COPY_AND_ASSIGN(DraggedTabControllerGtk);
-};
+#include "chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_TABS_DRAGGED_TAB_CONTROLLER_GTK_H_
diff --git a/chrome/browser/gtk/tabs/dragged_tab_gtk.h b/chrome/browser/gtk/tabs/dragged_tab_gtk.h
index ae4c0f1..501f757 100644
--- a/chrome/browser/gtk/tabs/dragged_tab_gtk.h
+++ b/chrome/browser/gtk/tabs/dragged_tab_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,142 +6,7 @@
#define CHROME_BROWSER_GTK_TABS_DRAGGED_TAB_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "base/callback.h"
-#include "base/scoped_ptr.h"
-#include "base/task.h"
-#include "gfx/canvas.h"
-#include "gfx/point.h"
-#include "gfx/rect.h"
-#include "gfx/size.h"
-#include "ui/base/animation/animation_delegate.h"
-#include "ui/base/animation/slide_animation.h"
-
-class TabContents;
-class TabRendererGtk;
-
-class DraggedTabGtk : public ui::AnimationDelegate {
- public:
- DraggedTabGtk(TabContents* datasource,
- const gfx::Point& mouse_tab_offset,
- const gfx::Size& contents_size,
- bool mini);
- virtual ~DraggedTabGtk();
-
- // Moves the dragged tab to the appropriate location given the mouse
- // pointer at |screen_point|.
- void MoveTo(const gfx::Point& screen_point);
-
- // Sets the offset of the mouse from the upper left corner of the tab.
- void set_mouse_tab_offset(const gfx::Point& offset) {
- mouse_tab_offset_ = offset;
- }
-
- // Notifies the dragged tab that it has become attached to a tabstrip.
- void Attach(int selected_width);
-
- // Resizes the dragged tab to a width of |width|.
- void Resize(int width);
-
- // Notifies the dragged tab that it has been detached from a tabstrip.
- void Detach();
-
- // Notifies the dragged tab that it should update itself.
- void Update();
-
- // Animates the dragged tab to the specified bounds, then calls back to
- // |callback|.
- typedef Callback0::Type AnimateToBoundsCallback;
- void AnimateToBounds(const gfx::Rect& bounds,
- AnimateToBoundsCallback* callback);
-
- // Returns the size of the dragged tab. Used when attaching to a tabstrip
- // to determine where to place the tab in the attached tabstrip.
- const gfx::Size& attached_tab_size() const { return attached_tab_size_; }
-
- GtkWidget* widget() const { return container_; }
-
- private:
- // Overridden from ui::AnimationDelegate:
- virtual void AnimationProgressed(const ui::Animation* animation);
- virtual void AnimationEnded(const ui::Animation* animation);
- virtual void AnimationCanceled(const ui::Animation* animation);
-
- // Arranges the contents of the dragged tab.
- void Layout();
-
- // Gets the preferred size of the dragged tab.
- gfx::Size GetPreferredSize();
-
- // Resizes the container to fit the content for the current attachment mode.
- void ResizeContainer();
-
- // Utility for scaling a size by the current scaling factor.
- int ScaleValue(int value);
-
- // Returns the bounds of the container window.
- gfx::Rect bounds() const;
-
- // Sets the color map of the container window to allow the window to be
- // transparent.
- void SetContainerColorMap();
-
- // Sets full transparency for the container window. This is used if
- // compositing is available for the screen.
- void SetContainerTransparency();
-
- // Sets the shape mask for the container window to emulate a transparent
- // container window. This is used if compositing is not available for the
- // screen.
- // |surface| represents the tab only (not the render view).
- void SetContainerShapeMask(cairo_surface_t* surface);
-
- // expose-event handler that notifies when the tab needs to be redrawn.
- static gboolean OnExposeEvent(GtkWidget* widget, GdkEventExpose* event,
- DraggedTabGtk* dragged_tab);
-
- // The tab contents that the dragged tab contains.
- TabContents* data_source_;
-
- // The window that contains the dragged tab or tab contents.
- GtkWidget* container_;
-
- // The fixed widget that we use to contain the tab renderer so that the
- // tab widget won't be resized.
- GtkWidget* fixed_;
-
- // The renderer that paints the dragged tab.
- scoped_ptr<TabRendererGtk> renderer_;
-
- // True if the view is currently attached to a tabstrip. Controls rendering
- // and sizing modes.
- bool attached_;
-
- // The unscaled offset of the mouse from the top left of the dragged tab.
- // This is used to maintain an appropriate offset for the mouse pointer when
- // dragging scaled and unscaled representations, and also to calculate the
- // position of detached windows.
- gfx::Point mouse_tab_offset_;
-
- // The size of the tab renderer when the dragged tab is attached to a
- // tabstrip.
- gfx::Size attached_tab_size_;
-
- // The dimensions of the TabContents being dragged.
- gfx::Size contents_size_;
-
- // The animation used to slide the attached tab to its final location.
- ui::SlideAnimation close_animation_;
-
- // A callback notified when the animation is complete.
- scoped_ptr<Callback0::Type> animation_callback_;
-
- // The start and end bounds of the animation sequence.
- gfx::Rect animation_start_bounds_;
- gfx::Rect animation_end_bounds_;
-
- DISALLOW_COPY_AND_ASSIGN(DraggedTabGtk);
-};
+#include "chrome/browser/ui/gtk/tabs/dragged_tab_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_TABS_DRAGGED_TAB_GTK_H_
diff --git a/chrome/browser/gtk/tabs/tab_gtk.h b/chrome/browser/gtk/tabs/tab_gtk.h
index 804656e..b51b1a7 100644
--- a/chrome/browser/gtk/tabs/tab_gtk.h
+++ b/chrome/browser/gtk/tabs/tab_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,208 +6,7 @@
#define CHROME_BROWSER_GTK_TABS_TAB_GTK_H_
#pragma once
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "base/message_loop.h"
-#include "chrome/browser/gtk/tabs/tab_renderer_gtk.h"
-#include "chrome/browser/tabs/tab_strip_model.h"
-
-namespace gfx {
-class Path;
-}
-
-class ThemeProvider;
-
-class TabGtk : public TabRendererGtk,
- public MessageLoopForUI::Observer {
- public:
- // An interface implemented by an object that can help this Tab complete
- // various actions. The index parameter is the index of this Tab in the
- // TabRenderer::Model.
- class TabDelegate {
- public:
- // Returns true if the specified Tab is selected.
- virtual bool IsTabSelected(const TabGtk* tab) const = 0;
-
- // Returns true if the specified Tab is pinned.
- virtual bool IsTabPinned(const TabGtk* tab) const = 0;
-
- // Returns true if the specified Tab is detached.
- virtual bool IsTabDetached(const TabGtk* tab) const = 0;
-
- // Selects the specified Tab.
- virtual void SelectTab(TabGtk* tab) = 0;
-
- // Closes the specified Tab.
- virtual void CloseTab(TabGtk* tab) = 0;
-
- // Returns true if the specified command is enabled for the specified Tab.
- virtual bool IsCommandEnabledForTab(
- TabStripModel::ContextMenuCommand command_id,
- const TabGtk* tab) const = 0;
-
- // Executes the specified command for the specified Tab.
- virtual void ExecuteCommandForTab(
- TabStripModel::ContextMenuCommand command_id, TabGtk* tab) = 0;
-
- // Starts/Stops highlighting the tabs that will be affected by the
- // specified command for the specified Tab.
- virtual void StartHighlightTabsForCommand(
- TabStripModel::ContextMenuCommand command_id, TabGtk* tab) = 0;
- virtual void StopHighlightTabsForCommand(
- TabStripModel::ContextMenuCommand command_id, TabGtk* tab) = 0;
- virtual void StopAllHighlighting() = 0;
-
- // Potentially starts a drag for the specified Tab.
- virtual void MaybeStartDrag(TabGtk* tab, const gfx::Point& point) = 0;
-
- // Continues dragging a Tab.
- virtual void ContinueDrag(GdkDragContext* context) = 0;
-
- // Ends dragging a Tab. |canceled| is true if the drag was aborted in a way
- // other than the user releasing the mouse. Returns whether the tab has been
- // destroyed.
- virtual bool EndDrag(bool canceled) = 0;
-
- // Returns true if the associated TabStrip's delegate supports tab moving or
- // detaching. Used by the Frame to determine if dragging on the Tab
- // itself should move the window in cases where there's only one
- // non drag-able Tab.
- virtual bool HasAvailableDragActions() const = 0;
-
- // Returns the theme provider for icons and colors.
- virtual ThemeProvider* GetThemeProvider() = 0;
-
- protected:
- virtual ~TabDelegate() {}
- };
-
- explicit TabGtk(TabDelegate* delegate);
- virtual ~TabGtk();
-
- // Access the delegate.
- TabDelegate* delegate() const { return delegate_; }
-
- GtkWidget* widget() const { return event_box_; }
-
- // Used to set/check whether this Tab is being animated closed.
- void set_closing(bool closing) { closing_ = closing; }
- bool closing() const { return closing_; }
-
- // Used to set/check whether this Tab is being dragged.
- void set_dragging(bool dragging) { dragging_ = dragging; }
- bool dragging() const { return dragging_; }
-
- // TabRendererGtk overrides:
- virtual bool IsSelected() const;
- virtual bool IsVisible() const;
- virtual void SetVisible(bool visible) const;
- virtual void CloseButtonClicked();
- virtual void UpdateData(TabContents* contents, bool app, bool loading_only);
- virtual void SetBounds(const gfx::Rect& bounds);
-
- private:
- class ContextMenuController;
- class TabGtkObserverHelper;
- friend class ContextMenuController;
-
- // MessageLoop::Observer implementation:
- virtual void WillProcessEvent(GdkEvent* event);
- virtual void DidProcessEvent(GdkEvent* event);
-
- // button-press-event handler that handles mouse clicks.
- CHROMEGTK_CALLBACK_1(TabGtk, gboolean, OnButtonPressEvent, GdkEventButton*);
-
- // button-release-event handler that handles mouse click releases.
- CHROMEGTK_CALLBACK_1(TabGtk, gboolean, OnButtonReleaseEvent, GdkEventButton*);
-
- // drag-begin is emitted when the drag is started. We connect so that we can
- // set the drag icon to a transparent pixbuf.
- CHROMEGTK_CALLBACK_1(TabGtk, void, OnDragBegin, GdkDragContext*);
-
- // drag-failed is emitted when the drag is finished. In our case the signal
- // does not imply failure as we don't use the drag-n-drop API to transfer drop
- // data.
- CHROMEGTK_CALLBACK_2(TabGtk, gboolean, OnDragFailed, GdkDragContext*,
- GtkDragResult);
-
- // When a drag is ending, a fake button release event is passed to the drag
- // widget to fake letting go of the mouse button. We need a callback for
- // this event because it is the only way to catch drag end events when the
- // user presses space or return.
- CHROMEGTK_CALLBACK_1(TabGtk, gboolean, OnDragButtonReleased, GdkEventButton*);
-
- // Shows the context menu.
- void ShowContextMenu();
-
- // Invoked when the context menu closes.
- void ContextMenuClosed();
-
- // Sets whether the tooltip should be shown or not, depending on the size of
- // the tab.
- void UpdateTooltipState();
-
- // Creates the drag widget used to track a drag operation.
- void CreateDragWidget();
-
- // Destroys the drag widget.
- void DestroyDragWidget();
-
- // Starts the dragging operation. |drag_offset| is the offset inside the tab
- // bounds where the grab occurred.
- void StartDragging(gfx::Point drag_offset);
-
- // Ends the dragging operations. |canceled| is true if the operation was
- // canceled.
- void EndDrag(bool canceled);
-
- // An instance of a delegate object that can perform various actions based on
- // user gestures.
- TabDelegate* delegate_;
-
- // True if the tab is being animated closed.
- bool closing_;
-
- // True if the tab is being dragged.
- bool dragging_;
-
- // The context menu controller.
- scoped_ptr<ContextMenuController> menu_controller_;
-
- // The windowless widget used to collect input events for the tab. We can't
- // use an OwnedWidgetGtk because of the way the dragged tab controller
- // destroys the source tab. The source tab is destroyed when the drag ends
- // before we let gtk handle the end of the drag. This results in the widget
- // having an extra reference, which will cause OwnedWidgetGtk.Destroy to
- // DCHECK.
- GtkWidget* event_box_;
-
- // A copy of the last button press event, used to initiate a drag.
- GdkEvent* last_mouse_down_;
-
- // A GtkInivisible used to track the drag event. GtkInvisibles are of the
- // type GInitiallyUnowned, but the widget initialization code sinks the
- // reference, so we can't used an OwnedWidgetGtk here.
- GtkWidget* drag_widget_;
-
- // The cached width of the title in pixels, updated whenever the title
- // changes.
- int title_width_;
-
- // Keep track of whether or not we have an observer.
- scoped_ptr<TabGtkObserverHelper> observer_;
-
- // Used to destroy the drag widget after a return to the message loop.
- ScopedRunnableMethodFactory<TabGtk> destroy_factory_;
-
- // Due to a bug in GTK+, we need to force the end of a drag when we get a
- // mouse release event on the the dragged widget, otherwise, we don't know
- // when the drag has ended when the user presses space or enter. We queue
- // a task to end the drag and only run it if GTK+ didn't send us the
- // drag-failed event.
- ScopedRunnableMethodFactory<TabGtk> drag_end_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(TabGtk);
-};
+#include "chrome/browser/ui/gtk/tabs/tab_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_TABS_TAB_GTK_H_
diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.h b/chrome/browser/gtk/tabs/tab_renderer_gtk.h
index 0593e68..8e6562c 100644
--- a/chrome/browser/gtk/tabs/tab_renderer_gtk.h
+++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,451 +6,7 @@
#define CHROME_BROWSER_GTK_TABS_TAB_RENDERER_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-#include <map>
-
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "base/string16.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "gfx/canvas.h"
-#include "gfx/font.h"
-#include "gfx/rect.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/base/animation/animation_delegate.h"
-
-namespace gfx {
-class Size;
-} // namespace gfx
-
-class CustomDrawButton;
-class GtkThemeProvider;
-class TabContents;
-class ThemeProvider;
-
-namespace ui {
-class SlideAnimation;
-class ThrobAnimation;
-}
-
-class TabRendererGtk : public ui::AnimationDelegate,
- public NotificationObserver {
- public:
- // Possible animation states.
- enum AnimationState {
- ANIMATION_NONE,
- ANIMATION_WAITING,
- ANIMATION_LOADING
- };
-
- class LoadingAnimation : public NotificationObserver {
- public:
- struct Data {
- explicit Data(ThemeProvider* theme_provider);
- Data(int loading, int waiting, int waiting_to_loading);
-
- SkBitmap* waiting_animation_frames;
- SkBitmap* loading_animation_frames;
- int loading_animation_frame_count;
- int waiting_animation_frame_count;
- int waiting_to_loading_frame_count_ratio;
- };
-
- explicit LoadingAnimation(ThemeProvider* theme_provider);
-
- // Used in unit tests to inject specific data.
- explicit LoadingAnimation(const LoadingAnimation::Data& data);
-
- virtual ~LoadingAnimation();
-
- // Advance the loading animation to the next frame, or hide the animation if
- // the tab isn't loading. Returns |true| if the icon area needs to be
- // repainted.
- bool ValidateLoadingAnimation(AnimationState animation_state);
-
- AnimationState animation_state() const { return animation_state_; }
- int animation_frame() const { return animation_frame_; }
-
- const SkBitmap* waiting_animation_frames() const {
- return data_->waiting_animation_frames;
- }
- const SkBitmap* loading_animation_frames() const {
- return data_->loading_animation_frames;
- }
-
- // Provide NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- private:
- scoped_ptr<Data> data_;
-
- // Used to listen for theme change notifications.
- NotificationRegistrar registrar_;
-
- // Gives us our throbber images.
- ThemeProvider* theme_provider_;
-
- // Current state of the animation.
- AnimationState animation_state_;
-
- // The current index into the Animation image strip.
- int animation_frame_;
-
- DISALLOW_COPY_AND_ASSIGN(LoadingAnimation);
- };
-
- explicit TabRendererGtk(ThemeProvider* theme_provider);
- virtual ~TabRendererGtk();
-
- // TabContents. If only the loading state was updated, the loading_only flag
- // should be specified. If other things change, set this flag to false to
- // update everything.
- virtual void UpdateData(TabContents* contents, bool app, bool loading_only);
-
- // Sets the blocked state of the tab.
- void SetBlocked(bool pinned);
- bool is_blocked() const;
-
- // Sets the mini-state of the tab.
- void set_mini(bool mini) { data_.mini = mini; }
- bool mini() const { return data_.mini; }
-
- // Sets the app state of the tab.
- void set_app(bool app) { data_.app = app; }
- bool app() const { return data_.app; }
-
- // Are we in the process of animating a mini tab state change on this tab?
- void set_animating_mini_change(bool value) {
- data_.animating_mini_change = value;
- }
-
- // Updates the display to reflect the contents of this TabRenderer's model.
- void UpdateFromModel();
-
- // Returns true if the Tab is selected, false otherwise.
- virtual bool IsSelected() const;
-
- // Returns true if the Tab is visible, false otherwise.
- virtual bool IsVisible() const;
-
- // Sets the visibility of the Tab.
- virtual void SetVisible(bool visible) const;
-
- // Paints the tab into |canvas|.
- virtual void Paint(gfx::Canvas* canvas);
-
- // Paints the tab into a SkBitmap.
- virtual SkBitmap PaintBitmap();
-
- // Paints the tab, and keeps the result server-side. The returned surface must
- // be freed with cairo_surface_destroy().
- virtual cairo_surface_t* PaintToSurface();
-
- // There is no PaintNow available, so the fastest we can do is schedule a
- // paint with the windowing system.
- virtual void SchedulePaint();
-
- // Notifies the Tab that the close button has been clicked.
- virtual void CloseButtonClicked();
-
- // Sets the bounds of the tab.
- virtual void SetBounds(const gfx::Rect& bounds);
-
- // Provide NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Advance the loading animation to the next frame, or hide the animation if
- // the tab isn't loading. Returns |true| if the icon area needs to be
- // repainted.
- bool ValidateLoadingAnimation(AnimationState animation_state);
-
- // Repaint only the area of the tab that contains the favicon.
- void PaintFavIconArea(GdkEventExpose* event);
-
- // Returns whether the Tab should display a favicon.
- bool ShouldShowIcon() const;
-
- // Returns the minimum possible size of a single unselected Tab.
- static gfx::Size GetMinimumUnselectedSize();
- // Returns the minimum possible size of a selected Tab. Selected tabs must
- // always show a close button and have a larger minimum size than unselected
- // tabs.
- static gfx::Size GetMinimumSelectedSize();
- // Returns the preferred size of a single Tab, assuming space is
- // available.
- static gfx::Size GetStandardSize();
-
- // Returns the width for mini-tabs. Mini-tabs always have this width.
- static int GetMiniWidth();
-
- // Loads the images to be used for the tab background.
- static void LoadTabImages();
-
- // Sets the colors used for painting text on the tabs.
- static void SetSelectedTitleColor(SkColor color);
- static void SetUnselectedTitleColor(SkColor color);
-
- static gfx::Font* title_font() { return title_font_; }
-
- // Returns the bounds of the Tab.
- int x() const { return bounds_.x(); }
- int y() const { return bounds_.y(); }
- int width() const { return bounds_.width(); }
- int height() const { return bounds_.height(); }
-
- gfx::Rect bounds() const { return bounds_; }
-
- gfx::Rect favicon_bounds() const { return favicon_bounds_; }
-
- // Returns the non-mirrored (LTR) bounds of this tab.
- gfx::Rect GetNonMirroredBounds(GtkWidget* parent) const;
-
- // Returns the requested bounds of the tab.
- gfx::Rect GetRequisition() const;
-
- GtkWidget* widget() const { return tab_.get(); }
-
- // Start/stop the mini-tab title animation.
- void StartMiniTabTitleAnimation();
- void StopMiniTabTitleAnimation();
-
- void set_vertical_offset(int offset) { background_offset_y_ = offset; }
-
- protected:
- const gfx::Rect& title_bounds() const { return title_bounds_; }
- const gfx::Rect& close_button_bounds() const { return close_button_bounds_; }
-
- // Returns the title of the Tab.
- string16 GetTitle() const;
-
- // enter-notify-event handler that signals when the mouse enters the tab.
- CHROMEGTK_CALLBACK_1(TabRendererGtk, gboolean, OnEnterNotifyEvent,
- GdkEventCrossing*);
-
- // leave-notify-event handler that signals when the mouse enters the tab.
- CHROMEGTK_CALLBACK_1(TabRendererGtk, gboolean, OnLeaveNotifyEvent,
- GdkEventCrossing*);
-
- private:
- class FavIconCrashAnimation;
-
- // The data structure used to hold cached bitmaps. We need to manually free
- // the bitmap in CachedBitmap when we remove it from |cached_bitmaps_|. We
- // handle this when we replace images in the map and in the destructor.
- struct CachedBitmap {
- int bg_offset_x;
- int bg_offset_y;
- SkBitmap* bitmap;
- };
- typedef std::map<std::pair<const SkBitmap*, const SkBitmap*>, CachedBitmap>
- BitmapCache;
-
- // Model data. We store this here so that we don't need to ask the underlying
- // model, which is tricky since instances of this object can outlive the
- // corresponding objects in the underlying model.
- struct TabData {
- TabData()
- : is_default_favicon(false),
- loading(false),
- crashed(false),
- off_the_record(false),
- show_icon(true),
- mini(false),
- blocked(false),
- animating_mini_change(false),
- app(false) {
- }
-
- SkBitmap favicon;
- bool is_default_favicon;
- string16 title;
- bool loading;
- bool crashed;
- bool off_the_record;
- bool show_icon;
- bool mini;
- bool blocked;
- bool animating_mini_change;
- bool app;
- };
-
- // TODO(jhawkins): Move into TabResources class.
- struct TabImage {
- SkBitmap* image_l;
- SkBitmap* image_c;
- SkBitmap* image_r;
- int l_width;
- int r_width;
- int y_offset;
- };
-
- // Overridden from ui::AnimationDelegate:
- virtual void AnimationProgressed(const ui::Animation* animation);
- virtual void AnimationCanceled(const ui::Animation* animation);
- virtual void AnimationEnded(const ui::Animation* animation);
-
- // Starts/Stops the crash animation.
- void StartCrashAnimation();
- void StopCrashAnimation();
-
- // Return true if the crash animation is currently running.
- bool IsPerformingCrashAnimation() const;
-
- // Set the temporary offset for the favicon. This is used during animation.
- void SetFavIconHidingOffset(int offset);
-
- void DisplayCrashedFavIcon();
- void ResetCrashedFavIcon();
-
- // Generates the bounds for the interior items of the tab.
- void Layout();
-
- // Returns the local bounds of the tab. This returns the rect
- // {0, 0, width(), height()} for now, as we don't yet support borders.
- gfx::Rect GetLocalBounds();
-
- // Moves the close button widget within the GtkFixed container.
- void MoveCloseButtonWidget();
-
- // Returns the largest of the favicon, title text, and the close button.
- static int GetContentHeight();
-
- // A helper method for generating the masked bitmaps used to draw the curved
- // edges of tabs. We cache the generated bitmaps because they can take a
- // long time to compute.
- SkBitmap* GetMaskedBitmap(const SkBitmap* mask,
- const SkBitmap* background,
- int bg_offset_x,
- int bg_offset_y);
- BitmapCache cached_bitmaps_;
-
- // Paints the tab, minus the close button.
- void PaintTab(GdkEventExpose* event);
-
- // Paint various portions of the Tab
- void PaintTitle(gfx::Canvas* canvas);
- void PaintIcon(gfx::Canvas* canvas);
- void PaintTabBackground(gfx::Canvas* canvas);
- void PaintInactiveTabBackground(gfx::Canvas* canvas);
- void PaintActiveTabBackground(gfx::Canvas* canvas);
- void PaintLoadingAnimation(gfx::Canvas* canvas);
-
- // Returns the number of favicon-size elements that can fit in the tab's
- // current size.
- int IconCapacity() const;
-
-
- // Returns whether the Tab should display a close button.
- bool ShouldShowCloseBox() const;
-
- CustomDrawButton* MakeCloseButton();
-
- // Gets the throb value for the tab. When a tab is not selected the
- // active background is drawn at |GetThrobValue()|%. This is used for hover
- // and mini-tab title change effects.
- double GetThrobValue();
-
- // Handles the clicked signal for the close button.
- CHROMEGTK_CALLBACK_0(TabRendererGtk, void, OnCloseButtonClicked);
-
- // Handles middle clicking the close button.
- CHROMEGTK_CALLBACK_1(TabRendererGtk, gboolean, OnCloseButtonMouseRelease,
- GdkEventButton*);
-
- // expose-event handler that redraws the tab.
- CHROMEGTK_CALLBACK_1(TabRendererGtk, gboolean, OnExposeEvent,
- GdkEventExpose*);
-
- // size-allocate handler used to update the current bounds of the tab.
- CHROMEGTK_CALLBACK_1(TabRendererGtk, void, OnSizeAllocate, GtkAllocation*);
-
- // TODO(jhawkins): Move to TabResources.
- static void InitResources();
- static bool initialized_;
-
- // The bounds of various sections of the display.
- gfx::Rect favicon_bounds_;
- gfx::Rect title_bounds_;
- gfx::Rect close_button_bounds_;
-
- TabData data_;
-
- static TabImage tab_active_;
- static TabImage tab_inactive_;
- static TabImage tab_alpha_;
-
- static gfx::Font* title_font_;
- static int title_font_height_;
-
- static int close_button_width_;
- static int close_button_height_;
-
- static SkColor selected_title_color_;
- static SkColor unselected_title_color_;
-
- // The GtkDrawingArea we draw the tab on.
- OwnedWidgetGtk tab_;
-
- // Whether we're showing the icon. It is cached so that we can detect when it
- // changes and layout appropriately.
- bool showing_icon_;
-
- // Whether we are showing the close button. It is cached so that we can
- // detect when it changes and layout appropriately.
- bool showing_close_button_;
-
- // The offset used to animate the favicon location.
- int fav_icon_hiding_offset_;
-
- // The animation object used to swap the favicon with the sad tab icon.
- scoped_ptr<FavIconCrashAnimation> crash_animation_;
-
- // Set when the crashed favicon should be displayed.
- bool should_display_crashed_favicon_;
-
- // The bounds of this Tab.
- gfx::Rect bounds_;
-
- // The requested bounds of this tab. These bounds are relative to the
- // tabstrip.
- gfx::Rect requisition_;
-
- // Hover animation.
- scoped_ptr<ui::SlideAnimation> hover_animation_;
-
- // Animation used when the title of an inactive mini-tab changes.
- scoped_ptr<ui::ThrobAnimation> mini_title_animation_;
-
- // Contains the loading animation state.
- LoadingAnimation loading_animation_;
-
- // The offset used to paint the tab theme images.
- int background_offset_x_;
-
- // The vertical offset used to paint the tab theme images. Controlled by the
- // tabstrip and plumbed here to offset the theme image by the size of the
- // alignment in the BrowserTitlebar.
- int background_offset_y_;
-
- GtkThemeProvider* theme_provider_;
-
- // The close button.
- scoped_ptr<CustomDrawButton> close_button_;
-
- // The current color of the close button.
- SkColor close_button_color_;
-
- // Used to listen for theme change notifications.
- NotificationRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(TabRendererGtk);
-};
+#include "chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_TABS_TAB_RENDERER_GTK_H_
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.h b/chrome/browser/gtk/tabs/tab_strip_gtk.h
index 716a793..4087991 100644
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.h
+++ b/chrome/browser/gtk/tabs/tab_strip_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,461 +6,7 @@
#define CHROME_BROWSER_GTK_TABS_TAB_STRIP_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-#include <vector>
-
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "base/task.h"
-#include "base/message_loop.h"
-#include "chrome/browser/gtk/owned_widget_gtk.h"
-#include "chrome/browser/gtk/tabstrip_origin_provider.h"
-#include "chrome/browser/gtk/tabs/tab_gtk.h"
-#include "chrome/browser/gtk/view_id_util.h"
-#include "chrome/browser/tabs/tab_strip_model.h"
-#include "chrome/common/notification_observer.h"
-#include "gfx/rect.h"
-
-class BrowserWindowGtk;
-class CustomDrawButton;
-class DraggedTabControllerGtk;
-class GtkThemeProvider;
-
-class TabStripGtk : public TabStripModelObserver,
- public TabGtk::TabDelegate,
- public MessageLoopForUI::Observer,
- public NotificationObserver,
- public TabstripOriginProvider,
- public ViewIDUtil::Delegate {
- public:
- class TabAnimation;
-
- TabStripGtk(TabStripModel* model, BrowserWindowGtk* window);
- virtual ~TabStripGtk();
-
- // Initialize and load the TabStrip into a container.
- // TODO(tc): Pass in theme provider so we can properly theme the tabs.
- void Init();
-
- void Show();
- void Hide();
-
- TabStripModel* model() const { return model_; }
-
- BrowserWindowGtk* window() const { return window_; }
-
- GtkWidget* widget() const { return tabstrip_.get(); }
-
- // Returns true if there is an active drag session.
- bool IsDragSessionActive() const { return drag_controller_.get() != NULL; }
-
- // Returns true if a tab is being dragged into this tabstrip.
- bool IsActiveDropTarget() const;
-
- // Sets the bounds of the tabs.
- void Layout();
-
- // Queues a draw for the tabstrip widget.
- void SchedulePaint();
-
- // Sets the bounds of the tabstrip.
- void SetBounds(const gfx::Rect& bounds);
-
- // Returns the bounds of the tabstrip.
- const gfx::Rect& bounds() const { return bounds_; }
-
- // Updates loading animations for the TabStrip.
- void UpdateLoadingAnimations();
-
- // Return true if this tab strip is compatible with the provided tab strip.
- // Compatible tab strips can transfer tabs during drag and drop.
- bool IsCompatibleWith(TabStripGtk* other);
-
- // Returns true if Tabs in this TabStrip are currently changing size or
- // position.
- bool IsAnimating() const;
-
- // Destroys the active drag controller.
- void DestroyDragController();
-
- // Removes the drag source tab from this tabstrip, and deletes it.
- void DestroyDraggedSourceTab(TabGtk* tab);
-
- // Retrieve the ideal bounds for the Tab at the specified index.
- gfx::Rect GetIdealBounds(int index);
-
- // Sets the vertical offset that each tab will use to offset against the
- // background image. Passed in from the titlebar and based on the size of the
- // alignment that sits above the tabstrip.
- void SetVerticalOffset(int offset);
-
- // TabstripOriginProvider implementation -------------------------------------
- virtual gfx::Point GetTabStripOriginForWidget(GtkWidget* widget);
-
- // ViewIDUtil::Delegate implementation ---------------------------------------
- virtual GtkWidget* GetWidgetForViewID(ViewID id);
-
- protected:
- // TabStripModelObserver implementation:
- virtual void TabInsertedAt(TabContentsWrapper* contents,
- int index,
- bool foreground);
- virtual void TabDetachedAt(TabContentsWrapper* contents, int index);
- virtual void TabSelectedAt(TabContentsWrapper* old_contents,
- TabContentsWrapper* contents,
- int index,
- bool user_gesture);
- virtual void TabMoved(TabContentsWrapper* contents,
- int from_index,
- int to_index);
- virtual void TabChangedAt(TabContentsWrapper* contents, int index,
- TabChangeType change_type);
- virtual void TabReplacedAt(TabStripModel* tab_strip_model,
- TabContentsWrapper* old_contents,
- TabContentsWrapper* new_contents,
- int index);
- virtual void TabMiniStateChanged(TabContentsWrapper* contents, int index);
- virtual void TabBlockedStateChanged(TabContentsWrapper* contents,
- int index);
-
- // TabGtk::TabDelegate implementation:
- virtual bool IsTabSelected(const TabGtk* tab) const;
- virtual bool IsTabPinned(const TabGtk* tab) const;
- virtual bool IsTabDetached(const TabGtk* tab) const;
- virtual void SelectTab(TabGtk* tab);
- virtual void CloseTab(TabGtk* tab);
- virtual bool IsCommandEnabledForTab(
- TabStripModel::ContextMenuCommand command_id, const TabGtk* tab) const;
- virtual void ExecuteCommandForTab(
- TabStripModel::ContextMenuCommand command_id, TabGtk* tab);
- virtual void StartHighlightTabsForCommand(
- TabStripModel::ContextMenuCommand command_id, TabGtk* tab);
- virtual void StopHighlightTabsForCommand(
- TabStripModel::ContextMenuCommand command_id, TabGtk* tab);
- virtual void StopAllHighlighting();
- virtual void MaybeStartDrag(TabGtk* tab, const gfx::Point& point);
- virtual void ContinueDrag(GdkDragContext* context);
- virtual bool EndDrag(bool canceled);
- virtual bool HasAvailableDragActions() const;
- virtual ThemeProvider* GetThemeProvider();
-
- // MessageLoop::Observer implementation:
- virtual void WillProcessEvent(GdkEvent* event);
- virtual void DidProcessEvent(GdkEvent* event);
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Horizontal gap between mini-tabs and normal tabs.
- static const int mini_to_non_mini_gap_;
-
- private:
- friend class BrowserWindowGtk;
- friend class DraggedTabControllerGtk;
- friend class InsertTabAnimation;
- friend class MiniMoveAnimation;
- friend class MiniTabAnimation;
- friend class MoveTabAnimation;
- friend class RemoveTabAnimation;
- friend class ResizeLayoutAnimation;
- friend class TabAnimation;
-
- struct TabData {
- TabGtk* tab;
- gfx::Rect ideal_bounds;
- };
-
- // Used during a drop session of a url. Tracks the position of the drop as
- // well as a window used to highlight where the drop occurs.
- class DropInfo {
- public:
- DropInfo(int index, bool drop_before, bool point_down);
- virtual ~DropInfo();
-
- // TODO(jhawkins): Factor out this code into a TransparentContainer class.
-
- // expose-event handler that redraws the drop indicator.
- CHROMEGTK_CALLBACK_1(DropInfo, gboolean, OnExposeEvent, GdkEventExpose*);
-
- // Sets the color map of the container window to allow the window to be
- // transparent.
- void SetContainerColorMap();
-
- // Sets full transparency for the container window. This is used if
- // compositing is available for the screen.
- void SetContainerTransparency();
-
- // Sets the shape mask for the container window to emulate a transparent
- // container window. This is used if compositing is not available for the
- // screen.
- void SetContainerShapeMask();
-
- // Creates the container widget.
- void CreateContainer();
-
- // Destroys the container widget.
- void DestroyContainer();
-
- // Index of the tab to drop on. If drop_before is true, the drop should
- // occur between the tab at drop_index - 1 and drop_index.
- // WARNING: if drop_before is true it is possible this will == tab_count,
- // which indicates the drop should create a new tab at the end of the tabs.
- int drop_index;
- bool drop_before;
-
- // Direction the arrow should point in. If true, the arrow is displayed
- // above the tab and points down. If false, the arrow is displayed beneath
- // the tab and points up.
- bool point_down;
-
- // Transparent container window used to render the drop indicator over the
- // tabstrip and toolbar.
- GtkWidget* container;
-
- // The drop indicator image.
- GdkPixbuf* drop_arrow;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(DropInfo);
- };
-
- // expose-event handler that redraws the tabstrip
- CHROMEGTK_CALLBACK_1(TabStripGtk, gboolean, OnExpose, GdkEventExpose*);
-
- // size-allocate handler that gets the new bounds of the tabstrip.
- CHROMEGTK_CALLBACK_1(TabStripGtk, void, OnSizeAllocate, GtkAllocation*);
-
- // drag-motion handler that is signaled when the user performs a drag in the
- // tabstrip bounds.
- CHROMEGTK_CALLBACK_4(TabStripGtk, gboolean, OnDragMotion, GdkDragContext*,
- gint, gint, guint);
-
- // drag-drop handler that is notified when the user finishes a drag.
- CHROMEGTK_CALLBACK_4(TabStripGtk, gboolean, OnDragDrop, GdkDragContext*,
- gint, gint, guint);
-
- // drag-leave handler that is signaled when the mouse leaves the tabstrip
- // during a drag.
- CHROMEGTK_CALLBACK_2(TabStripGtk, gboolean, OnDragLeave, GdkDragContext*,
- guint);
-
- // drag-data-received handler that receives the data associated with the drag.
- CHROMEGTK_CALLBACK_6(TabStripGtk, gboolean, OnDragDataReceived,
- GdkDragContext*, gint, gint, GtkSelectionData*,
- guint, guint);
-
- // Handles the clicked signal from the new tab button.
- CHROMEGTK_CALLBACK_0(TabStripGtk, void, OnNewTabClicked);
-
- // Sets the bounds of the tab and moves the tab widget to those bounds.
- void SetTabBounds(TabGtk* tab, const gfx::Rect& bounds);
-
- // Returns true if |rects| are all areas that match up with tab favicons.
- // |rects| must be sorted from left to right. |tabs_to_paint| are the tab
- // positions that match the rects.
- bool CanPaintOnlyFavIcons(const GdkRectangle* rects,
- int num_rects,
- std::vector<int>* tabs_to_paint);
-
- // Paints the tab favicon areas for tabs in |tabs_to_paint|.
- void PaintOnlyFavIcons(GdkEventExpose* event,
- const std::vector<int>& tabs_to_paint);
-
- // Initializes the new tab button.
- CustomDrawButton* MakeNewTabButton();
-
- // Gets the number of Tabs in the collection.
- int GetTabCount() const;
-
- // Returns the number of mini-tabs.
- int GetMiniTabCount() const;
-
- // Retrieves the Tab at the specified index. Take care in using this, you may
- // need to use GetTabAtAdjustForAnimation.
- TabGtk* GetTabAt(int index) const;
-
- // Returns the tab at the specified index. If a remove animation is on going
- // and the index is >= the index of the tab being removed, the index is
- // incremented. While a remove operation is on going the indices of the model
- // do not line up with the indices of the view. This method adjusts the index
- // accordingly.
- //
- // Use this instead of GetTabAt if the index comes from the model.
- TabGtk* GetTabAtAdjustForAnimation(int index) const;
-
- // Returns the exact (unrounded) current width of each tab.
- void GetCurrentTabWidths(double* unselected_width,
- double* selected_width) const;
-
- // Returns the exact (unrounded) desired width of each tab, based on the
- // desired strip width and number of tabs. If
- // |width_of_tabs_for_mouse_close_| is nonnegative we use that value in
- // calculating the desired strip width; otherwise we use the current width.
- // |mini_tab_count| gives the number of mini-tabs, and |tab_count| the
- // number of mini and non-mini-tabs.
- void GetDesiredTabWidths(int tab_count,
- int mini_tab_count,
- double* unselected_width,
- double* selected_width) const;
-
- // Returns the horizontal offset before the tab at |tab_index|.
- int GetTabHOffset(int tab_index);
-
- // Returns the x-coordinate tabs start from.
- int tab_start_x() const;
-
- // Perform an animated resize-relayout of the TabStrip immediately. The
- // value returned indicates whether a resize actually took place.
- bool ResizeLayoutTabs();
-
- // Returns whether or not the cursor is currently in the "tab strip zone"
- // which is defined as the region above the TabStrip and a bit below it.
- bool IsCursorInTabStripZone() const;
-
- // Ensure that the message loop observer used for event spying is added and
- // removed appropriately so we can tell when to resize layout the tab strip.
- void AddMessageLoopObserver();
- void RemoveMessageLoopObserver();
-
- // Calculates the available width for tabs, assuming a Tab is to be closed.
- int GetAvailableWidthForTabs(TabGtk* last_tab) const;
-
- // Finds the index of the TabContents corresponding to |tab| in our
- // associated TabStripModel, or -1 if there is none (e.g. the specified |tab|
- // is being animated closed).
- int GetIndexOfTab(const TabGtk* tab) const;
-
- // Cleans up the tab from the TabStrip at the specified |index|.
- void RemoveTabAt(int index);
-
- // Called from the message loop observer when a mouse movement has occurred
- // anywhere over our containing window.
- void HandleGlobalMouseMoveEvent();
-
- // Generates the ideal bounds of the TabStrip when all Tabs have finished
- // animating to their desired position/bounds. This is used by the standard
- // Layout method and other callers like the DraggedTabController that need
- // stable representations of Tab positions.
- void GenerateIdealBounds();
-
- // Lays out the New Tab button, assuming the right edge of the last Tab on
- // the TabStrip at |last_tab_right|. |unselected_width| is the width of
- // unselected tabs at the moment this function is called. The value changes
- // during animations, so we can't use current_unselected_width_.
- void LayoutNewTabButton(double last_tab_right, double unselected_width);
-
- // -- Link Drag & Drop ------------------------------------------------------
-
- // Returns the bounds to render the drop at, in screen coordinates. Sets
- // |is_beneath| to indicate whether the arrow is beneath the tab, or above
- // it.
- gfx::Rect GetDropBounds(int drop_index, bool drop_before, bool* is_beneath);
-
- // Updates the location of the drop based on the event.
- void UpdateDropIndex(GdkDragContext* context, gint x, gint y);
-
- // Sets the location of the drop, repainting as necessary.
- void SetDropIndex(int index, bool drop_before);
-
- // Determines whether the data is acceptable by the tabstrip and opens a new
- // tab with the data as URL if it is. Returns true if the drop was
- // successful.
- bool CompleteDrop(guchar* data, bool is_plain_text);
-
- // Returns the image to use for indicating a drop on a tab. If is_down is
- // true, this returns an arrow pointing down.
- static GdkPixbuf* GetDropArrowImage(bool is_down);
-
- // -- Animations -------------------------------------------------------------
-
- // Stops the current animation.
- void StopAnimation();
-
- // A generic Layout method for various classes of TabStrip animations,
- // including Insert, Remove and Resize Layout cases.
- void AnimationLayout(double unselected_width);
-
- // Starts various types of TabStrip animations.
- void StartInsertTabAnimation(int index);
- void StartRemoveTabAnimation(int index, TabContents* contents);
- void StartMoveTabAnimation(int from_index, int to_index);
- void StartMiniTabAnimation(int index);
- void StartMiniMoveTabAnimation(int from_index,
- int to_index,
- const gfx::Rect& start_bounds);
- void StartResizeLayoutAnimation();
-
- // Notifies the TabStrip that the specified TabAnimation has completed.
- // Optionally a full Layout will be performed, specified by |layout|.
- void FinishAnimation(TabAnimation* animation, bool layout);
-
- NotificationRegistrar registrar_;
-
- // The Tabs we contain, and their last generated "good" bounds.
- std::vector<TabData> tab_data_;
-
- // The current widths of various types of tabs. We save these so that, as
- // users close tabs while we're holding them at the same size, we can lay out
- // tabs exactly and eliminate the "pixel jitter" we'd get from just leaving
- // them all at their existing, rounded widths.
- double current_unselected_width_;
- double current_selected_width_;
-
- // If this value is nonnegative, it is used in GetDesiredTabWidths() to
- // calculate how much space in the tab strip to use for tabs. Most of the
- // time this will be -1, but while we're handling closing a tab via the mouse,
- // we'll set this to the edge of the last tab before closing, so that if we
- // are closing the last tab and need to resize immediately, we'll resize only
- // back to this width, thus once again placing the last tab under the mouse
- // cursor.
- int available_width_for_tabs_;
-
- // True if a resize layout animation should be run a short delay after the
- // mouse exits the TabStrip.
- bool needs_resize_layout_;
-
- // The GtkFixed widget.
- OwnedWidgetGtk tabstrip_;
-
- // The bounds of the tabstrip.
- gfx::Rect bounds_;
-
- // The amount to offset tab backgrounds when we are using an autogenerated
- // tab background image.
- int tab_vertical_offset_;
-
- // Our model.
- TabStripModel* model_;
-
- // The BrowserWindowGtk containing this tab strip.
- BrowserWindowGtk* window_;
-
- // Theme resources.
- GtkThemeProvider* theme_provider_;
-
- // The currently running animation.
- scoped_ptr<TabAnimation> active_animation_;
-
- // The New Tab button.
- scoped_ptr<CustomDrawButton> newtab_button_;
-
- // Valid for the lifetime of a drag over us.
- scoped_ptr<DropInfo> drop_info_;
-
- // The controller for a drag initiated from a Tab. Valid for the lifetime of
- // the drag session.
- scoped_ptr<DraggedTabControllerGtk> drag_controller_;
-
- // A factory that is used to construct a delayed callback to the
- // ResizeLayoutTabsNow method.
- ScopedRunnableMethodFactory<TabStripGtk> resize_layout_factory_;
-
- // True if the tabstrip has already been added as a MessageLoop observer.
- bool added_as_message_loop_observer_;
-
- DISALLOW_COPY_AND_ASSIGN(TabStripGtk);
-};
+#include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_TABS_TAB_STRIP_GTK_H_
diff --git a/chrome/browser/gtk/tabstrip_origin_provider.h b/chrome/browser/gtk/tabstrip_origin_provider.h
index 0904a01..2d6a5ea 100644
--- a/chrome/browser/gtk/tabstrip_origin_provider.h
+++ b/chrome/browser/gtk/tabstrip_origin_provider.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,26 +6,7 @@
#define CHROME_BROWSER_GTK_TABSTRIP_ORIGIN_PROVIDER_H_
#pragma once
-namespace gfx{
-class Point;
-}
-
-// Abstract interface that provides an offset of a widget. Many pieces of the
-// UI don't need the full BrowserWindowGtk, but just need information about
-// it's position relative to the tabstrip to draw correctly. This interface
-// exists to make it easier to test piece by piece.
-class TabstripOriginProvider {
- public:
- virtual ~TabstripOriginProvider() { }
-
- // Return the origin of the tab strip in coordinates relative to where we
- // start drawing the background theme image. This is the x coordinate of
- // the origin of the GdkWindow of widget(), but the y coordinate of the origin
- // of widget() itself.
- // Used to help other widgets draw their background relative to the tabstrip.
- // Should only be called after both the tabstrip and |widget| have been
- // allocated.
- virtual gfx::Point GetTabStripOriginForWidget(GtkWidget* widget) = 0;
-};
+#include "chrome/browser/ui/gtk/tabstrip_origin_provider.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_TABSTRIP_ORIGIN_PROVIDER_H_
diff --git a/chrome/browser/gtk/task_manager_gtk.h b/chrome/browser/gtk/task_manager_gtk.h
index 5aa5907..0a1fbb7 100644
--- a/chrome/browser/gtk/task_manager_gtk.h
+++ b/chrome/browser/gtk/task_manager_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,228 +6,7 @@
#define CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include <string>
-
-#include "app/gtk_signal.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/task_manager/task_manager.h"
-#include "grit/generated_resources.h"
-
-#if defined(TOOLKIT_VIEWS)
-namespace gfx {
-class Point;
-}
-#endif
-
-class TaskManagerGtk : public TaskManagerModelObserver {
- public:
- TaskManagerGtk();
- virtual ~TaskManagerGtk();
-
- // TaskManagerModelObserver
- virtual void OnModelChanged();
- virtual void OnItemsChanged(int start, int length);
- virtual void OnItemsAdded(int start, int length);
- virtual void OnItemsRemoved(int start, int length);
-
- // Creates the task manager if it doesn't exist; otherwise, it activates the
- // existing task manager window.
- static void Show();
-
- private:
- class ContextMenuController;
- friend class ContextMenuController;
-
- // Initializes the task manager dialog.
- void Init();
-
- // Set |dialog_|'s initial size, using its previous size if that was saved.
- void SetInitialDialogSize();
-
- // Connects the ctrl-w accelerator to the dialog.
- void ConnectAccelerators();
-
- // Sets up the treeview widget.
- void CreateTaskManagerTreeview();
-
- // Returns the model data for a given |row| and |col_id|.
- std::string GetModelText(int row, int col_id);
-
- // Retrieves the resource icon from the model for |row|.
- GdkPixbuf* GetModelIcon(int row);
-
- // Sets the treeview row data. |row| is an index into the model and |iter|
- // is the current position in the treeview.
- void SetRowDataFromModel(int row, GtkTreeIter* iter);
-
- // Queries the treeview for the selected rows, and kills those processes.
- void KillSelectedProcesses();
-
- // Opens the context menu used to select the task manager columns.
-#if defined(TOOLKIT_VIEWS)
- void ShowContextMenu(const gfx::Point& point);
-#else
- void ShowContextMenu();
-#endif
-
- // Opens about:memory in a new foreground tab.
- void OnLinkActivated();
-
- // Compare implementation used for sorting columns.
- gint CompareImpl(GtkTreeModel* tree_model, GtkTreeIter* a,
- GtkTreeIter* b, int id);
-
- // Response signal handler that notifies us of dialog destruction.
- CHROMEGTK_CALLBACK_0(TaskManagerGtk, void, OnDestroy);
-
- // Response signal handler that notifies us of dialog responses.
- CHROMEGTK_CALLBACK_1(TaskManagerGtk, void, OnResponse, gint);
-
- // Realize signal handler to set the page column's initial size.
- CHROMEG_CALLBACK_0(TaskManagerGtk, void, OnTreeViewRealize, GtkTreeView*);
-
- // Changed signal handler that is sent when the treeview selection changes.
- CHROMEG_CALLBACK_0(TaskManagerGtk, void, OnSelectionChanged,
- GtkTreeSelection*);
-
- // row-activated handler that foregrounds a process on activation (e.g.,
- // double-click).
- CHROMEGTK_CALLBACK_2(TaskManagerGtk, void, OnRowActivated,
- GtkTreePath*, GtkTreeViewColumn*);
-
- // button-release-event handler that opens the right-click context menu.
- CHROMEGTK_CALLBACK_1(TaskManagerGtk, gboolean, OnButtonReleaseEvent,
- GdkEventButton*);
-
- // Handles an accelerator being pressed.
- CHROMEG_CALLBACK_3(TaskManagerGtk, gboolean, OnGtkAccelerator,
- GtkAccelGroup*, GObject*, guint, GdkModifierType);
-
- // Page sorting callback.
- static gint ComparePage(GtkTreeModel* model, GtkTreeIter* a,
- GtkTreeIter* b, gpointer task_manager) {
- return reinterpret_cast<TaskManagerGtk*>(task_manager)->
- CompareImpl(model, a, b, IDS_TASK_MANAGER_PAGE_COLUMN);
- }
-
- // Shared memory sorting callback.
- static gint CompareSharedMemory(GtkTreeModel* model, GtkTreeIter* a,
- GtkTreeIter* b, gpointer task_manager) {
- return reinterpret_cast<TaskManagerGtk*>(task_manager)->
- CompareImpl(model, a, b, IDS_TASK_MANAGER_SHARED_MEM_COLUMN);
- }
-
- // Private memory sorting callback.
- static gint ComparePrivateMemory(GtkTreeModel* model, GtkTreeIter* a,
- GtkTreeIter* b, gpointer task_manager) {
- return reinterpret_cast<TaskManagerGtk*>(task_manager)->
- CompareImpl(model, a, b, IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN);
- }
-
- // Javascript memory sorting callback.
- static gint CompareV8Memory(GtkTreeModel* model, GtkTreeIter* a,
- GtkTreeIter* b, gpointer task_manager) {
- return reinterpret_cast<TaskManagerGtk*>(task_manager)->
- CompareImpl(model, a, b,
- IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN);
- }
-
- // CPU sorting callback.
- static gint CompareCPU(GtkTreeModel* model, GtkTreeIter* a,
- GtkTreeIter* b, gpointer task_manager) {
- return reinterpret_cast<TaskManagerGtk*>(task_manager)->
- CompareImpl(model, a, b, IDS_TASK_MANAGER_CPU_COLUMN);
- }
-
- // Network sorting callback.
- static gint CompareNetwork(GtkTreeModel* model, GtkTreeIter* a,
- GtkTreeIter* b, gpointer task_manager) {
- return reinterpret_cast<TaskManagerGtk*>(task_manager)->
- CompareImpl(model, a, b, IDS_TASK_MANAGER_NET_COLUMN);
- }
-
- // Process ID sorting callback.
- static gint CompareProcessID(GtkTreeModel* model, GtkTreeIter* a,
- GtkTreeIter* b, gpointer task_manager) {
- return reinterpret_cast<TaskManagerGtk*>(task_manager)->
- CompareImpl(model, a, b, IDS_TASK_MANAGER_PROCESS_ID_COLUMN);
- }
-
- // WebCore Image Cache sorting callback.
- static gint CompareWebCoreImageCache(GtkTreeModel* model, GtkTreeIter* a,
- GtkTreeIter* b, gpointer task_manager) {
- return reinterpret_cast<TaskManagerGtk*>(task_manager)->
- CompareImpl(model, a, b, IDS_TASK_MANAGER_WEBCORE_IMAGE_CACHE_COLUMN);
- }
-
- // WebCore Scripts Cache sorting callback.
- static gint CompareWebCoreScriptsCache(GtkTreeModel* model, GtkTreeIter* a,
- GtkTreeIter* b,
- gpointer task_manager) {
- return reinterpret_cast<TaskManagerGtk*>(task_manager)->
- CompareImpl(model, a, b, IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN);
- }
-
- // WebCore CSS Cache sorting callback.
- static gint CompareWebCoreCssCache(GtkTreeModel* model, GtkTreeIter* a,
- GtkTreeIter* b, gpointer task_manager) {
- return reinterpret_cast<TaskManagerGtk*>(task_manager)->
- CompareImpl(model, a, b, IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN);
- }
-
- // Sqlite memory sorting callback.
- static gint CompareSqliteMemoryUsed(GtkTreeModel* model, GtkTreeIter* a,
- GtkTreeIter* b, gpointer task_manager) {
- return reinterpret_cast<TaskManagerGtk*>(task_manager)->
- CompareImpl(model, a, b, IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN);
- }
-
- // Goats Teleported sorting callback.
- static gint CompareGoatsTeleported(GtkTreeModel* model, GtkTreeIter* a,
- GtkTreeIter* b, gpointer task_manager) {
- return reinterpret_cast<TaskManagerGtk*>(task_manager)->
- CompareImpl(model, a, b, IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN);
- }
-
- // The task manager.
- TaskManager* task_manager_;
-
- // Our model.
- TaskManagerModel* model_;
-
- // The task manager dialog window.
- GtkWidget* dialog_;
-
- // The treeview that contains the process list.
- GtkWidget* treeview_;
-
- // The list of processes.
- GtkListStore* process_list_;
- GtkTreeModel* process_list_sort_;
-
- // The number of processes in |process_list_|.
- int process_count_;
-
- // The id of the |dialog_| destroy signal handler.
- gulong destroy_handler_id_;
-
- // The context menu controller.
- scoped_ptr<ContextMenuController> menu_controller_;
-
- GtkAccelGroup* accel_group_;
-
- // An open task manager window. There can only be one open at a time. This
- // is reset to NULL when the window is closed.
- static TaskManagerGtk* instance_;
-
- // We edit the selection in the OnSelectionChanged handler, and we use this
- // variable to prevent ourselves from handling further changes that we
- // ourselves caused.
- bool ignore_selection_changed_;
-
- DISALLOW_COPY_AND_ASSIGN(TaskManagerGtk);
-};
+#include "chrome/browser/ui/gtk/task_manager_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_
diff --git a/chrome/browser/gtk/theme_install_bubble_view_gtk.h b/chrome/browser/gtk/theme_install_bubble_view_gtk.h
index fe38690..2081614 100644
--- a/chrome/browser/gtk/theme_install_bubble_view_gtk.h
+++ b/chrome/browser/gtk/theme_install_bubble_view_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,57 +6,7 @@
#define CHROME_BROWSER_GTK_THEME_INSTALL_BUBBLE_VIEW_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-
-class ThemeInstallBubbleViewGtk : public NotificationObserver {
- public:
- static void Show(GtkWindow* parent);
-
- // NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- private:
- explicit ThemeInstallBubbleViewGtk(GtkWidget* parent);
-
- virtual ~ThemeInstallBubbleViewGtk();
-
- void increment_num_loading() { num_loads_extant_++; }
-
- // Create the widget hierarchy.
- void InitWidgets();
-
- // Reposition |widget_| to be centered over |parent_|.
- void MoveWindow();
-
- // Our parent is going down; self destruct.
- CHROMEGTK_CALLBACK_0(ThemeInstallBubbleViewGtk, gboolean, OnUnmapEvent);
-
- // Draw the background. This is only signalled if we are using a compositing
- // window manager, otherwise we just use ActAsRoundedWindow().
- CHROMEGTK_CALLBACK_1(ThemeInstallBubbleViewGtk, gboolean,
- OnExpose, GdkEventExpose*);
-
- GtkWidget* widget_;
-
- // The parent browser window, over which we position ourselves.
- GtkWidget* parent_;
-
- // The number of loads we represent. When it reaches 0 we delete ourselves.
- int num_loads_extant_;
-
- NotificationRegistrar registrar_;
-
- // Our one instance. We don't allow more than one to exist at a time.
- static ThemeInstallBubbleViewGtk* instance_;
-
- DISALLOW_COPY_AND_ASSIGN(ThemeInstallBubbleViewGtk);
-};
+#include "chrome/browser/ui/gtk/theme_install_bubble_view_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_THEME_INSTALL_BUBBLE_VIEW_GTK_H_
diff --git a/chrome/browser/gtk/translate/after_translate_infobar_gtk.h b/chrome/browser/gtk/translate/after_translate_infobar_gtk.h
index 4f49ffd..edb2e3e 100644
--- a/chrome/browser/gtk/translate/after_translate_infobar_gtk.h
+++ b/chrome/browser/gtk/translate/after_translate_infobar_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,35 +6,7 @@
#define CHROME_BROWSER_GTK_TRANSLATE_AFTER_TRANSLATE_INFOBAR_GTK_H_
#pragma once
-#include "base/task.h"
-#include "chrome/browser/gtk/translate/translate_infobar_base_gtk.h"
-
-class TranslateInfoBarDelegate;
-
-class AfterTranslateInfoBar : public TranslateInfoBarBase {
- public:
- explicit AfterTranslateInfoBar(TranslateInfoBarDelegate* delegate);
- virtual ~AfterTranslateInfoBar();
-
- // Overridden from TranslateInfoBarBase:
- virtual void Init();
-
- protected:
- virtual bool ShowOptionsMenuButton() const;
-
- private:
- CHROMEGTK_CALLBACK_0(AfterTranslateInfoBar, void, OnOriginalLanguageModified);
- CHROMEGTK_CALLBACK_0(AfterTranslateInfoBar, void, OnTargetLanguageModified);
- CHROMEGTK_CALLBACK_0(AfterTranslateInfoBar, void, OnRevertPressed);
-
- // These methods set the original/target language on the
- // TranslateInfobarDelegate.
- void SetOriginalLanguage(int language_index);
- void SetTargetLanguage(int language_index);
-
- ScopedRunnableMethodFactory<AfterTranslateInfoBar> method_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(AfterTranslateInfoBar);
-};
+#include "chrome/browser/ui/gtk/translate/after_translate_infobar_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_TRANSLATE_AFTER_TRANSLATE_INFOBAR_GTK_H_
diff --git a/chrome/browser/gtk/translate/before_translate_infobar_gtk.h b/chrome/browser/gtk/translate/before_translate_infobar_gtk.h
index e6ff5a9..08b3c9b 100644
--- a/chrome/browser/gtk/translate/before_translate_infobar_gtk.h
+++ b/chrome/browser/gtk/translate/before_translate_infobar_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,29 +6,7 @@
#define CHROME_BROWSER_GTK_TRANSLATE_BEFORE_TRANSLATE_INFOBAR_GTK_H_
#pragma once
-#include "chrome/browser/gtk/translate/translate_infobar_base_gtk.h"
-
-class TranslateInfoBarDelegate;
-
-class BeforeTranslateInfoBar : public TranslateInfoBarBase {
- public:
- explicit BeforeTranslateInfoBar(TranslateInfoBarDelegate* delegate);
- virtual ~BeforeTranslateInfoBar();
-
- // Overridden from TranslateInfoBarBase:
- virtual void Init();
-
- protected:
- virtual bool ShowOptionsMenuButton() const;
-
- private:
- CHROMEGTK_CALLBACK_0(BeforeTranslateInfoBar, void, OnLanguageModified);
- CHROMEGTK_CALLBACK_0(BeforeTranslateInfoBar, void, OnAcceptPressed);
- CHROMEGTK_CALLBACK_0(BeforeTranslateInfoBar, void, OnDenyPressed);
- CHROMEGTK_CALLBACK_0(BeforeTranslateInfoBar, void, OnNeverTranslatePressed);
- CHROMEGTK_CALLBACK_0(BeforeTranslateInfoBar, void, OnAlwaysTranslatePressed);
-
- DISALLOW_COPY_AND_ASSIGN(BeforeTranslateInfoBar);
-};
+#include "chrome/browser/ui/gtk/translate/before_translate_infobar_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_TRANSLATE_BEFORE_TRANSLATE_INFOBAR_GTK_H_
diff --git a/chrome/browser/gtk/translate/translate_infobar_base_gtk.h b/chrome/browser/gtk/translate/translate_infobar_base_gtk.h
index 6adf98a..32d2505 100644
--- a/chrome/browser/gtk/translate/translate_infobar_base_gtk.h
+++ b/chrome/browser/gtk/translate/translate_infobar_base_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,84 +6,7 @@
#define CHROME_BROWSER_GTK_TRANSLATE_TRANSLATE_INFOBAR_BASE_GTK_H_
#pragma once
-#include "chrome/browser/translate/translate_infobar_view.h"
-#include "chrome/browser/gtk/infobar_gtk.h"
-#include "ui/base/animation/animation_delegate.h"
-
-class MenuGtk;
-class OptionsMenuModel;
-class TranslateInfoBarDelegate;
-
-// This class contains some of the base functionality that translate infobars
-// use.
-class TranslateInfoBarBase : public TranslateInfoBarView,
- public InfoBar,
- public ui::AnimationDelegate {
- public:
- explicit TranslateInfoBarBase(TranslateInfoBarDelegate* delegate);
- virtual ~TranslateInfoBarBase();
-
- // Initializes the infobar widgets. Should be called after the object has been
- // created.
- virtual void Init();
-
- // Overridden from InfoBar:
- virtual void GetTopColor(InfoBarDelegate::Type type,
- double* r, double* g, double *b);
- virtual void GetBottomColor(InfoBarDelegate::Type type,
- double* r, double* g, double *b);
-
- // Overridden from TranslateInfoBarView:
- virtual void OriginalLanguageChanged() {}
- virtual void TargetLanguageChanged() {}
-
- // Overridden from ui::AnimationDelegate:
- virtual void AnimationProgressed(const ui::Animation* animation);
-
- protected:
- // Sub-classes that want to have the options menu button showing sould
- // override and return true.
- virtual bool ShowOptionsMenuButton() const;
-
- // Creates a label with the appropriate font and color for the translate
- // infobars.
- GtkWidget* CreateLabel(const std::string& text);
-
- // Creates a combobox that displays the languages currently available.
- // |selected_language| is the language index (as used in the
- // TranslateInfoDelegate) that should be selected initially.
- // |exclude_language| is the language index of the language that should not be
- // included in the list (-1 means no language excluded).
- GtkWidget* CreateLanguageCombobox(int selected_language,
- int exclude_language);
-
- // Given an above-constructed combobox, returns the currently selected
- // language id.
- static int GetLanguageComboboxActiveId(GtkComboBox* combo);
-
- // Convenience to retrieve the TranslateInfoBarDelegate for this infobar.
- TranslateInfoBarDelegate* GetDelegate() const;
-
- private:
- // Builds a button with an arrow in it to emulate the menu-button style from
- // the windows version.
- static GtkWidget* BuildOptionsMenuButton();
-
- // The menu displayed when the Options button is pressed.
- scoped_ptr<OptionsMenuModel> options_menu_model_;
- scoped_ptr<MenuGtk> options_menu_menu_;
-
- CHROMEGTK_CALLBACK_0(TranslateInfoBarBase, void, OnOptionsClicked);
-
- // A percentage to average the normal page action background with the error
- // background. When 0, the infobar background should be pure PAGE_ACTION_TYPE.
- // When 1, the infobar background should be pure WARNING_TYPE.
- double background_error_percent_;
-
- // Changes the color of the background from normal to error color and back.
- scoped_ptr<ui::SlideAnimation> background_color_animation_;
-
- DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarBase);
-};
+#include "chrome/browser/ui/gtk/translate/translate_infobar_base_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_TRANSLATE_TRANSLATE_INFOBAR_BASE_GTK_H_
diff --git a/chrome/browser/gtk/translate/translate_message_infobar_gtk.h b/chrome/browser/gtk/translate/translate_message_infobar_gtk.h
index 74db7e3..c44beb9 100644
--- a/chrome/browser/gtk/translate/translate_message_infobar_gtk.h
+++ b/chrome/browser/gtk/translate/translate_message_infobar_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,22 +6,7 @@
#define CHROME_BROWSER_GTK_TRANSLATE_TRANSLATE_MESSAGE_INFOBAR_GTK_H_
#pragma once
-#include "chrome/browser/gtk/translate/translate_infobar_base_gtk.h"
-
-class TranslateInfoBarDelegate;
-
-class TranslateMessageInfoBar : public TranslateInfoBarBase {
- public:
- explicit TranslateMessageInfoBar(TranslateInfoBarDelegate* delegate);
- virtual ~TranslateMessageInfoBar();
-
- // Overridden from TranslateInfoBarBase:
- virtual void Init();
-
- private:
- CHROMEGTK_CALLBACK_0(TranslateMessageInfoBar, void, OnButtonPressed);
-
- DISALLOW_COPY_AND_ASSIGN(TranslateMessageInfoBar);
-};
+#include "chrome/browser/ui/gtk/translate/translate_message_infobar_gtk.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_TRANSLATE_TRANSLATE_MESSAGE_INFOBAR_GTK_H_
diff --git a/chrome/browser/gtk/update_recommended_dialog.h b/chrome/browser/gtk/update_recommended_dialog.h
index 1105584..2d0e04f 100644
--- a/chrome/browser/gtk/update_recommended_dialog.h
+++ b/chrome/browser/gtk/update_recommended_dialog.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,26 +6,7 @@
#define CHROME_BROWSER_GTK_UPDATE_RECOMMENDED_DIALOG_H_
#pragma once
-#include "app/gtk_integers.h"
-#include "app/gtk_signal.h"
-#include "base/basictypes.h"
-
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-
-class UpdateRecommendedDialog {
- public:
- static void Show(GtkWindow* parent);
-
- private:
- CHROMEGTK_CALLBACK_1(UpdateRecommendedDialog, void, OnResponse, gint);
-
- explicit UpdateRecommendedDialog(GtkWindow* parent);
- ~UpdateRecommendedDialog();
-
- GtkWidget* dialog_;
-
- DISALLOW_COPY_AND_ASSIGN(UpdateRecommendedDialog);
-};
+#include "chrome/browser/ui/gtk/update_recommended_dialog.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_UPDATE_RECOMMENDED_DIALOG_H_
diff --git a/chrome/browser/gtk/view_id_util.h b/chrome/browser/gtk/view_id_util.h
index 0be817e..4ae27c2 100644
--- a/chrome/browser/gtk/view_id_util.h
+++ b/chrome/browser/gtk/view_id_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,28 +6,7 @@
#define CHROME_BROWSER_GTK_VIEW_ID_UTIL_H_
#pragma once
-#include "chrome/browser/ui/view_ids.h"
-
-typedef struct _GtkWidget GtkWidget;
-
-class ViewIDUtil {
- public:
- // Use this delegate to override default view id searches.
- class Delegate {
- public:
- virtual GtkWidget* GetWidgetForViewID(ViewID id) = 0;
-
- protected:
- virtual ~Delegate() {}
- };
-
- // If you set the ID via this function, it will also set the name of your
- // widget to a human-readable value for debugging.
- static void SetID(GtkWidget* widget, ViewID id);
-
- static GtkWidget* GetWidget(GtkWidget* root, ViewID id);
-
- static void SetDelegateForWidget(GtkWidget* widget, Delegate* delegate);
-};
+#include "chrome/browser/ui/gtk/view_id_util.h"
+// TODO(msw): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_GTK_VIEW_ID_UTIL_H_
diff --git a/chrome/browser/gtk/about_chrome_dialog.cc b/chrome/browser/ui/gtk/about_chrome_dialog.cc
index 3d1ffa9..e756328 100644
--- a/chrome/browser/gtk/about_chrome_dialog.cc
+++ b/chrome/browser/ui/gtk/about_chrome_dialog.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/about_chrome_dialog.h b/chrome/browser/ui/gtk/about_chrome_dialog.h
new file mode 100644
index 0000000..11817ec
--- /dev/null
+++ b/chrome/browser/ui/gtk/about_chrome_dialog.h
@@ -0,0 +1,15 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_ABOUT_CHROME_DIALOG_H_
+#define CHROME_BROWSER_UI_GTK_ABOUT_CHROME_DIALOG_H_
+#pragma once
+
+class Profile;
+typedef struct _GtkWindow GtkWindow;
+
+// Displays the about box, using data copied from |profile|.
+void ShowAboutDialogForProfile(GtkWindow* parent, Profile* profile);
+
+#endif // CHROME_BROWSER_UI_GTK_ABOUT_CHROME_DIALOG_H_
diff --git a/chrome/browser/gtk/accelerators_gtk.cc b/chrome/browser/ui/gtk/accelerators_gtk.cc
index 5456b0d..bac41bd2 100644
--- a/chrome/browser/gtk/accelerators_gtk.cc
+++ b/chrome/browser/ui/gtk/accelerators_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/accelerators_gtk.h b/chrome/browser/ui/gtk/accelerators_gtk.h
new file mode 100644
index 0000000..c1e953f
--- /dev/null
+++ b/chrome/browser/ui/gtk/accelerators_gtk.h
@@ -0,0 +1,45 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_ACCELERATORS_GTK_H_
+#define CHROME_BROWSER_UI_GTK_ACCELERATORS_GTK_H_
+#pragma once
+
+#include "app/menus/accelerator_gtk.h"
+#include "base/hash_tables.h"
+
+template <typename T> struct DefaultSingletonTraits;
+
+class AcceleratorsGtk {
+ public:
+ typedef std::vector<std::pair<int, menus::AcceleratorGtk> >
+ AcceleratorGtkList;
+ typedef AcceleratorGtkList::const_iterator const_iterator;
+
+ // Returns the singleton instance.
+ static AcceleratorsGtk* GetInstance();
+
+ const_iterator const begin() {
+ return all_accelerators_.begin();
+ }
+
+ const_iterator const end() {
+ return all_accelerators_.end();
+ }
+
+ // Returns NULL if there is no accelerator for the command.
+ const menus::AcceleratorGtk* GetPrimaryAcceleratorForCommand(int command_id);
+
+ private:
+ friend struct DefaultSingletonTraits<AcceleratorsGtk>;
+
+ AcceleratorsGtk();
+ ~AcceleratorsGtk();
+
+ base::hash_map<int, menus::AcceleratorGtk> primary_accelerators_;
+
+ AcceleratorGtkList all_accelerators_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_ACCELERATORS_GTK_H_
diff --git a/chrome/browser/gtk/accessibility_event_router_gtk.cc b/chrome/browser/ui/gtk/accessibility_event_router_gtk.cc
index 1248247..534e74d 100644
--- a/chrome/browser/gtk/accessibility_event_router_gtk.cc
+++ b/chrome/browser/ui/gtk/accessibility_event_router_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/accessibility_event_router_gtk.h b/chrome/browser/ui/gtk/accessibility_event_router_gtk.h
new file mode 100644
index 0000000..d8ca832
--- /dev/null
+++ b/chrome/browser/ui/gtk/accessibility_event_router_gtk.h
@@ -0,0 +1,208 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_ACCESSIBILITY_EVENT_ROUTER_GTK_H_
+#define CHROME_BROWSER_UI_GTK_ACCESSIBILITY_EVENT_ROUTER_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/gtest_prod_util.h"
+#include "base/hash_tables.h"
+#include "base/singleton.h"
+#include "base/task.h"
+#include "chrome/browser/accessibility_events.h"
+
+class Profile;
+#if defined (TOOLKIT_VIEWS)
+namespace views {
+class NativeTextfieldGtk;
+}
+#endif
+
+// Allows us to use (GtkWidget*) in a hash_map with gcc.
+namespace __gnu_cxx {
+template<>
+struct hash<GtkWidget*> {
+ size_t operator()(GtkWidget* widget) const {
+ return reinterpret_cast<size_t>(widget);
+ }
+};
+} // namespace __gnu_cxx
+
+// Struct to keep track of event listener hook ids to remove them later.
+struct InstalledHook {
+ InstalledHook(guint _signal_id, gulong _hook_id)
+ : signal_id(_signal_id), hook_id(_hook_id) { }
+ guint signal_id;
+ gulong hook_id;
+};
+
+// NOTE: This class is part of the Accessibility Extension API, which lets
+// extensions receive accessibility events. It's distinct from code that
+// implements platform accessibility APIs like MSAA or ATK.
+//
+// Singleton class that adds a signal emission hook to many gtk events, and
+// then sends an accessibility notification whenever a relevant event is
+// sent to an accessible control.
+//
+// Gtk widgets are not accessible by default. When you register a root widget,
+// that widget and all of its descendants will start sending accessibility
+// event notifications. You can then override the default behavior for
+// specific descendants using other methods.
+//
+// You can use Profile::PauseAccessibilityEvents to prevent a flurry
+// of accessibility events when a window is being created or initialized.
+class AccessibilityEventRouterGtk {
+ public:
+ // Internal information about a particular widget to override the
+ // information we get directly from gtk.
+ struct WidgetInfo {
+ WidgetInfo() : refcount(0) { }
+
+ // The number of times that AddWidgetNameOverride has been called on this
+ // widget. When RemoveWidget has been called an equal number of
+ // times and the refcount reaches zero, this entry will be deleted.
+ int refcount;
+
+ // If nonempty, will use this name instead of the widget's label.
+ std::string name;
+ };
+
+ // Internal information about a root widget
+ struct RootWidgetInfo {
+ RootWidgetInfo() : refcount(0), profile(NULL) { }
+
+ // The number of times that AddRootWidget has been called on this
+ // widget. When RemoveRootWidget has been called an equal number of
+ // times and the refcount reaches zero, this entry will be deleted.
+ int refcount;
+
+ // The profile associated with this root widget; accessibility
+ // notifications for any descendant of this root widget will get routed
+ // to this profile.
+ Profile* profile;
+ };
+
+ // Get the single instance of this class.
+ static AccessibilityEventRouterGtk* GetInstance();
+
+ // Start sending accessibility events for this widget and all of its
+ // descendants. Notifications will go to the specified profile.
+ // Uses reference counting, so it's safe to call this twice on the
+ // same widget, as long as each call is paired with a call to
+ // RemoveRootWidget.
+ void AddRootWidget(GtkWidget* root_widget, Profile* profile);
+
+ // Stop sending accessibility events for this widget and all of its
+ // descendants.
+ void RemoveRootWidget(GtkWidget* root_widget);
+
+ // Use the following string as the name of this widget, instead of the
+ // gtk label associated with the widget. Must be paired with a call to
+ // RemoveWidgetNameOverride.
+ void AddWidgetNameOverride(GtkWidget* widget, std::string name);
+
+ // Forget widget name override. Must be paired with a call to
+ // AddWidgetNameOverride (uses reference counting).
+ void RemoveWidgetNameOverride(GtkWidget* widget);
+
+ //
+ // The following methods are only for use by gtk signal handlers.
+ //
+
+ // Called by the signal handler. Checks the type of the widget and
+ // calls one of the more specific Send*Notification methods, below.
+ void DispatchAccessibilityNotification(
+ GtkWidget* widget, NotificationType type);
+
+ // Post a task to call DispatchAccessibilityNotification the next time
+ // through the event loop.
+ void PostDispatchAccessibilityNotification(
+ GtkWidget* widget, NotificationType type);
+
+ private:
+ AccessibilityEventRouterGtk();
+ virtual ~AccessibilityEventRouterGtk();
+
+ // Given a widget, determine if it's the descendant of a root widget
+ // that's mapped to a profile and if so, if it's marked as accessible.
+ void FindWidget(GtkWidget* widget, Profile** profile, bool* is_accessible);
+
+ // Return the name of a widget.
+ std::string GetWidgetName(GtkWidget* widget);
+
+ // Each of these methods constructs an AccessibilityControlInfo object
+ // and sends a notification of a specific accessibility event.
+ void SendButtonNotification(
+ GtkWidget* widget, NotificationType type, Profile* profile);
+ void SendCheckboxNotification(
+ GtkWidget* widget, NotificationType type, Profile* profile);
+ void SendComboBoxNotification(
+ GtkWidget* widget, NotificationType type, Profile* profile);
+ void SendListBoxNotification(
+ GtkWidget* widget, NotificationType type, Profile* profile);
+ void SendMenuItemNotification(
+ GtkWidget* widget, NotificationType type, Profile* profile);
+ void SendRadioButtonNotification(
+ GtkWidget* widget, NotificationType type, Profile* profile);
+ void SendTabNotification(
+ GtkWidget* widget, NotificationType type, Profile* profile);
+ void SendEntryNotification(
+ GtkWidget* widget, NotificationType type, Profile* profile);
+ void SendTextViewNotification(
+ GtkWidget* widget, NotificationType type, Profile* profile);
+
+ bool IsPassword(GtkWidget* widget);
+ void InstallEventListeners();
+ void RemoveEventListeners();
+
+ // Start and stop listening to signals.
+ void StartListening();
+ void StopListening();
+
+ // Add a signal emission hook for one particular signal name and
+ // widget type, and save the hook_id in installed_hooks so we can
+ // remove it later.
+ void InstallEventListener(
+ const char *signal_name,
+ GType widget_type,
+ GSignalEmissionHook hook_func);
+
+ friend struct DefaultSingletonTraits<AccessibilityEventRouterGtk>;
+
+ // The set of all root widgets; only descendants of these will generate
+ // accessibility notifications.
+ base::hash_map<GtkWidget*, RootWidgetInfo> root_widget_info_map_;
+
+ // Extra information about specific widgets.
+ base::hash_map<GtkWidget*, WidgetInfo> widget_info_map_;
+
+ // Installed event listener hook ids so we can remove them later.
+ std::vector<InstalledHook> installed_hooks_;
+
+ // True if we are currently listening to signals.
+ bool listening_;
+
+ // The profile associated with the most recent window event - used to
+ // figure out where to route a few events that can't be directly traced
+ // to a window with a profile (like menu events).
+ Profile* most_recent_profile_;
+
+ // The most recent focused widget.
+ GtkWidget* most_recent_widget_;
+
+ // Used to schedule invocations of StartListening() and to defer handling
+ // of some events until the next time through the event loop.
+ ScopedRunnableMethodFactory<AccessibilityEventRouterGtk> method_factory_;
+
+ friend class AccessibilityEventRouterGtkTest;
+ FRIEND_TEST_ALL_PREFIXES(AccessibilityEventRouterGtkTest, AddRootWidgetTwice);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_ACCESSIBILITY_EVENT_ROUTER_GTK_H_
diff --git a/chrome/browser/gtk/accessibility_event_router_gtk_unittest.cc b/chrome/browser/ui/gtk/accessibility_event_router_gtk_unittest.cc
index 7264da7..424a8c2 100644
--- a/chrome/browser/gtk/accessibility_event_router_gtk_unittest.cc
+++ b/chrome/browser/ui/gtk/accessibility_event_router_gtk_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/accessible_widget_helper_gtk.cc b/chrome/browser/ui/gtk/accessible_widget_helper_gtk.cc
index 029aca4..5cefe36 100644
--- a/chrome/browser/gtk/accessible_widget_helper_gtk.cc
+++ b/chrome/browser/ui/gtk/accessible_widget_helper_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/accessible_widget_helper_gtk.h b/chrome/browser/ui/gtk/accessible_widget_helper_gtk.h
new file mode 100644
index 0000000..65cbe70
--- /dev/null
+++ b/chrome/browser/ui/gtk/accessible_widget_helper_gtk.h
@@ -0,0 +1,66 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_
+#define CHROME_BROWSER_UI_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <set>
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/singleton.h"
+#include "chrome/browser/accessibility_events.h"
+#include "chrome/browser/gtk/accessibility_event_router_gtk.h"
+
+class Profile;
+
+// NOTE: This class is part of the Accessibility Extension API, which lets
+// extensions receive accessibility events. It's distinct from code that
+// implements platform accessibility APIs like MSAA or ATK.
+//
+// Helper class that helps to manage the accessibility information for all
+// of the widgets in a container. Create an instance of this class for
+// each container GtkWidget (like a dialog) that should send accessibility
+// events for all of its descendants.
+//
+// Most controls have default behavior for accessibility; when this needs
+// to be augmented, call one of the methods below to change its details.
+//
+// All of the information managed by this class is registered with the
+// (global) AccessibilityEventRouterGtk and unregistered when this object is
+// destroyed.
+class AccessibleWidgetHelper {
+ public:
+ // Contruct an AccessibleWidgetHelper that makes the given root widget
+ // accessible for the lifetime of this object, sending accessibility
+ // notifications to the given profile.
+ AccessibleWidgetHelper(GtkWidget* root_widget, Profile* profile);
+
+ virtual ~AccessibleWidgetHelper();
+
+ // Send a notification that a new window was opened now, and a
+ // corresponding close window notification when this object
+ // goes out of scope.
+ void SendOpenWindowNotification(const std::string& window_title);
+
+ // Use the following string as the name of this widget, instead of the
+ // gtk label associated with the widget.
+ void SetWidgetName(GtkWidget* widget, std::string name);
+
+ // Use the following string as the name of this widget, instead of the
+ // gtk label associated with the widget.
+ void SetWidgetName(GtkWidget* widget, int string_id);
+
+ private:
+ AccessibilityEventRouterGtk* accessibility_event_router_;
+ Profile* profile_;
+ GtkWidget* root_widget_;
+ std::string window_title_;
+ std::set<GtkWidget*> managed_widgets_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_ACCESSIBLE_WIDGET_HELPER_GTK_H_
diff --git a/chrome/browser/gtk/back_forward_button_gtk.cc b/chrome/browser/ui/gtk/back_forward_button_gtk.cc
index 29cf61c..3eb970b 100644
--- a/chrome/browser/gtk/back_forward_button_gtk.cc
+++ b/chrome/browser/ui/gtk/back_forward_button_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/back_forward_button_gtk.h b/chrome/browser/ui/gtk/back_forward_button_gtk.h
new file mode 100644
index 0000000..12ea2df
--- /dev/null
+++ b/chrome/browser/ui/gtk/back_forward_button_gtk.h
@@ -0,0 +1,72 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_BACK_FORWARD_BUTTON_GTK_H_
+#define CHROME_BROWSER_UI_GTK_BACK_FORWARD_BUTTON_GTK_H_
+#pragma once
+
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+#include "base/task.h"
+#include "chrome/browser/gtk/custom_button.h"
+#include "chrome/browser/gtk/menu_gtk.h"
+
+class BackForwardMenuModel;
+class Browser;
+
+typedef struct _GtkWidget GtkWidget;
+
+// When clicked, these buttons will navigate forward or backward. When
+// pressed and held, they show a dropdown menu of recent web sites.
+class BackForwardButtonGtk : MenuGtk::Delegate {
+ public:
+ BackForwardButtonGtk(Browser* browser, bool is_forward);
+ virtual ~BackForwardButtonGtk();
+
+ // MenuGtk::Delegate implementation.
+ virtual void StoppedShowing();
+ virtual bool AlwaysShowIconForCmd(int command_id) const;
+
+ GtkWidget* widget() { return button_->widget(); }
+
+ private:
+ // Executes the browser command.
+ CHROMEGTK_CALLBACK_0(BackForwardButtonGtk, void, OnClick);
+
+ // Starts a timer to show the dropdown menu.
+ CHROMEGTK_CALLBACK_1(BackForwardButtonGtk, gboolean, OnButtonPress,
+ GdkEventButton*);
+
+ // If there is a timer to show the dropdown menu, and the mouse has moved
+ // sufficiently down the screen, cancel the timer and immediately show the
+ // menu.
+ CHROMEGTK_CALLBACK_1(BackForwardButtonGtk, gboolean, OnMouseMove,
+ GdkEventMotion*);
+
+ // Shows the dropdown menu.
+ void ShowBackForwardMenu();
+
+ // The menu gets reset every time it is shown.
+ scoped_ptr<MenuGtk> menu_;
+
+ scoped_ptr<CustomDrawButton> button_;
+
+ // The browser to which we will send commands.
+ Browser* browser_;
+
+ // Whether this button is a forward button.
+ bool is_forward_;
+
+ // The dropdown menu model.
+ scoped_ptr<BackForwardMenuModel> menu_model_;
+
+ // The y position of the last mouse down event.
+ int y_position_of_last_press_;
+
+ ScopedRunnableMethodFactory<BackForwardButtonGtk> show_menu_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(BackForwardButtonGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_BACK_FORWARD_BUTTON_GTK_H_
diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/ui/gtk/bookmark_bar_gtk.cc
index cd1ea94..e86c4e2 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk.cc
+++ b/chrome/browser/ui/gtk/bookmark_bar_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/bookmark_bar_gtk.h b/chrome/browser/ui/gtk/bookmark_bar_gtk.h
new file mode 100644
index 0000000..75ad908
--- /dev/null
+++ b/chrome/browser/ui/gtk/bookmark_bar_gtk.h
@@ -0,0 +1,401 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_BOOKMARK_BAR_GTK_H_
+#define CHROME_BROWSER_UI_GTK_BOOKMARK_BAR_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <vector>
+
+#include "app/gtk_signal.h"
+#include "base/gtest_prod_util.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/bookmarks/bookmark_context_menu_controller.h"
+#include "chrome/browser/bookmarks/bookmark_model_observer.h"
+#include "chrome/browser/gtk/bookmark_bar_instructions_gtk.h"
+#include "chrome/browser/gtk/menu_bar_helper.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/browser/gtk/view_id_util.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "gfx/point.h"
+#include "gfx/size.h"
+#include "ui/base/animation/animation_delegate.h"
+
+class BookmarkMenuController;
+class Browser;
+class BrowserWindowGtk;
+class CustomContainerButton;
+class GtkThemeProvider;
+class MenuGtk;
+class PageNavigator;
+class Profile;
+class TabstripOriginProvider;
+
+namespace ui {
+class SlideAnimation;
+}
+
+class BookmarkBarGtk : public ui::AnimationDelegate,
+ public ProfileSyncServiceObserver,
+ public BookmarkModelObserver,
+ public MenuBarHelper::Delegate,
+ public NotificationObserver,
+ public BookmarkBarInstructionsGtk::Delegate,
+ public BookmarkContextMenuControllerDelegate {
+ public:
+ BookmarkBarGtk(BrowserWindowGtk* window,
+ Profile* profile,
+ Browser* browser,
+ TabstripOriginProvider* tabstrip_origin_provider);
+ virtual ~BookmarkBarGtk();
+
+ // Resets the profile. This removes any buttons for the current profile and
+ // recreates the models.
+ void SetProfile(Profile* profile);
+
+ // Returns the current profile.
+ Profile* GetProfile() { return profile_; }
+
+ // Returns the current browser.
+ Browser* browser() const { return browser_; }
+
+ // Returns the top level widget.
+ GtkWidget* widget() const { return event_box_.get(); }
+
+ // Sets the PageNavigator that is used when the user selects an entry on
+ // the bookmark bar.
+ void SetPageNavigator(PageNavigator* navigator);
+
+ // Create the contents of the bookmark bar.
+ void Init(Profile* profile);
+
+ // Whether the current page is the New Tag Page (which requires different
+ // rendering).
+ bool OnNewTabPage();
+
+ // Change the visibility of the bookmarks bar. (Starts out hidden, per GTK's
+ // default behaviour). There are three visiblity states:
+ //
+ // Showing - bookmark bar is fully visible.
+ // Hidden - bookmark bar is hidden except for a few pixels that give
+ // extra padding to the bottom of the toolbar. Buttons are not
+ // clickable.
+ // Fullscreen - bookmark bar is fully hidden.
+ void Show(bool animate);
+ void Hide(bool animate);
+ void EnterFullscreen();
+
+ // Get the current height of the bookmark bar.
+ int GetHeight();
+
+ // Returns true if the bookmark bar is showing an animation.
+ bool IsAnimating();
+
+ // Returns true if the bookmarks bar preference is set to 'always show'.
+ bool IsAlwaysShown();
+
+ // ui::AnimationDelegate implementation --------------------------------------
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
+
+ // MenuBarHelper::Delegate implementation ------------------------------------
+ virtual void PopupForButton(GtkWidget* button);
+ virtual void PopupForButtonNextTo(GtkWidget* button,
+ GtkMenuDirectionType dir);
+
+ // The NTP needs to have access to this.
+ static const int kBookmarkBarNTPHeight;
+
+ // BookmarkContextMenuController::Delegate implementation --------------------
+ virtual void CloseMenu();
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, DisplaysHelpMessageOnEmpty);
+ FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest,
+ HidesHelpMessageWithBookmark);
+ FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, BuildsButtons);
+
+ // Helper function which generates GtkToolItems for |bookmark_toolbar_|.
+ void CreateAllBookmarkButtons();
+
+ // Sets the visibility of the instructional text based on whether there are
+ // any bookmarks in the bookmark bar node.
+ void SetInstructionState();
+
+ // Sets the visibility of the overflow chevron.
+ void SetChevronState();
+
+ // Helper function which destroys all the bookmark buttons in the GtkToolbar.
+ void RemoveAllBookmarkButtons();
+
+ // Returns the number of buttons corresponding to starred urls/groups. This
+ // is equivalent to the number of children the bookmark bar node from the
+ // bookmark bar model has.
+ int GetBookmarkButtonCount();
+
+ // Set the appearance of the overflow button appropriately (either chromium
+ // style or GTK style).
+ void SetOverflowButtonAppearance();
+
+ // Returns the index of the first bookmark that is not visible on the bar.
+ // Returns -1 if they are all visible.
+ // |extra_space| is how much extra space to give the toolbar during the
+ // calculation (for the purposes of determining if ditching the chevron
+ // would be a good idea).
+ // If non-NULL, |showing_folders| will be packed with all the folders that are
+ // showing on the bar.
+ int GetFirstHiddenBookmark(int extra_space,
+ std::vector<GtkWidget*>* showing_folders);
+
+ // Returns true if the bookmark bar should be floating on the page (for
+ // NTP).
+ bool ShouldBeFloating();
+ // Update the floating state (either enable or disable it, or do nothing).
+ void UpdateFloatingState();
+
+ // Turns on or off the app_paintable flag on |event_box_|, depending on our
+ // state.
+ void UpdateEventBoxPaintability();
+
+ // Queue a paint on the event box.
+ void PaintEventBox();
+
+ // Finds the size of the current tab contents, if it exists and sets |size|
+ // to the correct value. Returns false if there isn't a TabContents, a
+ // condition that can happen during testing.
+ bool GetTabContentsSize(gfx::Size* size);
+
+ // Makes the appropriate widget on the bookmark bar stop throbbing
+ // (a folder, the overflow chevron, or nothing).
+ void StartThrobbing(const BookmarkNode* node);
+
+ // Set |throbbing_widget_| to |widget|. Also makes sure that
+ // |throbbing_widget_| doesn't become stale.
+ void SetThrobbingWidget(GtkWidget* widget);
+
+ // An item has been dragged over the toolbar, update the drag context
+ // and toolbar UI appropriately.
+ gboolean ItemDraggedOverToolbar(
+ GdkDragContext* context, int index, guint time);
+
+ // When dragging in the middle of a folder, assume the user wants to drop
+ // on the folder. Towards the edges, assume the user wants to drop on the
+ // toolbar. This makes it possible to drop between two folders. This function
+ // returns the index on the toolbar the drag should target, or -1 if the
+ // drag should hit the folder.
+ int GetToolbarIndexForDragOverFolder(GtkWidget* button, gint x);
+
+ void ClearToolbarDropHighlighting();
+
+ // Overridden from BookmarkModelObserver:
+
+ // Invoked when the bookmark model has finished loading. Creates a button
+ // for each of the children of the root node from the model.
+ virtual void Loaded(BookmarkModel* model);
+
+ // Invoked when the model is being deleted.
+ virtual void BookmarkModelBeingDeleted(BookmarkModel* model);
+
+ // Invoked when a node has moved.
+ virtual void BookmarkNodeMoved(BookmarkModel* model,
+ const BookmarkNode* old_parent,
+ int old_index,
+ const BookmarkNode* new_parent,
+ int new_index);
+ virtual void BookmarkNodeAdded(BookmarkModel* model,
+ const BookmarkNode* parent,
+ int index);
+ virtual void BookmarkNodeRemoved(BookmarkModel* model,
+ const BookmarkNode* parent,
+ int old_index,
+ const BookmarkNode* node);
+ virtual void BookmarkNodeChanged(BookmarkModel* model,
+ const BookmarkNode* node);
+ // Invoked when a favicon has finished loading.
+ virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model,
+ const BookmarkNode* node);
+ virtual void BookmarkNodeChildrenReordered(BookmarkModel* model,
+ const BookmarkNode* node);
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ GtkWidget* CreateBookmarkButton(const BookmarkNode* node);
+ GtkToolItem* CreateBookmarkToolItem(const BookmarkNode* node);
+
+ void ConnectFolderButtonEvents(GtkWidget* widget, bool is_tool_item);
+
+ // Finds the BookmarkNode from the model associated with |button|.
+ const BookmarkNode* GetNodeForToolButton(GtkWidget* button);
+
+ // Creates and displays a popup menu for BookmarkNode |node|.
+ void PopupMenuForNode(GtkWidget* sender, const BookmarkNode* node,
+ GdkEventButton* event);
+
+ // GtkButton callbacks.
+ CHROMEGTK_CALLBACK_1(BookmarkBarGtk, gboolean, OnButtonPressed,
+ GdkEventButton*);
+ CHROMEGTK_CALLBACK_1(BookmarkBarGtk, gboolean, OnSyncErrorButtonPressed,
+ GdkEventButton*);
+ CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnClicked);
+ CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnButtonDragBegin,
+ GdkDragContext*);
+ CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnButtonDragEnd, GdkDragContext*);
+ CHROMEGTK_CALLBACK_4(BookmarkBarGtk, void, OnButtonDragGet,
+ GdkDragContext*, GtkSelectionData*, guint, guint);
+
+ // GtkButton callbacks for folder buttons.
+ CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnFolderClicked);
+
+ // GtkToolbar callbacks.
+ CHROMEGTK_CALLBACK_4(BookmarkBarGtk, gboolean, OnToolbarDragMotion,
+ GdkDragContext*, gint, gint, guint);
+ CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnToolbarSizeAllocate,
+ GtkAllocation*);
+
+ // Used for both folder buttons and the toolbar.
+ CHROMEGTK_CALLBACK_6(BookmarkBarGtk, void, OnDragReceived,
+ GdkDragContext*, gint, gint, GtkSelectionData*,
+ guint, guint);
+ CHROMEGTK_CALLBACK_2(BookmarkBarGtk, void, OnDragLeave,
+ GdkDragContext*, guint);
+
+ // Used for folder buttons.
+ CHROMEGTK_CALLBACK_4(BookmarkBarGtk, gboolean, OnFolderDragMotion,
+ GdkDragContext*, gint, gint, guint);
+
+ // GtkEventBox callbacks.
+ CHROMEGTK_CALLBACK_1(BookmarkBarGtk, gboolean, OnEventBoxExpose,
+ GdkEventExpose*);
+ CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnEventBoxDestroy);
+
+ // Callbacks on our parent widget.
+ CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnParentSizeAllocate,
+ GtkAllocation*);
+
+ // |throbbing_widget_| callback.
+ CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnThrobbingWidgetDestroy);
+
+ // ProfileSyncServiceObserver method.
+ virtual void OnStateChanged();
+
+ // Overriden from BookmarkBarInstructionsGtk::Delegate.
+ virtual void ShowImportDialog();
+
+ Profile* profile_;
+
+ // Used for opening urls.
+ PageNavigator* page_navigator_;
+
+ Browser* browser_;
+ BrowserWindowGtk* window_;
+
+ // Provides us with the offset into the background theme image.
+ TabstripOriginProvider* tabstrip_origin_provider_;
+
+ // Model providing details as to the starred entries/groups that should be
+ // shown. This is owned by the Profile.
+ BookmarkModel* model_;
+
+ // Contains |bookmark_hbox_|. Event box exists to prevent leakage of
+ // background color from the toplevel application window's GDK window.
+ OwnedWidgetGtk event_box_;
+
+ // Used to float the bookmark bar when on the NTP.
+ GtkWidget* ntp_padding_box_;
+
+ // Used to paint the background of the bookmark bar when in floating mode.
+ GtkWidget* paint_box_;
+
+ // Used to position all children.
+ GtkWidget* bookmark_hbox_;
+
+ // Alignment widget that is visible if there are no bookmarks on
+ // the bookmar bar.
+ GtkWidget* instructions_;
+
+ // BookmarkBarInstructionsGtk that holds the label and the link for importing
+ // bookmarks when there are no bookmarks on the bookmark bar.
+ scoped_ptr<BookmarkBarInstructionsGtk> instructions_gtk_;
+
+ // GtkToolbar which contains all the bookmark buttons.
+ OwnedWidgetGtk bookmark_toolbar_;
+
+ // The button that shows extra bookmarks that don't fit on the bookmark
+ // bar.
+ GtkWidget* overflow_button_;
+
+ // The other bookmarks button.
+ GtkWidget* other_bookmarks_button_;
+
+ // The sync error button.
+ GtkWidget* sync_error_button_;
+
+ // A pointer to the ProfileSyncService instance if one exists.
+ ProfileSyncService* sync_service_;
+
+ // The BookmarkNode from the model being dragged. NULL when we aren't
+ // dragging.
+ const BookmarkNode* dragged_node_;
+
+ // The visual representation that follows the cursor during drags.
+ GtkWidget* drag_icon_;
+
+ // We create a GtkToolbarItem from |dragged_node_| ;or display.
+ GtkToolItem* toolbar_drop_item_;
+
+ // Theme provider for building buttons.
+ GtkThemeProvider* theme_provider_;
+
+ // Whether we should show the instructional text in the bookmark bar.
+ bool show_instructions_;
+
+ MenuBarHelper menu_bar_helper_;
+
+ // The last displayed right click menu, or NULL if no menus have been
+ // displayed yet.
+ // The controller.
+ scoped_ptr<BookmarkContextMenuController> current_context_menu_controller_;
+ // The view.
+ scoped_ptr<MenuGtk> current_context_menu_;
+
+ // The last displayed left click menu, or NULL if no menus have been
+ // displayed yet.
+ scoped_ptr<BookmarkMenuController> current_menu_;
+
+ scoped_ptr<ui::SlideAnimation> slide_animation_;
+
+ // Whether we are currently configured as floating (detached from the
+ // toolbar). This reflects our actual state, and can be out of sync with
+ // what ShouldShowFloating() returns.
+ bool floating_;
+
+ // Used to optimize out |bookmark_toolbar_| size-allocate events we don't
+ // need to respond to.
+ int last_allocation_width_;
+
+ NotificationRegistrar registrar_;
+
+ // The size of the tab contents last time we forced a paint. We keep track
+ // of this so we don't force too many paints.
+ gfx::Size last_tab_contents_size_;
+
+ // The last coordinates recorded by OnButtonPress; used to line up the
+ // drag icon during bookmark drags.
+ gfx::Point last_pressed_coordinates_;
+
+ // The currently throbbing widget. This is NULL if no widget is throbbing.
+ // We track it because we only want to allow one widget to throb at a time.
+ GtkWidget* throbbing_widget_;
+
+ ScopedRunnableMethodFactory<BookmarkBarGtk> method_factory_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_BOOKMARK_BAR_GTK_H_
diff --git a/chrome/browser/gtk/bookmark_bar_gtk_interactive_uitest.cc b/chrome/browser/ui/gtk/bookmark_bar_gtk_interactive_uitest.cc
index cb027a8..548dbea 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk_interactive_uitest.cc
+++ b/chrome/browser/ui/gtk/bookmark_bar_gtk_interactive_uitest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/bookmark_bar_gtk_unittest.cc b/chrome/browser/ui/gtk/bookmark_bar_gtk_unittest.cc
index 7ee7083..31580f7 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk_unittest.cc
+++ b/chrome/browser/ui/gtk/bookmark_bar_gtk_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/bookmark_bar_instructions_gtk.cc b/chrome/browser/ui/gtk/bookmark_bar_instructions_gtk.cc
index 8090c06..cb93696 100644
--- a/chrome/browser/gtk/bookmark_bar_instructions_gtk.cc
+++ b/chrome/browser/ui/gtk/bookmark_bar_instructions_gtk.cc
@@ -1,10 +1,7 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_GTK_BOOKMARK_BAR_INSTRUCTIONS_GTK_CC_
-#define CHROME_BROWSER_GTK_BOOKMARK_BAR_INSTRUCTIONS_GTK_CC_
-
#include "chrome/browser/gtk/bookmark_bar_instructions_gtk.h"
#include "app/l10n_util.h"
@@ -94,5 +91,3 @@ void BookmarkBarInstructionsGtk::UpdateColors() {
}
}
}
-
-#endif // CHROME_BROWSER_GTK_BOOKMARK_BAR_INSTRUCTIONS_GTK_CC_
diff --git a/chrome/browser/ui/gtk/bookmark_bar_instructions_gtk.h b/chrome/browser/ui/gtk/bookmark_bar_instructions_gtk.h
new file mode 100644
index 0000000..b430381
--- /dev/null
+++ b/chrome/browser/ui/gtk/bookmark_bar_instructions_gtk.h
@@ -0,0 +1,62 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_BOOKMARK_BAR_INSTRUCTIONS_GTK_H_
+#define CHROME_BROWSER_UI_GTK_BOOKMARK_BAR_INSTRUCTIONS_GTK_H_
+#pragma once
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+
+typedef struct _GtkWidget GtkWidget;
+class GtkThemeProvider;
+class Profile;
+
+class BookmarkBarInstructionsGtk : public NotificationObserver {
+ public:
+ // The delegate is notified once the user clicks on the link to import
+ // bookmarks.
+ class Delegate {
+ public:
+ virtual void ShowImportDialog() = 0;
+
+ protected:
+ virtual ~Delegate() {}
+ };
+
+ explicit BookmarkBarInstructionsGtk(Delegate* delegate, Profile* profile);
+
+ // Get the native widget.
+ GtkWidget* widget() const { return instructions_hbox_; }
+
+ private:
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ CHROMEGTK_CALLBACK_0(BookmarkBarInstructionsGtk, void, OnButtonClick);
+
+ // Sets the correct color for |instructions_label_| and |instructions_link_|.
+ void UpdateColors();
+
+ Delegate* delegate_;
+
+ Profile* profile_;
+
+ GtkThemeProvider* theme_provider_;
+
+ // HBox that holds the the label and link of bookmark bar import promotion.
+ GtkWidget* instructions_hbox_;
+ GtkWidget* instructions_label_;
+ GtkWidget* instructions_link_;
+
+ NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkBarInstructionsGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_BOOKMARK_BAR_INSTRUCTIONS_GTK_H_
diff --git a/chrome/browser/gtk/bookmark_bubble_gtk.cc b/chrome/browser/ui/gtk/bookmark_bubble_gtk.cc
index ba0e198..64d4d45 100644
--- a/chrome/browser/gtk/bookmark_bubble_gtk.cc
+++ b/chrome/browser/ui/gtk/bookmark_bubble_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/bookmark_bubble_gtk.h b/chrome/browser/ui/gtk/bookmark_bubble_gtk.h
new file mode 100644
index 0000000..ee5598e
--- /dev/null
+++ b/chrome/browser/ui/gtk/bookmark_bubble_gtk.h
@@ -0,0 +1,129 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This is the GTK implementation of the bookmark bubble, the dialog box
+// presented to create or edit a bookmark. There can only ever be a single
+// bubble open, so the class presents only static methods, and handles the
+// singleton behavior for you. It also handles the object and widget
+// lifetimes, destroying everything and possibly committing any changes when
+// the bubble is closed.
+
+#ifndef CHROME_BROWSER_UI_GTK_BOOKMARK_BUBBLE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_BOOKMARK_BUBBLE_GTK_H_
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "base/task.h"
+#include "chrome/browser/gtk/info_bubble_gtk.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "googleurl/src/gurl.h"
+
+class BookmarkNode;
+class Profile;
+class RecentlyUsedFoldersComboModel;
+
+typedef struct _GtkWidget GtkWidget;
+typedef struct _GParamSpec GParamSpec;
+
+class BookmarkBubbleGtk : public InfoBubbleGtkDelegate,
+ public NotificationObserver {
+ public:
+ // Shows the bookmark bubble, pointing at |anchor_widget|.
+ static void Show(GtkWidget* anchor_widget,
+ Profile* profile,
+ const GURL& url,
+ bool newly_bookmarked);
+
+ // Implements the InfoBubbleGtkDelegate. We are notified when the bubble
+ // is about to be closed, so we have a chance to save any state / input in
+ // our widgets before they are destroyed.
+ virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble,
+ bool closed_by_escape);
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ private:
+ BookmarkBubbleGtk(GtkWidget* anchor,
+ Profile* profile,
+ const GURL& url,
+ bool newly_bookmarked);
+ ~BookmarkBubbleGtk();
+
+ // Notified when |content_| is destroyed so we can delete our instance.
+ CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnDestroy);
+ CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnNameActivate);
+ CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnFolderChanged);
+ CHROMEGTK_CALLBACK_1(BookmarkBubbleGtk, void, OnFolderPopupShown,
+ GParamSpec*);
+ CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnEditClicked);
+ CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnCloseClicked);
+ CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnRemoveClicked);
+
+ // Update the bookmark with any edits that have been made.
+ void ApplyEdits();
+
+ // Open the bookmark editor for the current url and close the bubble.
+ void ShowEditor();
+
+ // Return the UTF8 encoded title for the current |url_|.
+ std::string GetTitle();
+
+ void InitFolderComboModel();
+
+ // The URL of the bookmark.
+ GURL url_;
+ // Our current profile (used to access the bookmark system).
+ Profile* profile_;
+
+ // Provides colors and stuff.
+ GtkThemeProvider* theme_provider_;
+
+ // The widget relative to which we are positioned.
+ GtkWidget* anchor_;
+
+ // We let the InfoBubble own our content, and then we delete ourself
+ // when the widget is destroyed (when the InfoBubble is destroyed).
+ GtkWidget* content_;
+
+ // The button that removes the bookmark.
+ GtkWidget* remove_button_;
+
+ // The various labels in the interface. We keep track of them for theme
+ // changes.
+ std::vector<GtkWidget*> labels_;
+
+ // The GtkEntry for editing the bookmark name / title.
+ GtkWidget* name_entry_;
+
+ // The combo box for selecting the bookmark folder.
+ GtkWidget* folder_combo_;
+ scoped_ptr<RecentlyUsedFoldersComboModel> folder_combo_model_;
+
+ InfoBubbleGtk* bubble_;
+
+ // We need to push some things on the back of the message loop, so we have
+ // a factory attached to our instance to manage task lifetimes.
+ ScopedRunnableMethodFactory<BookmarkBubbleGtk> factory_;
+
+ // Whether the bubble is creating or editing an existing bookmark.
+ bool newly_bookmarked_;
+ // When closing the window, whether we should update or remove the bookmark.
+ bool apply_edits_;
+ bool remove_bookmark_;
+
+ NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_BOOKMARK_BUBBLE_GTK_H_
diff --git a/chrome/browser/gtk/bookmark_editor_gtk.cc b/chrome/browser/ui/gtk/bookmark_editor_gtk.cc
index 74558e1..12686e6 100644
--- a/chrome/browser/gtk/bookmark_editor_gtk.cc
+++ b/chrome/browser/ui/gtk/bookmark_editor_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/bookmark_editor_gtk.h b/chrome/browser/ui/gtk/bookmark_editor_gtk.h
new file mode 100644
index 0000000..b673ff6
--- /dev/null
+++ b/chrome/browser/ui/gtk/bookmark_editor_gtk.h
@@ -0,0 +1,167 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_BOOKMARK_EDITOR_GTK_H_
+#define CHROME_BROWSER_UI_GTK_BOOKMARK_EDITOR_GTK_H_
+#pragma once
+
+#include "app/gtk_integers.h"
+#include "app/gtk_signal.h"
+#include "base/gtest_prod_util.h"
+#include "base/scoped_ptr.h"
+#include "base/string16.h"
+#include "chrome/browser/bookmarks/bookmark_editor.h"
+#include "chrome/browser/bookmarks/bookmark_model_observer.h"
+
+class GURL;
+
+typedef union _GdkEvent GdkEvent;
+typedef struct _GdkEventButton GdkEventButton;
+typedef struct _GtkTreeIter GtkTreeIter;
+typedef struct _GtkTreeSelection GtkTreeSelection;
+typedef struct _GtkTreeStore GtkTreeStore;
+typedef struct _GtkWidget GtkWidget;
+
+namespace gfx {
+class Point;
+} // namespace gfx
+
+// GTK version of the bookmark editor dialog.
+class BookmarkEditorGtk : public BookmarkEditor,
+ public BookmarkModelObserver {
+ public:
+ BookmarkEditorGtk(GtkWindow* window,
+ Profile* profile,
+ const BookmarkNode* parent,
+ const EditDetails& details,
+ BookmarkEditor::Configuration configuration);
+
+ virtual ~BookmarkEditorGtk();
+
+ void Show();
+ void Close();
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeParent);
+ FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeParentAndURL);
+ FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeURLToExistingURL);
+ FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, EditTitleKeepsPosition);
+ FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, EditURLKeepsPosition);
+ FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ModelsMatch);
+ FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, MoveToNewParent);
+ FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, NewURL);
+ FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeURLNoTree);
+ FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeTitleNoTree);
+
+ class ContextMenuController;
+ friend class ContextMenuController;
+
+ void Init(GtkWindow* parent_window);
+
+ // BookmarkModel observer methods. Any structural change results in
+ // resetting the tree model.
+ virtual void Loaded(BookmarkModel* model) { }
+ virtual void BookmarkNodeMoved(BookmarkModel* model,
+ const BookmarkNode* old_parent,
+ int old_index,
+ const BookmarkNode* new_parent,
+ int new_index);
+ virtual void BookmarkNodeAdded(BookmarkModel* model,
+ const BookmarkNode* parent,
+ int index);
+ virtual void BookmarkNodeRemoved(BookmarkModel* model,
+ const BookmarkNode* parent,
+ int old_index,
+ const BookmarkNode* node);
+ virtual void BookmarkNodeChanged(BookmarkModel* model,
+ const BookmarkNode* node) {}
+ virtual void BookmarkNodeChildrenReordered(BookmarkModel* model,
+ const BookmarkNode* node);
+ virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model,
+ const BookmarkNode* node) {}
+
+ // Resets the model of the tree and updates the various buttons appropriately.
+ void Reset();
+
+ // Returns the current url the user has input.
+ GURL GetInputURL() const;
+
+ // Returns the title the user has input.
+ string16 GetInputTitle() const;
+
+ // Invokes ApplyEdits with the selected node.
+ //
+ // TODO(erg): This was copied from the windows version. Both should be
+ // cleaned up so that we don't overload ApplyEdits.
+ void ApplyEdits();
+
+ // Applies the edits done by the user. |selected_parent| gives the parent of
+ // the URL being edited.
+ void ApplyEdits(GtkTreeIter* selected_parent);
+
+ // Adds a new group parented on |parent| and sets |child| to point to this
+ // new group.
+ void AddNewGroup(GtkTreeIter* parent, GtkTreeIter* child);
+
+ CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnSelectionChanged);
+ CHROMEGTK_CALLBACK_1(BookmarkEditorGtk, void, OnResponse, int);
+ CHROMEGTK_CALLBACK_1(BookmarkEditorGtk, gboolean, OnWindowDeleteEvent,
+ GdkEvent*);
+
+ CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnWindowDestroy);
+ CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnEntryChanged);
+
+ CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnNewFolderClicked);
+
+ CHROMEGTK_CALLBACK_1(BookmarkEditorGtk, gboolean, OnTreeViewButtonPressEvent,
+ GdkEventButton*);
+
+ void ShowContextMenu(const gfx::Point& point);
+
+ void NewFolder();
+
+ // Profile the entry is from.
+ Profile* profile_;
+
+ // The dialog to display on screen.
+ GtkWidget* dialog_;
+ GtkWidget* name_entry_;
+ GtkWidget* url_entry_; // This is NULL if IsEditingFolder.
+ GtkWidget* tree_view_;
+ GtkWidget* new_folder_button_;
+
+ // Helper object that manages the currently selected item in |tree_view_|.
+ GtkTreeSelection* tree_selection_;
+
+ // Our local copy of the bookmark data that we make from the BookmarkModel
+ // that we can modify as much as we want and still discard when the user
+ // clicks Cancel.
+ GtkTreeStore* tree_store_;
+
+ // TODO(erg): BookmarkEditorView has an EditorTreeModel object here; convert
+ // that into a GObject that implements the interface GtkTreeModel.
+
+ // Initial parent to select. Is only used if node_ is NULL.
+ const BookmarkNode* parent_;
+
+ // Details about the node we're editing.
+ const EditDetails details_;
+
+ // Mode used to create nodes from.
+ BookmarkModel* bb_model_;
+
+ // If true, we're running the menu for the bookmark bar or other bookmarks
+ // nodes.
+ bool running_menu_for_root_;
+
+ // Is the tree shown?
+ bool show_tree_;
+
+ // The context menu controller.
+ scoped_ptr<ContextMenuController> menu_controller_;
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkEditorGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_BOOKMARK_EDITOR_GTK_H_
diff --git a/chrome/browser/gtk/bookmark_editor_gtk_unittest.cc b/chrome/browser/ui/gtk/bookmark_editor_gtk_unittest.cc
index 14143a8..612f04d 100644
--- a/chrome/browser/gtk/bookmark_editor_gtk_unittest.cc
+++ b/chrome/browser/ui/gtk/bookmark_editor_gtk_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/bookmark_menu_controller_gtk.cc b/chrome/browser/ui/gtk/bookmark_menu_controller_gtk.cc
index 21939c1..c0f7939 100644
--- a/chrome/browser/gtk/bookmark_menu_controller_gtk.cc
+++ b/chrome/browser/ui/gtk/bookmark_menu_controller_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/bookmark_menu_controller_gtk.h b/chrome/browser/ui/gtk/bookmark_menu_controller_gtk.h
new file mode 100644
index 0000000..12b7109
--- /dev/null
+++ b/chrome/browser/ui/gtk/bookmark_menu_controller_gtk.h
@@ -0,0 +1,145 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_
+#define CHROME_BROWSER_UI_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_
+#pragma once
+
+#include <map>
+
+#include "app/gtk_integers.h"
+#include "app/gtk_signal.h"
+#include "app/gtk_signal_registrar.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/bookmarks/base_bookmark_model_observer.h"
+#include "chrome/browser/bookmarks/bookmark_context_menu_controller.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "webkit/glue/window_open_disposition.h"
+
+class Browser;
+class Profile;
+class Profiler;
+class PageNavigator;
+class BookmarkModel;
+class BookmarkNode;
+class MenuGtk;
+
+typedef struct _GdkDragContext GdkDragContext;
+typedef struct _GdkEventButton GdkEventButton;
+typedef struct _GtkSelectionData GtkSelectionData;
+typedef struct _GtkWidget GtkWidget;
+
+class BookmarkMenuController : public BaseBookmarkModelObserver,
+ public BookmarkContextMenuControllerDelegate {
+ public:
+ // Creates a BookmarkMenuController showing the children of |node| starting
+ // at index |start_child_index|.
+ BookmarkMenuController(Browser* browser,
+ Profile* profile,
+ PageNavigator* page_navigator,
+ GtkWindow* window,
+ const BookmarkNode* node,
+ int start_child_index);
+ virtual ~BookmarkMenuController();
+
+ GtkWidget* widget() { return menu_; }
+
+ // Pops up the menu. |widget| must be a GtkChromeButton.
+ void Popup(GtkWidget* widget, gint button_type, guint32 timestamp);
+
+ // Overridden from BaseBookmarkModelObserver:
+ virtual void BookmarkModelChanged();
+ virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model,
+ const BookmarkNode* node);
+
+ // Overridden from BookmarkContextMenuController::Delegate:
+ virtual void WillExecuteCommand();
+ virtual void CloseMenu();
+
+ private:
+ // Recursively change the bookmark hierarchy rooted in |parent| into a set of
+ // gtk menus rooted in |menu|.
+ void BuildMenu(const BookmarkNode* parent,
+ int start_child_index,
+ GtkWidget* menu);
+
+ // Calls the page navigator to navigate to the node represented by
+ // |menu_item|.
+ void NavigateToMenuItem(GtkWidget* menu_item,
+ WindowOpenDisposition disposition);
+
+ // Button press and release events for a GtkMenu.
+ CHROMEGTK_CALLBACK_1(BookmarkMenuController, gboolean,
+ OnMenuButtonPressedOrReleased, GdkEventButton*);
+
+ // Button release event for a GtkMenuItem.
+ CHROMEGTK_CALLBACK_1(BookmarkMenuController, gboolean, OnButtonReleased,
+ GdkEventButton*);
+
+ // We connect this handler to the button-press-event signal for folder nodes.
+ // It suppresses the normal behavior (popping up the submenu) to allow these
+ // nodes to be draggable. The submenu is instead popped up on a
+ // button-release-event.
+ CHROMEGTK_CALLBACK_1(BookmarkMenuController, gboolean, OnFolderButtonPressed,
+ GdkEventButton*);
+
+ // We have to stop drawing |triggering_widget_| as active when the menu
+ // closes.
+ CHROMEGTK_CALLBACK_0(BookmarkMenuController, void, OnMenuHidden)
+
+ // We respond to the activate signal because things other than mouse button
+ // events can trigger it.
+ CHROMEGTK_CALLBACK_0(BookmarkMenuController, void, OnMenuItemActivated);
+
+ // The individual GtkMenuItems in the BookmarkMenu are all drag sources.
+ CHROMEGTK_CALLBACK_1(BookmarkMenuController, void, OnMenuItemDragBegin,
+ GdkDragContext*);
+ CHROMEGTK_CALLBACK_1(BookmarkMenuController, void, OnMenuItemDragEnd,
+ GdkDragContext*);
+ CHROMEGTK_CALLBACK_4(BookmarkMenuController, void, OnMenuItemDragGet,
+ GdkDragContext*, GtkSelectionData*, guint, guint);
+
+ Browser* browser_;
+ Profile* profile_;
+ PageNavigator* page_navigator_;
+
+ // Parent window of this menu.
+ GtkWindow* parent_window_;
+
+ // The bookmark model.
+ BookmarkModel* model_;
+
+ // The node we're showing the contents of.
+ const BookmarkNode* node_;
+
+ // Our bookmark menus. We don't use the MenuGtk class because we have to do
+ // all sorts of weird non-standard things with this menu, like:
+ // - The menu is a drag target
+ // - The menu items have context menus.
+ GtkWidget* menu_;
+
+ // The visual representation that follows the cursor during drags.
+ GtkWidget* drag_icon_;
+
+ // Whether we should ignore the next button release event (because we were
+ // dragging).
+ bool ignore_button_release_;
+
+ // The widget we are showing for (i.e. the bookmark bar folder button).
+ GtkWidget* triggering_widget_;
+
+ // Mapping from node to GtkMenuItem menu id. This only contains entries for
+ // nodes of type URL.
+ std::map<const BookmarkNode*, GtkWidget*> node_to_menu_widget_map_;
+
+ // The controller and view for the right click context menu.
+ scoped_ptr<BookmarkContextMenuController> context_menu_controller_;
+ scoped_ptr<MenuGtk> context_menu_;
+
+ GtkSignalRegistrar signals_;
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkMenuController);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_
diff --git a/chrome/browser/gtk/bookmark_tree_model.cc b/chrome/browser/ui/gtk/bookmark_tree_model.cc
index d6ef4de..409d26c 100644
--- a/chrome/browser/gtk/bookmark_tree_model.cc
+++ b/chrome/browser/ui/gtk/bookmark_tree_model.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/bookmark_tree_model.h b/chrome/browser/ui/gtk/bookmark_tree_model.h
new file mode 100644
index 0000000..9b3a78b
--- /dev/null
+++ b/chrome/browser/ui/gtk/bookmark_tree_model.h
@@ -0,0 +1,77 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_BOOKMARK_TREE_MODEL_H_
+#define CHROME_BROWSER_UI_GTK_BOOKMARK_TREE_MODEL_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/string16.h"
+
+class BookmarkModel;
+class BookmarkNode;
+
+typedef struct _GtkCellRenderer GtkCellRenderer;
+typedef struct _GtkTreeIter GtkTreeIter;
+typedef struct _GtkTreeModel GtkTreeModel;
+typedef struct _GtkTreeStore GtkTreeStore;
+typedef struct _GtkTreeView GtkTreeView;
+typedef struct _GdkPixbuf GdkPixbuf;
+typedef struct _GtkWidget GtkWidget;
+
+namespace bookmark_utils {
+
+enum FolderTreeStoreColumns {
+ FOLDER_ICON,
+ FOLDER_NAME,
+ ITEM_ID,
+ IS_EDITABLE,
+ FOLDER_STORE_NUM_COLUMNS
+};
+
+// Make a tree store that has two columns: name and id.
+GtkTreeStore* MakeFolderTreeStore();
+
+// Copies the folders in the model's root node into a GtkTreeStore. We
+// want the user to be able to modify the tree of folders, but to be able to
+// click Cancel and discard their modifications. |selected_id| is the
+// node->id() of the BookmarkNode that should selected on
+// node->screen. |selected_iter| is an out value that points to the
+// node->representation of the node associated with |selected_id| in |store|.
+// |recursive| indicates whether to recurse into sub-directories (if false,
+// the tree store will effectively be a list). |only_folders| indicates whether
+// to include bookmarks in the tree, or to only show folders.
+void AddToTreeStore(BookmarkModel* model, int64 selected_id,
+ GtkTreeStore* store, GtkTreeIter* selected_iter);
+
+// As above, but inserts just the tree rooted at |node| as a child of |parent|.
+// If |parent| is NULL, add it at the top level.
+void AddToTreeStoreAt(const BookmarkNode* node, int64 selected_id,
+ GtkTreeStore* store, GtkTreeIter* selected_iter,
+ GtkTreeIter* parent);
+
+// Makes a tree view for the store. This will take ownership of |store| and the
+// returned widget has a floating reference.
+GtkWidget* MakeTreeViewForStore(GtkTreeStore* store);
+
+// A helper method for getting pointer back to the GtkCellRendererText used for
+// the folder names.
+GtkCellRenderer* GetCellRendererText(GtkTreeView* tree_view);
+
+// Commits changes to a GtkTreeStore built from BuildTreeStoreFrom() back
+// into the BookmarkModel it was generated from. Returns the BookmarkNode that
+// represented by |selected|.
+const BookmarkNode* CommitTreeStoreDifferencesBetween(
+ BookmarkModel* model, GtkTreeStore* tree_store,
+ GtkTreeIter* selected);
+
+// Returns the id field of the row pointed to by |iter|.
+int64 GetIdFromTreeIter(GtkTreeModel* model, GtkTreeIter* iter);
+
+// Returns the title field in utf8 of the row pointed to by |iter|.
+string16 GetTitleFromTreeIter(GtkTreeModel* model, GtkTreeIter* iter);
+
+} // namespace bookmark_utils
+
+#endif // CHROME_BROWSER_UI_GTK_BOOKMARK_TREE_MODEL_H_
diff --git a/chrome/browser/gtk/bookmark_utils_gtk.cc b/chrome/browser/ui/gtk/bookmark_utils_gtk.cc
index e6d164a..8486445 100644
--- a/chrome/browser/gtk/bookmark_utils_gtk.cc
+++ b/chrome/browser/ui/gtk/bookmark_utils_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/bookmark_utils_gtk.h b/chrome/browser/ui/gtk/bookmark_utils_gtk.h
new file mode 100644
index 0000000..e662bbb
--- /dev/null
+++ b/chrome/browser/ui/gtk/bookmark_utils_gtk.h
@@ -0,0 +1,110 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_BOOKMARK_UTILS_GTK_H_
+#define CHROME_BROWSER_UI_GTK_BOOKMARK_UTILS_GTK_H_
+#pragma once
+
+#include <vector>
+#include <string>
+
+#include "app/gtk_integers.h"
+#include "base/string16.h"
+
+class BookmarkModel;
+class BookmarkNode;
+class GtkThemeProvider;
+class Profile;
+
+typedef struct _GdkDragContext GdkDragContext;
+typedef struct _GdkPixbuf GdkPixbuf;
+typedef struct _GtkSelectionData GtkSelectionData;
+typedef struct _GtkWidget GtkWidget;
+
+namespace bookmark_utils {
+
+extern const char kBookmarkNode[];
+
+// Get the image that is used to represent the node. This function adds a ref
+// to the returned pixbuf, so it requires a matching call to g_object_unref().
+GdkPixbuf* GetPixbufForNode(const BookmarkNode* node, BookmarkModel* model,
+ bool native);
+
+// Returns a GtkWindow with a visual hierarchy for passing to
+// gtk_drag_set_icon_widget().
+GtkWidget* GetDragRepresentation(GdkPixbuf* pixbuf,
+ const string16& title,
+ GtkThemeProvider* provider);
+GtkWidget* GetDragRepresentationForNode(const BookmarkNode* node,
+ BookmarkModel* model,
+ GtkThemeProvider* provider);
+
+// Helper function that sets visual properties of GtkButton |button| to the
+// contents of |node|.
+void ConfigureButtonForNode(const BookmarkNode* node, BookmarkModel* model,
+ GtkWidget* button, GtkThemeProvider* provider);
+
+// Returns the tooltip.
+std::string BuildTooltipFor(const BookmarkNode* node);
+
+// Returns the "bookmark-node" property of |widget| casted to the correct type.
+const BookmarkNode* BookmarkNodeForWidget(GtkWidget* widget);
+
+// Set the colors on |label| as per the theme.
+void SetButtonTextColors(GtkWidget* label, GtkThemeProvider* provider);
+
+// Drag and drop. --------------------------------------------------------------
+
+// Get the DnD target mask for a bookmark drag. This will vary based on whether
+// the node in question is a folder.
+int GetCodeMask(bool folder);
+
+// Pickle a node into a GtkSelection.
+void WriteBookmarkToSelection(const BookmarkNode* node,
+ GtkSelectionData* selection_data,
+ guint target_type,
+ Profile* profile);
+
+// Pickle a vector of nodes into a GtkSelection.
+void WriteBookmarksToSelection(const std::vector<const BookmarkNode*>& nodes,
+ GtkSelectionData* selection_data,
+ guint target_type,
+ Profile* profile);
+
+// Un-pickle node(s) from a GtkSelection.
+// The last two arguments are out parameters.
+std::vector<const BookmarkNode*> GetNodesFromSelection(
+ GdkDragContext* context,
+ GtkSelectionData* selection_data,
+ guint target_type,
+ Profile* profile,
+ gboolean* delete_selection_data,
+ gboolean* dnd_success);
+
+// Unpickle a new bookmark of the CHROME_NAMED_URL drag type, and put it in
+// the appropriate location in the model.
+bool CreateNewBookmarkFromNamedUrl(
+ GtkSelectionData* selection_data,
+ BookmarkModel* model,
+ const BookmarkNode* parent,
+ int idx);
+
+// Add the URIs in |selection_data| into the model at the given position. They
+// will be added whether or not the URL is valid.
+bool CreateNewBookmarksFromURIList(
+ GtkSelectionData* selection_data,
+ BookmarkModel* model,
+ const BookmarkNode* parent,
+ int idx);
+
+// Add the "url\ntitle" combination into the model at the given position.
+bool CreateNewBookmarkFromNetscapeURL(
+ GtkSelectionData* selection_data,
+ BookmarkModel* model,
+ const BookmarkNode* parent,
+ int idx);
+
+} // namespace bookmark_utils
+
+#endif // CHROME_BROWSER_UI_GTK_BOOKMARK_UTILS_GTK_H_
diff --git a/chrome/browser/gtk/bookmark_utils_gtk_unittest.cc b/chrome/browser/ui/gtk/bookmark_utils_gtk_unittest.cc
index be22a10..603a641 100644
--- a/chrome/browser/gtk/bookmark_utils_gtk_unittest.cc
+++ b/chrome/browser/ui/gtk/bookmark_utils_gtk_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc
index 93b126d..d3c0934 100644
--- a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h
new file mode 100644
index 0000000..5df98a1
--- /dev/null
+++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h
@@ -0,0 +1,223 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_
+#define CHROME_BROWSER_UI_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_
+#pragma once
+
+#include <map>
+#include <string>
+
+#include "app/gtk_signal.h"
+#include "app/gtk_signal_registrar.h"
+#include "app/menus/simple_menu_model.h"
+#include "base/linked_ptr.h"
+#include "base/task.h"
+#include "chrome/browser/extensions/extension_toolbar_model.h"
+#include "chrome/browser/gtk/custom_button.h"
+#include "chrome/browser/gtk/menu_gtk.h"
+#include "chrome/browser/gtk/overflow_button.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
+
+class Browser;
+class BrowserActionButton;
+class Extension;
+class GtkThemeProvider;
+class Profile;
+
+typedef struct _GdkDragContext GdkDragContext;
+typedef struct _GtkWidget GtkWidget;
+
+class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer,
+ public ui::AnimationDelegate,
+ public MenuGtk::Delegate,
+ public menus::SimpleMenuModel::Delegate,
+ public NotificationObserver {
+ public:
+ explicit BrowserActionsToolbarGtk(Browser* browser);
+ virtual ~BrowserActionsToolbarGtk();
+
+ GtkWidget* widget() { return hbox_.get(); }
+ GtkWidget* chevron() { return overflow_button_->widget(); }
+
+ // Returns the widget in use by the BrowserActionButton corresponding to
+ // |extension|. Used in positioning the ExtensionInstalledBubble for
+ // BrowserActions.
+ GtkWidget* GetBrowserActionWidget(const Extension* extension);
+
+ int button_count() { return extension_button_map_.size(); }
+
+ Browser* browser() { return browser_; }
+
+ // Returns the currently selected tab ID, or -1 if there is none.
+ int GetCurrentTabId();
+
+ // Update the display of all buttons.
+ void Update();
+
+ // NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ bool animating() {
+ return resize_animation_.is_animating();
+ }
+
+ private:
+ friend class BrowserActionButton;
+
+ // Initialize drag and drop.
+ void SetupDrags();
+
+ // Query the extensions service for all extensions with browser actions,
+ // and create the UI for them.
+ void CreateAllButtons();
+
+ // Sets the width of the container and overflow state according to the model.
+ void SetContainerWidth();
+
+ // Create the UI for a single browser action. This will stick the button
+ // at the end of the toolbar.
+ void CreateButtonForExtension(const Extension* extension, int index);
+
+ // Delete resources associated with UI for a browser action.
+ void RemoveButtonForExtension(const Extension* extension);
+
+ // Change the visibility of widget() based on whether we have any buttons
+ // to show.
+ void UpdateVisibility();
+
+ // Hide the extension popup, if any.
+ void HidePopup();
+
+ // Animate the toolbar to show the given number of icons. This assumes the
+ // visibility of the overflow button will not change.
+ void AnimateToShowNIcons(int count);
+
+ // Returns true if this extension should be shown in this toolbar. This can
+ // return false if we are in an incognito window and the extension is disabled
+ // for incognito.
+ bool ShouldDisplayBrowserAction(const Extension* extension);
+
+ // ExtensionToolbarModel::Observer implementation.
+ virtual void BrowserActionAdded(const Extension* extension, int index);
+ virtual void BrowserActionRemoved(const Extension* extension);
+ virtual void BrowserActionMoved(const Extension* extension, int index);
+ virtual void ModelLoaded();
+
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
+
+ // SimpleMenuModel::Delegate implementation.
+ // In our case, |command_id| is be the index into the model's extension list.
+ virtual bool IsCommandIdChecked(int command_id) const;
+ virtual bool IsCommandIdEnabled(int command_id) const;
+ virtual bool GetAcceleratorForCommandId(
+ int command_id,
+ menus::Accelerator* accelerator);
+ virtual void ExecuteCommand(int command_id);
+
+ // MenuGtk::Delegate implementation.
+ virtual void StoppedShowing();
+ virtual bool AlwaysShowIconForCmd(int command_id) const;
+
+ // Called by the BrowserActionButton in response to drag-begin.
+ void DragStarted(BrowserActionButton* button, GdkDragContext* drag_context);
+
+ // Sets the width of the button area of the toolbar to |new_width|, clamping
+ // it to appropriate values.
+ void SetButtonHBoxWidth(int new_width);
+
+ // Shows or hides the chevron as appropriate.
+ void UpdateChevronVisibility();
+
+ CHROMEGTK_CALLBACK_4(BrowserActionsToolbarGtk, gboolean, OnDragMotion,
+ GdkDragContext*, gint, gint, guint);
+ CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, void, OnDragEnd,
+ GdkDragContext*);
+ CHROMEGTK_CALLBACK_2(BrowserActionsToolbarGtk, gboolean, OnDragFailed,
+ GdkDragContext*, GtkDragResult);
+ CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, void, OnHierarchyChanged,
+ GtkWidget*);
+ CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, void, OnSetFocus, GtkWidget*);
+ CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, gboolean,
+ OnGripperMotionNotify, GdkEventMotion*);
+ CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, gboolean, OnGripperExpose,
+ GdkEventExpose*);
+ CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, gboolean,
+ OnGripperEnterNotify, GdkEventCrossing*);
+ CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, gboolean,
+ OnGripperLeaveNotify, GdkEventCrossing*);
+ CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, gboolean,
+ OnGripperButtonRelease, GdkEventButton*);
+ CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, gboolean,
+ OnGripperButtonPress, GdkEventButton*);
+ // The overflow button is pressed.
+ CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, gboolean,
+ OnOverflowButtonPress, GdkEventButton*);
+ // The user presses a mouse button over the popped up overflow menu.
+ CHROMEGTK_CALLBACK_1(BrowserActionsToolbarGtk, gboolean,
+ OnOverflowMenuButtonPress, GdkEventButton*);
+ CHROMEGTK_CALLBACK_0(BrowserActionsToolbarGtk, void, OnButtonShowOrHide);
+
+ Browser* browser_;
+
+ Profile* profile_;
+ GtkThemeProvider* theme_provider_;
+
+ ExtensionToolbarModel* model_;
+
+ // Contains the drag gripper, browser action buttons, and overflow chevron.
+ OwnedWidgetGtk hbox_;
+
+ // Contains the browser action buttons.
+ OwnedWidgetGtk button_hbox_;
+
+ // The overflow button for chrome theme mode.
+ scoped_ptr<CustomDrawButton> overflow_button_;
+ // The separator just next to the overflow button. Only shown in GTK+ theme
+ // mode. In Chrome theme mode, the overflow button has a separator built in.
+ GtkWidget* separator_;
+ scoped_ptr<MenuGtk> overflow_menu_;
+ scoped_ptr<menus::SimpleMenuModel> overflow_menu_model_;
+ GtkWidget* overflow_area_;
+ // A widget for adding extra padding to the left of the overflow button.
+ GtkWidget* overflow_alignment_;
+
+ // The button that is currently being dragged, or NULL.
+ BrowserActionButton* drag_button_;
+
+ // The new position of the button in the drag, or -1.
+ int drop_index_;
+
+ // Map from extension ID to BrowserActionButton, which is a wrapper for
+ // a chrome button and related functionality. There should be one entry
+ // for every extension that has a browser action.
+ typedef std::map<std::string, linked_ptr<BrowserActionButton> >
+ ExtensionButtonMap;
+ ExtensionButtonMap extension_button_map_;
+
+ // We use this animation for the smart resizing of the toolbar.
+ ui::SlideAnimation resize_animation_;
+ // This is the final width we are animating towards.
+ int desired_width_;
+ // This is the width we were at when we started animating.
+ int start_width_;
+
+ GtkSignalRegistrar signals_;
+
+ NotificationRegistrar registrar_;
+
+ ScopedRunnableMethodFactory<BrowserActionsToolbarGtk> method_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserActionsToolbarGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_
diff --git a/chrome/browser/gtk/browser_titlebar.cc b/chrome/browser/ui/gtk/browser_titlebar.cc
index 7af5a5e..77447f3 100644
--- a/chrome/browser/gtk/browser_titlebar.cc
+++ b/chrome/browser/ui/gtk/browser_titlebar.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/browser_titlebar.h b/chrome/browser/ui/gtk/browser_titlebar.h
new file mode 100644
index 0000000..65dd78d
--- /dev/null
+++ b/chrome/browser/ui/gtk/browser_titlebar.h
@@ -0,0 +1,239 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// A helper class that contains the gtk widgets that make up the titlebar. The
+// titlebar consists of the tabstrip and if the custom chrome frame is turned
+// on, it includes the taller titlebar and minimize, restore, maximize, and
+// close buttons.
+
+#ifndef CHROME_BROWSER_UI_GTK_BROWSER_TITLEBAR_H_
+#define CHROME_BROWSER_UI_GTK_BROWSER_TITLEBAR_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/active_window_watcher_x.h"
+#include "app/menus/simple_menu_model.h"
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+
+class BrowserWindowGtk;
+class CustomDrawButton;
+class GtkThemeProvider;
+class MenuGtk;
+class PopupPageMenuModel;
+class TabContents;
+
+class BrowserTitlebar : public NotificationObserver,
+ public ActiveWindowWatcherX::Observer,
+ public menus::SimpleMenuModel::Delegate {
+ public:
+ // A default button order string for when we aren't asking gconf for the
+ // metacity configuration.
+ static const char kDefaultButtonString[];
+
+ BrowserTitlebar(BrowserWindowGtk* browser_window, GtkWindow* window);
+ virtual ~BrowserTitlebar();
+
+ GtkWidget* widget() {
+ return container_;
+ }
+
+ void set_window(GtkWindow* window) { window_ = window; }
+
+ // Builds the buttons based on the metacity |button_string|.
+ void BuildButtons(const std::string& button_string);
+
+ // Update the appearance of the title bar based on whether we're showing a
+ // custom frame or not. If |use_custom_frame| is true, we show an extra
+ // tall titlebar and the min/max/close buttons.
+ void UpdateCustomFrame(bool use_custom_frame);
+
+ // Updates the title and icon when in app or popup mode (no tabstrip).
+ void UpdateTitleAndIcon();
+
+ // Called by the browser asking us to update the loading throbber.
+ // |tab_contents| is the tab that is associated with the window throbber.
+ // |tab_contents| can be null.
+ void UpdateThrobber(TabContents* tab_contents);
+
+ // On Windows, right clicking in the titlebar background brings up the system
+ // menu. There's no such thing on linux, so we just show the menu items we
+ // add to the menu.
+ void ShowContextMenu();
+
+ private:
+ // A helper class to keep track of which frame of the throbber animation
+ // we're showing.
+ class Throbber {
+ public:
+ Throbber() : current_frame_(0), current_waiting_frame_(0) {}
+
+ // Get the next frame in the animation. The image is owned by the throbber
+ // so the caller doesn't need to unref. |is_waiting| is true if we're
+ // still waiting for a response.
+ GdkPixbuf* GetNextFrame(bool is_waiting);
+
+ // Reset back to the first frame.
+ void Reset();
+ private:
+ // Make sure the frames are loaded.
+ static void InitFrames();
+
+ int current_frame_;
+ int current_waiting_frame_;
+ };
+
+ class ContextMenuModel : public menus::SimpleMenuModel {
+ public:
+ explicit ContextMenuModel(menus::SimpleMenuModel::Delegate* delegate);
+ };
+
+ // Build the titlebar, the space above the tab
+ // strip, and (maybe) the min, max, close buttons. |container| is the gtk
+ // continer that we put the widget into.
+ void Init();
+
+ // Lazily builds and returns |titlebar_{left,right}_buttons_vbox_| and their
+ // subtrees. We do this lazily because in most situations, only one of them
+ // is allocated (though the user can (and do) manually mess with their gconf
+ // settings to get absolutely horrid combinations of buttons on both sides.
+ GtkWidget* GetButtonHBox(bool left_side);
+
+ // Constructs a CustomDraw button given 3 image ids (IDR_), the box to place
+ // the button into, and a tooltip id (IDS_).
+ CustomDrawButton* BuildTitlebarButton(int image, int image_pressed,
+ int image_hot, GtkWidget* box,
+ int tooltip);
+
+ // Update the titlebar spacing based on the custom frame and maximized state.
+ void UpdateTitlebarAlignment();
+
+ // Updates the color of the title bar. Called whenever we have a state
+ // change in the window.
+ void UpdateTextColor();
+
+ // Show the menu that the user gets from left-clicking the favicon.
+ void ShowFaviconMenu(GdkEventButton* event);
+
+ // The maximize button was clicked, take an action depending on which mouse
+ // button the user pressed.
+ void MaximizeButtonClicked();
+
+ // Updates the visibility of the maximize and restore buttons; only one can
+ // be visible at a time.
+ void UpdateMaximizeRestoreVisibility();
+
+ // Callback for changes to window state. This includes
+ // maximizing/restoring/minimizing the window.
+ CHROMEG_CALLBACK_1(BrowserTitlebar, gboolean, OnWindowStateChanged,
+ GtkWindow*, GdkEventWindowState*);
+
+ // Callback for mousewheel events.
+ CHROMEGTK_CALLBACK_1(BrowserTitlebar, gboolean, OnScroll,
+ GdkEventScroll*);
+
+ // Callback for min/max/close buttons.
+ CHROMEGTK_CALLBACK_0(BrowserTitlebar, void, OnButtonClicked);
+
+ // Callback for favicon.
+ CHROMEGTK_CALLBACK_1(BrowserTitlebar, gboolean, OnButtonPressed,
+ GdkEventButton*);
+
+ // -- Context Menu -----------------------------------------------------------
+
+ // SimpleMenuModel::Delegate implementation:
+ virtual bool IsCommandIdEnabled(int command_id) const;
+ virtual bool IsCommandIdChecked(int command_id) const;
+ virtual void ExecuteCommand(int command_id);
+ virtual bool GetAcceleratorForCommandId(int command_id,
+ menus::Accelerator* accelerator);
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Overriden from ActiveWindowWatcher::Observer.
+ virtual void ActiveWindowChanged(GdkWindow* active_window);
+
+ // Pointers to the browser window that owns us and it's GtkWindow.
+ BrowserWindowGtk* browser_window_;
+ GtkWindow* window_;
+
+ // The container widget the holds the hbox which contains the whole titlebar.
+ GtkWidget* container_;
+
+ // The hbox that contains the whole titlebar.
+ GtkWidget* container_hbox_;
+
+ // VBoxes that holds the min/max/close buttons box and an optional padding
+ // that defines the skyline if the user turns off window manager decorations.
+ // There is a left and right version of this box since we try to integrate
+ // with the recent Ubuntu theme changes which put the buttons on the left.
+ GtkWidget* titlebar_left_buttons_vbox_;
+ GtkWidget* titlebar_right_buttons_vbox_;
+
+ // HBoxes that contains the actual min/max/close buttons.
+ GtkWidget* titlebar_left_buttons_hbox_;
+ GtkWidget* titlebar_right_buttons_hbox_;
+
+ // Spy frame. One of these frames holds the spy guy in incognito mode. It's
+ // the side with the least buttons. These are NULL when we aren't in
+ // incognito mode.
+ GtkWidget* titlebar_left_spy_frame_;
+ GtkWidget* titlebar_right_spy_frame_;
+
+ // Padding between the titlebar buttons and the top of the screen. Only show
+ // when not maximized.
+ GtkWidget* top_padding_left_;
+ GtkWidget* top_padding_right_;
+
+ // Gtk alignment that contains the tab strip. If the user turns off window
+ // manager decorations, we draw this taller.
+ GtkWidget* titlebar_alignment_;
+
+ // The favicon and page title used when in app mode or popup mode.
+ GtkWidget* app_mode_favicon_;
+ GtkWidget* app_mode_title_;
+
+ // Whether we are using a custom frame.
+ bool using_custom_frame_;
+
+ // Whether we have focus (gtk_window_is_active() sometimes returns the wrong
+ // value, so manually track the focus-in and focus-out events.)
+ bool window_has_focus_;
+
+ // We change the size of these three buttons when the window is maximized, so
+ // we use these structs to keep track of their original size.
+ GtkRequisition close_button_req_;
+ GtkRequisition minimize_button_req_;
+ GtkRequisition restore_button_req_;
+
+ // Maximize and restore widgets in the titlebar.
+ scoped_ptr<CustomDrawButton> minimize_button_;
+ scoped_ptr<CustomDrawButton> maximize_button_;
+ scoped_ptr<CustomDrawButton> restore_button_;
+ scoped_ptr<CustomDrawButton> close_button_;
+
+ // The context menu view and model.
+ scoped_ptr<MenuGtk> context_menu_;
+ scoped_ptr<ContextMenuModel> context_menu_model_;
+
+ // The favicon menu view and model.
+ scoped_ptr<MenuGtk> favicon_menu_;
+ scoped_ptr<PopupPageMenuModel> favicon_menu_model_;
+
+ // The throbber used when the window is in app mode or popup window mode.
+ Throbber throbber_;
+
+ // Theme provider for building buttons.
+ GtkThemeProvider* theme_provider_;
+
+ NotificationRegistrar registrar_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_BROWSER_TITLEBAR_H_
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc
index ea8a1b5..ea8a1b5 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc
diff --git a/chrome/browser/ui/gtk/browser_toolbar_gtk.h b/chrome/browser/ui/gtk/browser_toolbar_gtk.h
new file mode 100644
index 0000000..f090119
--- /dev/null
+++ b/chrome/browser/ui/gtk/browser_toolbar_gtk.h
@@ -0,0 +1,219 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_BROWSER_TOOLBAR_GTK_H_
+#define CHROME_BROWSER_UI_GTK_BROWSER_TOOLBAR_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+#include <string>
+
+#include "app/active_window_watcher_x.h"
+#include "app/gtk_signal.h"
+#include "app/gtk_signal_registrar.h"
+#include "app/menus/accelerator.h"
+#include "app/menus/simple_menu_model.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/command_updater.h"
+#include "chrome/browser/gtk/custom_button.h"
+#include "chrome/browser/gtk/menu_gtk.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/browser/ui/toolbar/wrench_menu_model.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+
+class BackForwardButtonGtk;
+class Browser;
+class BrowserActionsToolbarGtk;
+class BrowserWindowGtk;
+class CustomDrawButton;
+class GtkThemeProvider;
+class LocationBar;
+class LocationBarViewGtk;
+class Profile;
+class ReloadButtonGtk;
+class TabContents;
+class ToolbarModel;
+
+// View class that displays the GTK version of the toolbar and routes gtk
+// events back to the Browser.
+class BrowserToolbarGtk : public CommandUpdater::CommandObserver,
+ public menus::AcceleratorProvider,
+ public MenuGtk::Delegate,
+ public NotificationObserver {
+ public:
+ explicit BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window);
+ virtual ~BrowserToolbarGtk();
+
+ // Create the contents of the toolbar. |top_level_window| is the GtkWindow
+ // to which we attach our accelerators.
+ void Init(Profile* profile, GtkWindow* top_level_window);
+
+ // Set the various widgets' ViewIDs.
+ void SetViewIDs();
+
+ void Show();
+ void Hide();
+
+ // Getter for the containing widget.
+ GtkWidget* widget() {
+ return event_box_;
+ }
+
+ // Getter for associated browser object.
+ Browser* browser() {
+ return browser_;
+ }
+
+ virtual LocationBar* GetLocationBar() const;
+
+ ReloadButtonGtk* GetReloadButton() { return reload_.get(); }
+
+ GtkWidget* GetAppMenuButton() { return wrench_menu_button_->widget(); }
+
+ BrowserActionsToolbarGtk* GetBrowserActionsToolbar() {
+ return actions_toolbar_.get();
+ }
+
+ LocationBarViewGtk* GetLocationBarView() { return location_bar_.get(); }
+
+ // We have to show padding on the bottom of the toolbar when the bookmark
+ // is in floating mode. Otherwise the bookmark bar will paint it for us.
+ void UpdateForBookmarkBarVisibility(bool show_bottom_padding);
+
+ void ShowAppMenu();
+
+ // Overridden from CommandUpdater::CommandObserver:
+ virtual void EnabledStateChangedForCommand(int id, bool enabled);
+
+ // Overridden from MenuGtk::Delegate:
+ virtual void StoppedShowing();
+ virtual GtkIconSet* GetIconSetForId(int idr);
+ virtual bool AlwaysShowIconForCmd(int command_id) const;
+
+ // Overridden from menus::AcceleratorProvider:
+ virtual bool GetAcceleratorForCommandId(int id,
+ menus::Accelerator* accelerator);
+
+ // NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ Profile* profile() { return profile_; }
+ void SetProfile(Profile* profile);
+
+ // Message that we should react to a state change.
+ void UpdateTabContents(TabContents* contents, bool should_restore_state);
+
+ private:
+ // Connect/Disconnect signals for dragging a url onto the home button.
+ void SetUpDragForHomeButton(bool enable);
+
+ // Sets the top corners of the toolbar to rounded, or sets them to normal,
+ // depending on the state of the browser window. Returns false if no action
+ // was taken (the roundedness was already correct), true otherwise.
+ bool UpdateRoundedness();
+
+ // Gtk callback for the "expose-event" signal.
+ // The alignment contains the toolbar.
+ CHROMEGTK_CALLBACK_1(BrowserToolbarGtk, gboolean, OnAlignmentExpose,
+ GdkEventExpose*);
+ CHROMEGTK_CALLBACK_1(BrowserToolbarGtk, gboolean, OnLocationHboxExpose,
+ GdkEventExpose*);
+
+ // Gtk callback for the "clicked" signal.
+ CHROMEGTK_CALLBACK_0(BrowserToolbarGtk, void, OnButtonClick);
+
+ // Gtk callback to intercept mouse clicks to the menu buttons.
+ CHROMEGTK_CALLBACK_1(BrowserToolbarGtk, gboolean, OnMenuButtonPressEvent,
+ GdkEventButton*);
+
+ // Used for drags onto home button.
+ CHROMEGTK_CALLBACK_6(BrowserToolbarGtk, void, OnDragDataReceived,
+ GdkDragContext*, gint, gint, GtkSelectionData*,
+ guint, guint);
+
+ // Used to draw the upgrade notification badge.
+ CHROMEGTK_CALLBACK_1(BrowserToolbarGtk, gboolean, OnWrenchMenuButtonExpose,
+ GdkEventExpose*);
+
+ // Updates preference-dependent state.
+ void NotifyPrefChanged(const std::string* pref);
+
+ static void SetSyncMenuLabel(GtkWidget* widget, gpointer userdata);
+
+ // Sometimes we only want to show the location w/o the toolbar buttons (e.g.,
+ // in a popup window).
+ bool ShouldOnlyShowLocation() const;
+
+ // An event box that holds |toolbar_|. We need the toolbar to have its own
+ // GdkWindow when we use the GTK drawing because otherwise the color from our
+ // parent GdkWindow will leak through with some theme engines (such as
+ // Clearlooks).
+ GtkWidget* event_box_;
+
+ // This widget handles padding around the outside of the toolbar.
+ GtkWidget* alignment_;
+
+ // Gtk widgets. The toolbar is an hbox with each of the other pieces of the
+ // toolbar placed side by side.
+ GtkWidget* toolbar_;
+
+ // All widgets to the left or right of the |location_hbox_|. We put the
+ // widgets on either side of location_hbox_ in their own toolbar so we can
+ // set their minimum sizes independently of |location_hbox_| which needs to
+ // grow/shrink in GTK+ mode.
+ GtkWidget* toolbar_left_;
+
+ // Contains all the widgets of the location bar.
+ GtkWidget* location_hbox_;
+
+ // The location bar view.
+ scoped_ptr<LocationBarViewGtk> location_bar_;
+
+ // All the buttons in the toolbar.
+ scoped_ptr<BackForwardButtonGtk> back_, forward_;
+ scoped_ptr<CustomDrawButton> home_;
+ scoped_ptr<ReloadButtonGtk> reload_;
+ scoped_ptr<BrowserActionsToolbarGtk> actions_toolbar_;
+ scoped_ptr<CustomDrawButton> wrench_menu_button_;
+
+ // The image shown in GTK+ mode in the wrench button.
+ GtkWidget* wrench_menu_image_;
+
+ // The model that contains the security level, text, icon to display...
+ ToolbarModel* model_;
+
+ GtkThemeProvider* theme_provider_;
+
+ scoped_ptr<MenuGtk> wrench_menu_;
+
+ WrenchMenuModel wrench_menu_model_;
+
+ Browser* browser_;
+ BrowserWindowGtk* window_;
+ Profile* profile_;
+
+ // Controls whether or not a home button should be shown on the toolbar.
+ BooleanPrefMember show_home_button_;
+
+ // Preferences controlling the configured home page.
+ StringPrefMember home_page_;
+ BooleanPrefMember home_page_is_new_tab_page_;
+
+ NotificationRegistrar registrar_;
+
+ // A GtkEntry that isn't part of the hierarchy. We keep this for native
+ // rendering.
+ OwnedWidgetGtk offscreen_entry_;
+
+ // Manages the home button drop signal handler.
+ scoped_ptr<GtkSignalRegistrar> drop_handler_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserToolbarGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_BROWSER_TOOLBAR_GTK_H_
diff --git a/chrome/browser/gtk/browser_window_factory_gtk.cc b/chrome/browser/ui/gtk/browser_window_factory_gtk.cc
index 054a0df..d4dd62d 100644
--- a/chrome/browser/gtk/browser_window_factory_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_window_factory_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc
index c8499f8..c8499f8 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_window_gtk.cc
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.h b/chrome/browser/ui/gtk/browser_window_gtk.h
new file mode 100644
index 0000000..b14e65b
--- /dev/null
+++ b/chrome/browser/ui/gtk/browser_window_gtk.h
@@ -0,0 +1,496 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_BROWSER_WINDOW_GTK_H_
+#define CHROME_BROWSER_UI_GTK_BROWSER_WINDOW_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <map>
+
+#include "app/active_window_watcher_x.h"
+#include "app/gtk_signal.h"
+#include "app/x11_util.h"
+#include "base/scoped_ptr.h"
+#include "base/timer.h"
+#include "build/build_config.h"
+#include "chrome/browser/browser_window.h"
+#include "chrome/browser/gtk/infobar_arrow_model.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/browser/tabs/tab_strip_model_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "gfx/rect.h"
+
+class BookmarkBarGtk;
+class Browser;
+class BrowserTitlebar;
+class BrowserToolbarGtk;
+class CustomDrawButton;
+class DownloadShelfGtk;
+class FindBarGtk;
+class FullscreenExitBubbleGtk;
+class InfoBarContainerGtk;
+class LocationBar;
+class StatusBubbleGtk;
+class TabContentsContainerGtk;
+class TabStripGtk;
+
+// An implementation of BrowserWindow for GTK.
+// Cross-platform code will interact with this object when
+// it needs to manipulate the window.
+
+class BrowserWindowGtk : public BrowserWindow,
+ public NotificationObserver,
+ public TabStripModelObserver,
+ public ActiveWindowWatcherX::Observer,
+ public InfoBarArrowModel::Observer {
+ public:
+ explicit BrowserWindowGtk(Browser* browser);
+ virtual ~BrowserWindowGtk();
+
+ // Overridden from BrowserWindow
+ virtual void Show();
+ virtual void SetBounds(const gfx::Rect& bounds);
+ virtual void Close();
+ virtual void Activate();
+ virtual void Deactivate();
+ virtual bool IsActive() const;
+ virtual void FlashFrame();
+ virtual gfx::NativeWindow GetNativeHandle();
+ virtual BrowserWindowTesting* GetBrowserWindowTesting();
+ virtual StatusBubble* GetStatusBubble();
+ virtual void SelectedTabToolbarSizeChanged(bool is_animating);
+ virtual void UpdateTitleBar();
+ virtual void ShelfVisibilityChanged();
+ virtual void UpdateDevTools();
+ virtual void UpdateLoadingAnimations(bool should_animate);
+ virtual void SetStarredState(bool is_starred);
+ virtual gfx::Rect GetRestoredBounds() const;
+ virtual bool IsMaximized() const;
+ virtual void SetFullscreen(bool fullscreen);
+ virtual bool IsFullscreen() const;
+ virtual bool IsFullscreenBubbleVisible() const;
+ virtual LocationBar* GetLocationBar() const;
+ virtual void SetFocusToLocationBar(bool select_all);
+ virtual void UpdateReloadStopState(bool is_loading, bool force);
+ virtual void UpdateToolbar(TabContentsWrapper* contents,
+ bool should_restore_state);
+ virtual void FocusToolbar();
+ virtual void FocusAppMenu();
+ virtual void FocusBookmarksToolbar();
+ virtual void FocusChromeOSStatus();
+ virtual void RotatePaneFocus(bool forwards);
+ virtual bool IsBookmarkBarVisible() const;
+ virtual bool IsBookmarkBarAnimating() const;
+ virtual bool IsTabStripEditable() const;
+ virtual bool IsToolbarVisible() const;
+ virtual void ConfirmAddSearchProvider(const TemplateURL* template_url,
+ Profile* profile);
+ virtual void ToggleBookmarkBar();
+ virtual views::Window* ShowAboutChromeDialog();
+ virtual void ShowUpdateChromeDialog();
+ virtual void ShowTaskManager();
+ virtual void ShowBookmarkBubble(const GURL& url, bool already_bookmarked);
+ virtual bool IsDownloadShelfVisible() const;
+ virtual DownloadShelf* GetDownloadShelf();
+ virtual void ShowClearBrowsingDataDialog();
+ virtual void ShowImportDialog();
+ virtual void ShowSearchEnginesDialog();
+ virtual void ShowPasswordManager();
+ virtual void ShowRepostFormWarningDialog(TabContents* tab_contents);
+ virtual void ShowContentSettingsWindow(ContentSettingsType content_type,
+ Profile* profile);
+ virtual void ShowCollectedCookiesDialog(TabContents* tab_contents);
+ virtual void ShowProfileErrorDialog(int message_id);
+ virtual void ShowThemeInstallBubble();
+ virtual void ConfirmBrowserCloseWithPendingDownloads();
+ virtual void ShowHTMLDialog(HtmlDialogUIDelegate* delegate,
+ gfx::NativeWindow parent_window);
+ virtual void UserChangedTheme();
+ virtual int GetExtraRenderViewHeight() const;
+ virtual void TabContentsFocused(TabContents* tab_contents);
+ virtual void ShowPageInfo(Profile* profile,
+ const GURL& url,
+ const NavigationEntry::SSLStatus& ssl,
+ bool show_history);
+ virtual void ShowAppMenu();
+ virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
+ bool* is_keyboard_shortcut);
+ virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event);
+ virtual void ShowCreateWebAppShortcutsDialog(TabContents* tab_contents);
+ virtual void ShowCreateChromeAppShortcutsDialog(Profile* profile,
+ const Extension* app);
+ virtual void Cut();
+ virtual void Copy();
+ virtual void Paste();
+ virtual void ToggleTabStripMode() {}
+ virtual void PrepareForInstant();
+ virtual void ShowInstant(TabContents* preview_contents);
+ virtual void HideInstant(bool instant_is_active);
+ virtual gfx::Rect GetInstantBounds();
+
+ virtual gfx::Rect GrabWindowSnapshot(
+ std::vector<unsigned char>* png_representation);
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Overridden from TabStripModelObserver:
+ virtual void TabDetachedAt(TabContentsWrapper* contents, int index);
+ virtual void TabSelectedAt(TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
+ int index,
+ bool user_gesture);
+
+ // Overridden from ActiveWindowWatcher::Observer.
+ virtual void ActiveWindowChanged(GdkWindow* active_window);
+
+ // Overridden from InfoBarArrowModel::Observer.
+ virtual void PaintStateChanged();
+
+ // Accessor for the tab strip.
+ TabStripGtk* tabstrip() const { return tabstrip_.get(); }
+
+ void UpdateDevToolsForContents(TabContents* contents);
+
+ void OnBoundsChanged(const gfx::Rect& bounds);
+ void OnDebouncedBoundsChanged();
+ void OnStateChanged(GdkWindowState state, GdkWindowState changed_mask);
+
+ // Request the underlying window to unmaximize. Also tries to work around
+ // a window manager "feature" that can prevent this in some edge cases.
+ void UnMaximize();
+
+ // Returns false if we're not ready to close yet. E.g., a tab may have an
+ // onbeforeunload handler that prevents us from closing.
+ bool CanClose() const;
+
+ bool ShouldShowWindowIcon() const;
+
+ // Add the find bar widget to the window hierarchy.
+ void AddFindBar(FindBarGtk* findbar);
+
+ // Reset the mouse cursor to the default cursor if it was set to something
+ // else for the custom frame.
+ void ResetCustomFrameCursor();
+
+ // Toggles whether an infobar is showing.
+ // |animate| controls whether we animate to the new state set by |bar|.
+ void SetInfoBarShowing(InfoBar* bar, bool animate);
+
+ // Returns the BrowserWindowGtk registered with |window|.
+ static BrowserWindowGtk* GetBrowserWindowForNativeWindow(
+ gfx::NativeWindow window);
+
+ // Retrieves the GtkWindow associated with |xid|, which is the X Window
+ // ID of the top-level X window of this object.
+ static GtkWindow* GetBrowserWindowForXID(XID xid);
+
+ Browser* browser() const { return browser_.get(); }
+
+ GtkWindow* window() const { return window_; }
+
+ BrowserToolbarGtk* GetToolbar() { return toolbar_.get(); }
+
+ gfx::Rect bounds() const { return bounds_; }
+
+ // Make changes necessary when the floating state of the bookmark bar changes.
+ // This should only be called by the bookmark bar itself.
+ void BookmarkBarIsFloating(bool is_floating);
+
+ // Returns the tab contents we're currently displaying in the tab contents
+ // container.
+ TabContents* GetDisplayedTabContents();
+
+ static void RegisterUserPrefs(PrefService* prefs);
+
+ // Returns whether to draw the content drop shadow on the sides and bottom
+ // of the browser window. When false, we still draw a shadow on the top of
+ // the toolbar (under the tab strip), but do not round the top corners.
+ bool ShouldDrawContentDropShadow();
+
+ // Tells GTK that the toolbar area is invalidated and needs redrawing. We
+ // have this method as a hack because GTK doesn't queue the toolbar area for
+ // redraw when it should.
+ void QueueToolbarRedraw();
+
+ // Get the position where the infobar arrow should be anchored in
+ // |relative_to| coordinates. This is the middle of the omnibox location icon.
+ int GetXPositionOfLocationIcon(GtkWidget* relative_to);
+
+ protected:
+ virtual void DestroyBrowser();
+ // Top level window.
+ GtkWindow* window_;
+ // GtkAlignment that holds the interior components of the chromium window.
+ // This is used to draw the custom frame border and content shadow.
+ GtkWidget* window_container_;
+ // VBox that holds everything (tabs, toolbar, bookmarks bar, tab contents).
+ GtkWidget* window_vbox_;
+ // VBox that holds everything below the toolbar.
+ GtkWidget* render_area_vbox_;
+ // Floating container that holds the render area. It is needed to position
+ // the findbar.
+ GtkWidget* render_area_floating_container_;
+ // EventBox that holds render_area_floating_container_.
+ GtkWidget* render_area_event_box_;
+ // Border between toolbar and render area.
+ GtkWidget* toolbar_border_;
+
+ scoped_ptr<Browser> browser_;
+
+ // The download shelf view (view at the bottom of the page).
+ scoped_ptr<DownloadShelfGtk> download_shelf_;
+
+ private:
+ // Show or hide the bookmark bar.
+ void MaybeShowBookmarkBar(bool animate);
+
+ // Sets the default size for the window and the the way the user is allowed to
+ // resize it.
+ void SetGeometryHints();
+
+ // Connect to signals on |window_|.
+ void ConnectHandlersToSignals();
+
+ // Create the various UI components.
+ void InitWidgets();
+
+ // Set up background color of the window (depends on if we're incognito or
+ // not).
+ void SetBackgroundColor();
+
+ // Called when the window size changed.
+ void OnSizeChanged(int width, int height);
+
+ // Applies the window shape to if we're in custom drawing mode.
+ void UpdateWindowShape(int width, int height);
+
+ // Connect accelerators that aren't connected to menu items (like ctrl-o,
+ // ctrl-l, etc.).
+ void ConnectAccelerators();
+
+ // Change whether we're showing the custom blue frame.
+ // Must be called once at startup.
+ // Triggers relayout of the content.
+ void UpdateCustomFrame();
+
+ // Save the window position in the prefs.
+ void SaveWindowPosition();
+
+ // Set the bounds of the current window. If |exterior| is true, set the size
+ // of the window itself, otherwise set the bounds of the web contents.
+ // If |move| is true, set the position of the window, otherwise leave the
+ // position to the WM.
+ void SetBoundsImpl(const gfx::Rect& bounds, bool exterior, bool move);
+
+ // Callback for when the custom frame alignment needs to be redrawn.
+ // The content area includes the toolbar and web page but not the tab strip.
+ CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnCustomFrameExpose,
+ GdkEventExpose*);
+
+ // A helper method that draws the shadow above the toolbar and in the frame
+ // border during an expose.
+ void DrawContentShadow(cairo_t* cr);
+
+ // Draws the tab image as the frame so we can write legible text.
+ void DrawPopupFrame(cairo_t* cr, GtkWidget* widget, GdkEventExpose* event);
+
+ // Draws the normal custom frame using theme_frame.
+ void DrawCustomFrame(cairo_t* cr, GtkWidget* widget, GdkEventExpose* event);
+
+ // The background frame image needs to be offset by the size of the top of
+ // the window to the top of the tabs when the full skyline isn't displayed
+ // for some reason.
+ int GetVerticalOffset();
+
+ // Returns which frame image we should use based on the window's current
+ // activation state / incognito state.
+ int GetThemeFrameResource();
+
+ // Invalidate all the widgets that need to redraw when the infobar draw state
+ // has changed.
+ void InvalidateInfoBarBits();
+
+ // When the location icon moves, we have to redraw the arrow.
+ CHROMEGTK_CALLBACK_1(BrowserWindowGtk, void, OnLocationIconSizeAllocate,
+ GtkAllocation*);
+
+ // Used to draw the infobar arrow and drop shadow. This is connected to
+ // multiple widgets' expose events because it overlaps several widgets.
+ CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnExposeDrawInfobarBits,
+ GdkEventExpose*);
+
+ // Used to draw the infobar bits for the bookmark bar. When the bookmark
+ // bar is in floating mode, it has to draw a drop shadow only; otherwise
+ // it is responsible for its portion of the arrow as well as some shadowing.
+ CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnBookmarkBarExpose,
+ GdkEventExpose*);
+
+ // Callback for "size-allocate" signal on bookmark bar; this is relevant
+ // because when the bookmark bar changes dimensions, the infobar arrow has to
+ // change its shape, and we need to queue appropriate redraws.
+ CHROMEGTK_CALLBACK_1(BrowserWindowGtk, void, OnBookmarkBarSizeAllocate,
+ GtkAllocation*);
+
+ // Callback for accelerator activation. |user_data| stores the command id
+ // of the matched accelerator.
+ static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group,
+ GObject* acceleratable,
+ guint keyval,
+ GdkModifierType modifier,
+ void* user_data);
+
+ // Key press event callback.
+ CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnKeyPress, GdkEventKey*);
+
+ // Mouse move and mouse button press callbacks.
+ CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnMouseMoveEvent,
+ GdkEventMotion*);
+ CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnButtonPressEvent,
+ GdkEventButton*);
+
+ // Maps and Unmaps the xid of |widget| to |window|.
+ static void MainWindowMapped(GtkWidget* widget);
+ static void MainWindowUnMapped(GtkWidget* widget);
+
+ // Tracks focus state of browser.
+ CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnFocusIn,
+ GdkEventFocus*);
+ CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnFocusOut,
+ GdkEventFocus*);
+
+ // Callback for the loading animation(s) associated with this window.
+ void LoadingAnimationCallback();
+
+ // Shows UI elements for supported window features.
+ void ShowSupportedWindowFeatures();
+
+ // Hides UI elements for unsupported window features.
+ void HideUnsupportedWindowFeatures();
+
+ // Helper functions that query |browser_| concerning support for UI features
+ // in this window. (For example, a popup window might not support a tabstrip).
+ bool IsTabStripSupported() const;
+ bool IsToolbarSupported() const;
+ bool IsBookmarkBarSupported() const;
+
+ // Whether we should draw the tab background instead of the theme_frame
+ // background because this window is a popup.
+ bool UsingCustomPopupFrame() const;
+
+ // Checks to see if the mouse pointer at |x|, |y| is over the border of the
+ // custom frame (a spot that should trigger a window resize). Returns true if
+ // it should and sets |edge|.
+ bool GetWindowEdge(int x, int y, GdkWindowEdge* edge);
+
+ // Returns |true| if we should use the custom frame.
+ bool UseCustomFrame();
+
+ // Returns |true| if the window bounds match the monitor size.
+ bool BoundsMatchMonitorSize();
+
+ // Put the bookmark bar where it belongs.
+ void PlaceBookmarkBar(bool is_floating);
+
+ // Determine whether we use should default to native decorations or the custom
+ // frame based on the currently-running window manager.
+ static bool GetCustomFramePrefDefault();
+
+ NotificationRegistrar registrar_;
+
+ // The position and size of the current window.
+ gfx::Rect bounds_;
+
+ // The position and size of the non-maximized, non-fullscreen window.
+ gfx::Rect restored_bounds_;
+
+ GdkWindowState state_;
+
+ // The container for the titlebar + tab strip.
+ scoped_ptr<BrowserTitlebar> titlebar_;
+
+ // The object that manages all of the widgets in the toolbar.
+ scoped_ptr<BrowserToolbarGtk> toolbar_;
+
+ // The object that manages the bookmark bar. This will be NULL if the
+ // bookmark bar is not supported.
+ scoped_ptr<BookmarkBarGtk> bookmark_bar_;
+
+ // Caches the hover state of the bookmark bar.
+ bool bookmark_bar_is_floating_;
+
+ // The status bubble manager. Always non-NULL.
+ scoped_ptr<StatusBubbleGtk> status_bubble_;
+
+ // A container that manages the GtkWidget*s that are the webpage display
+ // (along with associated infobars, shelves, and other things that are part
+ // of the content area).
+ scoped_ptr<TabContentsContainerGtk> contents_container_;
+
+ // A container that manages the GtkWidget*s of developer tools for the
+ // selected tab contents.
+ scoped_ptr<TabContentsContainerGtk> devtools_container_;
+
+ // Split pane containing the contents_container_ and the devtools_container_.
+ GtkWidget* contents_split_;
+
+ // The tab strip. Always non-NULL.
+ scoped_ptr<TabStripGtk> tabstrip_;
+
+ // The container for info bars. Always non-NULL.
+ scoped_ptr<InfoBarContainerGtk> infobar_container_;
+
+ // The timer used to update frames for the Loading Animation.
+ base::RepeatingTimer<BrowserWindowGtk> loading_animation_timer_;
+
+ // The timer used to save the window position for session restore.
+ base::OneShotTimer<BrowserWindowGtk> window_configure_debounce_timer_;
+
+ // Whether the custom chrome frame pref is set. Normally you want to use
+ // UseCustomFrame() above to determine whether to use the custom frame or
+ // not.
+ BooleanPrefMember use_custom_frame_pref_;
+
+ // A map which translates an X Window ID into its respective GtkWindow.
+ static std::map<XID, GtkWindow*> xid_map_;
+
+ // The current window cursor. We set it to a resize cursor when over the
+ // custom frame border. We set it to NULL if we want the default cursor.
+ GdkCursor* frame_cursor_;
+
+ // True if the window manager thinks the window is active. Not all window
+ // managers keep track of this state (_NET_ACTIVE_WINDOW), in which case
+ // this will always be true.
+ bool is_active_;
+
+ // Keep track of the last click time and the last click position so we can
+ // filter out extra GDK_BUTTON_PRESS events when a double click happens.
+ guint32 last_click_time_;
+ gfx::Point last_click_position_;
+
+ // If true, maximize the window after we call BrowserWindow::Show for the
+ // first time. This is to work around a compiz bug.
+ bool maximize_after_show_;
+
+ // If true, don't call gdk_window_raise() when we get a click in the title
+ // bar or window border. This is to work around a compiz bug.
+ bool suppress_window_raise_;
+
+ // The accelerator group used to handle accelerators, owned by this object.
+ GtkAccelGroup* accel_group_;
+
+ scoped_ptr<FullscreenExitBubbleGtk> fullscreen_exit_bubble_;
+
+ // The model that tracks the paint state of the arrow for the infobar
+ // directly below the toolbar.
+ InfoBarArrowModel infobar_arrow_model_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserWindowGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_BROWSER_WINDOW_GTK_H_
diff --git a/chrome/browser/gtk/cairo_cached_surface.cc b/chrome/browser/ui/gtk/cairo_cached_surface.cc
index bb5ae41..e7ea7d0 100644
--- a/chrome/browser/gtk/cairo_cached_surface.cc
+++ b/chrome/browser/ui/gtk/cairo_cached_surface.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/cairo_cached_surface.h b/chrome/browser/ui/gtk/cairo_cached_surface.h
new file mode 100644
index 0000000..da7fe67
--- /dev/null
+++ b/chrome/browser/ui/gtk/cairo_cached_surface.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_CAIRO_CACHED_SURFACE_H_
+#define CHROME_BROWSER_UI_GTK_CAIRO_CACHED_SURFACE_H_
+#pragma once
+
+typedef struct _GdkPixbuf GdkPixbuf;
+typedef struct _cairo cairo_t;
+typedef struct _cairo_surface cairo_surface_t;
+
+// A helper class that takes a GdkPixbuf* and renders it to the screen. Unlike
+// gdk_cairo_set_source_pixbuf(), CairoCachedSurface assumes that the pixbuf is
+// immutable after UsePixbuf() is called and can be sent to the X server
+// once. From then on, that cached version is used so we don't upload the same
+// image each and every time we expose.
+//
+// Most cached surfaces are owned by the GtkThemeProvider, which associates
+// them with a certain XDisplay. Some users of surfaces (CustomDrawButtonBase,
+// for example) own their surfaces instead since they interact with the
+// ResourceBundle instead of the GtkThemeProvider.
+class CairoCachedSurface {
+ public:
+ CairoCachedSurface();
+ ~CairoCachedSurface();
+
+ // Whether this CairoCachedSurface owns a GdkPixbuf.
+ bool valid() const {
+ return pixbuf_;
+ }
+
+ // The dimensions of the underlying pixbuf/surface. (or -1 if invalid.)
+ int Width() const;
+ int Height() const;
+
+ // Sets the pixbuf that we pass to cairo. Calling UsePixbuf() only derefs the
+ // current pixbuf and surface (if they exist). Actually transfering data to
+ // the X server occurs at SetSource() time. Calling UsePixbuf() should only
+ // be done once as it clears cached data from the X server.
+ void UsePixbuf(GdkPixbuf* pixbuf);
+
+ // Sets our pixbuf as the active surface starting at (x, y), uploading it in
+ // case we don't have an X backed surface cached.
+ void SetSource(cairo_t* cr, int x, int y);
+
+ // Raw access to the pixbuf. May be NULL. Used for a few gdk operations
+ // regarding window shaping.
+ GdkPixbuf* pixbuf() { return pixbuf_; }
+
+ private:
+ // The source pixbuf.
+ GdkPixbuf* pixbuf_;
+
+ // Our cached surface. This should be a xlib surface so the data lives on the
+ // server instead of on the client.
+ cairo_surface_t* surface_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_CAIRO_CACHED_SURFACE_H_
diff --git a/chrome/browser/gtk/certificate_dialogs.cc b/chrome/browser/ui/gtk/certificate_dialogs.cc
index 8709bb4..9ef32d9 100644
--- a/chrome/browser/gtk/certificate_dialogs.cc
+++ b/chrome/browser/ui/gtk/certificate_dialogs.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/certificate_dialogs.h b/chrome/browser/ui/gtk/certificate_dialogs.h
new file mode 100644
index 0000000..656a283
--- /dev/null
+++ b/chrome/browser/ui/gtk/certificate_dialogs.h
@@ -0,0 +1,21 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_CERTIFICATE_DIALOGS_H_
+#define CHROME_BROWSER_UI_GTK_CERTIFICATE_DIALOGS_H_
+#pragma once
+
+#include "chrome/browser/shell_dialogs.h"
+#include "net/base/x509_certificate.h"
+
+void ShowCertSelectFileDialog(SelectFileDialog* select_file_dialog,
+ SelectFileDialog::Type type,
+ const FilePath& suggested_path,
+ gfx::NativeWindow parent,
+ void* params);
+
+void ShowCertExportDialog(gfx::NativeWindow parent,
+ net::X509Certificate::OSCertHandle cert);
+
+#endif // CHROME_BROWSER_UI_GTK_CERTIFICATE_DIALOGS_H_
diff --git a/chrome/browser/gtk/certificate_viewer.cc b/chrome/browser/ui/gtk/certificate_viewer.cc
index a79507d..1f92192 100644
--- a/chrome/browser/gtk/certificate_viewer.cc
+++ b/chrome/browser/ui/gtk/certificate_viewer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/certificate_viewer.h b/chrome/browser/ui/gtk/certificate_viewer.h
new file mode 100644
index 0000000..cbe2295
--- /dev/null
+++ b/chrome/browser/ui/gtk/certificate_viewer.h
@@ -0,0 +1,16 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_CERTIFICATE_VIEWER_H_
+#define CHROME_BROWSER_UI_GTK_CERTIFICATE_VIEWER_H_
+#pragma once
+
+#include "chrome/browser/certificate_viewer.h"
+#include "gfx/native_widget_types.h"
+#include "net/base/x509_certificate.h"
+
+void ShowCertificateViewer(gfx::NativeWindow parent,
+ net::X509Certificate::OSCertHandle);
+
+#endif // CHROME_BROWSER_UI_GTK_CERTIFICATE_VIEWER_H_
diff --git a/chrome/browser/gtk/chrome_gtk_frame.cc b/chrome/browser/ui/gtk/chrome_gtk_frame.cc
index 77f28d1..e2badee 100644
--- a/chrome/browser/gtk/chrome_gtk_frame.cc
+++ b/chrome/browser/ui/gtk/chrome_gtk_frame.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/chrome_gtk_frame.h b/chrome/browser/ui/gtk/chrome_gtk_frame.h
new file mode 100644
index 0000000..bbcb2fa
--- /dev/null
+++ b/chrome/browser/ui/gtk/chrome_gtk_frame.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_CHROME_GTK_FRAME_H_
+#define CHROME_BROWSER_UI_GTK_CHROME_GTK_FRAME_H_
+#pragma once
+
+#include <gdk/gdk.h>
+#include <gtk/gtkwindow.h>
+
+G_BEGIN_DECLS
+
+// This file declares two subclasses of GtkWindow for easier gtk+ theme
+// integration.
+//
+// The first is "MetaFrames," which is (was?) the name of a gobject class in
+// the metacity window manager. To actually get at those values, we need to
+// have an object whose gobject class name string matches the definitions in
+// the gtkrc file. MetaFrames derives from GtkWindow.
+//
+// Metaframes can not be instantiated. It has no constructor; instantiate
+// ChromeGtkFrame instead.
+typedef struct _MetaFrames MetaFrames;
+typedef struct _MetaFramesClass MetaFramesClass;
+
+struct _MetaFrames {
+ GtkWindow window;
+};
+
+struct _MetaFramesClass {
+ GtkWindowClass parent_class;
+};
+
+
+// The second is ChromeGtkFrame, which defines a number of optional style
+// properties so theme authors can control how chromium appears in gtk-theme
+// mode. It derives from MetaFrames in chrome so older themes that declare a
+// MetaFrames theme will still work. New themes should target this class.
+typedef struct _ChromeGtkFrame ChromeGtkFrame;
+typedef struct _ChromeGtkFrameClass ChromeGtkFrameClass;
+
+struct _ChromeGtkFrame {
+ MetaFrames frames;
+};
+
+struct _ChromeGtkFrameClass {
+ MetaFramesClass frames_class;
+};
+
+// Creates a GtkWindow object the the class name "ChromeGtkFrame".
+GtkWidget* chrome_gtk_frame_new();
+
+G_END_DECLS
+
+#endif // CHROME_BROWSER_UI_GTK_CHROME_GTK_FRAME_H_
diff --git a/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc b/chrome/browser/ui/gtk/clear_browsing_data_dialog_gtk.cc
index cae4b37..862fd19 100644
--- a/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/clear_browsing_data_dialog_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/clear_browsing_data_dialog_gtk.h b/chrome/browser/ui/gtk/clear_browsing_data_dialog_gtk.h
new file mode 100644
index 0000000..5ae0d81
--- /dev/null
+++ b/chrome/browser/ui/gtk/clear_browsing_data_dialog_gtk.h
@@ -0,0 +1,70 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_CLEAR_BROWSING_DATA_DIALOG_GTK_H_
+#define CHROME_BROWSER_UI_GTK_CLEAR_BROWSING_DATA_DIALOG_GTK_H_
+#pragma once
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+
+typedef struct _GtkWidget GtkWidget;
+typedef struct _GtkWindow GtkWindow;
+
+class AccessibleWidgetHelper;
+class BrowsingDataRemover;
+class Profile;
+
+class ClearBrowsingDataDialogGtk {
+ public:
+ // Displays the dialog box to clear browsing data from |profile|.
+ static void Show(GtkWindow* parent, Profile* profile);
+
+ private:
+ ClearBrowsingDataDialogGtk(GtkWindow* parent, Profile* profile);
+ ~ClearBrowsingDataDialogGtk();
+
+ // Handler to respond to Ok and Cancel responses from the dialog.
+ CHROMEGTK_CALLBACK_1(ClearBrowsingDataDialogGtk, void, OnDialogResponse, int);
+
+ // Handler to respond to widget clicked actions from the dialog.
+ CHROMEGTK_CALLBACK_0(ClearBrowsingDataDialogGtk, void, OnDialogWidgetClicked);
+
+ CHROMEGTK_CALLBACK_0(ClearBrowsingDataDialogGtk, void, OnFlashLinkClicked);
+
+ // Enable or disable the dialog buttons depending on the state of the
+ // checkboxes.
+ void UpdateDialogButtons();
+
+ // Create a bitmask from the checkboxes of the dialog.
+ int GetCheckedItems();
+
+ // The dialog window.
+ GtkWidget* dialog_;
+
+ // UI elements.
+ GtkWidget* del_history_checkbox_;
+ GtkWidget* del_downloads_checkbox_;
+ GtkWidget* del_cache_checkbox_;
+ GtkWidget* del_cookies_checkbox_;
+ GtkWidget* del_passwords_checkbox_;
+ GtkWidget* del_form_data_checkbox_;
+ GtkWidget* time_period_combobox_;
+
+ // Our current profile.
+ Profile* profile_;
+
+ // If non-null it means removal is in progress. BrowsingDataRemover takes care
+ // of deleting itself when done.
+ BrowsingDataRemover* remover_;
+
+ // Helper object to manage accessibility metadata.
+ scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClearBrowsingDataDialogGtk);
+};
+
+
+#endif // CHROME_BROWSER_UI_GTK_CLEAR_BROWSING_DATA_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/collected_cookies_gtk.cc b/chrome/browser/ui/gtk/collected_cookies_gtk.cc
index a64f19e..9eb3580 100644
--- a/chrome/browser/gtk/collected_cookies_gtk.cc
+++ b/chrome/browser/ui/gtk/collected_cookies_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/collected_cookies_gtk.h b/chrome/browser/ui/gtk/collected_cookies_gtk.h
new file mode 100644
index 0000000..2e55ec1
--- /dev/null
+++ b/chrome/browser/ui/gtk/collected_cookies_gtk.h
@@ -0,0 +1,108 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This is the Gtk implementation of the collected Cookies dialog.
+
+#ifndef CHROME_BROWSER_UI_GTK_COLLECTED_COOKIES_GTK_H_
+#define CHROME_BROWSER_UI_GTK_COLLECTED_COOKIES_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/gtk/constrained_window_gtk.h"
+#include "chrome/browser/gtk/gtk_tree.h"
+#include "chrome/common/content_settings.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+
+class CookiesTreeModel;
+
+// CollectedCookiesGtk is a dialog that displays the allowed and blocked
+// cookies of the current tab contents. To display the dialog, invoke
+// ShowCollectedCookiesDialog() on the delegate of the tab contents.
+
+class CollectedCookiesGtk : public ConstrainedDialogDelegate,
+ gtk_tree::TreeAdapter::Delegate,
+ NotificationObserver {
+ public:
+ CollectedCookiesGtk(GtkWindow* parent, TabContents* tab_contents);
+
+ // ConstrainedDialogDelegate methods.
+ virtual GtkWidget* GetWidgetRoot();
+ virtual void DeleteDelegate();
+
+ private:
+ virtual ~CollectedCookiesGtk();
+
+ // Initialize all widgets of this dialog.
+ void Init();
+
+ // True if the selection contains at least one origin node.
+ bool SelectionContainsOriginNode(GtkTreeSelection* selection,
+ gtk_tree::TreeAdapter* adapter);
+
+ // Enable the allow/block buttons if at least one origin node is selected.
+ void EnableControls();
+
+ // Add exceptions for all origin nodes within the selection.
+ void AddExceptions(GtkTreeSelection* selection,
+ gtk_tree::TreeAdapter* adapter,
+ ContentSetting setting);
+
+ // Notification Observer implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Callbacks.
+ CHROMEGTK_CALLBACK_2(CollectedCookiesGtk, void, OnTreeViewRowExpanded,
+ GtkTreeIter*, GtkTreePath*);
+ CHROMEGTK_CALLBACK_0(CollectedCookiesGtk, void, OnTreeViewSelectionChange);
+ CHROMEGTK_CALLBACK_0(CollectedCookiesGtk, void, OnClose);
+ CHROMEGTK_CALLBACK_0(CollectedCookiesGtk, void, OnBlockAllowedButtonClicked);
+ CHROMEGTK_CALLBACK_0(CollectedCookiesGtk, void, OnAllowBlockedButtonClicked);
+ CHROMEGTK_CALLBACK_0(CollectedCookiesGtk, void,
+ OnForSessionBlockedButtonClicked);
+
+ NotificationRegistrar registrar_;
+
+ ConstrainedWindow* window_;
+
+ // Widgets of the dialog.
+ GtkWidget* dialog_;
+
+ GtkWidget* allowed_description_label_;
+ GtkWidget* blocked_description_label_;
+
+ GtkWidget* block_allowed_cookie_button_;
+
+ GtkWidget* allow_blocked_cookie_button_;
+ GtkWidget* for_session_blocked_cookie_button_;
+
+ // The table listing the cookies.
+ GtkWidget* allowed_tree_;
+ GtkWidget* blocked_tree_;
+
+ GtkTreeSelection* allowed_selection_;
+ GtkTreeSelection* blocked_selection_;
+
+ // The infobar widget.
+ GtkWidget* infobar_;
+ GtkWidget* infobar_label_;
+
+ // The tab contents.
+ TabContents* tab_contents_;
+
+ // The Cookies Table model.
+ scoped_ptr<CookiesTreeModel> allowed_cookies_tree_model_;
+ scoped_ptr<CookiesTreeModel> blocked_cookies_tree_model_;
+ scoped_ptr<gtk_tree::TreeAdapter> allowed_cookies_tree_adapter_;
+ scoped_ptr<gtk_tree::TreeAdapter> blocked_cookies_tree_adapter_;
+
+ DISALLOW_COPY_AND_ASSIGN(CollectedCookiesGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_COLLECTED_COOKIES_GTK_H_
diff --git a/chrome/browser/gtk/constrained_html_delegate_gtk.cc b/chrome/browser/ui/gtk/constrained_html_delegate_gtk.cc
index d55393f..ac0184d 100644
--- a/chrome/browser/gtk/constrained_html_delegate_gtk.cc
+++ b/chrome/browser/ui/gtk/constrained_html_delegate_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/constrained_window_gtk.cc b/chrome/browser/ui/gtk/constrained_window_gtk.cc
index 195fb17..173dd08 100644
--- a/chrome/browser/gtk/constrained_window_gtk.cc
+++ b/chrome/browser/ui/gtk/constrained_window_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/constrained_window_gtk.h b/chrome/browser/ui/gtk/constrained_window_gtk.h
new file mode 100644
index 0000000..d5e768b
--- /dev/null
+++ b/chrome/browser/ui/gtk/constrained_window_gtk.h
@@ -0,0 +1,93 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_CONSTRAINED_WINDOW_GTK_H_
+#define CHROME_BROWSER_UI_GTK_CONSTRAINED_WINDOW_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/task.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/browser/tab_contents/constrained_window.h"
+
+class TabContents;
+typedef struct _GdkColor GdkColor;
+#if defined(TOUCH_UI)
+class TabContentsViewViews;
+#else
+class TabContentsViewGtk;
+#endif
+
+class ConstrainedWindowGtkDelegate {
+ public:
+ // Returns the widget that will be put in the constrained window's container.
+ virtual GtkWidget* GetWidgetRoot() = 0;
+
+ // Tells the delegate to either delete itself or set up a task to delete
+ // itself later.
+ virtual void DeleteDelegate() = 0;
+
+ virtual bool GetBackgroundColor(GdkColor* color);
+
+ protected:
+ virtual ~ConstrainedWindowGtkDelegate();
+};
+
+// Constrained window implementation for the GTK port. Unlike the Win32 system,
+// ConstrainedWindowGtk doesn't draw draggable fake windows and instead just
+// centers the dialog. It is thus an order of magnitude simpler.
+class ConstrainedWindowGtk : public ConstrainedWindow {
+ public:
+#if defined(TOUCH_UI)
+ typedef TabContentsViewViews TabContentsViewType;
+#else
+ typedef TabContentsViewGtk TabContentsViewType;
+#endif
+
+ virtual ~ConstrainedWindowGtk();
+
+ // Overridden from ConstrainedWindow:
+ virtual void ShowConstrainedWindow();
+ virtual void CloseConstrainedWindow();
+
+ // Returns the TabContents that constrains this Constrained Window.
+ TabContents* owner() const { return owner_; }
+
+ // Returns the toplevel widget that displays this "window".
+ GtkWidget* widget() { return border_.get(); }
+
+ // Returns the View that we collaborate with to position ourselves.
+ TabContentsViewType* ContainingView();
+
+ private:
+ friend class ConstrainedWindow;
+
+ ConstrainedWindowGtk(TabContents* owner,
+ ConstrainedWindowGtkDelegate* delegate);
+
+ // Handler for Escape.
+ CHROMEGTK_CALLBACK_1(ConstrainedWindowGtk, gboolean, OnKeyPress,
+ GdkEventKey*);
+
+ // The TabContents that owns and constrains this ConstrainedWindow.
+ TabContents* owner_;
+
+ // The top level widget container that exports to our TabContentsView.
+ OwnedWidgetGtk border_;
+
+ // Delegate that provides the contents of this constrained window.
+ ConstrainedWindowGtkDelegate* delegate_;
+
+ // Stores if |ShowConstrainedWindow()| has been called.
+ bool visible_;
+
+ ScopedRunnableMethodFactory<ConstrainedWindowGtk> factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_CONSTRAINED_WINDOW_GTK_H_
diff --git a/chrome/browser/gtk/content_setting_bubble_gtk.cc b/chrome/browser/ui/gtk/content_setting_bubble_gtk.cc
index f8c36f0..c3ca05c 100644
--- a/chrome/browser/gtk/content_setting_bubble_gtk.cc
+++ b/chrome/browser/ui/gtk/content_setting_bubble_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/content_setting_bubble_gtk.h b/chrome/browser/ui/gtk/content_setting_bubble_gtk.h
new file mode 100644
index 0000000..654a867
--- /dev/null
+++ b/chrome/browser/ui/gtk/content_setting_bubble_gtk.h
@@ -0,0 +1,92 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_CONTENT_SETTING_BUBBLE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_CONTENT_SETTING_BUBBLE_GTK_H_
+#pragma once
+
+#include <map>
+
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/gtk/info_bubble_gtk.h"
+#include "chrome/common/content_settings_types.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+
+class ContentSettingBubbleModel;
+class Profile;
+class TabContents;
+
+// ContentSettingBubbleGtk is used when the user turns on different kinds of
+// content blocking (e.g. "block images"). An icon appears in the location bar,
+// and when clicked, an instance of this class is created specialized for the
+// type of content being blocked.
+class ContentSettingBubbleGtk : public InfoBubbleGtkDelegate,
+ public NotificationObserver {
+ public:
+ ContentSettingBubbleGtk(
+ GtkWidget* anchor,
+ InfoBubbleGtkDelegate* delegate,
+ ContentSettingBubbleModel* content_setting_bubble_model,
+ Profile* profile, TabContents* tab_contents);
+ virtual ~ContentSettingBubbleGtk();
+
+ // Dismisses the infobubble.
+ void Close();
+
+ private:
+ typedef std::map<GtkWidget*, int> PopupMap;
+
+ // InfoBubbleGtkDelegate:
+ virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble,
+ bool closed_by_escape);
+
+ // NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Builds the info bubble and all the widgets that it displays.
+ void BuildBubble();
+
+ // Widget callback methods.
+ CHROMEGTK_CALLBACK_1(ContentSettingBubbleGtk, void, OnPopupIconButtonPress,
+ GdkEventButton*);
+ CHROMEGTK_CALLBACK_0(ContentSettingBubbleGtk, void, OnPopupLinkClicked);
+ CHROMEGTK_CALLBACK_0(ContentSettingBubbleGtk, void, OnRadioToggled);
+ CHROMEGTK_CALLBACK_0(ContentSettingBubbleGtk, void, OnCustomLinkClicked);
+ CHROMEGTK_CALLBACK_0(ContentSettingBubbleGtk, void, OnManageLinkClicked);
+ CHROMEGTK_CALLBACK_0(ContentSettingBubbleGtk, void, OnCloseButtonClicked);
+
+ // We position the bubble near this widget.
+ GtkWidget* anchor_;
+
+ // The active profile.
+ Profile* profile_;
+
+ // The active tab contents.
+ TabContents* tab_contents_;
+
+ // A registrar for listening for TAB_CONTENTS_DESTROYED notifications.
+ NotificationRegistrar registrar_;
+
+ // Pass on delegate messages to this.
+ InfoBubbleGtkDelegate* delegate_;
+
+ // Provides data for this bubble.
+ scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model_;
+
+ // The info bubble.
+ InfoBubbleGtk* info_bubble_;
+
+ // Stored controls so we can figure out what was clicked.
+ PopupMap popup_links_;
+ PopupMap popup_icons_;
+
+ typedef std::vector<GtkWidget*> RadioGroupGtk;
+ RadioGroupGtk radio_group_gtk_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_CONTENT_SETTING_BUBBLE_GTK_H_
diff --git a/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc
index 2d6b44e..f13ab00 100644
--- a/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h
new file mode 100644
index 0000000..3fbbc8a
--- /dev/null
+++ b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h
@@ -0,0 +1,119 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_CREATE_APPLICATION_SHORTCUTS_DIALOG_GTK_H_
+#define CHROME_BROWSER_UI_GTK_CREATE_APPLICATION_SHORTCUTS_DIALOG_GTK_H_
+#pragma once
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/ref_counted.h"
+#include "chrome/browser/browser_thread.h"
+#include "chrome/browser/extensions/image_loading_tracker.h"
+#include "chrome/browser/shell_integration.h"
+#include "googleurl/src/gurl.h"
+
+typedef struct _GdkPixbuf GdkPixbuf;
+typedef struct _GtkWidget GtkWidget;
+typedef struct _GtkWindow GtkWindow;
+
+class Extension;
+class TabContents;
+
+class CreateApplicationShortcutsDialogGtk
+ : public base::RefCountedThreadSafe<CreateApplicationShortcutsDialogGtk,
+ BrowserThread::DeleteOnUIThread> {
+ protected:
+ explicit CreateApplicationShortcutsDialogGtk(GtkWindow* parent);
+ virtual ~CreateApplicationShortcutsDialogGtk();
+
+ CHROMEGTK_CALLBACK_1(CreateApplicationShortcutsDialogGtk, void,
+ OnCreateDialogResponse, int);
+
+ CHROMEGTK_CALLBACK_1(CreateApplicationShortcutsDialogGtk, void,
+ OnErrorDialogResponse, int);
+
+ CHROMEGTK_CALLBACK_0(CreateApplicationShortcutsDialogGtk, void,
+ OnToggleCheckbox);
+
+ virtual void CreateDialogBox(GtkWindow* parent);
+ virtual void CreateIconPixBuf(const SkBitmap& bitmap);
+
+ // This method is called after a shortcut is created.
+ // Subclasses can override it to take some action at that time.
+ virtual void OnCreatedShortcut(void) {}
+
+ void CreateDesktopShortcut(
+ const ShellIntegration::ShortcutInfo& shortcut_info);
+ void ShowErrorDialog();
+
+ GtkWindow* parent_;
+
+ // UI elements.
+ GtkWidget* desktop_checkbox_;
+ GtkWidget* menu_checkbox_;
+
+ // ShortcutInfo for the new shortcut.
+ ShellIntegration::ShortcutInfo shortcut_info_;
+
+ // Image associated with the site.
+ GdkPixbuf* favicon_pixbuf_;
+
+ // Dialog box that allows the user to create an application shortcut.
+ GtkWidget* create_dialog_;
+
+ // Dialog box that shows the error message.
+ GtkWidget* error_dialog_;
+
+ private:
+ friend class BrowserThread;
+ friend class DeleteTask<CreateApplicationShortcutsDialogGtk>;
+ DISALLOW_COPY_AND_ASSIGN(CreateApplicationShortcutsDialogGtk);
+};
+
+class CreateWebApplicationShortcutsDialogGtk
+ : public CreateApplicationShortcutsDialogGtk {
+ public:
+ // Displays the dialog box to create application shortcuts for |tab_contents|.
+ static void Show(GtkWindow* parent, TabContents* tab_contents);
+
+ explicit CreateWebApplicationShortcutsDialogGtk(GtkWindow* parent,
+ TabContents* tab_contents);
+ virtual ~CreateWebApplicationShortcutsDialogGtk() {}
+
+ virtual void OnCreatedShortcut(void);
+
+ private:
+
+ // TabContents for which the shortcut will be created.
+ TabContents* tab_contents_;
+
+ DISALLOW_COPY_AND_ASSIGN(CreateWebApplicationShortcutsDialogGtk);
+};
+
+class CreateChromeApplicationShortcutsDialogGtk
+ : public CreateApplicationShortcutsDialogGtk,
+ public ImageLoadingTracker::Observer {
+ public:
+ // Displays the dialog box to create application shortcuts for |app|.
+ static void Show(GtkWindow* parent, const Extension* app);
+
+ explicit CreateChromeApplicationShortcutsDialogGtk(GtkWindow* parent,
+ const Extension* app);
+ virtual ~CreateChromeApplicationShortcutsDialogGtk() {}
+
+ // Implement ImageLoadingTracker::Observer. |tracker_| is used to
+ // load the app's icon. This method recieves the icon, and adds
+ // it to the "Create Shortcut" dailog box.
+ virtual void OnImageLoaded(SkBitmap* image,
+ ExtensionResource resource,
+ int index);
+
+ private:
+ const Extension* app_;
+ ImageLoadingTracker tracker_;
+ DISALLOW_COPY_AND_ASSIGN(CreateChromeApplicationShortcutsDialogGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_CREATE_APPLICATION_SHORTCUTS_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/custom_button.cc b/chrome/browser/ui/gtk/custom_button.cc
index 375452d..31d1cf6 100644
--- a/chrome/browser/gtk/custom_button.cc
+++ b/chrome/browser/ui/gtk/custom_button.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/custom_button.h b/chrome/browser/ui/gtk/custom_button.h
new file mode 100644
index 0000000..8eaefa3
--- /dev/null
+++ b/chrome/browser/ui/gtk/custom_button.h
@@ -0,0 +1,227 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_
+#define CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "gfx/rect.h"
+#include "third_party/skia/include/core/SkColor.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
+
+class CairoCachedSurface;
+class GtkThemeProvider;
+class SkBitmap;
+
+// These classes implement two kinds of custom-drawn buttons. They're
+// used on the toolbar and the bookmarks bar.
+
+// CustomDrawButtonBase provides the base for building a custom drawn button.
+// It handles managing the pixbufs containing all the static images used to draw
+// the button. It also manages painting these pixbufs.
+class CustomDrawButtonBase : public NotificationObserver {
+ public:
+ // If the images come from ResourceBundle rather than the theme provider,
+ // pass in NULL for |theme_provider|.
+ CustomDrawButtonBase(GtkThemeProvider* theme_provider,
+ int normal_id,
+ int pressed_id,
+ int hover_id,
+ int disabled_id);
+
+ ~CustomDrawButtonBase();
+
+ // Flip the image horizontally. Not to be used for RTL/LTR reasons. (In RTL
+ // mode, this will unflip the image.)
+ void set_flipped(bool flipped) { flipped_ = flipped; }
+
+ // Returns the dimensions of the first surface.
+ int Width() const;
+ int Height() const;
+
+ gboolean OnExpose(GtkWidget* widget, GdkEventExpose* e, gdouble hover_state);
+
+ void set_paint_override(int state) { paint_override_ = state; }
+ int paint_override() const { return paint_override_; }
+
+ // Set the background details.
+ void SetBackground(SkColor color, SkBitmap* image, SkBitmap* mask);
+
+ // Provide NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ private:
+ // Get the CairoCachedSurface from |surfaces_| for |state|.
+ CairoCachedSurface* PixbufForState(int state);
+
+ // We store one surface for each possible state of the button;
+ // INSENSITIVE is the last available state;
+ scoped_ptr<CairoCachedSurface> surfaces_[GTK_STATE_INSENSITIVE + 1];
+
+ // The background image.
+ scoped_ptr<CairoCachedSurface> background_image_;
+
+ // If non-negative, the state to paint the button.
+ int paint_override_;
+
+ // We need to remember the image ids that the user passes in and the theme
+ // provider so we can reload images if the user changes theme.
+ int normal_id_;
+ int pressed_id_;
+ int hover_id_;
+ int disabled_id_;
+ GtkThemeProvider* theme_provider_;
+
+ // Whether the button is flipped horizontally. Not used for RTL (we get
+ // flipped versions from the theme provider). Used for the flipped window
+ // buttons.
+ bool flipped_;
+
+ // Used to listen for theme change notifications.
+ NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(CustomDrawButtonBase);
+};
+
+// CustomDrawHoverController is a convenience class that eases the common task
+// of controlling the hover state of a button. The "hover state" refers to the
+// percent opacity of a button's PRELIGHT. The PRELIGHT is animated such that
+// when a user moves a mouse over a button the PRELIGHT fades in.
+class CustomDrawHoverController : public ui::AnimationDelegate {
+ public:
+ explicit CustomDrawHoverController(GtkWidget* widget);
+ CustomDrawHoverController();
+
+ virtual ~CustomDrawHoverController();
+
+ void Init(GtkWidget* widget);
+
+ double GetCurrentValue() {
+ return slide_animation_.GetCurrentValue();
+ }
+
+ private:
+ virtual void AnimationProgressed(const ui::Animation* animation);
+
+ CHROMEGTK_CALLBACK_1(CustomDrawHoverController, gboolean, OnEnter,
+ GdkEventCrossing*);
+ CHROMEGTK_CALLBACK_1(CustomDrawHoverController, gboolean, OnLeave,
+ GdkEventCrossing*);
+
+ ui::SlideAnimation slide_animation_;
+ GtkWidget* widget_;
+};
+
+// CustomDrawButton is a plain button where all its various states are drawn
+// with static images. In GTK rendering mode, it will show the standard button
+// with GTK |stock_id|.
+class CustomDrawButton : public NotificationObserver {
+ public:
+ // The constructor takes 4 resource ids. If a resource doesn't exist for a
+ // button, pass in 0.
+ CustomDrawButton(int normal_id,
+ int pressed_id,
+ int hover_id,
+ int disabled_id);
+
+ // Same as above, but uses themed (and possibly tinted) images. |stock_id| and
+ // |stock_size| are used for GTK+ theme mode.
+ CustomDrawButton(GtkThemeProvider* theme_provider,
+ int normal_id,
+ int pressed_id,
+ int hover_id,
+ int disabled_id,
+ const char* stock_id,
+ GtkIconSize stock_size);
+
+ // As above, but uses an arbitrary GtkImage rather than a stock icon. This
+ // constructor takes ownership of |native_widget|.
+ CustomDrawButton(GtkThemeProvider* theme_provider,
+ int normal_id,
+ int pressed_id,
+ int hover_id,
+ int disabled_id,
+ GtkWidget* native_widget);
+
+ ~CustomDrawButton();
+
+ void Init();
+
+ // Flip the image horizontally. Not to be used for RTL/LTR reasons. (In RTL
+ // mode, this will unflip the image.)
+ void set_flipped(bool flipped) { button_base_.set_flipped(flipped); }
+
+ GtkWidget* widget() const { return widget_.get(); }
+
+ gfx::Rect bounds() const {
+ return gfx::Rect(widget_->allocation.x,
+ widget_->allocation.y,
+ widget_->allocation.width,
+ widget_->allocation.height);
+ }
+
+ int width() const { return widget_->allocation.width; }
+ int height() const { return widget_->allocation.height; }
+
+ // Set the state to draw. We will paint the widget as if it were in this
+ // state.
+ void SetPaintOverride(GtkStateType state);
+
+ // Resume normal drawing of the widget's state.
+ void UnsetPaintOverride();
+
+ // Set the background details.
+ void SetBackground(SkColor color, SkBitmap* image, SkBitmap* mask);
+
+ // NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Returns a standard close button. Pass a |theme_provider| to use Gtk icons
+ // in Gtk rendering mode.
+ static CustomDrawButton* CloseButton(GtkThemeProvider* theme_provider);
+
+ private:
+ // Sets the button to themed or not.
+ void SetBrowserTheme();
+
+ // Whether to use the GTK+ theme. For this to be true, we have to be in GTK+
+ // theme mode and we must have a valid stock icon resource.
+ bool UseGtkTheme();
+
+ // Callback for custom button expose, used to draw the custom graphics.
+ CHROMEGTK_CALLBACK_1(CustomDrawButton, gboolean, OnCustomExpose,
+ GdkEventExpose*);
+
+ // The actual button widget.
+ OwnedWidgetGtk widget_;
+
+ CustomDrawButtonBase button_base_;
+
+ CustomDrawHoverController hover_controller_;
+
+ // The widget to use when we are displaying in GTK+ theme mode.
+ OwnedWidgetGtk native_widget_;
+
+ // Our theme provider.
+ GtkThemeProvider* theme_provider_;
+
+ // Used to listen for theme change notifications.
+ NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(CustomDrawButton);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_
diff --git a/chrome/browser/gtk/custom_drag.cc b/chrome/browser/ui/gtk/custom_drag.cc
index 6556e85..42d6c51 100644
--- a/chrome/browser/gtk/custom_drag.cc
+++ b/chrome/browser/ui/gtk/custom_drag.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/custom_drag.h b/chrome/browser/ui/gtk/custom_drag.h
new file mode 100644
index 0000000..40916e3
--- /dev/null
+++ b/chrome/browser/ui/gtk/custom_drag.h
@@ -0,0 +1,100 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_CUSTOM_DRAG_H_
+#define CHROME_BROWSER_UI_GTK_CUSTOM_DRAG_H_
+#pragma once
+
+#include <gtk/gtk.h>
+#include <vector>
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+
+class BookmarkNode;
+class DownloadItem;
+class Profile;
+class SkBitmap;
+
+// Base class for programatically generated drags.
+class CustomDrag {
+ protected:
+ explicit CustomDrag(SkBitmap* icon, int code_mask, GdkDragAction action);
+ virtual ~CustomDrag();
+
+ virtual void OnDragDataGet(GtkWidget* widget, GdkDragContext* context,
+ GtkSelectionData* selection_data,
+ guint target_type, guint time) = 0;
+
+ private:
+ CHROMEGTK_CALLBACK_1(CustomDrag, void, OnDragBegin, GdkDragContext*);
+ CHROMEGTK_CALLBACK_1(CustomDrag, void, OnDragEnd, GdkDragContext*);
+
+ // Since this uses a virtual function, we can't use a macro.
+ static void OnDragDataGetThunk(GtkWidget* widget, GdkDragContext* context,
+ GtkSelectionData* selection_data,
+ guint target_type, guint time,
+ CustomDrag* custom_drag) {
+ return custom_drag->OnDragDataGet(widget, context, selection_data,
+ target_type, time);
+ }
+
+ // Can't use a OwnedWidgetGtk because the initialization of GtkInvisible
+ // sinks the reference.
+ GtkWidget* drag_widget_;
+
+ GdkPixbuf* pixbuf_;
+
+ DISALLOW_COPY_AND_ASSIGN(CustomDrag);
+};
+
+// Encapsulates functionality for drags of download items.
+class DownloadItemDrag : public CustomDrag {
+ public:
+ // Sets |widget| as a source for drags pertaining to |item|. No
+ // DownloadItemDrag object is created.
+ // It is safe to call this multiple times with different values of |icon|.
+ static void SetSource(GtkWidget* widget, DownloadItem* item, SkBitmap* icon);
+
+ // Creates a new DownloadItemDrag, the lifetime of which is tied to the
+ // system drag.
+ static void BeginDrag(const DownloadItem* item, SkBitmap* icon);
+
+ private:
+ DownloadItemDrag(const DownloadItem* item, SkBitmap* icon);
+ virtual ~DownloadItemDrag();
+
+ virtual void OnDragDataGet(GtkWidget* widget, GdkDragContext* context,
+ GtkSelectionData* selection_data,
+ guint target_type, guint time);
+
+ const DownloadItem* download_item_;
+
+ DISALLOW_COPY_AND_ASSIGN(DownloadItemDrag);
+};
+
+// Encapsulates functionality for drags of one or more bookmarks.
+class BookmarkDrag : public CustomDrag {
+ public:
+ // Creates a new BookmarkDrag, the lifetime of which is tied to the
+ // system drag.
+ static void BeginDrag(Profile* profile,
+ const std::vector<const BookmarkNode*>& nodes);
+
+ private:
+ BookmarkDrag(Profile* profile,
+ const std::vector<const BookmarkNode*>& nodes);
+ virtual ~BookmarkDrag();
+
+ virtual void OnDragDataGet(GtkWidget* widget, GdkDragContext* context,
+ GtkSelectionData* selection_data,
+ guint target_type, guint time);
+
+ Profile* profile_;
+ std::vector<const BookmarkNode*> nodes_;
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkDrag);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_CUSTOM_DRAG_H_
diff --git a/chrome/browser/gtk/dialogs_gtk.cc b/chrome/browser/ui/gtk/dialogs_gtk.cc
index 7188620..5b978ca 100644
--- a/chrome/browser/gtk/dialogs_gtk.cc
+++ b/chrome/browser/ui/gtk/dialogs_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/download_in_progress_dialog_gtk.cc b/chrome/browser/ui/gtk/download_in_progress_dialog_gtk.cc
index 0aa0455..db151ff 100644
--- a/chrome/browser/gtk/download_in_progress_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/download_in_progress_dialog_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/download_in_progress_dialog_gtk.h b/chrome/browser/ui/gtk/download_in_progress_dialog_gtk.h
new file mode 100644
index 0000000..c5a8a6d
--- /dev/null
+++ b/chrome/browser/ui/gtk/download_in_progress_dialog_gtk.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_DOWNLOAD_IN_PROGRESS_DIALOG_GTK_H_
+#define CHROME_BROWSER_UI_GTK_DOWNLOAD_IN_PROGRESS_DIALOG_GTK_H_
+#pragma once
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+
+class Browser;
+
+typedef struct _GtkWidget GtkWidget;
+
+class DownloadInProgressDialogGtk {
+ public:
+ explicit DownloadInProgressDialogGtk(Browser* browser);
+
+ protected:
+ virtual ~DownloadInProgressDialogGtk() {}
+
+ private:
+ CHROMEGTK_CALLBACK_1(DownloadInProgressDialogGtk, void, OnResponse, int);
+
+ Browser* browser_;
+
+ DISALLOW_COPY_AND_ASSIGN(DownloadInProgressDialogGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_DOWNLOAD_IN_PROGRESS_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/download_item_gtk.cc b/chrome/browser/ui/gtk/download_item_gtk.cc
index b0acf44..a0f4569 100644
--- a/chrome/browser/gtk/download_item_gtk.cc
+++ b/chrome/browser/ui/gtk/download_item_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/download_item_gtk.h b/chrome/browser/ui/gtk/download_item_gtk.h
new file mode 100644
index 0000000..9c539cc
--- /dev/null
+++ b/chrome/browser/ui/gtk/download_item_gtk.h
@@ -0,0 +1,220 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_DOWNLOAD_ITEM_GTK_H_
+#define CHROME_BROWSER_UI_GTK_DOWNLOAD_ITEM_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <string>
+
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+#include "base/time.h"
+#include "chrome/browser/download/download_item.h"
+#include "chrome/browser/icon_manager.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "ui/base/animation/animation_delegate.h"
+
+class BaseDownloadItemModel;
+class DownloadShelfContextMenuGtk;
+class DownloadShelfGtk;
+class GtkThemeProvider;
+class NineBox;
+class SkBitmap;
+
+namespace ui {
+class SlideAnimation;
+}
+
+class DownloadItemGtk : public DownloadItem::Observer,
+ public ui::AnimationDelegate,
+ public NotificationObserver {
+ public:
+ // DownloadItemGtk takes ownership of |download_item_model|.
+ DownloadItemGtk(DownloadShelfGtk* parent_shelf,
+ BaseDownloadItemModel* download_item_model);
+
+ // Destroys all widgets belonging to this DownloadItemGtk.
+ ~DownloadItemGtk();
+
+ // DownloadItem::Observer implementation.
+ virtual void OnDownloadUpdated(DownloadItem* download);
+ virtual void OnDownloadFileCompleted(DownloadItem* download) { }
+ virtual void OnDownloadOpened(DownloadItem* download) { }
+
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationProgressed(const ui::Animation* animation);
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Called when the icon manager has finished loading the icon. We take
+ // ownership of |icon_bitmap|.
+ void OnLoadSmallIconComplete(IconManager::Handle handle,
+ SkBitmap* icon_bitmap);
+ void OnLoadLargeIconComplete(IconManager::Handle handle,
+ SkBitmap* icon_bitmap);
+
+ // Returns the DownloadItem model object belonging to this item.
+ DownloadItem* get_download();
+
+ private:
+ friend class DownloadShelfContextMenuGtk;
+
+ // Returns true IFF the download is dangerous and unconfirmed.
+ bool IsDangerous();
+
+ // Functions for controlling the progress animation.
+ // Repaint the download progress.
+ void UpdateDownloadProgress();
+
+ // Starts a repeating timer for UpdateDownloadProgress.
+ void StartDownloadProgress();
+
+ // Stops the repeating timer.
+ void StopDownloadProgress();
+
+ // Ask the icon manager to asynchronously start loading the icon for the file.
+ void LoadIcon();
+
+ // Sets the tooltip on the download button.
+ void UpdateTooltip();
+
+ // Sets the name label to the correct color.
+ void UpdateNameLabel();
+
+ // Sets the text of |status_label_| with the correct color.
+ void UpdateStatusLabel(const std::string& status_text);
+
+ // Sets the components of the danger warning.
+ void UpdateDangerWarning();
+
+ static void InitNineBoxes();
+
+ // Draws everything in GTK rendering mode.
+ CHROMEGTK_CALLBACK_1(DownloadItemGtk, gboolean, OnHboxExpose,
+ GdkEventExpose*);
+
+ // Used for the download item's body and menu button in chrome theme mode.
+ CHROMEGTK_CALLBACK_1(DownloadItemGtk, gboolean, OnExpose, GdkEventExpose*);
+
+ // Called when |body_| is clicked.
+ CHROMEGTK_CALLBACK_0(DownloadItemGtk, void, OnClick);
+
+ // Used for the download icon.
+ CHROMEGTK_CALLBACK_1(DownloadItemGtk, gboolean, OnProgressAreaExpose,
+ GdkEventExpose*);
+
+ CHROMEGTK_CALLBACK_1(DownloadItemGtk, gboolean, OnMenuButtonPressEvent,
+ GdkEvent*);
+
+ // Dangerous download related. -----------------------------------------------
+ CHROMEGTK_CALLBACK_1(DownloadItemGtk, gboolean, OnDangerousPromptExpose,
+ GdkEventExpose*);
+ CHROMEGTK_CALLBACK_0(DownloadItemGtk, void, OnDangerousAccept);
+ CHROMEGTK_CALLBACK_0(DownloadItemGtk, void, OnDangerousDecline);
+
+ // Nineboxes for the body area.
+ static NineBox* body_nine_box_normal_;
+ static NineBox* body_nine_box_prelight_;
+ static NineBox* body_nine_box_active_;
+
+ // Nineboxes for the menu button.
+ static NineBox* menu_nine_box_normal_;
+ static NineBox* menu_nine_box_prelight_;
+ static NineBox* menu_nine_box_active_;
+
+ // Ninebox for the background of the dangerous download prompt.
+ static NineBox* dangerous_nine_box_;
+
+ // The shelf on which we are displayed.
+ DownloadShelfGtk* parent_shelf_;
+
+ // The widget that contains the body and menu dropdown.
+ OwnedWidgetGtk hbox_;
+
+ // The widget that contains the name of the download and the progress
+ // animation.
+ OwnedWidgetGtk body_;
+
+ // The GtkLabel that holds the download title text.
+ GtkWidget* name_label_;
+
+ // The GtkLabel that holds the status text.
+ GtkWidget* status_label_;
+
+ // The current text of status label
+ std::string status_text_;
+
+ // The widget that creates a dropdown menu when pressed.
+ GtkWidget* menu_button_;
+
+ // A gtk arrow pointing downward displayed in |menu_button_|. Only displayed
+ // in GTK mode.
+ GtkWidget* arrow_;
+
+ // Whether the menu is currently showing for |menu_button_|. Affects how we
+ // draw the button.
+ bool menu_showing_;
+
+ // Whether we should use the GTK text color
+ GtkThemeProvider* theme_provider_;
+
+ // The widget that contains the animation progress and the file's icon
+ // (as well as the complete animation).
+ OwnedWidgetGtk progress_area_;
+
+ // In degrees. Only used for downloads with no known total size.
+ int progress_angle_;
+
+ // The menu that pops down when the user presses |menu_button_|. We do not
+ // create this until the first time we actually need it.
+ scoped_ptr<DownloadShelfContextMenuGtk> menu_;
+
+ // The download item model we represent.
+ scoped_ptr<BaseDownloadItemModel> download_model_;
+
+ // The dangerous download dialog. This will be null for safe downloads.
+ GtkWidget* dangerous_prompt_;
+ GtkWidget* dangerous_image_;
+ GtkWidget* dangerous_label_;
+
+ // An hbox for holding components of the dangerous download dialog.
+ GtkWidget* dangerous_hbox_;
+ int dangerous_hbox_start_width_;
+ int dangerous_hbox_full_width_;
+
+ // The animation when this item is first added to the shelf.
+ scoped_ptr<ui::SlideAnimation> new_item_animation_;
+
+ // Progress animation.
+ base::RepeatingTimer<DownloadItemGtk> progress_timer_;
+
+ // Animation for download complete.
+ scoped_ptr<ui::SlideAnimation> complete_animation_;
+
+ // The file icon for the download. May be null. The small version is used
+ // for display in the shelf; the large version is for use as a drag icon.
+ SkBitmap* icon_small_;
+ SkBitmap* icon_large_;
+
+ // The last download file path for which we requested an icon.
+ FilePath icon_filepath_;
+
+ NotificationRegistrar registrar_;
+
+ // The time at which we were insantiated.
+ base::Time creation_time_;
+
+ // For canceling an in progress icon request.
+ CancelableRequestConsumerT<int, 0> icon_consumer_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_DOWNLOAD_ITEM_GTK_H_
diff --git a/chrome/browser/gtk/download_shelf_gtk.cc b/chrome/browser/ui/gtk/download_shelf_gtk.cc
index d9b5109..adb20cf 100644
--- a/chrome/browser/gtk/download_shelf_gtk.cc
+++ b/chrome/browser/ui/gtk/download_shelf_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/download_shelf_gtk.h b/chrome/browser/ui/gtk/download_shelf_gtk.h
new file mode 100644
index 0000000..e9c2506
--- /dev/null
+++ b/chrome/browser/ui/gtk/download_shelf_gtk.h
@@ -0,0 +1,109 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_DOWNLOAD_SHELF_GTK_H_
+#define CHROME_BROWSER_UI_GTK_DOWNLOAD_SHELF_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <vector>
+
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/download/download_shelf.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/browser/gtk/slide_animator_gtk.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "gfx/native_widget_types.h"
+
+class BaseDownloadItemModel;
+class Browser;
+class CustomDrawButton;
+class DownloadItemGtk;
+class GtkThemeProvider;
+class SlideAnimatorGtk;
+
+class DownloadShelfGtk : public DownloadShelf,
+ public NotificationObserver,
+ public SlideAnimatorGtk::Delegate {
+ public:
+ explicit DownloadShelfGtk(Browser* browser, gfx::NativeView view);
+
+ ~DownloadShelfGtk();
+
+ // DownloadShelf implementation.
+ virtual void AddDownload(BaseDownloadItemModel* download_model);
+ virtual bool IsShowing() const;
+ virtual bool IsClosing() const;
+ virtual void Show();
+ virtual void Close();
+ virtual Browser* browser() const;
+
+ // SlideAnimatorGtk::Delegate implementation.
+ virtual void Closed();
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Returns the current height of the shelf.
+ int GetHeight() const;
+
+ private:
+ // Remove |download_item| from the download shelf and delete it.
+ void RemoveDownloadItem(DownloadItemGtk* download_item);
+
+ // Get the hbox download items ought to pack themselves into.
+ GtkWidget* GetHBox() const;
+
+ // Show more hidden download items if there is enough space in the shelf.
+ // It's called when a download item is removed from the shelf or an item's
+ // size is changed.
+ void MaybeShowMoreDownloadItems();
+
+ CHROMEGTK_CALLBACK_0(DownloadShelfGtk, void, OnButtonClick);
+
+ // The browser that owns this download shelf.
+ Browser* browser_;
+
+ // The top level widget of the shelf.
+ scoped_ptr<SlideAnimatorGtk> slide_widget_;
+
+ // |items_hbox_| holds the download items.
+ OwnedWidgetGtk items_hbox_;
+
+ // |shelf_| is the second highest level widget. See the constructor
+ // for an explanation of the widget layout.
+ OwnedWidgetGtk shelf_;
+
+ // Top level event box which draws the one pixel border.
+ GtkWidget* top_border_;
+
+ // A GtkEventBox which we color.
+ GtkWidget* padding_bg_;
+
+ // The "Show all downloads..." link.
+ GtkWidget* link_button_;
+
+ // The 'x' that the user can press to hide the download shelf.
+ scoped_ptr<CustomDrawButton> close_button_;
+
+ // Keeps track of our current hide/show state.
+ bool is_showing_;
+
+ // The download items we have added to our shelf.
+ std::vector<DownloadItemGtk*> download_items_;
+
+ // Gives us our colors and theme information.
+ GtkThemeProvider* theme_provider_;
+
+ NotificationRegistrar registrar_;
+
+ friend class DownloadItemGtk;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_DOWNLOAD_SHELF_GTK_H_
diff --git a/chrome/browser/gtk/download_started_animation_gtk.cc b/chrome/browser/ui/gtk/download_started_animation_gtk.cc
index e54e1a7..1f7765e 100644
--- a/chrome/browser/gtk/download_started_animation_gtk.cc
+++ b/chrome/browser/ui/gtk/download_started_animation_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/edit_search_engine_dialog.cc b/chrome/browser/ui/gtk/edit_search_engine_dialog.cc
index a3fa339..0903040 100644
--- a/chrome/browser/gtk/edit_search_engine_dialog.cc
+++ b/chrome/browser/ui/gtk/edit_search_engine_dialog.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/edit_search_engine_dialog.h b/chrome/browser/ui/gtk/edit_search_engine_dialog.h
new file mode 100644
index 0000000..fea1992
--- /dev/null
+++ b/chrome/browser/ui/gtk/edit_search_engine_dialog.h
@@ -0,0 +1,83 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_EDIT_SEARCH_ENGINE_DIALOG_H_
+#define CHROME_BROWSER_UI_GTK_EDIT_SEARCH_ENGINE_DIALOG_H_
+#pragma once
+
+#include <gtk/gtk.h>
+#include <string>
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "base/string16.h"
+
+class AccessibleWidgetHelper;
+class EditSearchEngineController;
+class EditSearchEngineControllerDelegate;
+class Profile;
+class TemplateURL;
+
+class EditSearchEngineDialog {
+ public:
+ EditSearchEngineDialog(GtkWindow* parent_window,
+ const TemplateURL* template_url,
+ EditSearchEngineControllerDelegate* delegate,
+ Profile* profile);
+ virtual ~EditSearchEngineDialog();
+
+ private:
+ // Create and show the window.
+ void Init(GtkWindow* parent_window, Profile* profile);
+
+ // Retrieve the user input in the various fields.
+ string16 GetTitleInput() const;
+ string16 GetKeywordInput() const;
+ std::string GetURLInput() const;
+
+ // Set sensitivity of buttons based on entry state.
+ void EnableControls();
+
+ // Updates the tooltip and image of the image view based on is_valid. If
+ // is_valid is false the tooltip of the image view is set to the message with
+ // id invalid_message_id, otherwise the tooltip is set to the empty text.
+ void UpdateImage(GtkWidget* image, bool is_valid, int invalid_message_id);
+
+ // Callback for entry changes.
+ CHROMEG_CALLBACK_0(EditSearchEngineDialog, void, OnEntryChanged,
+ GtkEditable*);
+
+ // Callback for dialog buttons.
+ CHROMEG_CALLBACK_1(EditSearchEngineDialog, void, OnResponse, GtkDialog*, int);
+
+ // Callback for window destruction.
+ CHROMEGTK_CALLBACK_0(EditSearchEngineDialog, void, OnWindowDestroy);
+
+ // The dialog window.
+ GtkWidget* dialog_;
+
+ // Text entries for each field.
+ GtkWidget* title_entry_;
+ GtkWidget* keyword_entry_;
+ GtkWidget* url_entry_;
+
+ // Images showing whether each entry is okay or has errors.
+ GtkWidget* title_image_;
+ GtkWidget* keyword_image_;
+ GtkWidget* url_image_;
+
+ // The ok button (we need a reference to it so we can de-activate it when the
+ // entries are not all filled in.)
+ GtkWidget* ok_button_;
+
+ scoped_ptr<EditSearchEngineController> controller_;
+
+ // Helper object to manage accessibility metadata.
+ scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
+
+ DISALLOW_COPY_AND_ASSIGN(EditSearchEngineDialog);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_EDIT_SEARCH_ENGINE_DIALOG_H_
diff --git a/chrome/browser/gtk/extension_infobar_gtk.cc b/chrome/browser/ui/gtk/extension_infobar_gtk.cc
index bd40795..48f1613 100644
--- a/chrome/browser/gtk/extension_infobar_gtk.cc
+++ b/chrome/browser/ui/gtk/extension_infobar_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/extension_infobar_gtk.h b/chrome/browser/ui/gtk/extension_infobar_gtk.h
new file mode 100644
index 0000000..8d24690
--- /dev/null
+++ b/chrome/browser/ui/gtk/extension_infobar_gtk.h
@@ -0,0 +1,50 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_EXTENSION_INFOBAR_GTK_H_
+#define CHROME_BROWSER_UI_GTK_EXTENSION_INFOBAR_GTK_H_
+#pragma once
+
+#include "chrome/browser/gtk/extension_view_gtk.h"
+#include "chrome/browser/gtk/infobar_gtk.h"
+#include "chrome/browser/extensions/extension_infobar_delegate.h"
+#include "chrome/browser/extensions/image_loading_tracker.h"
+#include "gfx/gtk_util.h"
+
+class ExtensionInfobarDelegate;
+class ExtensionResource;
+class ExtensionViewGtk;
+
+class ExtensionInfoBarGtk : public InfoBar,
+ public ImageLoadingTracker::Observer,
+ public ExtensionViewGtk::Container {
+ public:
+ explicit ExtensionInfoBarGtk(ExtensionInfoBarDelegate* delegate);
+ virtual ~ExtensionInfoBarGtk();
+
+ // Overridden from ImageLoadingTracker::Observer:
+ virtual void OnImageLoaded(
+ SkBitmap* image, ExtensionResource resource, int index);
+
+ // ExtensionViewGtk::Container implementation
+ virtual void OnExtensionPreferredSizeChanged(ExtensionViewGtk* view,
+ const gfx::Size& new_size);
+
+ private:
+ // Build the widgets of the Infobar.
+ void BuildWidgets();
+
+ CHROMEGTK_CALLBACK_1(ExtensionInfoBarGtk, void, OnSizeAllocate,
+ GtkAllocation*);
+
+ ImageLoadingTracker tracker_;
+
+ ExtensionInfoBarDelegate* delegate_;
+
+ ExtensionViewGtk* view_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_EXTENSION_INFOBAR_GTK_H_
diff --git a/chrome/browser/gtk/extension_install_prompt2_gtk.cc b/chrome/browser/ui/gtk/extension_install_prompt2_gtk.cc
index 10ee4e4..b35e7a1 100644
--- a/chrome/browser/gtk/extension_install_prompt2_gtk.cc
+++ b/chrome/browser/ui/gtk/extension_install_prompt2_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/extension_install_prompt_gtk.cc b/chrome/browser/ui/gtk/extension_install_prompt_gtk.cc
index a1166d0..979bfb0 100644
--- a/chrome/browser/gtk/extension_install_prompt_gtk.cc
+++ b/chrome/browser/ui/gtk/extension_install_prompt_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chrome/browser/gtk/extension_installed_bubble_gtk.cc b/chrome/browser/ui/gtk/extension_installed_bubble_gtk.cc
index 9ca5854..a1f3c35 100644
--- a/chrome/browser/gtk/extension_installed_bubble_gtk.cc
+++ b/chrome/browser/ui/gtk/extension_installed_bubble_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/extension_installed_bubble_gtk.h b/chrome/browser/ui/gtk/extension_installed_bubble_gtk.h
new file mode 100644
index 0000000..a422c70
--- /dev/null
+++ b/chrome/browser/ui/gtk/extension_installed_bubble_gtk.h
@@ -0,0 +1,97 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_EXTENSION_INSTALLED_BUBBLE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_EXTENSION_INSTALLED_BUBBLE_GTK_H_
+#pragma once
+
+#include "base/ref_counted.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/gtk/custom_button.h"
+#include "chrome/browser/gtk/info_bubble_gtk.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+
+class Browser;
+class BrowserWindowGtk;
+class Extension;
+class SkBitmap;
+
+// Provides feedback to the user upon successful installation of an
+// extension. Depending on the type of extension, the InfoBubble will
+// point to:
+// OMNIBOX_KEYWORD-> The omnibox.
+// BROWSER_ACTION -> The browserAction icon in the toolbar.
+// PAGE_ACTION -> A preview of the page action icon in the location
+// bar which is shown while the InfoBubble is shown.
+// GENERIC -> The wrench menu. This case includes page actions that
+// don't specify a default icon.
+//
+// ExtensionInstallBubble manages its own lifetime.
+class ExtensionInstalledBubbleGtk
+ : public InfoBubbleGtkDelegate,
+ public NotificationObserver,
+ public base::RefCountedThreadSafe<ExtensionInstalledBubbleGtk> {
+ public:
+ // The behavior and content of this InfoBubble comes in three varieties.
+ enum BubbleType {
+ OMNIBOX_KEYWORD,
+ BROWSER_ACTION,
+ PAGE_ACTION,
+ GENERIC
+ };
+
+ // Creates the ExtensionInstalledBubble and schedules it to be shown once
+ // the extension has loaded. |extension| is the installed extension. |browser|
+ // is the browser window which will host the bubble. |icon| is the install
+ // icon of the extension.
+ static void Show(const Extension* extension, Browser *browser, SkBitmap icon);
+
+ private:
+ friend class base::RefCountedThreadSafe<ExtensionInstalledBubbleGtk>;
+
+ // Private ctor. Registers a listener for EXTENSION_LOADED.
+ ExtensionInstalledBubbleGtk(const Extension* extension, Browser *browser,
+ SkBitmap icon);
+
+ virtual ~ExtensionInstalledBubbleGtk();
+
+ // Shows the bubble. Called internally via PostTask.
+ void ShowInternal();
+
+ // NotificationObserver
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // InfoBubbleDelegate
+ virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble,
+ bool closed_by_escape);
+
+ // Calls Release() internally. Called internally via PostTask.
+ void Close();
+
+ static void OnButtonClick(GtkWidget* button,
+ ExtensionInstalledBubbleGtk* toolbar);
+
+ const Extension* extension_;
+ Browser *browser_;
+ SkBitmap icon_;
+ NotificationRegistrar registrar_;
+ BubbleType type_;
+
+ // The number of times to retry showing the bubble if the browser action
+ // toolbar is animating.
+ int animation_wait_retries_;
+
+ // The 'x' that the user can press to hide the info bubble shelf.
+ scoped_ptr<CustomDrawButton> close_button_;
+
+ InfoBubbleGtk* info_bubble_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubbleGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_EXTENSION_INSTALLED_BUBBLE_GTK_H_
diff --git a/chrome/browser/gtk/extension_popup_gtk.cc b/chrome/browser/ui/gtk/extension_popup_gtk.cc
index f1faf37..412d394 100644
--- a/chrome/browser/gtk/extension_popup_gtk.cc
+++ b/chrome/browser/ui/gtk/extension_popup_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/extension_popup_gtk.h b/chrome/browser/ui/gtk/extension_popup_gtk.h
new file mode 100644
index 0000000..779114d
--- /dev/null
+++ b/chrome/browser/ui/gtk/extension_popup_gtk.h
@@ -0,0 +1,100 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_EXTENSION_POPUP_GTK_H_
+#define CHROME_BROWSER_UI_GTK_EXTENSION_POPUP_GTK_H_
+#pragma once
+
+#include "base/scoped_ptr.h"
+#include "base/task.h"
+#include "chrome/browser/gtk/extension_view_gtk.h"
+#include "chrome/browser/gtk/info_bubble_gtk.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "gfx/rect.h"
+
+class Browser;
+class ExtensionHost;
+class GURL;
+
+class ExtensionPopupGtk : public NotificationObserver,
+ public InfoBubbleGtkDelegate,
+ public ExtensionViewGtk::Container {
+ public:
+ ExtensionPopupGtk(Browser* browser,
+ ExtensionHost* host,
+ GtkWidget* anchor,
+ bool inspect);
+ virtual ~ExtensionPopupGtk();
+
+ static void Show(const GURL& url,
+ Browser* browser,
+ GtkWidget* anchor,
+ bool inspect);
+
+ // NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // InfoBubbleGtkDelegate implementation.
+ virtual void InfoBubbleClosing(InfoBubbleGtk* bubble,
+ bool closed_by_escape);
+
+ // ExtensionViewGtk::Container implementation
+ virtual void OnExtensionPreferredSizeChanged(ExtensionViewGtk* view,
+ const gfx::Size& new_size);
+
+ // Destroys the popup widget. This will in turn destroy us since we delete
+ // ourselves when the info bubble closes. Returns true if we successfully
+ // closed the bubble.
+ bool DestroyPopup();
+
+ // Get the currently showing extension popup, or NULL.
+ static ExtensionPopupGtk* get_current_extension_popup() {
+ return current_extension_popup_;
+ }
+
+ bool being_inspected() const {
+ return being_inspected_;
+ }
+
+ // Declared here for testing.
+ static const int kMinWidth;
+ static const int kMinHeight;
+ static const int kMaxWidth;
+ static const int kMaxHeight;
+
+ private:
+ // Shows the popup widget. Called after loading completes.
+ void ShowPopup();
+
+ Browser* browser_;
+
+ InfoBubbleGtk* bubble_;
+
+ // We take ownership of the popup ExtensionHost.
+ scoped_ptr<ExtensionHost> host_;
+
+ // The widget for anchoring the position of the info bubble.
+ GtkWidget* anchor_;
+
+ NotificationRegistrar registrar_;
+
+ static ExtensionPopupGtk* current_extension_popup_;
+
+ // Whether a devtools window is attached to this bubble.
+ bool being_inspected_;
+
+ ScopedRunnableMethodFactory<ExtensionPopupGtk> method_factory_;
+
+ // Used for testing. ---------------------------------------------------------
+ gfx::Rect GetViewBounds();
+
+ friend class BrowserActionTestUtil;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionPopupGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_EXTENSION_POPUP_GTK_H_
diff --git a/chrome/browser/gtk/extension_view_gtk.cc b/chrome/browser/ui/gtk/extension_view_gtk.cc
index f2e49c3..b39b6c6 100644
--- a/chrome/browser/gtk/extension_view_gtk.cc
+++ b/chrome/browser/ui/gtk/extension_view_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/extension_view_gtk.h b/chrome/browser/ui/gtk/extension_view_gtk.h
new file mode 100644
index 0000000..c398fed
--- /dev/null
+++ b/chrome/browser/ui/gtk/extension_view_gtk.h
@@ -0,0 +1,70 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_EXTENSION_VIEW_GTK_H_
+#define CHROME_BROWSER_UI_GTK_EXTENSION_VIEW_GTK_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "gfx/native_widget_types.h"
+#include "gfx/size.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+
+class Browser;
+class ExtensionHost;
+class RenderViewHost;
+class RenderWidgetHostViewGtk;
+class SkBitmap;
+
+class ExtensionViewGtk {
+ public:
+ ExtensionViewGtk(ExtensionHost* extension_host, Browser* browser);
+
+ class Container {
+ public:
+ virtual ~Container() {}
+ virtual void OnExtensionPreferredSizeChanged(ExtensionViewGtk* view,
+ const gfx::Size& new_size) {}
+ };
+
+ void Init();
+
+ gfx::NativeView native_view();
+ Browser* browser() const { return browser_; }
+
+ void SetBackground(const SkBitmap& background);
+
+ // Sets the container for this view.
+ void SetContainer(Container* container) { container_ = container; }
+
+ // Method for the ExtensionHost to notify us about the correct size for
+ // extension contents.
+ void UpdatePreferredSize(const gfx::Size& new_size);
+
+ // Method for the ExtensionHost to notify us when the RenderViewHost has a
+ // connection.
+ void RenderViewCreated();
+
+ RenderViewHost* render_view_host() const;
+
+ private:
+ void CreateWidgetHostView();
+
+ Browser* browser_;
+
+ ExtensionHost* extension_host_;
+
+ RenderWidgetHostViewGtk* render_widget_host_view_;
+
+ // The background the view should have once it is initialized. This is set
+ // when the view has a custom background, but hasn't been initialized yet.
+ SkBitmap pending_background_;
+
+ // This view's container.
+ Container* container_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionViewGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_EXTENSION_VIEW_GTK_H_
diff --git a/chrome/browser/gtk/external_protocol_dialog_gtk.cc b/chrome/browser/ui/gtk/external_protocol_dialog_gtk.cc
index 34c2f78..7fc1a88 100644
--- a/chrome/browser/gtk/external_protocol_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/external_protocol_dialog_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/external_protocol_dialog_gtk.h b/chrome/browser/ui/gtk/external_protocol_dialog_gtk.h
new file mode 100644
index 0000000..979d5c8
--- /dev/null
+++ b/chrome/browser/ui/gtk/external_protocol_dialog_gtk.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_EXTERNAL_PROTOCOL_DIALOG_GTK_H_
+#define CHROME_BROWSER_UI_GTK_EXTERNAL_PROTOCOL_DIALOG_GTK_H_
+#pragma once
+
+#include "app/gtk_signal.h"
+#include "base/time.h"
+#include "googleurl/src/gurl.h"
+
+class TabContents;
+
+typedef struct _GtkWidget GtkWidget;
+
+class ExternalProtocolDialogGtk {
+ public:
+ explicit ExternalProtocolDialogGtk(const GURL& url);
+
+ protected:
+ virtual ~ExternalProtocolDialogGtk() {}
+
+ private:
+ CHROMEGTK_CALLBACK_1(ExternalProtocolDialogGtk, void, OnDialogResponse, int);
+
+ GtkWidget* dialog_;
+ GtkWidget* checkbox_;
+ GURL url_;
+ base::TimeTicks creation_time_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_EXTERNAL_PROTOCOL_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/find_bar_gtk.cc b/chrome/browser/ui/gtk/find_bar_gtk.cc
index ddd9955..6fd27c8 100644
--- a/chrome/browser/gtk/find_bar_gtk.cc
+++ b/chrome/browser/ui/gtk/find_bar_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/find_bar_gtk.h b/chrome/browser/ui/gtk/find_bar_gtk.h
new file mode 100644
index 0000000..514831d
--- /dev/null
+++ b/chrome/browser/ui/gtk/find_bar_gtk.h
@@ -0,0 +1,240 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_FIND_BAR_GTK_H_
+#define CHROME_BROWSER_UI_GTK_FIND_BAR_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/gtk/focus_store_gtk.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/browser/gtk/slide_animator_gtk.h"
+#include "chrome/browser/ui/find_bar/find_bar.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "gfx/point.h"
+
+class Browser;
+class BrowserWindowGtk;
+class CustomDrawButton;
+class FindBarController;
+class GtkThemeProvider;
+class NineBox;
+class SlideAnimatorGtk;
+class TabContentsContainerGtk;
+
+typedef struct _GtkFloatingContainer GtkFloatingContainer;
+
+// Currently this class contains both a model and a view. We may want to
+// eventually pull out the model specific bits and share with Windows.
+class FindBarGtk : public FindBar,
+ public FindBarTesting,
+ public NotificationObserver {
+ public:
+ explicit FindBarGtk(Browser* browser);
+ virtual ~FindBarGtk();
+
+ GtkWidget* widget() const { return slide_widget_->widget(); }
+
+ // Methods from FindBar.
+ virtual FindBarController* GetFindBarController() const;
+ virtual void SetFindBarController(FindBarController* find_bar_controller);
+ virtual void Show(bool animate);
+ virtual void Hide(bool animate);
+ virtual void SetFocusAndSelection();
+ virtual void ClearResults(const FindNotificationDetails& results);
+ virtual void StopAnimation();
+ virtual void MoveWindowIfNecessary(const gfx::Rect& selection_rect,
+ bool no_redraw);
+ virtual void SetFindText(const string16& find_text);
+ virtual void UpdateUIForFindResult(const FindNotificationDetails& result,
+ const string16& find_text);
+ virtual void AudibleAlert();
+ virtual bool IsFindBarVisible();
+ virtual void RestoreSavedFocus();
+ virtual FindBarTesting* GetFindBarTesting();
+
+ // Methods from FindBarTesting.
+ virtual bool GetFindBarWindowInfo(gfx::Point* position,
+ bool* fully_visible);
+ virtual string16 GetFindText();
+ virtual string16 GetFindSelectedText();
+ virtual string16 GetMatchCountText();
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ private:
+ void InitWidgets();
+
+ // Store the currently focused widget if it is not in the find bar.
+ // This should always be called before we claim focus.
+ void StoreOutsideFocus();
+
+ // For certain keystrokes, such as up or down, we want to forward the event
+ // to the renderer rather than handling it ourselves. Returns true if the
+ // key event was forwarded.
+ // See similar function in FindBarWin.
+ bool MaybeForwardKeyEventToRenderer(GdkEventKey* event);
+
+ // Searches for another occurrence of the entry text, moving forward if
+ // |forward_search| is true.
+ void FindEntryTextInContents(bool forward_search);
+
+ void UpdateMatchLabelAppearance(bool failure);
+
+ // Asynchronously repositions the dialog.
+ void Reposition();
+
+ // Returns the rectangle representing where to position the find bar. If
+ // |avoid_overlapping_rect| is specified, the return value will be a rectangle
+ // located immediately to the left of |avoid_overlapping_rect|, as long as
+ // there is enough room for the dialog to draw within the bounds. If not, the
+ // dialog position returned will overlap |avoid_overlapping_rect|.
+ // Note: |avoid_overlapping_rect| is expected to use coordinates relative to
+ // the top of the page area, (it will be converted to coordinates relative to
+ // the top of the browser window, when comparing against the dialog
+ // coordinates). The returned value is relative to the browser window.
+ gfx::Rect GetDialogPosition(gfx::Rect avoid_overlapping_rect);
+
+ // Adjust the text alignment according to the text direction of the widget
+ // and |text_entry_|'s content, to make sure the real text alignment is
+ // always in sync with the UI language direction.
+ void AdjustTextAlignment();
+
+ // Get the position of the findbar within the floating container.
+ gfx::Point GetPosition();
+
+ static void OnParentSet(GtkWidget* widget, GtkObject* old_parent,
+ FindBarGtk* find_bar);
+
+ static void OnSetFloatingPosition(GtkFloatingContainer* floating_container,
+ GtkAllocation* allocation,
+ FindBarGtk* find_bar);
+
+ // Callback when the entry text changes.
+ static gboolean OnChanged(GtkWindow* window, FindBarGtk* find_bar);
+
+ static gboolean OnKeyPressEvent(GtkWidget* widget, GdkEventKey* event,
+ FindBarGtk* find_bar);
+ static gboolean OnKeyReleaseEvent(GtkWidget* widget, GdkEventKey* event,
+ FindBarGtk* find_bar);
+
+ // Callback for previous, next, and close button.
+ static void OnClicked(GtkWidget* button, FindBarGtk* find_bar);
+
+ // Handles shapping and drawing the find bar background.
+ static gboolean OnExpose(GtkWidget* widget, GdkEventExpose* event,
+ FindBarGtk* bar);
+
+ // Expose that draws the text entry background in GTK mode.
+ static gboolean OnContentEventBoxExpose(GtkWidget* widget,
+ GdkEventExpose* event,
+ FindBarGtk* bar);
+
+ // These are both used for focus management.
+ static gboolean OnFocus(GtkWidget* text_entry, GtkDirectionType focus,
+ FindBarGtk* find_bar);
+ static gboolean OnButtonPress(GtkWidget* text_entry, GdkEventButton* e,
+ FindBarGtk* find_bar);
+
+ // Forwards ctrl-Home/End key bindings to the renderer.
+ static void OnMoveCursor(GtkEntry* entry, GtkMovementStep step, gint count,
+ gboolean selection, FindBarGtk* bar);
+
+ // Handles Enter key.
+ static void OnActivate(GtkEntry* entry, FindBarGtk* bar);
+
+ static void OnWidgetDirectionChanged(GtkWidget* widget,
+ GtkTextDirection previous_direction,
+ FindBarGtk* find_bar) {
+ find_bar->AdjustTextAlignment();
+ }
+
+ static void OnKeymapDirectionChanged(GdkKeymap* keymap,
+ FindBarGtk* find_bar) {
+ find_bar->AdjustTextAlignment();
+ }
+
+ static gboolean OnFocusIn(GtkWidget* entry, GdkEventFocus* event,
+ FindBarGtk* find_bar);
+
+ static gboolean OnFocusOut(GtkWidget* entry, GdkEventFocus* event,
+ FindBarGtk* find_bar);
+
+ Browser* browser_;
+ BrowserWindowGtk* window_;
+
+ // Provides colors and information about GTK.
+ GtkThemeProvider* theme_provider_;
+
+ // The widget that animates the slide-in and -out of the findbar.
+ scoped_ptr<SlideAnimatorGtk> slide_widget_;
+
+ // A GtkAlignment that is the child of |slide_widget_|.
+ GtkWidget* container_;
+
+ // Cached allocation of |container_|. We keep this on hand so that we can
+ // reset the widget's shape when the width/height change.
+ int container_width_;
+ int container_height_;
+
+ // The widget where text is entered.
+ GtkWidget* text_entry_;
+
+ // An event box and alignment that wrap the entry area and the count label.
+ GtkWidget* content_event_box_;
+ GtkWidget* content_alignment_;
+
+ // The border around the text entry area.
+ GtkWidget* border_bin_;
+ GtkWidget* border_bin_alignment_;
+
+ // The next and previous match buttons.
+ scoped_ptr<CustomDrawButton> find_previous_button_;
+ scoped_ptr<CustomDrawButton> find_next_button_;
+
+ // The GtkLabel listing how many results were found.
+ GtkWidget* match_count_label_;
+ GtkWidget* match_count_event_box_;
+ // Cache whether the match count label is showing failure or not so that
+ // we can update its appearance without changing its semantics.
+ bool match_label_failure_;
+
+ // The X to close the find bar.
+ scoped_ptr<CustomDrawButton> close_button_;
+
+ // The last matchcount number we reported to the user.
+ int last_reported_matchcount_;
+
+ // Pointer back to the owning controller.
+ FindBarController* find_bar_controller_;
+
+ // Saves where the focus used to be whenever we get it.
+ FocusStoreGtk focus_store_;
+
+ // If true, the change signal for the text entry is ignored.
+ bool ignore_changed_signal_;
+
+ // This is the width of widget(). We cache it so we can recognize whether
+ // allocate signals have changed it, and if so take appropriate actions.
+ int current_fixed_width_;
+
+ scoped_ptr<NineBox> dialog_background_;
+
+ // The selection rect we are currently showing. We cache it to avoid covering
+ // it up.
+ gfx::Rect selection_rect_;
+
+ NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(FindBarGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_FIND_BAR_GTK_H_
diff --git a/chrome/browser/gtk/first_run_bubble.cc b/chrome/browser/ui/gtk/first_run_bubble.cc
index 119166b..11a61422 100644
--- a/chrome/browser/gtk/first_run_bubble.cc
+++ b/chrome/browser/ui/gtk/first_run_bubble.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/first_run_bubble.h b/chrome/browser/ui/gtk/first_run_bubble.h
new file mode 100644
index 0000000..b03e321
--- /dev/null
+++ b/chrome/browser/ui/gtk/first_run_bubble.h
@@ -0,0 +1,90 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This is the GTK implementation of the First Run bubble, the dialog box
+// presented on first run of Chromium. There can only ever be a single
+// bubble open, so the class presents only static methods.
+
+#ifndef CHROME_BROWSER_UI_GTK_FIRST_RUN_BUBBLE_H_
+#define CHROME_BROWSER_UI_GTK_FIRST_RUN_BUBBLE_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "chrome/browser/first_run/first_run.h"
+#include "chrome/browser/gtk/info_bubble_gtk.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+
+class Profile;
+
+class FirstRunBubble : public InfoBubbleGtkDelegate,
+ public NotificationObserver {
+ public:
+ // Shows the first run bubble, pointing at |rect|.
+ static void Show(Profile* profile,
+ GtkWidget* anchor,
+ const gfx::Rect& rect,
+ FirstRun::BubbleType bubble_type);
+
+ // Implements the InfoBubbleGtkDelegate. We are notified when the bubble
+ // is about to be closed.
+ virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble,
+ bool closed_by_escape);
+ virtual bool CloseOnEscape();
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ private:
+ FirstRunBubble(Profile* profile,
+ GtkWidget* anchor,
+ const gfx::Rect& rect,
+ FirstRun::BubbleType bubble_type);
+ virtual ~FirstRunBubble();
+
+ // Create and pack widgets for different bubble types.
+ void InitializeContentForLarge();
+ void InitializeContentForOEM();
+ void InitializeContentForMinimal();
+
+ // Contains some common set up for the labels in the bubble. |width| is a
+ // resource that holds the desired width for the labels.
+ void InitializeLabels(int width_resource);
+
+ CHROMEGTK_CALLBACK_0(FirstRunBubble, void, HandleDestroy);
+ CHROMEGTK_CALLBACK_0(FirstRunBubble, void, HandleKeepButton);
+ CHROMEGTK_CALLBACK_0(FirstRunBubble, void, HandleChangeButton);
+
+ // Our current profile.
+ Profile* profile_;
+
+ // Provides colors and stuff.
+ GtkThemeProvider* theme_provider_;
+
+ // The widget we anchor to, and a descendant of the toplevel window we
+ // are transient for.
+ GtkWidget* anchor_;
+
+ // We let the InfoBubble own our content, and then we delete ourself
+ // when the widget is destroyed (when the InfoBubble is destroyed).
+ GtkWidget* content_;
+
+ // The various labels in the interface. We keep track of them for theme
+ // changes.
+ std::vector<GtkWidget*> labels_;
+
+ InfoBubbleGtk* bubble_;
+
+ NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(FirstRunBubble);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_FIRST_RUN_BUBBLE_H_
diff --git a/chrome/browser/gtk/first_run_dialog.cc b/chrome/browser/ui/gtk/first_run_dialog.cc
index 0074d28..5994a84 100644
--- a/chrome/browser/gtk/first_run_dialog.cc
+++ b/chrome/browser/ui/gtk/first_run_dialog.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/first_run_dialog.h b/chrome/browser/ui/gtk/first_run_dialog.h
new file mode 100644
index 0000000..cd26910
--- /dev/null
+++ b/chrome/browser/ui/gtk/first_run_dialog.h
@@ -0,0 +1,82 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_FIRST_RUN_DIALOG_H_
+#define CHROME_BROWSER_UI_GTK_FIRST_RUN_DIALOG_H_
+#pragma once
+
+typedef struct _GtkButton GtkButton;
+typedef struct _GtkWidget GtkWidget;
+
+#include "app/gtk_signal.h"
+#include "chrome/browser/first_run/first_run.h"
+#include "chrome/browser/search_engines/template_url_model_observer.h"
+
+class TemplateURL;
+class TemplateURLModel;
+
+class FirstRunDialog : public TemplateURLModelObserver {
+ public:
+ // Displays the first run UI for reporting opt-in, import data etc.
+ static bool Show(Profile* profile, bool randomize_search_engine_order);
+
+ virtual void OnTemplateURLModelChanged();
+
+ private:
+ FirstRunDialog(Profile* profile,
+ bool show_reporting_dialog,
+ bool show_search_engines_dialog,
+ int* response);
+ virtual ~FirstRunDialog();
+
+ CHROMEGTK_CALLBACK_1(FirstRunDialog, void, OnResponseDialog, int);
+ CHROMEGTK_CALLBACK_0(FirstRunDialog, void, OnSearchEngineButtonClicked);
+ CHROMEGTK_CALLBACK_0(FirstRunDialog, void, OnSearchEngineWindowDestroy);
+ CHROMEG_CALLBACK_0(FirstRunDialog, void, OnLearnMoreLinkClicked, GtkButton*);
+
+ void ShowSearchEngineWindow();
+ void ShowReportingDialog();
+
+ // This method closes the first run window and quits the message loop so that
+ // the Chrome startup can continue. This should be called when all the
+ // first run tasks are done.
+ void FirstRunDone();
+
+ // The search engine choice window. This is created and shown before
+ // |dialog_|.
+ GtkWidget* search_engine_window_;
+
+ // Dialog that holds the bug reporting and default browser checkboxes.
+ GtkWidget* dialog_;
+
+ // Container for the search engine choices.
+ GtkWidget* search_engine_hbox_;
+
+ // Crash reporting checkbox
+ GtkWidget* report_crashes_;
+
+ // Make browser default checkbox
+ GtkWidget* make_default_;
+
+ // Our current profile
+ Profile* profile_;
+
+ // Owned by the profile_.
+ TemplateURLModel* search_engines_model_;
+
+ // The search engine the user chose, or NULL if the user has not chosen a
+ // search engine.
+ TemplateURL* chosen_search_engine_;
+
+ // Whether we should show the dialog asking the user whether to report
+ // crashes and usage stats.
+ bool show_reporting_dialog_;
+
+ // User response (accept or cancel) is returned through this.
+ int* response_;
+
+ DISALLOW_COPY_AND_ASSIGN(FirstRunDialog);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_FIRST_RUN_DIALOG_H_
diff --git a/chrome/browser/gtk/focus_store_gtk.cc b/chrome/browser/ui/gtk/focus_store_gtk.cc
index e882e2b..f5e26db 100644
--- a/chrome/browser/gtk/focus_store_gtk.cc
+++ b/chrome/browser/ui/gtk/focus_store_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/focus_store_gtk.h b/chrome/browser/ui/gtk/focus_store_gtk.h
new file mode 100644
index 0000000..012332e
--- /dev/null
+++ b/chrome/browser/ui/gtk/focus_store_gtk.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_FOCUS_STORE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_FOCUS_STORE_GTK_H_
+#pragma once
+
+#include "base/basictypes.h"
+
+typedef struct _GtkWidget GtkWidget;
+
+class FocusStoreGtk {
+ public:
+ FocusStoreGtk();
+
+ virtual ~FocusStoreGtk();
+
+ GtkWidget* widget() const { return widget_; }
+
+ // Save the widget that is currently focused for |widget|'s toplevel (NOT
+ // |widget|).
+ void Store(GtkWidget* widget);
+
+ // Save |widget| as the focus widget. Call with NULL to clear |widget_|.
+ void SetWidget(GtkWidget* widget);
+
+ private:
+ // Disconnect the previous destroy handler (if any).
+ void DisconnectDestroyHandler();
+
+ // The widget which last had focus.
+ GtkWidget* widget_;
+
+ // The widget for which we've stored focus might be destroyed by the time we
+ // want to restore focus. Thus we connect to the "destroy" signal on that
+ // widget. This is the ID for the destroy handler.
+ unsigned int destroy_handler_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(FocusStoreGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_FOCUS_STORE_GTK_H_
diff --git a/chrome/browser/gtk/fullscreen_exit_bubble_gtk.cc b/chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.cc
index ee452b8..a53507d 100644
--- a/chrome/browser/gtk/fullscreen_exit_bubble_gtk.cc
+++ b/chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.h b/chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.h
new file mode 100644
index 0000000..0831509
--- /dev/null
+++ b/chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_FULLSCREEN_EXIT_BUBBLE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_FULLSCREEN_EXIT_BUBBLE_GTK_H_
+#pragma once
+
+#include "app/gtk_signal.h"
+#include "app/gtk_signal_registrar.h"
+#include "base/timer.h"
+#include "chrome/browser/gtk/slide_animator_gtk.h"
+
+typedef struct _GtkFloatingContainer GtkFloatingContainer;
+typedef struct _GtkWidget GtkWidget;
+
+// FullscreenExitBubbleGTK is responsible for showing a bubble atop the screen
+// in fullscreen mode, telling users how to exit and providing a click target.
+class FullscreenExitBubbleGtk {
+ public:
+ // We place the bubble in |container|.
+ explicit FullscreenExitBubbleGtk(GtkFloatingContainer* container);
+ virtual ~FullscreenExitBubbleGtk();
+
+ void InitWidgets();
+
+ private:
+ GtkWidget* widget() const {
+ return slide_widget_->widget();
+ }
+
+ // Hide the exit bubble.
+ void Hide();
+
+ CHROMEGTK_CALLBACK_1(FullscreenExitBubbleGtk, void, OnSetFloatingPosition,
+ GtkAllocation*);
+ CHROMEGTK_CALLBACK_0(FullscreenExitBubbleGtk, void, OnLinkClicked);
+
+ // A pointer to the floating container that is our parent.
+ GtkFloatingContainer* container_;
+
+ // The widget that animates the slide-out of fullscreen exit bubble.
+ scoped_ptr<SlideAnimatorGtk> slide_widget_;
+
+ // The timer that does the initial hiding of the exit bubble.
+ base::OneShotTimer<FullscreenExitBubbleGtk> initial_delay_;
+
+ GtkSignalRegistrar signals_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_FULLSCREEN_EXIT_BUBBLE_GTK_H_
diff --git a/chrome/browser/gtk/gconf_titlebar_listener.cc b/chrome/browser/ui/gtk/gconf_titlebar_listener.cc
index ae89f1a..6104263 100644
--- a/chrome/browser/gtk/gconf_titlebar_listener.cc
+++ b/chrome/browser/ui/gtk/gconf_titlebar_listener.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/gconf_titlebar_listener.h b/chrome/browser/ui/gtk/gconf_titlebar_listener.h
new file mode 100644
index 0000000..ad0c67b
--- /dev/null
+++ b/chrome/browser/ui/gtk/gconf_titlebar_listener.h
@@ -0,0 +1,72 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_GCONF_TITLEBAR_LISTENER_H_
+#define CHROME_BROWSER_UI_GTK_GCONF_TITLEBAR_LISTENER_H_
+#pragma once
+
+#include <gconf/gconf-client.h>
+#include <gtk/gtk.h>
+
+#include <set>
+#include <string>
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+
+class BrowserTitlebar;
+template <typename T> struct DefaultSingletonTraits;
+
+// On GNOME desktops, subscribes to the gconf key which controlls button order.
+// Everywhere else, SetTiltebarButtons() just calls back into BrowserTitlebar
+// with the default ordering.
+//
+// Meant to be used as a Singleton through base/singleton.h's interface.
+class GConfTitlebarListener {
+ public:
+ // Returns the singleton instance.
+ static GConfTitlebarListener* GetInstance();
+
+ // Sets the current titlebar button order. On GNOME desktops, also subscribes
+ // to further notifications when this changes.
+ void SetTitlebarButtons(BrowserTitlebar* titlebar);
+
+ // Removes |titlebar| from the list of objects observing button order change
+ // notifications.
+ void RemoveObserver(BrowserTitlebar* titlebar);
+
+ protected:
+ virtual ~GConfTitlebarListener();
+
+ private:
+ // Private constructor to enforce singleton access.
+ GConfTitlebarListener();
+
+ // Called whenever the metacity key changes.
+ CHROMEG_CALLBACK_2(GConfTitlebarListener, void, OnChangeNotification,
+ GConfClient*, guint, GConfEntry*);
+
+ // Checks |error|. On error, prints out a message and closes the connection
+ // to GConf and reverts to default mode.
+ bool HandleGError(GError* error, const char* key);
+
+ // Parses the return data structure from GConf, falling back to the default
+ // value on any error.
+ void ParseAndStoreValue(GConfValue* gconf_value);
+
+ // Pointer to our gconf context. NULL if we aren't on a desktop that uses
+ // gconf.
+ GConfClient* client_;
+
+ // The current button ordering as heard from gconf.
+ std::string current_value_;
+
+ // BrowserTitlebar objects which have subscribed to updates.
+ std::set<BrowserTitlebar*> titlebars_;
+
+ friend struct DefaultSingletonTraits<GConfTitlebarListener>;
+ DISALLOW_COPY_AND_ASSIGN(GConfTitlebarListener);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_GCONF_TITLEBAR_LISTENER_H_
diff --git a/chrome/browser/gtk/gtk_chrome_button.cc b/chrome/browser/ui/gtk/gtk_chrome_button.cc
index 20310a5..9c01dbc 100644
--- a/chrome/browser/gtk/gtk_chrome_button.cc
+++ b/chrome/browser/ui/gtk/gtk_chrome_button.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/gtk_chrome_button.h b/chrome/browser/ui/gtk/gtk_chrome_button.h
new file mode 100644
index 0000000..1a8e1b8
--- /dev/null
+++ b/chrome/browser/ui/gtk/gtk_chrome_button.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_GTK_CHROME_BUTTON_H_
+#define CHROME_BROWSER_UI_GTK_GTK_CHROME_BUTTON_H_
+#pragma once
+
+#include <gdk/gdk.h>
+#include <gtk/gtkbutton.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_CHROME_BUTTON (gtk_chrome_button_get_type ())
+#define GTK_CHROME_BUTTON(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_CHROME_BUTTON, GtkChromeButton))
+#define GTK_CHROME_BUTTON_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_CHROME_BUTTON, \
+ GtkChromeButtonClass))
+#define GTK_IS_CHROME_BUTTON(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_CHROME_BUTTON))
+#define GTK_IS_CHROME_BUTTON_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_CHROME_BUTTON))
+#define GTK_CHROME_BUTTON_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_CHROME_BUTTON, GtkChromeButton))
+
+typedef struct _GtkChromeButton GtkChromeButton;
+typedef struct _GtkChromeButtonClass GtkChromeButtonClass;
+
+struct _GtkChromeButton {
+ GtkButton button;
+};
+
+struct _GtkChromeButtonClass {
+ GtkButtonClass parent_class;
+};
+
+GtkWidget* gtk_chrome_button_new();
+
+GType gtk_chrome_button_get_type();
+
+// Set the paint state to |state|. This overrides the widget's current state.
+void gtk_chrome_button_set_paint_state(GtkChromeButton* button,
+ GtkStateType state);
+
+// Revert to using the widget's current state for painting.
+void gtk_chrome_button_unset_paint_state(GtkChromeButton* button);
+
+// Whether we should use custom theme images or let GTK take care of it.
+void gtk_chrome_button_set_use_gtk_rendering(GtkChromeButton* button,
+ gboolean value);
+
+// Sets the partial hover state of the button. The acceptable range is 0.0 to
+// 1.0. If |state| is outside of that range, then revert the button to normal
+// hovering. This can be overridden by gtk_chrome_button_set_paint_state.
+void gtk_chrome_button_set_hover_state(GtkChromeButton* button,
+ gdouble state);
+
+G_END_DECLS
+
+#endif // CHROME_BROWSER_UI_GTK_GTK_CHROME_BUTTON_H_
diff --git a/chrome/browser/gtk/gtk_chrome_cookie_view.cc b/chrome/browser/ui/gtk/gtk_chrome_cookie_view.cc
index a0e3c62..bd9717f 100644
--- a/chrome/browser/gtk/gtk_chrome_cookie_view.cc
+++ b/chrome/browser/ui/gtk/gtk_chrome_cookie_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/gtk_chrome_cookie_view.h b/chrome/browser/ui/gtk/gtk_chrome_cookie_view.h
new file mode 100644
index 0000000..e0d5d4f
--- /dev/null
+++ b/chrome/browser/ui/gtk/gtk_chrome_cookie_view.h
@@ -0,0 +1,194 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_GTK_CHROME_COOKIE_VIEW_H_
+#define CHROME_BROWSER_UI_GTK_GTK_CHROME_COOKIE_VIEW_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <string>
+
+#include "chrome/browser/browsing_data_appcache_helper.h"
+#include "chrome/browser/browsing_data_database_helper.h"
+#include "chrome/browser/browsing_data_indexed_db_helper.h"
+#include "chrome/browser/browsing_data_local_storage_helper.h"
+#include "net/base/cookie_monster.h"
+
+class GURL;
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_CHROME_COOKIE_VIEW gtk_chrome_cookie_view_get_type()
+
+#define GTK_CHROME_COOKIE_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GTK_TYPE_CHROME_COOKIE_VIEW, GtkChromeCookieView))
+
+#define GTK_CHROME_COOKIE_VIEW_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GTK_TYPE_CHROME_COOKIE_VIEW, GtkChromeCookieViewClass))
+
+#define GTK_IS_CHROME_COOKIE_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GTK_TYPE_CHROME_COOKIE_VIEW))
+
+#define GTK_IS_CHROME_COOKIE_VIEW_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GTK_TYPE_CHROME_COOKIE_VIEW))
+
+#define GTK_CHROME_COOKIE_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GTK_TYPE_CHROME_COOKIE_VIEW, GtkChromeCookieViewClass))
+
+// TODO(erg): Refactor the following class. It's continuously grown as more
+// things have been added to it and should probably become a general key/value
+// table. The problem is that any implementation for that would be much more
+// complicated and would require changing a whole lot of code.
+typedef struct {
+ GtkFrame parent;
+
+ // All public for testing since I don't think there's a "friend" mechanism in
+ // gobject.
+
+ GtkWidget* table_box_;
+
+ // A label we keep around so we can access its GtkStyle* once it is realized.
+ GtkWidget* first_label_;
+
+ // The cookie details widgets.
+ GtkWidget* cookie_details_table_;
+ GtkWidget* cookie_name_entry_;
+ GtkWidget* cookie_content_entry_;
+ GtkWidget* cookie_domain_entry_;
+ GtkWidget* cookie_path_entry_;
+ GtkWidget* cookie_send_for_entry_;
+ GtkWidget* cookie_created_entry_;
+
+ // Note: These two widgets are mutually exclusive based on what
+ // |editable_expiration| was when the cookie view was created. One of these
+ // variables will be NULL.
+ GtkWidget* cookie_expires_entry_;
+ GtkWidget* cookie_expires_combobox_;
+
+ GtkListStore* cookie_expires_combobox_store_;
+
+ // The database details widgets.
+ GtkWidget* database_details_table_;
+ GtkWidget* database_name_entry_;
+ GtkWidget* database_description_entry_;
+ GtkWidget* database_size_entry_;
+ GtkWidget* database_last_modified_entry_;
+
+ // The local storage details widgets.
+ GtkWidget* local_storage_details_table_;
+ GtkWidget* local_storage_origin_entry_;
+ GtkWidget* local_storage_size_entry_;
+ GtkWidget* local_storage_last_modified_entry_;
+
+ // The appcache details widgets.
+ GtkWidget* appcache_details_table_;
+ GtkWidget* appcache_manifest_entry_;
+ GtkWidget* appcache_size_entry_;
+ GtkWidget* appcache_created_entry_;
+ GtkWidget* appcache_last_accessed_entry_;
+
+ // The IndexedDB details widgets.
+ GtkWidget* indexed_db_details_table_;
+ GtkWidget* indexed_db_origin_entry_;
+ GtkWidget* indexed_db_size_entry_;
+ GtkWidget* indexed_db_last_modified_entry_;
+
+ // The local storage item widgets.
+ GtkWidget* local_storage_item_table_;
+ GtkWidget* local_storage_item_origin_entry_;
+ GtkWidget* local_storage_item_key_entry_;
+ GtkWidget* local_storage_item_value_entry_;
+
+ // The database accessed widgets.
+ GtkWidget* database_accessed_table_;
+ GtkWidget* database_accessed_origin_entry_;
+ GtkWidget* database_accessed_name_entry_;
+ GtkWidget* database_accessed_description_entry_;
+ GtkWidget* database_accessed_size_entry_;
+
+ // The appcache created widgets.
+ GtkWidget* appcache_created_table_;
+ GtkWidget* appcache_created_manifest_entry_;
+} GtkChromeCookieView;
+
+typedef struct {
+ GtkFrameClass parent_class;
+} GtkChromeCookieViewClass;
+
+GType gtk_chrome_cookie_view_get_type();
+
+// Builds a new cookie view.
+GtkWidget* gtk_chrome_cookie_view_new(gboolean editable_expiration);
+
+// Clears the cookie view.
+void gtk_chrome_cookie_view_clear(GtkChromeCookieView* widget);
+
+// NOTE: The G_END_DECLS ends here instead of at the end of the document
+// because we want to define some methods on GtkChromeCookieView that take C++
+// objects.
+G_END_DECLS
+// NOTE: ^^^^^^^^^^^^^^^^^^^^^^^
+
+// Switches the display to showing the passed in cookie.
+void gtk_chrome_cookie_view_display_cookie(
+ GtkChromeCookieView* widget,
+ const std::string& domain,
+ const net::CookieMonster::CanonicalCookie& cookie);
+
+// Looks up the cookie_line in CookieMonster and displays that.
+void gtk_chrome_cookie_view_display_cookie_string(
+ GtkChromeCookieView* widget,
+ const GURL& url,
+ const std::string& cookie_line);
+
+// Switches the display to showing the passed in database.
+void gtk_chrome_cookie_view_display_database(
+ GtkChromeCookieView* widget,
+ const BrowsingDataDatabaseHelper::DatabaseInfo& database_info);
+
+// Switches the display to showing the passed in local storage data.
+void gtk_chrome_cookie_view_display_local_storage(
+ GtkChromeCookieView* widget,
+ const BrowsingDataLocalStorageHelper::LocalStorageInfo&
+ local_storage_info);
+
+// Switches the display to showing the passed in app cache.
+void gtk_chrome_cookie_view_display_app_cache(
+ GtkChromeCookieView* widget,
+ const appcache::AppCacheInfo& info);
+
+// Switches the display to showing the passed in IndexedDB data.
+void gtk_chrome_cookie_view_display_indexed_db(
+ GtkChromeCookieView* widget,
+ const BrowsingDataIndexedDBHelper::IndexedDBInfo& info);
+
+// Switches the display to an individual storage item.
+void gtk_chrome_cookie_view_display_local_storage_item(
+ GtkChromeCookieView* widget,
+ const std::string& host,
+ const string16& key,
+ const string16& value);
+
+void gtk_chrome_cookie_view_display_database_accessed(
+ GtkChromeCookieView* self,
+ const std::string& host,
+ const string16& database_name,
+ const string16& display_name,
+ unsigned long estimated_size);
+
+void gtk_chrome_cookie_view_display_appcache_created(
+ GtkChromeCookieView* self,
+ const GURL& manifest_url);
+
+// If |editable_expiration| was true at construction time, returns the value of
+// the combo box. Otherwise, returns false.
+bool gtk_chrome_cookie_view_session_expires(GtkChromeCookieView* self);
+
+#endif // CHROME_BROWSER_UI_GTK_GTK_CHROME_COOKIE_VIEW_H_
diff --git a/chrome/browser/gtk/gtk_chrome_link_button.cc b/chrome/browser/ui/gtk/gtk_chrome_link_button.cc
index 0da375f..38514bf 100644
--- a/chrome/browser/gtk/gtk_chrome_link_button.cc
+++ b/chrome/browser/ui/gtk/gtk_chrome_link_button.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/gtk_chrome_link_button.h b/chrome/browser/ui/gtk/gtk_chrome_link_button.h
new file mode 100644
index 0000000..4532b02
--- /dev/null
+++ b/chrome/browser/ui/gtk/gtk_chrome_link_button.h
@@ -0,0 +1,79 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Creates a link button that shows |text| in blue and underlined. The cursor
+// changes to a hand when over the link. This is like the GTK LinkButton, but
+// it doesn't call the global URI link handler, etc. It is a button subclass,
+// so you can just handle the clicked signal.
+
+#ifndef CHROME_BROWSER_UI_GTK_GTK_CHROME_LINK_BUTTON_H_
+#define CHROME_BROWSER_UI_GTK_GTK_CHROME_LINK_BUTTON_H_
+#pragma once
+
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_CHROME_LINK_BUTTON (gtk_chrome_link_button_get_type ())
+#define GTK_CHROME_LINK_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GTK_TYPE_CHROME_LINK_BUTTON, \
+ GtkChromeLinkButton))
+#define GTK_CHROME_LINK_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GTK_TYPE_CHROME_LINK_BUTTON, \
+ GtkChromeLinkButtonClass))
+#define GTK_IS_CHROME_LINK_BUTTON(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_CHROME_LINK_BUTTON))
+#define GTK_IS_CHROME_LINK_BUTTON_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_CHROME_LINK_BUTTON))
+#define GTK_CHROME_LINK_BUTTON_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_CHROME_LINK_BUTTON, \
+ GtkChromeLinkButton))
+
+typedef struct _GtkChromeLinkButton GtkChromeLinkButton;
+typedef struct _GtkChromeLinkButtonClass GtkChromeLinkButtonClass;
+
+struct _GtkChromeLinkButton {
+ GtkButton button;
+ GtkWidget* label;
+ gchar* normal_markup;
+ gchar* pressed_markup;
+ gboolean is_normal;
+ gchar normal_color[9];
+ gchar* native_markup;
+ gboolean using_native_theme;
+ GdkCursor* hand_cursor;
+ gchar* text;
+ gboolean uses_markup;
+};
+
+struct _GtkChromeLinkButtonClass {
+ GtkButtonClass parent_class;
+};
+
+// Make a link button with display text |text|.
+GtkWidget* gtk_chrome_link_button_new(const char* text);
+
+// As above, but don't escape markup in the text.
+GtkWidget* gtk_chrome_link_button_new_with_markup(const char* markup);
+
+// Set whether the link button draws natively (using "link-color"). The default
+// is TRUE.
+void gtk_chrome_link_button_set_use_gtk_theme(GtkChromeLinkButton* button,
+ gboolean use_gtk);
+
+// Set the label text of the link.
+void gtk_chrome_link_button_set_label(GtkChromeLinkButton* button,
+ const char* text);
+
+// Set the color when the link is in a normal state (i.e. not pressed).
+// If not set, or called NULL |color|, the color will be blue.
+void gtk_chrome_link_button_set_normal_color(GtkChromeLinkButton* button,
+ const GdkColor* color);
+
+GType gtk_chrome_link_button_get_type();
+
+G_END_DECLS
+
+#endif // CHROME_BROWSER_UI_GTK_GTK_CHROME_LINK_BUTTON_H_
diff --git a/chrome/browser/gtk/gtk_chrome_shrinkable_hbox.cc b/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.cc
index 3ce83d0..db49fa4 100644
--- a/chrome/browser/gtk/gtk_chrome_shrinkable_hbox.cc
+++ b/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h b/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h
new file mode 100644
index 0000000..240021a
--- /dev/null
+++ b/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h
@@ -0,0 +1,87 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_GTK_CHROME_SHRINKABLE_HBOX_H_
+#define CHROME_BROWSER_UI_GTK_GTK_CHROME_SHRINKABLE_HBOX_H_
+#pragma once
+
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+
+// A specialized container derived from GtkHBox, which can shrink or hide its
+// children one by one to fit into its width.
+//
+// Limitations of this container:
+// - All children should have the same pack type, otherwise they may be
+// overlapped with each other.
+// - All children must be packed with expand == false and fill == false,
+// otherwise they may be overlapped with each other.
+// - The visibility of a child is adjusted automatically according to the
+// container's width. The child may not show or hide itself.
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_CHROME_SHRINKABLE_HBOX \
+ (gtk_chrome_shrinkable_hbox_get_type())
+#define GTK_CHROME_SHRINKABLE_HBOX(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_CHROME_SHRINKABLE_HBOX, \
+ GtkChromeShrinkableHBox))
+#define GTK_CHROME_SHRINKABLE_HBOX_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_CHROME_SHRINKABLE_HBOX, \
+ GtkChromeShrinkableHBoxClass))
+#define GTK_IS_CHROME_SHRINKABLE_HBOX(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_CHROME_SHRINKABLE_HBOX))
+#define GTK_IS_CHROME_SHRINKABLE_HBOX_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_CHROME_SHRINKABLE_HBOX))
+#define GTK_CHROME_SHRINKABLE_HBOX_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_CHROME_SHRINKABLE_HBOX, \
+ GtkChromeShrinkableHBoxClass))
+
+typedef struct _GtkChromeShrinkableHBox GtkChromeShrinkableHBox;
+typedef struct _GtkChromeShrinkableHBoxClass GtkChromeShrinkableHBoxClass;
+
+struct _GtkChromeShrinkableHBox {
+ // Parent class.
+ GtkHBox hbox;
+
+ gboolean hide_child_directly;
+
+ // Private
+ int children_width_requisition;
+};
+
+struct _GtkChromeShrinkableHBoxClass {
+ GtkHBoxClass parent_class;
+};
+
+GType gtk_chrome_shrinkable_hbox_get_type() G_GNUC_CONST;
+
+// Creates a new shrinkable hbox.
+// If |hide_child_directly| is true then its child widgets will be hid directly
+// if they are too wide to be fit into the hbox's width. Otherwise they will be
+// shrunk first before being hid completely.
+GtkWidget* gtk_chrome_shrinkable_hbox_new(gboolean hide_child_directly,
+ gboolean homogeneous,
+ gint spacing);
+
+void gtk_chrome_shrinkable_hbox_set_hide_child_directly(
+ GtkChromeShrinkableHBox* box, gboolean hide_child_directly);
+
+gboolean gtk_chrome_shrinkable_hbox_get_hide_child_directly(
+ GtkChromeShrinkableHBox* box);
+
+void gtk_chrome_shrinkable_hbox_pack_start(GtkChromeShrinkableHBox* box,
+ GtkWidget* child,
+ guint padding);
+
+void gtk_chrome_shrinkable_hbox_pack_end(GtkChromeShrinkableHBox* box,
+ GtkWidget* child,
+ guint padding);
+
+gint gtk_chrome_shrinkable_hbox_get_visible_child_count(
+ GtkChromeShrinkableHBox* box);
+
+G_END_DECLS
+
+#endif // CHROME_BROWSER_UI_GTK_GTK_CHROME_SHRINKABLE_HBOX_H_
diff --git a/chrome/browser/gtk/gtk_chrome_shrinkable_hbox_unittest.cc b/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox_unittest.cc
index db9981f..c7bfcbe 100644
--- a/chrome/browser/gtk/gtk_chrome_shrinkable_hbox_unittest.cc
+++ b/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/gtk_custom_menu.cc b/chrome/browser/ui/gtk/gtk_custom_menu.cc
index 15eeb5a..ed71a1a 100644
--- a/chrome/browser/gtk/gtk_custom_menu.cc
+++ b/chrome/browser/ui/gtk/gtk_custom_menu.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/gtk_custom_menu.h b/chrome/browser/ui/gtk/gtk_custom_menu.h
new file mode 100644
index 0000000..e832cb0
--- /dev/null
+++ b/chrome/browser/ui/gtk/gtk_custom_menu.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_GTK_CUSTOM_MENU_H_
+#define CHROME_BROWSER_UI_GTK_GTK_CUSTOM_MENU_H_
+#pragma once
+
+// GtkCustomMenu is a GtkMenu subclass that can contain, and collaborates with,
+// GtkCustomMenuItem instances. GtkCustomMenuItem is a GtkMenuItem that can
+// have buttons and other normal widgets embeded in it. GtkCustomMenu exists
+// only to override most of the button/motion/move callback functions so
+// that the normal GtkMenu implementation doesn't handle events related to
+// GtkCustomMenuItem items.
+//
+// For a more through overview of this system, see the comments in
+// gtk_custom_menu_item.h.
+
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+#include <gtk/gtkmenuitem.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_CUSTOM_MENU \
+ (gtk_custom_menu_get_type())
+#define GTK_CUSTOM_MENU(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_CUSTOM_MENU, GtkCustomMenu))
+#define GTK_CUSTOM_MENU_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_CUSTOM_MENU, GtkCustomMenuClass))
+#define GTK_IS_CUSTOM_MENU(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_CUSTOM_MENU))
+#define GTK_IS_CUSTOM_MENU_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_CUSTOM_MENU))
+#define GTK_CUSTOM_MENU_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_CUSTOM_MENU, GtkCustomMenuClass))
+
+typedef struct _GtkCustomMenu GtkCustomMenu;
+typedef struct _GtkCustomMenuClass GtkCustomMenuClass;
+
+struct _GtkCustomMenu {
+ GtkMenu menu;
+};
+
+struct _GtkCustomMenuClass {
+ GtkMenuClass parent_class;
+};
+
+GType gtk_custom_menu_get_type(void) G_GNUC_CONST;
+GtkWidget* gtk_custom_menu_new();
+
+G_END_DECLS
+
+#endif // CHROME_BROWSER_UI_GTK_GTK_CUSTOM_MENU_H_
diff --git a/chrome/browser/gtk/gtk_custom_menu_item.cc b/chrome/browser/ui/gtk/gtk_custom_menu_item.cc
index a3d62d4..9c3f0fd 100644
--- a/chrome/browser/gtk/gtk_custom_menu_item.cc
+++ b/chrome/browser/ui/gtk/gtk_custom_menu_item.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/gtk_custom_menu_item.h b/chrome/browser/ui/gtk/gtk_custom_menu_item.h
new file mode 100644
index 0000000..d0fbf1a
--- /dev/null
+++ b/chrome/browser/ui/gtk/gtk_custom_menu_item.h
@@ -0,0 +1,141 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_GTK_CUSTOM_MENU_ITEM_H_
+#define CHROME_BROWSER_UI_GTK_GTK_CUSTOM_MENU_ITEM_H_
+#pragma once
+
+// GtkCustomMenuItem is a GtkMenuItem subclass that has buttons in it and acts
+// to support this. GtkCustomMenuItems only render properly when put in a
+// GtkCustomMenu; there's a lot of collaboration between these two classes
+// necessary to work around how gtk normally does menus.
+//
+// We can't rely on the normal event infrastructure. While a menu is up, the
+// GtkMenu has a grab on all events. Instead of trying to pump events through
+// the normal channels, we have the GtkCustomMenu selectively forward mouse
+// motion through a back channel. The GtkCustomMenu only listens for button
+// press information so it can block the effects of the click if the cursor
+// isn't in a button in the menu item.
+//
+// A GtkCustomMenuItem doesn't try to take these signals and forward them to
+// the buttons it owns. The GtkCustomMenu class keeps track of which button is
+// selected (due to key events and mouse movement) and otherwise acts like a
+// normal GtkItem. The buttons are only for sizing and rendering; they don't
+// respond to events. Instead, when the GtkCustomMenuItem is activated by the
+// GtkMenu, it uses which button was selected as a signal of what to do.
+//
+// Users should connect to the "button-pushed" signal to be notified when a
+// button was pushed. We don't go through the normal "activate" signal because
+// we need to communicate additional information, namely which button was
+// activated.
+
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_CUSTOM_MENU_ITEM \
+ (gtk_custom_menu_item_get_type())
+#define GTK_CUSTOM_MENU_ITEM(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_CUSTOM_MENU_ITEM, \
+ GtkCustomMenuItem))
+#define GTK_CUSTOM_MENU_ITEM_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_CUSTOM_MENU_ITEM, \
+ GtkCustomMenuItemClass))
+#define GTK_IS_CUSTOM_MENU_ITEM(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_CUSTOM_MENU_ITEM))
+#define GTK_IS_CUSTOM_MENU_ITEM_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_CUSTOM_MENU_ITEM))
+#define GTK_CUSTOM_MENU_ITEM_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_CUSTOM_MENU_ITEM, \
+ GtkCustomMenuItemClass))
+
+typedef struct _GtkCustomMenuItem GtkCustomMenuItem;
+typedef struct _GtkCustomMenuItemClass GtkCustomMenuItemClass;
+
+struct _GtkCustomMenuItem {
+ GtkMenuItem menu_item;
+
+ // Container for button widgets.
+ GtkWidget* hbox;
+
+ // Label on left side of menu item.
+ GtkWidget* label;
+
+ // List of all widgets we added. Used to find the leftmost and rightmost
+ // continuous buttons.
+ GList* all_widgets;
+
+ // Possible button widgets. Used for keyboard navigation.
+ GList* button_widgets;
+
+ // The widget that currently has highlight.
+ GtkWidget* currently_selected_button;
+
+ // The widget that was selected *before* |currently_selected_button|. Why do
+ // we hang on to this? Because the menu system sends us a deselect signal
+ // right before activating us. We need to listen to deselect since that's
+ // what we receive when the mouse cursor leaves us entirely.
+ GtkWidget* previously_selected_button;
+};
+
+struct _GtkCustomMenuItemClass {
+ GtkMenuItemClass parent_class;
+};
+
+GType gtk_custom_menu_item_get_type(void) G_GNUC_CONST;
+GtkWidget* gtk_custom_menu_item_new(const char* title);
+
+// Adds a button to our list of items in the |hbox|.
+GtkWidget* gtk_custom_menu_item_add_button(GtkCustomMenuItem* menu_item,
+ int command_id);
+
+// Adds a button to our list of items in the |hbox|, but that isn't part of
+// |button_widgets| to prevent it from being activatable.
+GtkWidget* gtk_custom_menu_item_add_button_label(GtkCustomMenuItem* menu_item,
+ int command_id);
+
+// Adds a vertical space in the |hbox|.
+void gtk_custom_menu_item_add_space(GtkCustomMenuItem* menu_item);
+
+// Receives a motion event from the GtkCustomMenu that contains us. We can't
+// just subscribe to motion-event or the individual widget enter/leave events
+// because the top level GtkMenu has an event grab.
+void gtk_custom_menu_item_receive_motion_event(GtkCustomMenuItem* menu_item,
+ gdouble x, gdouble y);
+
+// Notification that the menu got a cursor key event. Used to move up/down
+// within the menu buttons. Returns TRUE to stop the default signal handler
+// from running.
+gboolean gtk_custom_menu_item_handle_move(GtkCustomMenuItem* menu_item,
+ GtkMenuDirectionType direction);
+
+// Because we only get a generic "selected" signal when we've changed, we need
+// to have a way for the GtkCustomMenu to tell us that we were just
+// selected.
+void gtk_custom_menu_item_select_item_by_direction(
+ GtkCustomMenuItem* menu_item, GtkMenuDirectionType direction);
+
+// Whether we are currently hovering over a clickable region on the menu
+// item. Used by GtkCustomMenu to determine whether it should discard click
+// events.
+gboolean gtk_custom_menu_item_is_in_clickable_region(
+ GtkCustomMenuItem* menu_item);
+
+// If the button is released while the |currently_selected_button| isn't
+// supposed to dismiss the menu, this signals to our listeners that we want to
+// run this command if it doesn't dismiss the menu. Returns TRUE if we acted
+// on this button click (and should prevent the normal GtkMenu machinery from
+// firing an "activate" signal).
+gboolean gtk_custom_menu_item_try_no_dismiss_command(
+ GtkCustomMenuItem* menu_item);
+
+// Calls |callback| with every button and button-label in the container.
+void gtk_custom_menu_item_foreach_button(GtkCustomMenuItem* menu_item,
+ GtkCallback callback,
+ gpointer callback_data);
+
+G_END_DECLS
+
+#endif // CHROME_BROWSER_UI_GTK_GTK_CUSTOM_MENU_ITEM_H_
diff --git a/chrome/browser/gtk/gtk_expanded_container.cc b/chrome/browser/ui/gtk/gtk_expanded_container.cc
index 4e5daad..3b2a9a5 100644
--- a/chrome/browser/gtk/gtk_expanded_container.cc
+++ b/chrome/browser/ui/gtk/gtk_expanded_container.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/gtk_expanded_container.h b/chrome/browser/ui/gtk/gtk_expanded_container.h
new file mode 100644
index 0000000..ffc9163
--- /dev/null
+++ b/chrome/browser/ui/gtk/gtk_expanded_container.h
@@ -0,0 +1,71 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_GTK_EXPANDED_CONTAINER_H_
+#define CHROME_BROWSER_UI_GTK_GTK_EXPANDED_CONTAINER_H_
+#pragma once
+
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+
+// A specialized container derived from GtkFixed, which expands the size of its
+// children to fill the container, in one or both directions. The usage of this
+// container is similar to GtkFixed.
+//
+// The "child-size-request" signal is optional, if you want to expand child
+// widgets to customized size other than the container's size. It should have
+// the following signature:
+//
+// void (*child_size_request)(GtkExpandedContainer* container,
+// GtkWidget* child,
+// GtkRequisition* requisition);
+//
+// This signal is emitted for each child with the requisition set to the size of
+// the container. Your handler may adjust the value of the requisition. If the
+// width or height is set to -1, then that direction will not be expanded, and
+// the original size request of the child will be used.
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_EXPANDED_CONTAINER \
+ (gtk_expanded_container_get_type())
+#define GTK_EXPANDED_CONTAINER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_EXPANDED_CONTAINER, \
+ GtkExpandedContainer))
+#define GTK_EXPANDED_CONTAINER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_EXPANDED_CONTAINER, \
+ GtkExpandedContainerClass))
+#define GTK_IS_EXPANDED_CONTAINER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_EXPANDED_CONTAINER))
+#define GTK_IS_EXPANDED_CONTAINER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_EXPANDED_CONTAINER))
+#define GTK_EXPANDED_CONTAINER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_EXPANDED_CONTAINER, \
+ GtkExpandedContainerClass))
+
+typedef struct _GtkExpandedContainer GtkExpandedContainer;
+typedef struct _GtkExpandedContainerClass GtkExpandedContainerClass;
+
+struct _GtkExpandedContainer {
+ // Parent class.
+ GtkFixed fixed;
+};
+
+struct _GtkExpandedContainerClass {
+ GtkFixedClass parent_class;
+};
+
+GType gtk_expanded_container_get_type() G_GNUC_CONST;
+GtkWidget* gtk_expanded_container_new();
+void gtk_expanded_container_put(GtkExpandedContainer* container,
+ GtkWidget* widget, gint x, gint y);
+void gtk_expanded_container_move(GtkExpandedContainer* container,
+ GtkWidget* widget, gint x, gint y);
+void gtk_expanded_container_set_has_window(GtkExpandedContainer* container,
+ gboolean has_window);
+gboolean gtk_expanded_container_get_has_window(GtkExpandedContainer* container);
+
+G_END_DECLS
+
+#endif // CHROME_BROWSER_UI_GTK_GTK_EXPANDED_CONTAINER_H_
diff --git a/chrome/browser/gtk/gtk_expanded_container_unittest.cc b/chrome/browser/ui/gtk/gtk_expanded_container_unittest.cc
index d400bb1..609231b 100644
--- a/chrome/browser/gtk/gtk_expanded_container_unittest.cc
+++ b/chrome/browser/ui/gtk/gtk_expanded_container_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/gtk_floating_container.cc b/chrome/browser/ui/gtk/gtk_floating_container.cc
index ab8a49e..2b1f7f1 100644
--- a/chrome/browser/gtk/gtk_floating_container.cc
+++ b/chrome/browser/ui/gtk/gtk_floating_container.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/gtk_floating_container.h b/chrome/browser/ui/gtk/gtk_floating_container.h
new file mode 100644
index 0000000..9b15b74
--- /dev/null
+++ b/chrome/browser/ui/gtk/gtk_floating_container.h
@@ -0,0 +1,87 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_GTK_FLOATING_CONTAINER_H_
+#define CHROME_BROWSER_UI_GTK_GTK_FLOATING_CONTAINER_H_
+#pragma once
+
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+
+// A specialized container, which is a cross between a GtkBin and a
+// GtkFixed. This container dervies from GtkBin and the implementation of
+// gtk_container_add() is the same: only one GtkWidget can be added through
+// that interface. The GtkBin portion contains normal content and is given the
+// same allocation that this container has.
+//
+// In addition, any number of widgets can be added through the
+// gtk_floating_container_add_floating() method, which provides functionality
+// similar to a GtkFixed. Unlike a GtkFixed, coordinates are not set when you
+// gtk_fixed_put(). The location of the floating widgets is determined while
+// running the "set-floating-position" signal, which is emitted during this
+// container's "size-allocate" handler.
+//
+// The "set-floating-position" signal is (semi-)mandatory if you want widgets
+// placed anywhere other than the origin and should have the following
+// signature:
+//
+// void (*set_floating_position)(GtkFloatingContainer* container,
+// GtkAllocation* allocation,
+// gpointer userdata);
+//
+// Your handler should, for each floating widget, set the "x" and "y" child
+// properties.
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_FLOATING_CONTAINER \
+ (gtk_floating_container_get_type())
+#define GTK_FLOATING_CONTAINER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_FLOATING_CONTAINER, \
+ GtkFloatingContainer))
+#define GTK_FLOATING_CONTAINER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_FLOATING_CONTAINER, \
+ GtkFloatingContainerClass))
+#define GTK_IS_FLOATING_CONTAINER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_FLOATING_CONTAINER))
+#define GTK_IS_FLOATING_CONTAINER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_FLOATING_CONTAINER))
+#define GTK_FLOATING_CONTAINER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_FLOATING_CONTAINER, \
+ GtkFloatingContainerClass))
+
+typedef struct _GtkFloatingContainer GtkFloatingContainer;
+typedef struct _GtkFloatingContainerClass GtkFloatingContainerClass;
+typedef struct _GtkFloatingContainerChild GtkFloatingContainerChild;
+
+struct _GtkFloatingContainer {
+ // Parent class.
+ GtkBin bin;
+
+ // A GList of all our floating children, in GtkFloatingContainerChild
+ // structs. Owned by the GtkFloatingContainer.
+ GList* floating_children;
+};
+
+struct _GtkFloatingContainerClass {
+ GtkBinClass parent_class;
+};
+
+// Internal structure used to associate a widget and its x/y child properties.
+struct _GtkFloatingContainerChild {
+ GtkWidget* widget;
+ gint x;
+ gint y;
+};
+
+GType gtk_floating_container_get_type() G_GNUC_CONST;
+GtkWidget* gtk_floating_container_new();
+void gtk_floating_container_add_floating(GtkFloatingContainer* container,
+ GtkWidget* widget);
+// Use gtk_container_remove to remove all widgets; both widgets added with
+// gtk_container_add() and gtk_floating_container_add_floating().
+
+G_END_DECLS
+
+#endif // CHROME_BROWSER_UI_GTK_GTK_FLOATING_CONTAINER_H_
diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/ui/gtk/gtk_theme_provider.cc
index 84c44b3..31e2aca 100644
--- a/chrome/browser/gtk/gtk_theme_provider.cc
+++ b/chrome/browser/ui/gtk/gtk_theme_provider.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/gtk_theme_provider.h b/chrome/browser/ui/gtk/gtk_theme_provider.h
new file mode 100644
index 0000000..458c201
--- /dev/null
+++ b/chrome/browser/ui/gtk/gtk_theme_provider.h
@@ -0,0 +1,309 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_GTK_THEME_PROVIDER_H_
+#define CHROME_BROWSER_UI_GTK_GTK_THEME_PROVIDER_H_
+#pragma once
+
+#include <map>
+#include <vector>
+
+#include "app/gtk_integers.h"
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/prefs/pref_change_registrar.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/browser/themes/browser_theme_provider.h"
+#include "chrome/common/notification_observer.h"
+#include "gfx/color_utils.h"
+
+class CairoCachedSurface;
+class GtkSignalRegistrar;
+class Profile;
+
+typedef struct _GdkDisplay GdkDisplay;
+typedef struct _GdkEventExpose GdkEventExpose;
+typedef struct _GdkPixbuf GdkPixbuf;
+typedef struct _GtkIconSet GtkIconSet;
+typedef struct _GtkStyle GtkStyle;
+typedef struct _GtkWidget GtkWidget;
+
+// Specialization of BrowserThemeProvider which supplies system colors.
+class GtkThemeProvider : public BrowserThemeProvider,
+ public NotificationObserver {
+ public:
+ // Returns GtkThemeProvider, casted from our superclass.
+ static GtkThemeProvider* GetFrom(Profile* profile);
+
+ GtkThemeProvider();
+ virtual ~GtkThemeProvider();
+
+ // Calls |observer|.Observe() for the browser theme with this provider as the
+ // source.
+ void InitThemesFor(NotificationObserver* observer);
+
+ // Overridden from BrowserThemeProvider:
+ //
+ // Sets that we aren't using the system theme, then calls
+ // BrowserThemeProvider's implementation.
+ virtual void Init(Profile* profile);
+ virtual SkBitmap* GetBitmapNamed(int id) const;
+ virtual SkColor GetColor(int id) const;
+ virtual bool HasCustomImage(int id) const;
+ virtual void SetTheme(const Extension* extension);
+ virtual void UseDefaultTheme();
+ virtual void SetNativeTheme();
+ virtual bool UsingDefaultTheme();
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Creates a GtkChromeButton instance, registered with this theme provider,
+ // with a "destroy" signal to remove it from our internal list when it goes
+ // away.
+ GtkWidget* BuildChromeButton();
+
+ // Creates a theme-aware vertical separator widget.
+ GtkWidget* CreateToolbarSeparator();
+
+ // Whether we should use the GTK system theme.
+ bool UseGtkTheme() const;
+
+ // A wrapper around ThemeProvider::GetColor, transforming the result to a
+ // GdkColor.
+ GdkColor GetGdkColor(int id) const;
+
+ // A weighted average between the text color and the background color of a
+ // label. Used for borders between GTK stuff and the webcontent.
+ GdkColor GetBorderColor() const;
+
+ // Returns a set of icons tinted for different GtkStateTypes based on the
+ // label colors for the IDR resource |id|.
+ GtkIconSet* GetIconSetForId(int id) const;
+
+ // This method returns the colors webkit will use for the scrollbars. When no
+ // colors are specified by the GTK+ theme, this function averages of the
+ // thumb part and of the track colors.
+ void GetScrollbarColors(GdkColor* thumb_active_color,
+ GdkColor* thumb_inactive_color,
+ GdkColor* track_color);
+
+ // Expose the inner label. Only used for testing.
+ GtkWidget* fake_label() { return fake_label_.get(); }
+
+ // Returns a CairoCachedSurface for a particular Display. CairoCachedSurfaces
+ // (hopefully) live on the X server, instead of the client so we don't have
+ // to send the image to the server on each expose.
+ CairoCachedSurface* GetSurfaceNamed(int id, GtkWidget* widget_on_display);
+
+ // Same as above, but auto-mirrors the underlying pixbuf in RTL mode.
+ CairoCachedSurface* GetRTLEnabledSurfaceNamed(int id,
+ GtkWidget* widget_on_display);
+
+ // Same as above, but gets the resource from the ResourceBundle instead of the
+ // BrowserThemeProvider.
+ // NOTE: Never call this with resource IDs that are ever passed to the above
+ // two functions! Depending on which call comes first, all callers will
+ // either get the themed or the unthemed version.
+ CairoCachedSurface* GetUnthemedSurfaceNamed(int id,
+ GtkWidget* widget_on_display);
+
+ // Returns colors that we pass to webkit to match the system theme.
+ const SkColor& get_focus_ring_color() const { return focus_ring_color_; }
+ const SkColor& get_thumb_active_color() const { return thumb_active_color_; }
+ const SkColor& get_thumb_inactive_color() const {
+ return thumb_inactive_color_;
+ }
+ const SkColor& get_track_color() const { return track_color_; }
+ const SkColor& get_active_selection_bg_color() const {
+ return active_selection_bg_color_;
+ }
+ const SkColor& get_active_selection_fg_color() const {
+ return active_selection_fg_color_;
+ }
+ const SkColor& get_inactive_selection_bg_color() const {
+ return inactive_selection_bg_color_;
+ }
+ const SkColor& get_inactive_selection_fg_color() const {
+ return inactive_selection_fg_color_;
+ }
+
+ // These functions do not add a ref to the returned pixbuf, and it should not
+ // be unreffed. If |native| is true, get the GTK_STOCK version of the icon.
+ static GdkPixbuf* GetFolderIcon(bool native);
+ static GdkPixbuf* GetDefaultFavicon(bool native);
+
+ // Whether we use the GTK theme by default in the current desktop
+ // environment. Returns true when we GTK defaults to on.
+ static bool DefaultUsesSystemTheme();
+
+ private:
+ typedef std::map<int, SkColor> ColorMap;
+ typedef std::map<int, color_utils::HSL> TintMap;
+ typedef std::map<int, SkBitmap*> ImageCache;
+ typedef std::map<int, CairoCachedSurface*> CairoCachedSurfaceMap;
+ typedef std::map<GdkDisplay*, CairoCachedSurfaceMap> PerDisplaySurfaceMap;
+
+ // Clears all the GTK color overrides.
+ virtual void ClearAllThemeData();
+
+ // Load theme data from preferences, possibly picking colors from GTK.
+ virtual void LoadThemePrefs();
+
+ // Let all the browser views know that themes have changed.
+ virtual void NotifyThemeChanged(const Extension* extension);
+
+ // Additionally frees the CairoCachedSurfaces.
+ virtual void FreePlatformCaches();
+
+ // Extracts colors and tints from the GTK theme, both for the
+ // BrowserThemeProvider interface and the colors we send to webkit.
+ void LoadGtkValues();
+
+ // Reads in explicit theme frame colors from the ChromeGtkFrame style class
+ // or generates them per our fallback algorithm.
+ GdkColor BuildFrameColors(GtkStyle* frame_style);
+
+ // Sets the values that we send to webkit to safe defaults.
+ void LoadDefaultValues();
+
+ // Builds all of the tinted menus images needed for custom buttons. This is
+ // always called on style-set even if we aren't using the gtk-theme because
+ // the menus are always rendered with gtk colors.
+ void RebuildMenuIconSets();
+
+ // Sets the underlying theme colors/tints from a GTK color.
+ void SetThemeColorFromGtk(int id, const GdkColor* color);
+ void SetThemeTintFromGtk(int id, const GdkColor* color);
+
+ // Creates and returns a frame color, either using |gtk_base| verbatim if
+ // non-NULL, or tinting |base| with |tint|. Also sets |color_id| and
+ // |tint_id| to the returned color.
+ GdkColor BuildAndSetFrameColor(const GdkColor* base,
+ const GdkColor* gtk_base,
+ const color_utils::HSL& tint,
+ int color_id,
+ int tint_id);
+
+ // Split out from FreePlatformCaches so it can be called in our destructor;
+ // FreePlatformCaches() is called from the BrowserThemeProvider's destructor,
+ // but by the time ~BrowserThemeProvider() is run, the vtable no longer
+ // points to GtkThemeProvider's version.
+ void FreePerDisplaySurfaces(PerDisplaySurfaceMap* per_display_map);
+
+ // Frees all the created GtkIconSets we use for the chrome menu.
+ void FreeIconSets();
+
+ // Lazily generates each bitmap used in the gtk theme.
+ SkBitmap* GenerateGtkThemeBitmap(int id) const;
+
+ // Creates a GTK+ version of IDR_THEME_FRAME. Instead of tinting, this
+ // creates a theme configurable gradient ending with |color_id| at the
+ // bottom, and |gradient_name| at the top if that color is specified in the
+ // theme.
+ SkBitmap* GenerateFrameImage(int color_id,
+ const char* gradient_name) const;
+
+ // Takes the base frame image |base_id| and tints it with |tint_id|.
+ SkBitmap* GenerateTabImage(int base_id) const;
+
+ // Tints an icon based on tint.
+ SkBitmap* GenerateTintedIcon(int base_id, color_utils::HSL tint) const;
+
+ // Returns the tint for buttons that contrasts with the normal window
+ // background color.
+ void GetNormalButtonTintHSL(color_utils::HSL* tint) const;
+
+ // Returns a tint that's the color of the current normal text in an entry.
+ void GetNormalEntryForegroundHSL(color_utils::HSL* tint) const;
+
+ // Returns a tint that's the color of the current highlighted text in an
+ // entry.
+ void GetSelectedEntryForegroundHSL(color_utils::HSL* tint) const;
+
+ // Implements GetXXXSurfaceNamed(), given the appropriate pixbuf to use.
+ CairoCachedSurface* GetSurfaceNamedImpl(int id,
+ PerDisplaySurfaceMap* surface_map,
+ GdkPixbuf* pixbuf,
+ GtkWidget* widget_on_display);
+
+ // Handles signal from GTK that our theme has been changed.
+ CHROMEGTK_CALLBACK_1(GtkThemeProvider, void, OnStyleSet, GtkStyle*);
+
+ // A notification from the GtkChromeButton GObject destructor that we should
+ // remove it from our internal list.
+ CHROMEGTK_CALLBACK_0(GtkThemeProvider, void, OnDestroyChromeButton);
+
+ CHROMEGTK_CALLBACK_1(GtkThemeProvider, gboolean, OnSeparatorExpose,
+ GdkEventExpose*);
+
+ // Whether we should be using gtk rendering.
+ bool use_gtk_;
+
+ // GtkWidgets that exist only so we can look at their properties (and take
+ // their colors).
+ GtkWidget* fake_window_;
+ GtkWidget* fake_frame_;
+ OwnedWidgetGtk fake_label_;
+ OwnedWidgetGtk fake_entry_;
+ OwnedWidgetGtk fake_menu_item_;
+
+ // A list of all GtkChromeButton instances. We hold on to these to notify
+ // them of theme changes.
+ std::vector<GtkWidget*> chrome_buttons_;
+
+ // Tracks all the signals we have connected to on various widgets.
+ scoped_ptr<GtkSignalRegistrar> signals_;
+
+ // Tints and colors calculated by LoadGtkValues() that are given to the
+ // caller while |use_gtk_| is true.
+ ColorMap colors_;
+ TintMap tints_;
+
+ // Colors used to tint certain icons.
+ color_utils::HSL button_tint_;
+ color_utils::HSL entry_tint_;
+ color_utils::HSL selected_entry_tint_;
+
+ // Colors that we pass to WebKit. These are generated each time the theme
+ // changes.
+ SkColor focus_ring_color_;
+ SkColor thumb_active_color_;
+ SkColor thumb_inactive_color_;
+ SkColor track_color_;
+ SkColor active_selection_bg_color_;
+ SkColor active_selection_fg_color_;
+ SkColor inactive_selection_bg_color_;
+ SkColor inactive_selection_fg_color_;
+
+ // A GtkIconSet that has the tinted icons for the NORMAL and PRELIGHT states
+ // of the IDR_FULLSCREEN_MENU_BUTTON tinted to the respective menu item label
+ // colors.
+ GtkIconSet* fullscreen_icon_set_;
+
+ // Image cache of lazily created images, created when requested by
+ // GetBitmapNamed().
+ mutable ImageCache gtk_images_;
+
+ // Cairo surfaces for each GdkDisplay.
+ PerDisplaySurfaceMap per_display_surfaces_;
+ PerDisplaySurfaceMap per_display_unthemed_surfaces_;
+
+ PrefChangeRegistrar registrar_;
+
+ // This is a dummy widget that only exists so we have something to pass to
+ // gtk_widget_render_icon().
+ static GtkWidget* icon_widget_;
+
+ // The default folder icon and default bookmark icon for the GTK theme.
+ // These are static because the system can only have one theme at a time.
+ // They are cached when they are requested the first time, and cleared when
+ // the system theme changes.
+ static GdkPixbuf* default_folder_icon_;
+ static GdkPixbuf* default_bookmark_icon_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_GTK_THEME_PROVIDER_H_
diff --git a/chrome/browser/gtk/gtk_theme_provider_unittest.cc b/chrome/browser/ui/gtk/gtk_theme_provider_unittest.cc
index e2a7272..baedfe0 100644
--- a/chrome/browser/gtk/gtk_theme_provider_unittest.cc
+++ b/chrome/browser/ui/gtk/gtk_theme_provider_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/gtk_tree.cc b/chrome/browser/ui/gtk/gtk_tree.cc
index 46307da..e0673cc 100644
--- a/chrome/browser/gtk/gtk_tree.cc
+++ b/chrome/browser/ui/gtk/gtk_tree.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/gtk_tree.h b/chrome/browser/ui/gtk/gtk_tree.h
new file mode 100644
index 0000000..a37e5d1
--- /dev/null
+++ b/chrome/browser/ui/gtk/gtk_tree.h
@@ -0,0 +1,207 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_GTK_TREE_H_
+#define CHROME_BROWSER_UI_GTK_GTK_TREE_H_
+#pragma once
+
+#include <gtk/gtk.h>
+#include <set>
+#include <vector>
+
+#include "app/table_model_observer.h"
+#include "app/tree_model.h"
+#include "base/basictypes.h"
+#include "chrome/browser/remove_rows_table_model.h"
+
+class TableModel;
+
+namespace gtk_tree {
+
+// Get the row number corresponding to |path|.
+gint GetRowNumForPath(GtkTreePath* path);
+
+// Get the row number corresponding to |iter|.
+gint GetRowNumForIter(GtkTreeModel* model, GtkTreeIter* iter);
+
+// Get the row number in the child tree model corresponding to |sort_path| in
+// the parent tree model.
+gint GetTreeSortChildRowNumForPath(GtkTreeModel* sort_model,
+ GtkTreePath* sort_path);
+
+// Select the given row by number.
+void SelectAndFocusRowNum(int row, GtkTreeView* tree_view);
+
+// Remove the row and all its children from the |tree_store|. If there is a
+// following row, |iter| will be updated to point to the it and the return value
+// will be true, otherwise the return will be false and |iter| is no longer
+// valid.
+bool RemoveRecursively(GtkTreeStore* tree_store, GtkTreeIter* iter);
+
+// Writes all the indexes of selected rows into |out|.
+void GetSelectedIndices(GtkTreeSelection* selection, std::set<int>* out);
+
+// A helper class for populating a GtkListStore from a TableModel.
+class TableAdapter : public TableModelObserver {
+ public:
+
+ enum ColumnID {
+ COL_TITLE = 0,
+ COL_IS_HEADER,
+ COL_IS_SEPARATOR,
+ COL_GROUP_ID,
+ COL_WEIGHT,
+ COL_WEIGHT_SET,
+ COL_LAST_ID
+ };
+
+ class Delegate {
+ public:
+ // Should fill in the column and row.
+ virtual void SetColumnValues(int row, GtkTreeIter* iter) = 0;
+
+ // Called after any change to the TableModel but before the corresponding
+ // change to the GtkListStore.
+ virtual void OnAnyModelUpdateStart() {}
+
+ // Called after any change to the TableModel.
+ virtual void OnAnyModelUpdate() {}
+
+ // When the TableModel has been completely changed, called by OnModelChanged
+ // after clearing the list store. Can be overriden by the delegate if it
+ // needs to do extra initialization before the list store is populated.
+ virtual void OnModelChanged() {}
+
+ protected:
+ virtual ~Delegate() {}
+ };
+
+ // |table_model| may be NULL.
+ TableAdapter(Delegate* delegate,
+ GtkListStore* list_store,
+ TableModel* table_model);
+ virtual ~TableAdapter() {}
+
+ // Replace the TableModel with a different one. If the list store currenty
+ // has items this would cause weirdness, so this should generally only be
+ // called during the Delegate's OnModelChanged call, or if the adapter was
+ // created with a NULL |table_model|.
+ void SetModel(TableModel* table_model);
+
+ // Add all model rows corresponding to the given list store indices to |rows|.
+ void MapListStoreIndicesToModelRows(const std::set<int>& list_store_indices,
+ RemoveRowsTableModel::Rows* model_rows);
+
+ // GtkTreeModel callbacks:
+ // Callback checking whether a row should be drawn as a separator.
+ static gboolean OnCheckRowIsSeparator(GtkTreeModel* model,
+ GtkTreeIter* iter,
+ gpointer user_data);
+
+ // Callback checking whether a row may be selected. We use some rows in the
+ // table as headers/separators for the groups, which should not be selectable.
+ static gboolean OnSelectionFilter(GtkTreeSelection* selection,
+ GtkTreeModel* model,
+ GtkTreePath* path,
+ gboolean path_currently_selected,
+ gpointer user_data);
+
+ // TableModelObserver implementation.
+ virtual void OnModelChanged();
+ virtual void OnItemsChanged(int start, int length);
+ virtual void OnItemsAdded(int start, int length);
+ virtual void OnItemsRemoved(int start, int length);
+
+ private:
+ // Return whether the row pointed to by |iter| is a group row, i.e. a group
+ // header, or a separator.
+ bool IsGroupRow(GtkTreeIter* iter) const;
+
+ // Return the index into the list store for the given model row.
+ int GetListStoreIndexForModelRow(int model_row) const;
+
+ // Add the values from |row| of the TableModel.
+ void AddNodeToList(int row);
+
+ Delegate* delegate_;
+ GtkListStore* list_store_;
+ TableModel* table_model_;
+
+ DISALLOW_COPY_AND_ASSIGN(TableAdapter);
+};
+
+// A helper class for populating a GtkTreeStore from a TreeModel.
+// TODO(mattm): support SetRootShown(true)
+class TreeAdapter : public TreeModelObserver {
+ public:
+ // Column ids for |tree_store_|.
+ enum {
+ COL_ICON,
+ COL_TITLE,
+ COL_NODE_PTR,
+ COL_COUNT,
+ };
+
+ class Delegate {
+ public:
+ // Called after any change to the TreeModel but before the corresponding
+ // change to the GtkTreeStore.
+ virtual void OnAnyModelUpdateStart() {}
+
+ // Called after any change to the GtkTreeStore.
+ virtual void OnAnyModelUpdate() {}
+
+ protected:
+ virtual ~Delegate() {}
+ };
+
+ TreeAdapter(Delegate* delegate, TreeModel* tree_model);
+ virtual ~TreeAdapter();
+
+ // Populate the tree store from the |tree_model_|.
+ void Init();
+
+ // Return the tree store.
+ GtkTreeStore* tree_store() { return tree_store_; }
+
+ // Get the TreeModelNode corresponding to iter in the tree store.
+ TreeModelNode* GetNode(GtkTreeIter* iter);
+
+ // Begin TreeModelObserver implementation.
+ virtual void TreeNodesAdded(TreeModel* model,
+ TreeModelNode* parent,
+ int start,
+ int count);
+ virtual void TreeNodesRemoved(TreeModel* model,
+ TreeModelNode* parent,
+ int start,
+ int count);
+ virtual void TreeNodeChanged(TreeModel* model, TreeModelNode* node);
+ // End TreeModelObserver implementation.
+
+ private:
+ // Fill the tree store values for a given node.
+ void FillRow(GtkTreeIter* iter, TreeModelNode* node);
+
+ // Fill the tree store for a row and all its descendants.
+ void Fill(GtkTreeIter* parent_iter, TreeModelNode* parent_node);
+
+ // Get the GtkTreePath in the tree store for the given node.
+ // The returned path should be freed with gtk_tree_path_free.
+ GtkTreePath* GetTreePath(TreeModelNode* node);
+
+ // Get the GtkTreeIter in the tree store for the given node.
+ bool GetTreeIter(TreeModelNode* node, GtkTreeIter* iter);
+
+ Delegate* delegate_;
+ GtkTreeStore* tree_store_;
+ TreeModel* tree_model_;
+ std::vector<GdkPixbuf*> pixbufs_;
+
+ DISALLOW_COPY_AND_ASSIGN(TreeAdapter);
+};
+
+} // namespace gtk_tree
+
+#endif // CHROME_BROWSER_UI_GTK_GTK_TREE_H_
diff --git a/chrome/browser/gtk/gtk_util.cc b/chrome/browser/ui/gtk/gtk_util.cc
index bf7ba63..c837f24 100644
--- a/chrome/browser/gtk/gtk_util.cc
+++ b/chrome/browser/ui/gtk/gtk_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/gtk_util.h b/chrome/browser/ui/gtk/gtk_util.h
new file mode 100644
index 0000000..57ef74b
--- /dev/null
+++ b/chrome/browser/ui/gtk/gtk_util.h
@@ -0,0 +1,380 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_GTK_UTIL_H_
+#define CHROME_BROWSER_UI_GTK_GTK_UTIL_H_
+#pragma once
+
+#include <gtk/gtk.h>
+#include <string>
+#include <vector>
+
+#include "app/x11_util.h"
+#include "base/string16.h"
+#include "gfx/point.h"
+#include "gfx/rect.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h"
+#include "webkit/glue/window_open_disposition.h"
+
+typedef struct _cairo cairo_t;
+typedef struct _GdkColor GdkColor;
+typedef struct _GtkWidget GtkWidget;
+
+class BrowserWindow;
+class GtkThemeProvider;
+class GURL;
+class Profile;
+struct RendererPreferences; // from common/renderer_preferences.h
+
+const int kSkiaToGDKMultiplier = 257;
+
+// Define a macro for creating GdkColors from RGB values. This is a macro to
+// allow static construction of literals, etc. Use this like:
+// GdkColor white = GDK_COLOR_RGB(0xff, 0xff, 0xff);
+#define GDK_COLOR_RGB(r, g, b) {0, r * kSkiaToGDKMultiplier, \
+ g * kSkiaToGDKMultiplier, b * kSkiaToGDKMultiplier}
+
+namespace event_utils {
+
+// Translates event flags into what kind of disposition they represent.
+// For example, a middle click would mean to open a background tab.
+// event_flags are the state in the GdkEvent structure.
+WindowOpenDisposition DispositionFromEventFlags(guint state);
+
+} // namespace event_utils
+
+namespace gtk_util {
+
+extern const GdkColor kGdkWhite;
+extern const GdkColor kGdkGray;
+extern const GdkColor kGdkBlack;
+extern const GdkColor kGdkGreen;
+
+// Constants relating to the layout of dialog windows:
+// (See http://library.gnome.org/devel/hig-book/stable/design-window.html.en)
+
+// Spacing between controls of the same group.
+const int kControlSpacing = 6;
+
+// Horizontal spacing between a label and its control.
+const int kLabelSpacing = 12;
+
+// Indent of the controls within each group.
+const int kGroupIndent = 12;
+
+// Space around the outside of a dialog's contents.
+const int kContentAreaBorder = 12;
+
+// Spacing between groups of controls.
+const int kContentAreaSpacing = 18;
+
+// Horizontal Spacing between controls in a form.
+const int kFormControlSpacing = 10;
+
+// Create a table of labeled controls, using proper spacing and alignment.
+// Arguments should be pairs of const char*, GtkWidget*, concluding with a
+// NULL. The first argument is a vector in which to place all labels
+// produced. It can be NULL if you don't need to keep track of the label
+// widgets. The second argument is a color to force the label text to. It can
+// be NULL to get the system default.
+//
+// For example:
+// controls = CreateLabeledControlsGroup(NULL,
+// "Name:", title_entry_,
+// "Folder:", folder_combobox_,
+// NULL);
+GtkWidget* CreateLabeledControlsGroup(
+ std::vector<GtkWidget*>* labels,
+ const char* text, ...);
+
+// Create a GtkBin with |child| as its child widget. This bin will paint a
+// border of color |color| with the sizes specified in pixels.
+GtkWidget* CreateGtkBorderBin(GtkWidget* child, const GdkColor* color,
+ int top, int bottom, int left, int right);
+
+// Left-align the given GtkMisc and return the same pointer.
+GtkWidget* LeftAlignMisc(GtkWidget* misc);
+
+// Create a left-aligned label with the given text in bold.
+GtkWidget* CreateBoldLabel(const std::string& text);
+
+// As above, but uses number of characters/lines directly rather than looking up
+// a resource.
+void GetWidgetSizeFromCharacters(GtkWidget* widget,
+ double width_chars, double height_lines,
+ int* width, int* height);
+
+// Calculates the size of given widget based on the size specified in number of
+// characters/lines (in locale specific resource file) and font metrics.
+// NOTE: Make sure to realize |widget| before using this method, or a default
+// font size will be used instead of the actual font size.
+void GetWidgetSizeFromResources(GtkWidget* widget,
+ int width_chars, int height_lines,
+ int* width, int* height);
+
+// As above, but a convenience method for configuring dialog size.
+// |width_id| and |height_id| are resource IDs for the size. If either of these
+// are set to -1, the respective size will be set to the widget default.
+// |resizable| also controls whether the dialog will be resizable
+// (this info is also necessary for getting the width-setting code
+// right).
+void SetWindowSizeFromResources(GtkWindow* window,
+ int width_id, int height_id, bool resizable);
+
+// Places |window| approximately over center of |parent|, it also moves window
+// to parent's desktop. Use this only for non-modal dialogs, such as the
+// options window and content settings window; otherwise you should be using
+// transient_for.
+void CenterOverWindow(GtkWindow* window, GtkWindow* parent);
+
+// Puts all browser windows in one window group; this will make any dialog
+// spawned app modal.
+void MakeAppModalWindowGroup();
+
+// Called after an app modal dialog that used MakeAppModalWindowGroup() was
+// dismissed. Returns each browser window to its own window group.
+void AppModalDismissedUngroupWindows();
+
+// Remove all children from this container.
+void RemoveAllChildren(GtkWidget* container);
+
+// Force the font size of the widget to |size_pixels|.
+void ForceFontSizePixels(GtkWidget* widget, double size_pixels);
+
+// Undoes the effects of a previous ForceFontSizePixels() call. Safe to call
+// even if ForceFontSizePixels() was never called.
+void UndoForceFontSize(GtkWidget* widget);
+
+// Gets the position of a gtk widget in screen coordinates.
+gfx::Point GetWidgetScreenPosition(GtkWidget* widget);
+
+// Returns the bounds of the specified widget in screen coordinates.
+gfx::Rect GetWidgetScreenBounds(GtkWidget* widget);
+
+// Retuns size of the |widget| without window manager decorations.
+gfx::Size GetWidgetSize(GtkWidget* widget);
+
+// Converts a point in a widget to screen coordinates. The point |p| is
+// relative to the widget's top-left origin.
+void ConvertWidgetPointToScreen(GtkWidget* widget, gfx::Point* p);
+
+// Initialize some GTK settings so that our dialogs are consistent.
+void InitRCStyles();
+
+// Stick the widget in the given hbox without expanding vertically. The widget
+// is packed at the start of the hbox. This is useful for widgets that would
+// otherwise expand to fill the vertical space of the hbox
+// (e.g. buttons). Returns the vbox that widget was packed in.
+GtkWidget* CenterWidgetInHBox(GtkWidget* hbox, GtkWidget* widget,
+ bool pack_at_end, int padding);
+
+// Returns true if the screen is composited, false otherwise.
+bool IsScreenComposited();
+
+// Enumerates the top-level gdk windows of the current display.
+void EnumerateTopLevelWindows(x11_util::EnumerateWindowsDelegate* delegate);
+
+// Set that clicking the button with the given mouse buttons will cause a click
+// event.
+// NOTE: If you need to connect to the button-press-event or
+// button-release-event signals, do so before calling this function.
+void SetButtonClickableByMouseButtons(GtkWidget* button,
+ bool left, bool middle, bool right);
+
+// Set that a button causes a page navigation. In particular, it will accept
+// middle clicks. Warning: only call this *after* you have connected your
+// own handlers for button-press and button-release events, or you will not get
+// those events.
+void SetButtonTriggersNavigation(GtkWidget* button);
+
+// Returns the mirrored x value for |bounds| if the layout is RTL; otherwise,
+// the original value is returned unchanged.
+int MirroredLeftPointForRect(GtkWidget* widget, const gfx::Rect& bounds);
+
+// Returns the mirrored x value for the point |x| if the layout is RTL;
+// otherwise, the original value is returned unchanged.
+int MirroredXCoordinate(GtkWidget* widget, int x);
+
+// Returns true if the pointer is currently inside the widget.
+bool WidgetContainsCursor(GtkWidget* widget);
+
+// Sets the icon of |window| to the product icon (potentially used in window
+// border or alt-tab list).
+void SetWindowIcon(GtkWindow* window);
+
+// Sets the default window icon for windows created in this app.
+void SetDefaultWindowIcon();
+
+// Adds an action button with the given text to the dialog. Only useful when you
+// want a stock icon but not the stock text to go with it. Returns the button.
+GtkWidget* AddButtonToDialog(GtkWidget* dialog, const gchar* text,
+ const gchar* stock_id, gint response_id);
+
+GtkWidget* BuildDialogButton(GtkWidget* dialog, int ids_id,
+ const gchar* stock_id);
+
+GtkWidget* CreateEntryImageHBox(GtkWidget* entry, GtkWidget* image);
+
+// Sets all the foreground color states of |label| to |color|.
+void SetLabelColor(GtkWidget* label, const GdkColor* color);
+
+// Adds the given widget to an alignment identing it by |kGroupIndent|.
+GtkWidget* IndentWidget(GtkWidget* content);
+
+// Sets (or resets) the font settings in |prefs| (used when creating new
+// renderers) based on GtkSettings (which itself comes from XSETTINGS).
+void UpdateGtkFontSettings(RendererPreferences* prefs);
+
+// Get the current location of the mouse cursor relative to the screen.
+gfx::Point ScreenPoint(GtkWidget* widget);
+
+// Get the current location of the mouse cursor relative to the widget.
+gfx::Point ClientPoint(GtkWidget* widget);
+
+// Reverses a point in RTL mode. Used in making vectors of GdkPoints for window
+// shapes.
+GdkPoint MakeBidiGdkPoint(gint x, gint y, gint width, bool ltr);
+
+// Draws a GTK text entry with the style parameters of GtkEntry
+// |offscreen_entry| onto |widget_to_draw_on| in the rectangle |rec|. Drawing
+// is only done in the clip rectangle |dirty_rec|.
+void DrawTextEntryBackground(GtkWidget* offscreen_entry,
+ GtkWidget* widget_to_draw_on,
+ GdkRectangle* dirty_rec,
+ GdkRectangle* rec);
+
+// Draws the background of the toolbar area subject to the expose rectangle
+// |event| and starting image tiling from |tabstrip_origin|.
+void DrawThemedToolbarBackground(GtkWidget* widget,
+ cairo_t* cr,
+ GdkEventExpose* event,
+ const gfx::Point& tabstrip_origin,
+ GtkThemeProvider* provider);
+
+// Returns the two colors averaged together.
+GdkColor AverageColors(GdkColor color_one, GdkColor color_two);
+
+// Show the image for the given menu item, even if the user's default is to not
+// show images. Only to be used for favicons or other menus where the image is
+// crucial to its functionality.
+void SetAlwaysShowImage(GtkWidget* image_menu_item);
+
+// Stacks a |popup| window directly on top of a |toplevel| window.
+void StackPopupWindow(GtkWidget* popup, GtkWidget* toplevel);
+
+// Get a rectangle corresponding to a widget's allocation relative to its
+// toplevel window's origin.
+gfx::Rect GetWidgetRectRelativeToToplevel(GtkWidget* widget);
+
+// Don't allow the widget to paint anything, and instead propagate the expose
+// to its children. This is similar to calling
+//
+// gtk_widget_set_app_paintable(container, TRUE);
+//
+// except that it will always work, and it should be called after any custom
+// expose events are connected.
+void SuppressDefaultPainting(GtkWidget* container);
+
+// Get the window open disposition from the state in gtk_get_current_event().
+// This is designed to be called inside a "clicked" event handler. It is an
+// error to call it when gtk_get_current_event() won't return a GdkEventButton*.
+WindowOpenDisposition DispositionForCurrentButtonPressEvent();
+
+// Safely grabs all input (with X grabs and an application grab), returning true
+// for success.
+bool GrabAllInput(GtkWidget* widget);
+
+// Returns a rectangle that represents the widget's bounds. The rectangle it
+// returns is the same as widget->allocation, but anchored at (0, 0).
+gfx::Rect WidgetBounds(GtkWidget* widget);
+
+// Update the timestamp for the given window. This is usually the time of the
+// last user event, but on rare occasions we wish to update it despite not
+// receiving a user event.
+void SetWMLastUserActionTime(GtkWindow* window);
+
+// The current system time, using the format expected by the X server, but not
+// retrieved from the X server. NOTE: You should almost never need to use this
+// function, instead using the timestamp from the latest GDK event.
+guint32 XTimeNow();
+
+// Uses the autocomplete controller for |profile| to convert the contents of the
+// PRIMARY selection to a parsed URL. Returns true and sets |url| on success,
+// otherwise returns false.
+bool URLFromPrimarySelection(Profile* profile, GURL* url);
+
+// Set the colormap of the given window to rgba to allow transparency.
+bool AddWindowAlphaChannel(GtkWidget* window);
+
+// Get the default colors for a text entry. Parameters may be NULL.
+void GetTextColors(GdkColor* normal_base,
+ GdkColor* selected_base,
+ GdkColor* normal_text,
+ GdkColor* selected_text);
+
+// Wrappers to show a GtkDialog. On Linux, it merely calls gtk_widget_show_all.
+// On ChromeOs, it calls ShowNativeDialog which hosts the its vbox
+// in a view based Window.
+void ShowDialog(GtkWidget* dialog);
+void ShowDialogWithLocalizedSize(GtkWidget* dialog,
+ int width_id,
+ int height_id,
+ bool resizeable);
+void ShowModalDialogWithMinLocalizedWidth(GtkWidget* dialog,
+ int width_id);
+
+// Wrapper to present a window. On Linux, it just calls gtk_window_present or
+// gtk_window_present_with_time for non-zero timestamp. For ChromeOS, it first
+// finds the host window of the dialog contents and then present it.
+void PresentWindow(GtkWidget* window, int timestamp);
+
+// Get real window for given dialog. On ChromeOS, this gives the native dialog
+// host window. On Linux, it merely returns the passed in dialog.
+GtkWindow* GetDialogWindow(GtkWidget* dialog);
+
+// Gets dialog window bounds.
+gfx::Rect GetDialogBounds(GtkWidget* dialog);
+
+// Returns the stock menu item label for the "preferences" item - returns an
+// empty string if no stock item found.
+string16 GetStockPreferencesMenuLabel();
+
+// Checks whether a widget is actually visible, i.e. whether it and all its
+// ancestors up to its toplevel are visible.
+bool IsWidgetAncestryVisible(GtkWidget* widget);
+
+// Sets the GTK font from the given font name (ex. "Arial Black, 10").
+void SetGtkFont(const std::string& font_name);
+
+// Sets the given label's size request to |pixel_width|. This will cause the
+// label to wrap if it needs to. The reason for this function is that some
+// versions of GTK mis-align labels that have a size request and line wrapping,
+// and this function hides the complexity of the workaround.
+void SetLabelWidth(GtkWidget* label, int pixel_width);
+
+// Make the |label| shrinkable within a GthChromeShrinkableHBox
+// It calculates the real size request of a label and set its ellipsize mode to
+// PANGO_ELLIPSIZE_END.
+// It must be done when the label is mapped (become visible on the screen),
+// to make sure the pango can get correct font information for the calculation.
+void InitLabelSizeRequestAndEllipsizeMode(GtkWidget* label);
+
+// Convenience methods for converting between web drag operations and the GDK
+// equivalent.
+GdkDragAction WebDragOpToGdkDragAction(WebKit::WebDragOperationsMask op);
+WebKit::WebDragOperationsMask GdkDragActionToWebDragOp(GdkDragAction action);
+
+// A helper function for gtk_message_dialog_new() to work around a few KDE 3
+// window manager bugs. You should always call it after creating a dialog with
+// gtk_message_dialog_new.
+void ApplyMessageDialogQuirks(GtkWidget* dialog);
+
+// Performs Cut/Copy/Paste operation on the |window|.
+void DoCut(BrowserWindow* window);
+void DoCopy(BrowserWindow* window);
+void DoPaste(BrowserWindow* window);
+
+} // namespace gtk_util
+
+#endif // CHROME_BROWSER_UI_GTK_GTK_UTIL_H_
diff --git a/chrome/browser/gtk/hover_controller_gtk.cc b/chrome/browser/ui/gtk/hover_controller_gtk.cc
index f7fe91a..617556e 100644
--- a/chrome/browser/gtk/hover_controller_gtk.cc
+++ b/chrome/browser/ui/gtk/hover_controller_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/hover_controller_gtk.h b/chrome/browser/ui/gtk/hover_controller_gtk.h
new file mode 100644
index 0000000..30c2408
--- /dev/null
+++ b/chrome/browser/ui/gtk/hover_controller_gtk.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_HOVER_CONTROLLER_GTK_H_
+#define CHROME_BROWSER_UI_GTK_HOVER_CONTROLLER_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "app/gtk_signal_registrar.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
+#include "ui/base/animation/throb_animation.h"
+
+// This class handles the "throbbing" of a GtkChromeButton. The visual effect
+// of throbbing is created by painting partially transparent hover effects. It
+// only works in non-gtk theme mode. This class mainly exists to glue an
+// AnimationDelegate (C++ class) to a GtkChromeButton* (GTK/c object).
+class HoverControllerGtk : public ui::AnimationDelegate {
+ public:
+ virtual ~HoverControllerGtk();
+
+ GtkWidget* button() { return button_; }
+
+ // Throb for |cycles| cycles. This will override the current remaining
+ // number of cycles. Note that a "cycle" is (somewhat unintuitively) half of
+ // a complete throb revolution.
+ void StartThrobbing(int cycles);
+
+ // Get the HoverControllerGtk for a given GtkChromeButton*. It is an error
+ // to call this on a widget that is not a GtkChromeButton*.
+ static HoverControllerGtk* GetHoverControllerGtk(GtkWidget* button);
+
+ // Creates a GtkChromeButton and adds a HoverControllerGtk for it.
+ static GtkWidget* CreateChromeButton();
+
+ // Stop throbbing and delete |this|.
+ void Destroy();
+
+ private:
+ explicit HoverControllerGtk(GtkWidget* button);
+
+ // Overridden from ui::AnimationDelegate.
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
+
+ CHROMEGTK_CALLBACK_1(HoverControllerGtk, gboolean, OnEnter,
+ GdkEventCrossing*);
+ CHROMEGTK_CALLBACK_1(HoverControllerGtk, gboolean, OnLeave,
+ GdkEventCrossing*);
+ CHROMEGTK_CALLBACK_1(HoverControllerGtk, void, OnHierarchyChanged,
+ GtkWidget*);
+ CHROMEGTK_CALLBACK_0(HoverControllerGtk, void, OnDestroy);
+
+ ui::ThrobAnimation throb_animation_;
+ ui::SlideAnimation hover_animation_;
+ GtkWidget* button_;
+
+ GtkSignalRegistrar signals_;
+
+ DISALLOW_COPY_AND_ASSIGN(HoverControllerGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_HOVER_CONTROLLER_GTK_H_
diff --git a/chrome/browser/gtk/html_dialog_gtk.cc b/chrome/browser/ui/gtk/html_dialog_gtk.cc
index d0d18b2..bec9abd 100644
--- a/chrome/browser/gtk/html_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/html_dialog_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/html_dialog_gtk.h b/chrome/browser/ui/gtk/html_dialog_gtk.h
new file mode 100644
index 0000000..391c77d
--- /dev/null
+++ b/chrome/browser/ui/gtk/html_dialog_gtk.h
@@ -0,0 +1,75 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_HTML_DIALOG_GTK_H_
+#define CHROME_BROWSER_UI_GTK_HTML_DIALOG_GTK_H_
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/dom_ui/html_dialog_ui.h"
+#include "chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h"
+#include "gfx/native_widget_types.h"
+#include "gfx/size.h"
+
+typedef struct _GtkWidget GtkWidget;
+
+class Browser;
+class Profile;
+class TabContents;
+class TabContentsContainerGtk;
+
+class HtmlDialogGtk : public HtmlDialogTabContentsDelegate,
+ public HtmlDialogUIDelegate {
+ public:
+ HtmlDialogGtk(Profile* profile, HtmlDialogUIDelegate* delegate,
+ gfx::NativeWindow parent_window);
+ virtual ~HtmlDialogGtk();
+
+ static void ShowHtmlDialogGtk(Browser* browser,
+ HtmlDialogUIDelegate* delegate,
+ gfx::NativeWindow parent_window);
+ // Initializes the contents of the dialog (the DOMView and the callbacks).
+ void InitDialog();
+
+ // Overridden from HtmlDialogUI::Delegate:
+ virtual bool IsDialogModal() const;
+ virtual std::wstring GetDialogTitle() const;
+ virtual GURL GetDialogContentURL() const;
+ virtual void GetDOMMessageHandlers(
+ std::vector<DOMMessageHandler*>* handlers) const;
+ virtual void GetDialogSize(gfx::Size* size) const;
+ virtual std::string GetDialogArgs() const;
+ virtual void OnDialogClosed(const std::string& json_retval);
+ virtual void OnCloseContents(TabContents* source, bool* out_close_dialog) { }
+ virtual bool ShouldShowDialogTitle() const;
+
+ // Overridden from TabContentsDelegate:
+ virtual void MoveContents(TabContents* source, const gfx::Rect& pos);
+ virtual void ToolbarSizeChanged(TabContents* source, bool is_animating);
+ virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event);
+
+ private:
+ CHROMEGTK_CALLBACK_1(HtmlDialogGtk, void, OnResponse, int);
+
+ // This view is a delegate to the HTML content since it needs to get notified
+ // about when the dialog is closing. For all other actions (besides dialog
+ // closing) we delegate to the creator of this view, which we keep track of
+ // using this variable.
+ HtmlDialogUIDelegate* delegate_;
+
+ gfx::NativeWindow parent_window_;
+
+ GtkWidget* dialog_;
+
+ scoped_ptr<TabContents> tab_contents_;
+ scoped_ptr<TabContentsContainerGtk> tab_contents_container_;
+
+ DISALLOW_COPY_AND_ASSIGN(HtmlDialogGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_HTML_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/hung_renderer_dialog_gtk.cc b/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc
index 5dbed52..25c5a6a 100644
--- a/chrome/browser/gtk/hung_renderer_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/import_dialog_gtk.cc b/chrome/browser/ui/gtk/import_dialog_gtk.cc
index d1f828a..5ec7666 100644
--- a/chrome/browser/gtk/import_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/import_dialog_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/import_dialog_gtk.h b/chrome/browser/ui/gtk/import_dialog_gtk.h
new file mode 100644
index 0000000..7d1cd03
--- /dev/null
+++ b/chrome/browser/ui/gtk/import_dialog_gtk.h
@@ -0,0 +1,89 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_IMPORT_DIALOG_GTK_H_
+#define CHROME_BROWSER_UI_GTK_IMPORT_DIALOG_GTK_H_
+#pragma once
+
+#include "app/gtk_signal.h"
+#include "chrome/browser/importer/importer.h"
+
+class AccessibleWidgetHelper;
+class Profile;
+
+class ImportDialogGtk : public ImportObserver,
+ public ImporterList::Observer {
+ public:
+ // Displays the import box to import data from another browser into |profile|
+ // |initial_state| is a bitmask of ImportItems. Each checkbox for the bits in
+ // is checked.
+ static void Show(GtkWindow* parent, Profile* profile, int initial_state);
+
+ // ImportObserver implementation.
+ virtual void ImportCanceled();
+ virtual void ImportComplete();
+
+ private:
+ ImportDialogGtk(GtkWindow* parent, Profile* profile, int initial_state);
+ ~ImportDialogGtk();
+
+ // ImporterList::Observer implementation.
+ virtual void SourceProfilesLoaded();
+
+ // Handler to respond to OK or Cancel responses from the dialog.
+ CHROMEGTK_CALLBACK_1(ImportDialogGtk, void, OnDialogResponse, int);
+
+ // Handler to respond to widget clicked actions from the dialog.
+ CHROMEGTK_CALLBACK_0(ImportDialogGtk, void, OnDialogWidgetClicked);
+
+ // Enable or disable the dialog buttons depending on the state of the
+ // checkboxes.
+ void UpdateDialogButtons();
+
+ // Sets the sensitivity of all controls on the dialog except the cancel
+ // button.
+ void SetDialogControlsSensitive(bool sensitive);
+
+ // Create a bitmask from the checkboxes of the dialog.
+ uint16 GetCheckedItems();
+
+ // Parent window
+ GtkWindow* parent_;
+
+ // Import Dialog
+ GtkWidget* dialog_;
+
+ // Combo box that displays list of profiles from which we can import.
+ GtkWidget* combo_;
+
+ // Bookmarks/Favorites checkbox
+ GtkWidget* bookmarks_;
+
+ // Search Engines checkbox
+ GtkWidget* search_engines_;
+
+ // Passwords checkbox
+ GtkWidget* passwords_;
+
+ // History checkbox
+ GtkWidget* history_;
+
+ // Import button.
+ GtkWidget* import_button_;
+
+ // Our current profile
+ Profile* profile_;
+
+ // Utility class that does the actual import.
+ scoped_refptr<ImporterHost> importer_host_;
+
+ int initial_state_;
+
+ // Helper object to manage accessibility metadata.
+ scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
+
+ DISALLOW_COPY_AND_ASSIGN(ImportDialogGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_IMPORT_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/import_lock_dialog_gtk.cc b/chrome/browser/ui/gtk/import_lock_dialog_gtk.cc
index 8fcaefe..30b7cab 100644
--- a/chrome/browser/gtk/import_lock_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/import_lock_dialog_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/import_lock_dialog_gtk.h b/chrome/browser/ui/gtk/import_lock_dialog_gtk.h
new file mode 100644
index 0000000..c82f4c3
--- /dev/null
+++ b/chrome/browser/ui/gtk/import_lock_dialog_gtk.h
@@ -0,0 +1,37 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_IMPORT_LOCK_DIALOG_GTK_H_
+#define CHROME_BROWSER_UI_GTK_IMPORT_LOCK_DIALOG_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/ref_counted.h"
+
+class ImporterHost;
+
+class ImportLockDialogGtk {
+ public:
+ // Displays the Firefox profile locked warning
+ static void Show(GtkWindow* parent, ImporterHost* importer_host);
+
+ private:
+ ImportLockDialogGtk(GtkWindow* parent, ImporterHost* importer_host);
+ ~ImportLockDialogGtk();
+
+ CHROMEGTK_CALLBACK_1(ImportLockDialogGtk, void, OnDialogResponse, int);
+
+ // Dialog box
+ GtkWidget* dialog_;
+
+ // Utility class that does the actual import.
+ scoped_refptr<ImporterHost> importer_host_;
+
+ DISALLOW_COPY_AND_ASSIGN(ImportLockDialogGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_IMPORT_LOCK_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/import_progress_dialog_gtk.cc b/chrome/browser/ui/gtk/import_progress_dialog_gtk.cc
index c70561b..80f9731 100644
--- a/chrome/browser/gtk/import_progress_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/import_progress_dialog_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/import_progress_dialog_gtk.h b/chrome/browser/ui/gtk/import_progress_dialog_gtk.h
new file mode 100644
index 0000000..2d8d629
--- /dev/null
+++ b/chrome/browser/ui/gtk/import_progress_dialog_gtk.h
@@ -0,0 +1,83 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_IMPORT_PROGRESS_DIALOG_GTK_H_
+#define CHROME_BROWSER_UI_GTK_IMPORT_PROGRESS_DIALOG_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "chrome/browser/importer/importer.h"
+#include "chrome/browser/importer/importer_data_types.h"
+
+class Profile;
+
+class ImportProgressDialogGtk : public ImporterHost::Observer {
+ public:
+ // Displays the import progress dialog box and starts the import
+ static void StartImport(GtkWindow* parent, int16 items,
+ ImporterHost* importer_host,
+ const ProfileInfo& browser_profile,
+ Profile* profile,
+ ImportObserver* observer, bool first_run);
+
+ // Overridden from ImporterHost::Observer:
+ virtual void ImportItemStarted(importer::ImportItem item);
+ virtual void ImportItemEnded(importer::ImportItem item);
+ virtual void ImportStarted();
+ virtual void ImportEnded();
+
+ private:
+ ImportProgressDialogGtk(const string16& source_profile, int16 items,
+ ImporterHost* importer_host, ImportObserver* observer,
+ GtkWindow* parent, bool bookmarks_import);
+ virtual ~ImportProgressDialogGtk();
+
+ static void HandleOnResponseDialog(GtkWidget* widget,
+ int response,
+ gpointer user_data) {
+ reinterpret_cast<ImportProgressDialogGtk*>(user_data)->OnDialogResponse(
+ widget, response);
+ }
+
+ void CloseDialog();
+
+ void OnDialogResponse(GtkWidget* widget, int response);
+
+ void ShowDialog();
+
+ // Parent window
+ GtkWindow* parent_;
+
+ // Import progress dialog
+ GtkWidget* dialog_;
+
+ // Bookmarks/Favorites checkbox
+ GtkWidget* bookmarks_;
+
+ // Search Engines checkbox
+ GtkWidget* search_engines_;
+
+ // Passwords checkbox
+ GtkWidget* passwords_;
+
+ // History checkbox
+ GtkWidget* history_;
+
+ // Boolean that tells whether we are currently in the mid of import process
+ bool importing_;
+
+ // Observer that we need to notify about import events
+ ImportObserver* observer_;
+
+ // Items to import from the other browser.
+ int16 items_;
+
+ // Utility class that does the actual import.
+ scoped_refptr<ImporterHost> importer_host_;
+
+ DISALLOW_COPY_AND_ASSIGN(ImportProgressDialogGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_IMPORT_PROGRESS_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/info_bubble_accelerators_gtk.cc b/chrome/browser/ui/gtk/info_bubble_accelerators_gtk.cc
index ba04846..0c63cfe 100644
--- a/chrome/browser/gtk/info_bubble_accelerators_gtk.cc
+++ b/chrome/browser/ui/gtk/info_bubble_accelerators_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/info_bubble_accelerators_gtk.h b/chrome/browser/ui/gtk/info_bubble_accelerators_gtk.h
new file mode 100644
index 0000000..92c66ef
--- /dev/null
+++ b/chrome/browser/ui/gtk/info_bubble_accelerators_gtk.h
@@ -0,0 +1,39 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_INFO_BUBBLE_ACCELERATORS_GTK_H_
+#define CHROME_BROWSER_UI_GTK_INFO_BUBBLE_ACCELERATORS_GTK_H_
+#pragma once
+
+#include <gdk/gdktypes.h>
+#include <glib.h>
+#include <vector>
+
+#include "base/basictypes.h"
+
+struct InfoBubbleAcceleratorGtk {
+ guint keyval;
+ GdkModifierType modifier_type;
+};
+
+typedef std::vector<struct InfoBubbleAcceleratorGtk>
+ InfoBubbleAcceleratorGtkList;
+
+// This class contains a list of accelerators that an InfoBubbleGtk
+// is expected to either catch and respond to or catch and forward to the
+// root browser window. This list is expected to be a subset of the
+// accelerators that are handled by the root browser window, but the
+// specific accelerators to be handled has not yet been fully specified. The
+// common use case for this class has code that uses it needing the entire
+// list and not needing extra processing, so the only get method gives you the
+// entire list.
+class InfoBubbleAcceleratorsGtk {
+ public:
+ static InfoBubbleAcceleratorGtkList GetList();
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(InfoBubbleAcceleratorsGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_INFO_BUBBLE_ACCELERATORS_GTK_H_
diff --git a/chrome/browser/gtk/info_bubble_gtk.cc b/chrome/browser/ui/gtk/info_bubble_gtk.cc
index 42dc0d1..33131de 100644
--- a/chrome/browser/gtk/info_bubble_gtk.cc
+++ b/chrome/browser/ui/gtk/info_bubble_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/info_bubble_gtk.h b/chrome/browser/ui/gtk/info_bubble_gtk.h
new file mode 100644
index 0000000..d26167a
--- /dev/null
+++ b/chrome/browser/ui/gtk/info_bubble_gtk.h
@@ -0,0 +1,215 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This is the GTK implementation of InfoBubbles. InfoBubbles are like
+// dialogs, but they point to a given element on the screen. You should call
+// InfoBubbleGtk::Show, which will create and display a bubble. The object is
+// self deleting, when the bubble is closed, you will be notified via
+// InfoBubbleGtkDelegate::InfoBubbleClosing(). Then the widgets and the
+// underlying object will be destroyed. You can also close and destroy the
+// bubble by calling Close().
+
+#ifndef CHROME_BROWSER_UI_GTK_INFO_BUBBLE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_INFO_BUBBLE_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+#include <vector>
+
+#include "app/gtk_signal.h"
+#include "app/gtk_signal_registrar.h"
+#include "base/basictypes.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "gfx/point.h"
+#include "gfx/rect.h"
+
+class GtkThemeProvider;
+class InfoBubbleGtk;
+namespace gfx {
+class Rect;
+}
+
+class InfoBubbleGtkDelegate {
+ public:
+ // Called when the InfoBubble is closing and is about to be deleted.
+ // |closed_by_escape| is true if the close is the result of pressing escape.
+ virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble,
+ bool closed_by_escape) = 0;
+
+ // NOTE: The Views interface has CloseOnEscape, except I can't find a place
+ // where it ever returns false, so we always allow you to close via escape.
+
+ protected:
+ virtual ~InfoBubbleGtkDelegate() {}
+};
+
+class InfoBubbleGtk : public NotificationObserver {
+ public:
+ // Where should the arrow be placed relative to the bubble?
+ enum ArrowLocationGtk {
+ // TODO(derat): Support placing arrows on the bottoms of the bubbles.
+ ARROW_LOCATION_TOP_LEFT,
+ ARROW_LOCATION_TOP_RIGHT,
+ };
+
+ // Show an InfoBubble, pointing at the area |rect| (in coordinates relative to
+ // |anchor_widget|'s origin). An info bubble will try to fit on the screen,
+ // so it can point to any edge of |rect|. If |rect| is NULL, the widget's
+ // entire area will be used. The bubble will host the |content|
+ // widget. Its arrow will be drawn at |arrow_location| if possible. The
+ // |delegate| will be notified when the bubble is closed. The bubble will
+ // perform an X grab of the pointer and keyboard, and will close itself if a
+ // click is received outside of the bubble.
+ static InfoBubbleGtk* Show(GtkWidget* anchor_widget,
+ const gfx::Rect* rect,
+ GtkWidget* content,
+ ArrowLocationGtk arrow_location,
+ bool match_system_theme,
+ bool grab_input,
+ GtkThemeProvider* provider,
+ InfoBubbleGtkDelegate* delegate);
+
+ // Close the bubble if it's open. This will delete the widgets and object,
+ // so you shouldn't hold a InfoBubbleGtk pointer after calling Close().
+ void Close();
+
+ // NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // If the content contains widgets that can steal our pointer and keyboard
+ // grabs (e.g. GtkComboBox), this method should be called after a widget
+ // releases the grabs so we can reacquire them. Note that this causes a race
+ // condition; another client could grab them before we do (ideally, GDK would
+ // transfer the grabs back to us when the widget releases them). The window
+ // is small, though, and the worst-case scenario for this seems to just be
+ // that the content's widgets will appear inactive even after the user clicks
+ // in them.
+ void HandlePointerAndKeyboardUngrabbedByContent();
+
+ private:
+ enum FrameType {
+ FRAME_MASK,
+ FRAME_STROKE,
+ };
+
+ explicit InfoBubbleGtk(GtkThemeProvider* provider, bool match_system_theme);
+ virtual ~InfoBubbleGtk();
+
+ // Creates the InfoBubble.
+ void Init(GtkWidget* anchor_widget,
+ const gfx::Rect* rect,
+ GtkWidget* content,
+ ArrowLocationGtk arrow_location,
+ bool grab_input);
+
+ // Make the points for our polygon frame, either for fill (the mask), or for
+ // when we stroke the border.
+ static std::vector<GdkPoint> MakeFramePolygonPoints(
+ ArrowLocationGtk arrow_location,
+ int width,
+ int height,
+ FrameType type);
+
+ // Get the location where the arrow should be placed (which is a function of
+ // the preferred location and of the direction that the bubble should be
+ // facing to fit onscreen). |arrow_x| is the X component in screen
+ // coordinates of the point at which the bubble's arrow should be aimed, and
+ // |width| is the bubble's width.
+ static ArrowLocationGtk GetArrowLocation(
+ ArrowLocationGtk preferred_location, int arrow_x, int width);
+
+ // Updates |arrow_location_| based on the toplevel window's current position
+ // and the bubble's size. If the |force_move_and_reshape| is true or the
+ // location changes, moves and reshapes the window and returns true.
+ bool UpdateArrowLocation(bool force_move_and_reshape);
+
+ // Reshapes the window and updates |mask_region_|.
+ void UpdateWindowShape();
+
+ // Calculate the current screen position for the bubble's window (per
+ // |toplevel_window_|'s position as of its most-recent ConfigureNotify event
+ // and |rect_|) and move it there.
+ void MoveWindow();
+
+ // Restack the bubble's window directly above |toplevel_window_|.
+ void StackWindow();
+
+ // Sets the delegate.
+ void set_delegate(InfoBubbleGtkDelegate* delegate) { delegate_ = delegate; }
+
+ // Grab (in the X sense) the pointer and keyboard. This is needed to make
+ // sure that we have the input focus.
+ void GrabPointerAndKeyboard();
+
+ CHROMEG_CALLBACK_3(InfoBubbleGtk, gboolean, OnGtkAccelerator, GtkAccelGroup*,
+ GObject*, guint, GdkModifierType);
+
+ CHROMEGTK_CALLBACK_1(InfoBubbleGtk, gboolean, OnExpose, GdkEventExpose*);
+ CHROMEGTK_CALLBACK_1(InfoBubbleGtk, void, OnSizeAllocate, GtkAllocation*);
+ CHROMEGTK_CALLBACK_1(InfoBubbleGtk, gboolean, OnButtonPress, GdkEventButton*);
+ CHROMEGTK_CALLBACK_0(InfoBubbleGtk, gboolean, OnDestroy);
+ CHROMEGTK_CALLBACK_0(InfoBubbleGtk, void, OnHide);
+ CHROMEGTK_CALLBACK_1(InfoBubbleGtk, gboolean, OnToplevelConfigure,
+ GdkEventConfigure*);
+ CHROMEGTK_CALLBACK_1(InfoBubbleGtk, gboolean, OnToplevelUnmap, GdkEvent*);
+ CHROMEGTK_CALLBACK_1(InfoBubbleGtk, void, OnAnchorAllocate, GtkAllocation*);
+
+ // The caller supplied delegate, can be NULL.
+ InfoBubbleGtkDelegate* delegate_;
+
+ // Our GtkWindow popup window, we don't technically "own" the widget, since
+ // it deletes us when it is destroyed.
+ GtkWidget* window_;
+
+ // Provides colors and stuff.
+ GtkThemeProvider* theme_provider_;
+
+ // The accel group attached to |window_|, to handle closing with escape.
+ GtkAccelGroup* accel_group_;
+
+ // The window for which we're being shown (and to which |rect_| is relative).
+ // Note that it's possible for |toplevel_window_| to be NULL if the
+ // window is destroyed before this object is destroyed, so it's important
+ // to check for that case.
+ GtkWindow* toplevel_window_;
+
+ // The widget that we use to relatively position the popup window.
+ GtkWidget* anchor_widget_;
+
+ // Provides an offset from |anchor_widget_|'s origin for MoveWindow() to
+ // use.
+ gfx::Rect rect_;
+
+ // The current shape of |window_| (used to test whether clicks fall in it or
+ // not).
+ GdkRegion* mask_region_;
+
+ // Where would we prefer for the arrow be drawn relative to the bubble, and
+ // where is it currently drawn?
+ ArrowLocationGtk preferred_arrow_location_;
+ ArrowLocationGtk current_arrow_location_;
+
+ // Whether the background should match the system theme, when the system theme
+ // is being used. For example, the bookmark bubble does, but extension popups
+ // do not.
+ bool match_system_theme_;
+
+ // If true, the popup owns all X input for the duration of its existence.
+ // This will usually be true, the exception being when inspecting extension
+ // popups with dev tools.
+ bool grab_input_;
+
+ bool closed_by_escape_;
+
+ NotificationRegistrar registrar_;
+
+ GtkSignalRegistrar signals_;
+
+ DISALLOW_COPY_AND_ASSIGN(InfoBubbleGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_INFO_BUBBLE_GTK_H_
diff --git a/chrome/browser/gtk/infobar_arrow_model.cc b/chrome/browser/ui/gtk/infobar_arrow_model.cc
index fc2f889..cc24d5c 100644
--- a/chrome/browser/gtk/infobar_arrow_model.cc
+++ b/chrome/browser/ui/gtk/infobar_arrow_model.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/infobar_arrow_model.h b/chrome/browser/ui/gtk/infobar_arrow_model.h
new file mode 100644
index 0000000..c7f82cf
--- /dev/null
+++ b/chrome/browser/ui/gtk/infobar_arrow_model.h
@@ -0,0 +1,79 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_INFOBAR_ARROW_MODEL_H_
+#define CHROME_BROWSER_UI_GTK_INFOBAR_ARROW_MODEL_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "third_party/skia/include/core/SkPaint.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
+
+namespace gfx {
+class Point;
+}
+
+class InfoBar;
+
+// A helper class that tracks the state of an infobar arrow and provides a
+// utility to draw it.
+class InfoBarArrowModel : public ui::AnimationDelegate {
+ public:
+ class Observer {
+ public:
+ // The arrow has changed states; relevant widgets need to be repainted.
+ virtual void PaintStateChanged() = 0;
+ };
+
+ explicit InfoBarArrowModel(Observer* observer);
+ virtual ~InfoBarArrowModel();
+
+ // An infobar has been added or removed that will affect the state of this
+ // arrow.
+ void ShowArrowFor(InfoBar* bar, bool animate);
+
+ // Returns true if the arrow is showing at all.
+ bool NeedToDrawInfoBarArrow();
+
+ // Paints the arrow on |widget|, in response to |expose|, with the bottom
+ // center of the arrow at |origin|, drawing a border with |border_color|.
+ void Paint(GtkWidget* widget,
+ GdkEventExpose* expose,
+ const gfx::Point& origin,
+ const GdkColor& border_color);
+
+ // Overridden from ui::AnimationDelegate.
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
+
+ private:
+ // A pair of colors used to draw a gradient for an arrow.
+ struct InfoBarColors {
+ SkColor top;
+ SkColor bottom;
+ };
+
+ // Calculates the currently showing arrow color, which is a blend of the new
+ // arrow color and the old arrow color.
+ InfoBarColors CurrentInfoBarColors();
+
+ // The view that owns us.
+ Observer* observer_;
+
+ // An animation that tracks the progress of the transition from the last color
+ // to the new color.
+ ui::SlideAnimation animation_;
+
+ // The color we are animating towards.
+ InfoBarColors target_colors_;
+ // The last color we showed (the one we are animating away from).
+ InfoBarColors previous_colors_;
+
+ DISALLOW_COPY_AND_ASSIGN(InfoBarArrowModel);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_INFOBAR_ARROW_MODEL_H_
diff --git a/chrome/browser/gtk/infobar_container_gtk.cc b/chrome/browser/ui/gtk/infobar_container_gtk.cc
index f32ca80..6a6e1c8 100644
--- a/chrome/browser/gtk/infobar_container_gtk.cc
+++ b/chrome/browser/ui/gtk/infobar_container_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/infobar_container_gtk.h b/chrome/browser/ui/gtk/infobar_container_gtk.h
new file mode 100644
index 0000000..d25fa0e
--- /dev/null
+++ b/chrome/browser/ui/gtk/infobar_container_gtk.h
@@ -0,0 +1,85 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_INFOBAR_CONTAINER_GTK_H_
+#define CHROME_BROWSER_UI_GTK_INFOBAR_CONTAINER_GTK_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+
+class InfoBar;
+class InfoBarDelegate;
+class Profile;
+class TabContents;
+
+typedef struct _GtkWidget GtkWidget;
+
+class InfoBarContainerGtk : public NotificationObserver {
+ public:
+ explicit InfoBarContainerGtk(Profile* profile);
+ virtual ~InfoBarContainerGtk();
+
+ // Get the native widget.
+ GtkWidget* widget() const { return container_.get(); }
+
+ // Changes the TabContents for which this container is showing InfoBars. Can
+ // be NULL, in which case we will simply detach ourselves from the old tab
+ // contents.
+ void ChangeTabContents(TabContents* contents);
+
+ // Remove the specified InfoBarDelegate from the selected TabContents. This
+ // will notify us back and cause us to close the View. This is called from
+ // the InfoBar's close button handler.
+ void RemoveDelegate(InfoBarDelegate* delegate);
+
+ // Returns the total pixel height of all infobars in this container that
+ // are currently animating.
+ int TotalHeightOfAnimatingBars() const;
+
+ private:
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Constructs the InfoBars needed to reflect the state of the current
+ // TabContents associated with this container. No animations are run during
+ // this process.
+ void UpdateInfoBars();
+
+ // Makes the calls to show an arrow for |delegate| (either on the browser
+ // toolbar or on the next infobar up).
+ void ShowArrowForDelegate(InfoBarDelegate* delegate, bool animate);
+
+ // Adds an InfoBar for the specified delegate, in response to a notification
+ // from the selected TabContents.
+ void AddInfoBar(InfoBarDelegate* delegate, bool animate);
+
+ // Removes an InfoBar for the specified delegate, in response to a
+ // notification from the selected TabContents. The InfoBar's disappearance
+ // will be animated.
+ void RemoveInfoBar(InfoBarDelegate* delegate, bool animate);
+
+ // Tells the browser window about our state so it can draw the arrow
+ // appropriately.
+ void UpdateToolbarInfoBarState(InfoBar* infobar, bool animate);
+
+ NotificationRegistrar registrar_;
+
+ // The profile for the browser that hosts this InfoBarContainer.
+ Profile* profile_;
+
+ // The TabContents for which we are currently showing InfoBars.
+ TabContents* tab_contents_;
+
+ // VBox that holds the info bars.
+ OwnedWidgetGtk container_;
+
+ DISALLOW_COPY_AND_ASSIGN(InfoBarContainerGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_INFOBAR_CONTAINER_GTK_H_
diff --git a/chrome/browser/gtk/infobar_gtk.cc b/chrome/browser/ui/gtk/infobar_gtk.cc
index e5f812b..e5f812b 100644
--- a/chrome/browser/gtk/infobar_gtk.cc
+++ b/chrome/browser/ui/gtk/infobar_gtk.cc
diff --git a/chrome/browser/ui/gtk/infobar_gtk.h b/chrome/browser/ui/gtk/infobar_gtk.h
new file mode 100644
index 0000000..6d27c6f
--- /dev/null
+++ b/chrome/browser/ui/gtk/infobar_gtk.h
@@ -0,0 +1,144 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_INFOBAR_GTK_H_
+#define CHROME_BROWSER_UI_GTK_INFOBAR_GTK_H_
+#pragma once
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/gtk/infobar_arrow_model.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/browser/gtk/slide_animator_gtk.h"
+#include "chrome/browser/tab_contents/infobar_delegate.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "third_party/skia/include/core/SkPaint.h"
+
+class CustomDrawButton;
+class GtkThemeProvider;
+class InfoBarContainerGtk;
+class InfoBarDelegate;
+
+class InfoBar : public SlideAnimatorGtk::Delegate,
+ public NotificationObserver,
+ public InfoBarArrowModel::Observer {
+ public:
+ explicit InfoBar(InfoBarDelegate* delegate);
+ virtual ~InfoBar();
+
+ InfoBarDelegate* delegate() const { return delegate_; }
+
+ // Get the top level native GTK widget for this infobar.
+ GtkWidget* widget();
+
+ // Set a link to the parent InfoBarContainer. This must be set before the
+ // InfoBar is added to the view hierarchy.
+ void set_container(InfoBarContainerGtk* container) { container_ = container; }
+
+ // Starts animating the InfoBar open.
+ void AnimateOpen();
+
+ // Opens the InfoBar immediately.
+ void Open();
+
+ // Starts animating the InfoBar closed. It will not be closed until the
+ // animation has completed, when |Close| will be called.
+ void AnimateClose();
+
+ // Closes the InfoBar immediately and removes it from its container. Notifies
+ // the delegate that it has closed. The InfoBar is deleted after this function
+ // is called.
+ void Close();
+
+ // Returns true if the infobar is showing the its open or close animation.
+ bool IsAnimating();
+
+ // Returns true if the infobar is showing the close animation.
+ bool IsClosing();
+
+ void SetThemeProvider(GtkThemeProvider* theme_provider);
+
+ // Show an arrow that originates from another infobar (i.e. a bar was added
+ // below this one). If |other| is NULL, stop showing the arrow.
+ void ShowArrowFor(InfoBar* other, bool animate);
+
+ // InfoBarArrowModel::Observer implementation.
+ virtual void PaintStateChanged();
+
+ // SlideAnimatorGtk::Delegate implementation.
+ virtual void Closed();
+
+ // NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Retrieves the component colors for the infobar's background
+ // gradient. (This varies by infobars and can be animated to change).
+ virtual void GetTopColor(InfoBarDelegate::Type type,
+ double* r, double* g, double *b);
+ virtual void GetBottomColor(InfoBarDelegate::Type type,
+ double* r, double* g, double *b);
+
+ // The total height of the info bar.
+ static const int kInfoBarHeight;
+
+ protected:
+ // Removes our associated InfoBarDelegate from the associated TabContents.
+ // (Will lead to this InfoBar being closed).
+ void RemoveInfoBar() const;
+
+ // Adds |display_text| to the infobar. If |link_text| is not empty, it is
+ // rendered as a hyperlink and inserted into |display_text| at |link_offset|,
+ // or right aligned in the infobar if |link_offset| is |npos|. If a link is
+ // supplied, |link_callback| must not be null. It will be invoked on click.
+ void AddLabelWithInlineLink(const string16& display_text,
+ const string16& link_text,
+ size_t link_offset,
+ GCallback callback);
+
+ // Adds |display_text| to the infobar. If |link_text| is not empty, it is
+ // right aligned in the infobar.
+ void AddLabelAndLink(const string16& display_text,
+ const string16& link_text,
+ GCallback callback);
+ // The top level widget of the infobar.
+ scoped_ptr<SlideAnimatorGtk> slide_widget_;
+
+ // The second highest widget in the hierarchy (after the slide widget).
+ GtkWidget* bg_box_;
+
+ // The hbox that holds infobar elements (button, text, icon, etc.).
+ GtkWidget* hbox_;
+
+ // The x that closes the bar.
+ scoped_ptr<CustomDrawButton> close_button_;
+
+ // The InfoBar's container
+ InfoBarContainerGtk* container_;
+
+ // The InfoBar's delegate.
+ InfoBarDelegate* delegate_;
+
+ // The theme provider, used for getting border colors.
+ GtkThemeProvider* theme_provider_;
+
+ // The model that tracks the paint state of the arrow for the infobar
+ // below this one (if it exists).
+ InfoBarArrowModel arrow_model_;
+
+ NotificationRegistrar registrar_;
+
+ private:
+ CHROMEGTK_CALLBACK_0(InfoBar, void, OnCloseButton);
+ CHROMEGTK_CALLBACK_1(InfoBar, gboolean, OnBackgroundExpose, GdkEventExpose*);
+
+ void UpdateBorderColor();
+
+ DISALLOW_COPY_AND_ASSIGN(InfoBar);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_INFOBAR_GTK_H_
diff --git a/chrome/browser/gtk/instant_confirm_dialog_gtk.cc b/chrome/browser/ui/gtk/instant_confirm_dialog_gtk.cc
index 1e7725c..59a153f 100644
--- a/chrome/browser/gtk/instant_confirm_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/instant_confirm_dialog_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/instant_confirm_dialog_gtk.h b/chrome/browser/ui/gtk/instant_confirm_dialog_gtk.h
new file mode 100644
index 0000000..9999421
--- /dev/null
+++ b/chrome/browser/ui/gtk/instant_confirm_dialog_gtk.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_INSTANT_CONFIRM_DIALOG_GTK_H_
+#define CHROME_BROWSER_UI_GTK_INSTANT_CONFIRM_DIALOG_GTK_H_
+#pragma once
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+
+class Profile;
+typedef struct _GtkWindow GtkWindow;
+
+// A dialog that explains some of the privacy implications surrounding instant.
+// Shown when the user enables instant for the first time.
+class InstantConfirmDialogGtk {
+ public:
+ InstantConfirmDialogGtk(GtkWindow* parent, Profile* profile);
+ ~InstantConfirmDialogGtk();
+
+ private:
+ CHROMEGTK_CALLBACK_1(InstantConfirmDialogGtk, void, OnDialogResponse, int);
+ CHROMEGTK_CALLBACK_0(InstantConfirmDialogGtk, void, OnLinkButtonClicked);
+
+ GtkWidget* dialog_;
+ Profile* profile_;
+
+ DISALLOW_COPY_AND_ASSIGN(InstantConfirmDialogGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_INSTANT_CONFIRM_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/js_modal_dialog_gtk.cc b/chrome/browser/ui/gtk/js_modal_dialog_gtk.cc
index 27888d4..e1da7c7 100644
--- a/chrome/browser/gtk/js_modal_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/js_modal_dialog_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/js_modal_dialog_gtk.h b/chrome/browser/ui/gtk/js_modal_dialog_gtk.h
new file mode 100644
index 0000000..e40c38b
--- /dev/null
+++ b/chrome/browser/ui/gtk/js_modal_dialog_gtk.h
@@ -0,0 +1,42 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_JS_MODAL_DIALOG_GTK_H_
+#define CHROME_BROWSER_UI_GTK_JS_MODAL_DIALOG_GTK_H_
+#pragma once
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
+#include "gfx/native_widget_types.h"
+
+typedef struct _GtkWidget GtkWidget;
+
+class JavaScriptAppModalDialog;
+
+class JSModalDialogGtk : public NativeAppModalDialog {
+ public:
+ JSModalDialogGtk(JavaScriptAppModalDialog* dialog,
+ gfx::NativeWindow parent_window);
+ virtual ~JSModalDialogGtk();
+
+ // Overridden from NativeAppModalDialog:
+ virtual int GetAppModalDialogButtons() const;
+ virtual void ShowAppModalDialog();
+ virtual void ActivateAppModalDialog();
+ virtual void CloseAppModalDialog();
+ virtual void AcceptAppModalDialog();
+ virtual void CancelAppModalDialog();
+
+ private:
+ CHROMEGTK_CALLBACK_1(JSModalDialogGtk, void, OnDialogResponse, int);
+
+ scoped_ptr<JavaScriptAppModalDialog> dialog_;
+ GtkWidget* gtk_dialog_;
+
+ DISALLOW_COPY_AND_ASSIGN(JSModalDialogGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_JS_MODAL_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/keyword_editor_view.cc b/chrome/browser/ui/gtk/keyword_editor_view.cc
index 63931b9..c9cd9e7 100644
--- a/chrome/browser/gtk/keyword_editor_view.cc
+++ b/chrome/browser/ui/gtk/keyword_editor_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/keyword_editor_view.h b/chrome/browser/ui/gtk/keyword_editor_view.h
new file mode 100644
index 0000000..0b138a0
--- /dev/null
+++ b/chrome/browser/ui/gtk/keyword_editor_view.h
@@ -0,0 +1,167 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_KEYWORD_EDITOR_VIEW_H_
+#define CHROME_BROWSER_UI_GTK_KEYWORD_EDITOR_VIEW_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/table_model_observer.h"
+#include "base/basictypes.h"
+#include "base/gtest_prod_util.h"
+#include "base/scoped_ptr.h"
+#include "base/string16.h"
+#include "chrome/browser/search_engines/edit_search_engine_controller.h"
+#include "chrome/browser/search_engines/template_url_model_observer.h"
+
+class AccessibleWidgetHelper;
+class KeywordEditorController;
+class Profile;
+class TemplateURLTableModel;
+
+class KeywordEditorView : public TableModelObserver,
+ public TemplateURLModelObserver,
+ public EditSearchEngineControllerDelegate {
+ public:
+ virtual ~KeywordEditorView();
+
+ // Create (if necessary) and show the keyword editor window.
+ static void Show(Profile* profile);
+
+ // Overriden from EditSearchEngineControllerDelegate.
+ virtual void OnEditedKeyword(const TemplateURL* template_url,
+ const string16& title,
+ const string16& keyword,
+ const std::string& url);
+ private:
+ // Column ids for |list_store_|.
+ enum {
+ COL_FAVICON,
+ COL_TITLE,
+ COL_KEYWORD,
+ COL_IS_HEADER,
+ COL_IS_SEPARATOR,
+ COL_WEIGHT,
+ COL_WEIGHT_SET,
+ COL_COUNT,
+ };
+
+ explicit KeywordEditorView(Profile* profile);
+ void Init();
+
+ // Enable buttons based on selection state.
+ void EnableControls();
+
+ // Set the column values for |row| of |table_model_| in the |list_store_| at
+ // |iter|.
+ void SetColumnValues(int row, GtkTreeIter* iter);
+
+ // Get the row number in the GtkListStore corresponding to |model_row|.
+ int GetListStoreRowForModelRow(int model_row) const;
+
+ // Get the row number in the TemplateURLTableModel corresponding to |path|.
+ int GetModelRowForPath(GtkTreePath* path) const;
+
+ // Get the row number in the TemplateURLTableModel corresponding to |iter|.
+ int GetModelRowForIter(GtkTreeIter* iter) const;
+
+ // Get the row number in the TemplateURLTableModel of the current selection,
+ // or -1 if no row is selected.
+ int GetSelectedModelRow() const;
+
+ // Select the row in the |tree_| corresponding to |model_row|.
+ void SelectModelRow(int model_row);
+
+ // Add the values from |row| of |table_model_|.
+ void AddNodeToList(int row);
+
+ // TableModelObserver implementation.
+ virtual void OnModelChanged();
+ virtual void OnItemsChanged(int start, int length);
+ virtual void OnItemsAdded(int start, int length);
+ virtual void OnItemsRemoved(int start, int length);
+
+ // TemplateURLModelObserver notification.
+ virtual void OnTemplateURLModelChanged();
+
+ // Callback for window destruction.
+ static void OnWindowDestroy(GtkWidget* widget, KeywordEditorView* window);
+
+ // Callback for dialog buttons.
+ static void OnResponse(GtkDialog* dialog, int response_id,
+ KeywordEditorView* window);
+
+ // Callback checking whether a row should be drawn as a separator.
+ static gboolean OnCheckRowIsSeparator(GtkTreeModel* model,
+ GtkTreeIter* iter,
+ gpointer user_data);
+
+ // Callback checking whether a row may be selected. We use some rows in the
+ // table as headers/separators for the groups, which should not be selectable.
+ static gboolean OnSelectionFilter(GtkTreeSelection* selection,
+ GtkTreeModel* model,
+ GtkTreePath* path,
+ gboolean path_currently_selected,
+ gpointer user_data);
+
+ // Callback for when user selects something.
+ static void OnSelectionChanged(GtkTreeSelection* selection,
+ KeywordEditorView* editor);
+
+ // Callbacks for user actions modifying the table.
+ static void OnRowActivated(GtkTreeView* tree_view,
+ GtkTreePath* path,
+ GtkTreeViewColumn* column,
+ KeywordEditorView* editor);
+ static void OnAddButtonClicked(GtkButton* button,
+ KeywordEditorView* editor);
+ static void OnEditButtonClicked(GtkButton* button,
+ KeywordEditorView* editor);
+ static void OnRemoveButtonClicked(GtkButton* button,
+ KeywordEditorView* editor);
+ static void OnMakeDefaultButtonClicked(GtkButton* button,
+ KeywordEditorView* editor);
+
+ // The table listing the search engines.
+ GtkWidget* tree_;
+ GtkListStore* list_store_;
+ GtkTreeSelection* selection_;
+
+ // Buttons for acting on the table.
+ GtkWidget* add_button_;
+ GtkWidget* edit_button_;
+ GtkWidget* remove_button_;
+ GtkWidget* make_default_button_;
+
+ // The containing dialog.
+ GtkWidget* dialog_;
+
+ // The profile.
+ Profile* profile_;
+
+ scoped_ptr<KeywordEditorController> controller_;
+
+ TemplateURLTableModel* table_model_;
+
+ // We store our own index of the start of the second group within the model,
+ // as when OnItemsRemoved is called the value in the model is already updated
+ // but we need the old value to know which row to remove from the
+ // |list_store_|.
+ int model_second_group_index_;
+
+ // Helper object to manage accessibility metadata.
+ scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
+
+ friend class KeywordEditorViewTest;
+ FRIEND_TEST_ALL_PREFIXES(KeywordEditorViewTest, Empty);
+ FRIEND_TEST_ALL_PREFIXES(KeywordEditorViewTest, Add);
+ FRIEND_TEST_ALL_PREFIXES(KeywordEditorViewTest, MakeDefault);
+ FRIEND_TEST_ALL_PREFIXES(KeywordEditorViewTest, Remove);
+ FRIEND_TEST_ALL_PREFIXES(KeywordEditorViewTest, Edit);
+
+ DISALLOW_COPY_AND_ASSIGN(KeywordEditorView);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_KEYWORD_EDITOR_VIEW_H_
diff --git a/chrome/browser/gtk/keyword_editor_view_unittest.cc b/chrome/browser/ui/gtk/keyword_editor_view_unittest.cc
index 1f06fb8..345f50a1 100644
--- a/chrome/browser/gtk/keyword_editor_view_unittest.cc
+++ b/chrome/browser/ui/gtk/keyword_editor_view_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
index 5f95daa..982af73 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.h b/chrome/browser/ui/gtk/location_bar_view_gtk.h
new file mode 100644
index 0000000..abf94f1
--- /dev/null
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk.h
@@ -0,0 +1,435 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_
+#define CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <map>
+#include <string>
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "base/scoped_vector.h"
+#include "chrome/browser/autocomplete/autocomplete_edit.h"
+#include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h"
+#include "chrome/browser/extensions/extension_context_menu_model.h"
+#include "chrome/browser/extensions/image_loading_tracker.h"
+#include "chrome/browser/first_run/first_run.h"
+#include "chrome/browser/gtk/info_bubble_gtk.h"
+#include "chrome/browser/gtk/menu_gtk.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/browser/ui/omnibox/location_bar.h"
+#include "chrome/common/content_settings_types.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "chrome/common/page_transition_types.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+#include "webkit/glue/window_open_disposition.h"
+
+class AutocompleteEditViewGtk;
+class Browser;
+class CommandUpdater;
+class ContentSettingImageModel;
+class ContentSettingBubbleGtk;
+class ExtensionAction;
+class GtkThemeProvider;
+class Profile;
+class SkBitmap;
+class TabContents;
+class ToolbarModel;
+
+class LocationBarViewGtk : public AutocompleteEditController,
+ public LocationBar,
+ public LocationBarTesting,
+ public NotificationObserver {
+ public:
+ explicit LocationBarViewGtk(Browser* browser);
+ virtual ~LocationBarViewGtk();
+
+ void Init(bool popup_window_mode);
+
+ void SetProfile(Profile* profile);
+
+ // Returns the widget the caller should host. You must call Init() first.
+ GtkWidget* widget() { return hbox_.get(); }
+
+ // Returns the widget the page info bubble should point to.
+ GtkWidget* location_icon_widget() const { return location_icon_image_; }
+
+ // Returns the widget the extension installed bubble should point to.
+ GtkWidget* location_entry_widget() const { return entry_box_; }
+
+ // Returns the current TabContents.
+ TabContents* GetTabContents() const;
+
+ // Sets |preview_enabled| for the PageActionViewGtk associated with this
+ // |page_action|. If |preview_enabled| is true, the view will display the
+ // page action's icon even though it has not been activated by the extension.
+ // This is used by the ExtensionInstalledBubbleGtk to preview what the icon
+ // will look like for the user upon installation of the extension.
+ void SetPreviewEnabledPageAction(ExtensionAction *page_action,
+ bool preview_enabled);
+
+ // Retrieves the GtkWidget which is associated with PageActionView
+ // corresponding to |page_action|.
+ GtkWidget* GetPageActionWidget(ExtensionAction* page_action);
+
+ // Updates the location bar. We also reset the bar's permanent text and
+ // security style, and, if |tab_for_state_restoring| is non-NULL, also
+ // restore saved state that the tab holds.
+ void Update(const TabContents* tab_for_state_restoring);
+
+ // Show the bookmark bubble.
+ void ShowStarBubble(const GURL& url, bool newly_boomkarked);
+
+ // Set the starred state of the bookmark star.
+ void SetStarred(bool starred);
+
+ // Implement the AutocompleteEditController interface.
+ virtual void OnAutocompleteWillClosePopup();
+ virtual void OnAutocompleteLosingFocus(gfx::NativeView view_gaining_focus);
+ virtual void OnAutocompleteWillAccept();
+ // For this implementation, the parameter is ignored.
+ virtual bool OnCommitSuggestedText(const std::wstring& typed_text);
+ virtual bool AcceptCurrentInstantPreview();
+ virtual void OnSetSuggestedSearchText(const string16& suggested_text);
+ virtual void OnPopupBoundsChanged(const gfx::Rect& bounds);
+ virtual void OnAutocompleteAccept(const GURL& url,
+ WindowOpenDisposition disposition,
+ PageTransition::Type transition,
+ const GURL& alternate_nav_url);
+ virtual void OnChanged();
+ virtual void OnSelectionBoundsChanged();
+ virtual void OnKillFocus();
+ virtual void OnSetFocus();
+ virtual void OnInputInProgress(bool in_progress);
+ virtual SkBitmap GetFavIcon() const;
+ virtual std::wstring GetTitle() const;
+
+ // Implement the LocationBar interface.
+ virtual void ShowFirstRunBubble(FirstRun::BubbleType bubble_type);
+ virtual void SetSuggestedText(const string16& text);
+ virtual std::wstring GetInputString() const;
+ virtual WindowOpenDisposition GetWindowOpenDisposition() const;
+ virtual PageTransition::Type GetPageTransition() const;
+ virtual void AcceptInput();
+ virtual void FocusLocation(bool select_all);
+ virtual void FocusSearch();
+ virtual void UpdateContentSettingsIcons();
+ virtual void UpdatePageActions();
+ virtual void InvalidatePageActions();
+ virtual void SaveStateToContents(TabContents* contents);
+ virtual void Revert();
+ virtual const AutocompleteEditView* location_entry() const;
+ virtual AutocompleteEditView* location_entry();
+ virtual LocationBarTesting* GetLocationBarForTesting();
+
+ // Implement the LocationBarTesting interface.
+ virtual int PageActionCount();
+ virtual int PageActionVisibleCount();
+ virtual ExtensionAction* GetPageAction(size_t index);
+ virtual ExtensionAction* GetVisiblePageAction(size_t index);
+ virtual void TestPageActionPressed(size_t index);
+
+ // Implement the NotificationObserver interface.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Edit background color.
+ static const GdkColor kBackgroundColor;
+
+ private:
+ class ContentSettingImageViewGtk : public InfoBubbleGtkDelegate {
+ public:
+ ContentSettingImageViewGtk(ContentSettingsType content_type,
+ const LocationBarViewGtk* parent,
+ Profile* profile);
+ virtual ~ContentSettingImageViewGtk();
+
+ GtkWidget* widget() { return event_box_.get(); }
+
+ void set_profile(Profile* profile) { profile_ = profile; }
+
+ bool IsVisible() { return GTK_WIDGET_VISIBLE(widget()); }
+ void UpdateFromTabContents(TabContents* tab_contents);
+
+ private:
+ CHROMEGTK_CALLBACK_1(ContentSettingImageViewGtk, gboolean, OnButtonPressed,
+ GdkEvent*);
+
+ // InfoBubbleDelegate overrides:
+ virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble,
+ bool closed_by_escape);
+
+ scoped_ptr<ContentSettingImageModel> content_setting_image_model_;
+
+ // The widgets for this content settings view.
+ OwnedWidgetGtk event_box_;
+ OwnedWidgetGtk image_;
+
+ // The owning LocationBarViewGtk.
+ const LocationBarViewGtk* parent_;
+
+ // The currently active profile.
+ Profile* profile_;
+
+ // The currently shown info bubble if any.
+ ContentSettingBubbleGtk* info_bubble_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContentSettingImageViewGtk);
+ };
+
+ class PageActionViewGtk : public ImageLoadingTracker::Observer,
+ public ExtensionContextMenuModel::PopupDelegate {
+ public:
+ PageActionViewGtk(
+ LocationBarViewGtk* owner, Profile* profile,
+ ExtensionAction* page_action);
+ virtual ~PageActionViewGtk();
+
+ GtkWidget* widget() { return event_box_.get(); }
+
+ ExtensionAction* page_action() { return page_action_; }
+
+ void set_preview_enabled(bool preview_enabled) {
+ preview_enabled_ = preview_enabled;
+ }
+
+ bool IsVisible() { return GTK_WIDGET_VISIBLE(widget()); }
+
+ // Called to notify the PageAction that it should determine whether to be
+ // visible or hidden. |contents| is the TabContents that is active, |url|
+ // is the current page URL.
+ void UpdateVisibility(TabContents* contents, GURL url);
+
+ // A callback from ImageLoadingTracker for when the image has loaded.
+ virtual void OnImageLoaded(
+ SkBitmap* image, ExtensionResource resource, int index);
+
+ // Simulate left mouse click on the page action button.
+ void TestActivatePageAction();
+
+ // Overridden from ExtensionContextMenuModel::PopupDelegate:
+ virtual void InspectPopup(ExtensionAction* action);
+
+ private:
+ // Show the popup for this page action. If |devtools| is true, show it
+ // with a debugger window attached. Returns true if a popup was shown.
+ bool ShowPopup(bool devtools);
+
+ CHROMEGTK_CALLBACK_1(PageActionViewGtk, gboolean, OnButtonPressed,
+ GdkEvent*);
+ CHROMEGTK_CALLBACK_1(PageActionViewGtk, gboolean, OnExposeEvent,
+ GdkEventExpose*);
+
+ // The location bar view that owns us.
+ LocationBarViewGtk* owner_;
+
+ // The current profile (not owned by us).
+ Profile* profile_;
+
+ // The PageAction that this view represents. The PageAction is not owned by
+ // us, it resides in the extension of this particular profile.
+ ExtensionAction* page_action_;
+
+ // A cache of all the different icon paths associated with this page action.
+ typedef std::map<std::string, GdkPixbuf*> PixbufMap;
+ PixbufMap pixbufs_;
+
+ // A cache of the last dynamically generated bitmap and the pixbuf that
+ // corresponds to it. We keep track of both so we can free old pixbufs as
+ // their icons are replaced.
+ SkBitmap last_icon_skbitmap_;
+ GdkPixbuf* last_icon_pixbuf_;
+
+ // The object that is waiting for the image loading to complete
+ // asynchronously.
+ ImageLoadingTracker tracker_;
+
+ // The widgets for this page action.
+ OwnedWidgetGtk event_box_;
+ OwnedWidgetGtk image_;
+
+ // The tab id we are currently showing the icon for.
+ int current_tab_id_;
+
+ // The URL we are currently showing the icon for.
+ GURL current_url_;
+
+ // This is used for post-install visual feedback. The page_action icon
+ // is briefly shown even if it hasn't been enabled by its extension.
+ bool preview_enabled_;
+
+ // The context menu view and model for this extension action.
+ scoped_ptr<MenuGtk> context_menu_;
+ scoped_refptr<ExtensionContextMenuModel> context_menu_model_;
+
+ DISALLOW_COPY_AND_ASSIGN(PageActionViewGtk);
+ };
+ friend class PageActionViewGtk;
+
+ // Creates, initializes, and packs the location icon, EV certificate name,
+ // and optional border.
+ void BuildSiteTypeArea();
+
+ // Enable or disable the location icon/EV certificate as a drag source for
+ // the URL.
+ void SetSiteTypeDragSource();
+
+ GtkWidget* site_type_area() { return site_type_alignment_; }
+
+ CHROMEGTK_CALLBACK_1(LocationBarViewGtk, gboolean, HandleExpose,
+ GdkEventExpose*);
+ CHROMEGTK_CALLBACK_1(LocationBarViewGtk, gboolean, OnIconReleased,
+ GdkEventButton*);
+ CHROMEGTK_CALLBACK_4(LocationBarViewGtk, void, OnIconDragData,
+ GdkDragContext*, GtkSelectionData*, guint, guint);
+ CHROMEGTK_CALLBACK_1(LocationBarViewGtk, void, OnIconDragBegin,
+ GdkDragContext*);
+ CHROMEGTK_CALLBACK_1(LocationBarViewGtk, void, OnIconDragEnd,
+ GdkDragContext*);
+ CHROMEGTK_CALLBACK_1(LocationBarViewGtk, void, OnHboxSizeAllocate,
+ GtkAllocation*);
+ CHROMEGTK_CALLBACK_1(LocationBarViewGtk, void, OnEntryBoxSizeAllocate,
+ GtkAllocation*);
+ CHROMEGTK_CALLBACK_1(LocationBarViewGtk, gboolean, OnStarButtonPress,
+ GdkEventButton*);
+
+ // Updates the site type area: changes the icon and shows/hides the EV
+ // certificate information.
+ void UpdateSiteTypeArea();
+
+ // Updates the maximum size of the EV certificate label.
+ void UpdateEVCertificateLabelSize();
+
+ // Sets the text that should be displayed in the info label and its associated
+ // tooltip text. Call with an empty string if the info label should be
+ // hidden.
+ void SetInfoText();
+
+ // Set the keyword text for the Search BLAH: keyword box.
+ void SetKeywordLabel(const std::wstring& keyword);
+
+ // Set the keyword text for the "Press tab to search BLAH" hint box.
+ void SetKeywordHintLabel(const std::wstring& keyword);
+
+ void ShowFirstRunBubbleInternal(FirstRun::BubbleType bubble_type);
+
+ // Show or hide |tab_to_search_box_| and |tab_to_search_hint_| according to
+ // the value of |show_selected_keyword_|, |show_keyword_hint_|, and the
+ // available horizontal space in the location bar.
+ void AdjustChildrenVisibility();
+
+ // Build the star icon.
+ void CreateStarButton();
+
+ // Update the star icon after it is toggled or the theme changes.
+ void UpdateStarIcon();
+
+ // Returns true if we should only show the URL and none of the extras like
+ // the star button or page actions.
+ bool ShouldOnlyShowLocation();
+
+ // The outermost widget we want to be hosted.
+ OwnedWidgetGtk hbox_;
+
+ // Star button.
+ OwnedWidgetGtk star_;
+ GtkWidget* star_image_;
+ bool starred_;
+
+ // An icon to the left of the address bar.
+ GtkWidget* site_type_alignment_;
+ GtkWidget* site_type_event_box_;
+ GtkWidget* location_icon_image_;
+ GtkWidget* drag_icon_;
+ bool enable_location_drag_;
+ // TODO(pkasting): Split this label off and move the rest of the items to the
+ // left of the address bar.
+ GtkWidget* security_info_label_;
+
+ // Content setting icons.
+ OwnedWidgetGtk content_setting_hbox_;
+ ScopedVector<ContentSettingImageViewGtk> content_setting_views_;
+
+ // Extension page action icons.
+ OwnedWidgetGtk page_action_hbox_;
+ ScopedVector<PageActionViewGtk> page_action_views_;
+
+ // The widget that contains our tab hints and the location bar.
+ GtkWidget* entry_box_;
+
+ // Area on the left shown when in tab to search mode.
+ GtkWidget* tab_to_search_box_;
+ GtkWidget* tab_to_search_magnifier_;
+ GtkWidget* tab_to_search_full_label_;
+ GtkWidget* tab_to_search_partial_label_;
+
+ // Hint to user that they can tab-to-search by hitting tab.
+ GtkWidget* tab_to_search_hint_;
+ GtkWidget* tab_to_search_hint_leading_label_;
+ GtkWidget* tab_to_search_hint_icon_;
+ GtkWidget* tab_to_search_hint_trailing_label_;
+
+ scoped_ptr<AutocompleteEditViewGtk> location_entry_;
+
+ // Alignment used to wrap |location_entry_|.
+ GtkWidget* location_entry_alignment_;
+
+ Profile* profile_;
+ CommandUpdater* command_updater_;
+ ToolbarModel* toolbar_model_;
+ Browser* browser_;
+
+ // When we get an OnAutocompleteAccept notification from the autocomplete
+ // edit, we save the input string so we can give it back to the browser on
+ // the LocationBar interface via GetInputString().
+ std::wstring location_input_;
+
+ // The user's desired disposition for how their input should be opened.
+ WindowOpenDisposition disposition_;
+
+ // The transition type to use for the navigation.
+ PageTransition::Type transition_;
+
+ // Used to schedule a task for the first run info bubble.
+ ScopedRunnableMethodFactory<LocationBarViewGtk> first_run_bubble_;
+
+ // When true, the location bar view is read only and also is has a slightly
+ // different presentation (font size / color). This is used for popups.
+ bool popup_window_mode_;
+
+ // Provides colors and rendering mode.
+ GtkThemeProvider* theme_provider_;
+
+ NotificationRegistrar registrar_;
+
+ // Width of the main |hbox_|. Used to properly elide the EV certificate.
+ int hbox_width_;
+
+ // Width of the hbox that holds |tab_to_search_box_|, |location_entry_| and
+ // |tab_to_search_hint_|.
+ int entry_box_width_;
+
+ // Indicate if |tab_to_search_box_| should be shown.
+ bool show_selected_keyword_;
+
+ // Indicate if |tab_to_search_hint_| should be shown.
+ bool show_keyword_hint_;
+
+ // The last search keyword that was shown via the |tab_to_search_box_|.
+ std::wstring last_keyword_;
+
+ // True if we should update the instant controller when the edit text changes.
+ bool update_instant_;
+
+ DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_
diff --git a/chrome/browser/gtk/menu_bar_helper.cc b/chrome/browser/ui/gtk/menu_bar_helper.cc
index 7d8fa8d..b2cba9d 100644
--- a/chrome/browser/gtk/menu_bar_helper.cc
+++ b/chrome/browser/ui/gtk/menu_bar_helper.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/menu_bar_helper.h b/chrome/browser/ui/gtk/menu_bar_helper.h
new file mode 100644
index 0000000..e29a18e
--- /dev/null
+++ b/chrome/browser/ui/gtk/menu_bar_helper.h
@@ -0,0 +1,78 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// This class replicates some menubar behaviors that are tricky to get right.
+// It is used to create a more native feel for the bookmark bar.
+
+#ifndef CHROME_BROWSER_UI_GTK_MENU_BAR_HELPER_H_
+#define CHROME_BROWSER_UI_GTK_MENU_BAR_HELPER_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <vector>
+
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+
+class GtkSignalRegistrar;
+
+class MenuBarHelper {
+ public:
+ class Delegate {
+ public:
+ virtual ~Delegate() {}
+
+ // Called when a the menu for a button ought to be triggered.
+ virtual void PopupForButton(GtkWidget* button) = 0;
+ virtual void PopupForButtonNextTo(GtkWidget* button,
+ GtkMenuDirectionType dir) = 0;
+ };
+
+ // |delegate| cannot be null.
+ explicit MenuBarHelper(Delegate* delegate);
+ virtual ~MenuBarHelper();
+
+ // Must be called whenever a button's menu starts showing. It triggers the
+ // MenuBarHelper to start listening for certain events.
+ void MenuStartedShowing(GtkWidget* button, GtkWidget* menu);
+
+ // Add |button| to the set of buttons we care about.
+ void Add(GtkWidget* button);
+
+ // Remove |button| from the set of buttons we care about.
+ void Remove(GtkWidget* button);
+
+ // Clear all buttons from the set.
+ void Clear();
+
+ private:
+ CHROMEGTK_CALLBACK_0(MenuBarHelper, void, OnMenuHiddenOrDestroyed);
+ CHROMEGTK_CALLBACK_1(MenuBarHelper, gboolean, OnMenuMotionNotify,
+ GdkEventMotion*);
+ CHROMEGTK_CALLBACK_1(MenuBarHelper, void, OnMenuMoveCurrent,
+ GtkMenuDirectionType);
+
+ // The buttons for which we pop up menus. We do not own these, or even add
+ // refs to them.
+ std::vector<GtkWidget*> buttons_;
+
+ // The button that is currently showing a menu, or NULL.
+ GtkWidget* button_showing_menu_;
+
+ // The highest level menu that is currently showing, or NULL.
+ GtkWidget* showing_menu_;
+
+ // All the submenus of |showing_menu_|. We connect to motion events on all
+ // of them.
+ std::vector<GtkWidget*> submenus_;
+
+ // Signal handlers that are attached only between the "show" and "hide" events
+ // for the menu.
+ scoped_ptr<GtkSignalRegistrar> signal_handlers_;
+
+ Delegate* delegate_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_MENU_BAR_HELPER_H_
diff --git a/chrome/browser/gtk/menu_gtk.cc b/chrome/browser/ui/gtk/menu_gtk.cc
index 52b9c12..4836ba6 100644
--- a/chrome/browser/gtk/menu_gtk.cc
+++ b/chrome/browser/ui/gtk/menu_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/menu_gtk.h b/chrome/browser/ui/gtk/menu_gtk.h
new file mode 100644
index 0000000..1802caa
--- /dev/null
+++ b/chrome/browser/ui/gtk/menu_gtk.h
@@ -0,0 +1,199 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_MENU_GTK_H_
+#define CHROME_BROWSER_UI_GTK_MENU_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <string>
+#include <vector>
+
+#include "app/gtk_signal.h"
+#include "base/task.h"
+#include "gfx/point.h"
+
+class SkBitmap;
+
+namespace menus {
+class ButtonMenuItemModel;
+class MenuModel;
+}
+
+class MenuGtk {
+ public:
+ // Delegate class that lets another class control the status of the menu.
+ class Delegate {
+ public:
+ virtual ~Delegate() { }
+
+ // Called before a command is executed. This exists for the case where a
+ // model is handling the actual execution of commands, but the delegate
+ // still needs to know that some command got executed. This is called before
+ // and not after the command is executed because its execution may delete
+ // the menu and/or the delegate.
+ virtual void CommandWillBeExecuted() {}
+
+ // Called when the menu stops showing. This will be called before
+ // ExecuteCommand if the user clicks an item, but will also be called when
+ // the user clicks away from the menu.
+ virtual void StoppedShowing() {}
+
+ // Return true if we should override the "gtk-menu-images" system setting
+ // when showing image menu items for this menu.
+ virtual bool AlwaysShowIconForCmd(int command_id) const { return false; }
+
+ // Returns a tinted image used in button in a menu.
+ virtual GtkIconSet* GetIconSetForId(int idr) { return NULL; }
+
+ // Returns an icon for the menu item, if available.
+ virtual GtkWidget* GetImageForCommandId(int command_id) const;
+
+ static GtkWidget* GetDefaultImageForCommandId(int command_id);
+ };
+
+ MenuGtk(MenuGtk::Delegate* delegate, menus::MenuModel* model);
+ ~MenuGtk();
+
+ // Initialize GTK signal handlers.
+ void ConnectSignalHandlers();
+
+ // These methods are used to build the menu dynamically. The return value
+ // is the new menu item.
+ GtkWidget* AppendMenuItemWithLabel(int command_id, const std::string& label);
+ GtkWidget* AppendMenuItemWithIcon(int command_id, const std::string& label,
+ const SkBitmap& icon);
+ GtkWidget* AppendCheckMenuItemWithLabel(int command_id,
+ const std::string& label);
+ GtkWidget* AppendSeparator();
+ GtkWidget* AppendMenuItem(int command_id, GtkWidget* menu_item);
+ GtkWidget* AppendMenuItemToMenu(int index,
+ menus::MenuModel* model,
+ GtkWidget* menu_item,
+ GtkWidget* menu,
+ bool connect_to_activate);
+
+ // Displays the menu. |timestamp| is the time of activation. The popup is
+ // statically positioned at |widget|.
+ void Popup(GtkWidget* widget, gint button_type, guint32 timestamp);
+
+ // Displays the menu using the button type and timestamp of |event|. The popup
+ // is statically positioned at |widget|.
+ void Popup(GtkWidget* widget, GdkEvent* event);
+
+ // Displays the menu as a context menu, i.e. at the current cursor location.
+ // |event_time| is the time of the event that triggered the menu's display.
+ void PopupAsContext(guint32 event_time);
+
+ // Displays the menu at the given coords. |point| is intentionally not const.
+ void PopupAsContextAt(guint32 event_time, gfx::Point point);
+
+ // Displays the menu as a context menu for the passed status icon.
+ void PopupAsContextForStatusIcon(guint32 event_time, guint32 button,
+ GtkStatusIcon* icon);
+
+ // Displays the menu following a keyboard event (such as selecting |widget|
+ // and pressing "enter").
+ void PopupAsFromKeyEvent(GtkWidget* widget);
+
+ // Closes the menu.
+ void Cancel();
+
+ // Repositions the menu to be right under the button. Alignment is set as
+ // object data on |void_widget| with the tag "left_align". If "left_align"
+ // is true, it aligns the left side of the menu with the left side of the
+ // button. Otherwise it aligns the right side of the menu with the right side
+ // of the button. Public since some menus have odd requirements that don't
+ // belong in a public class.
+ static void WidgetMenuPositionFunc(GtkMenu* menu,
+ int* x,
+ int* y,
+ gboolean* push_in,
+ void* void_widget);
+
+ // Positions the menu to appear at the gfx::Point represented by |userdata|.
+ static void PointMenuPositionFunc(GtkMenu* menu,
+ int* x,
+ int* y,
+ gboolean* push_in,
+ gpointer userdata);
+
+ GtkWidget* widget() const { return menu_; }
+
+ // Updates all the enabled/checked states and the dynamic labels.
+ void UpdateMenu();
+
+ private:
+ // Builds a GtkImageMenuItem.
+ GtkWidget* BuildMenuItemWithImage(const std::string& label,
+ const SkBitmap& icon);
+
+ GtkWidget* BuildMenuItemWithImage(const std::string& label,
+ GtkWidget* image);
+
+ GtkWidget* BuildMenuItemWithLabel(const std::string& label,
+ int command_id);
+
+ // A function that creates a GtkMenu from |model_|.
+ void BuildMenuFromModel();
+ // Implementation of the above; called recursively.
+ void BuildSubmenuFromModel(menus::MenuModel* model, GtkWidget* menu);
+ // Builds a menu item with buttons in it from the data in the model.
+ GtkWidget* BuildButtomMenuItem(menus::ButtonMenuItemModel* model,
+ GtkWidget* menu);
+
+ void ExecuteCommand(menus::MenuModel* model, int id);
+
+ // Callback for when a menu item is clicked.
+ CHROMEGTK_CALLBACK_0(MenuGtk, void, OnMenuItemActivated);
+
+ // Called when one of the buttons are pressed.
+ CHROMEGTK_CALLBACK_1(MenuGtk, void, OnMenuButtonPressed, int);
+
+ // Called to maybe activate a button if that button isn't supposed to dismiss
+ // the menu.
+ CHROMEGTK_CALLBACK_1(MenuGtk, gboolean, OnMenuTryButtonPressed, int);
+
+ // Updates all the menu items' state.
+ CHROMEGTK_CALLBACK_0(MenuGtk, void, OnMenuShow);
+
+ // Sets the activating widget back to a normal appearance.
+ CHROMEGTK_CALLBACK_0(MenuGtk, void, OnMenuHidden);
+
+ // Sets the enable/disabled state and dynamic labels on our menu items.
+ static void SetButtonItemInfo(GtkWidget* button, gpointer userdata);
+
+ // Sets the check mark, enabled/disabled state and dynamic labels on our menu
+ // items.
+ static void SetMenuItemInfo(GtkWidget* widget, void* raw_menu);
+
+ // Queries this object about the menu state.
+ MenuGtk::Delegate* delegate_;
+
+ // If non-NULL, the MenuModel that we use to populate and control the GTK
+ // menu (overriding the delegate as a controller).
+ menus::MenuModel* model_;
+
+ // For some menu items, we want to show the accelerator, but not actually
+ // explicitly handle it. To this end we connect those menu items' accelerators
+ // to this group, but don't attach this group to any top level window.
+ GtkAccelGroup* dummy_accel_group_;
+
+ // gtk_menu_popup() does not appear to take ownership of popup menus, so
+ // MenuGtk explicitly manages the lifetime of the menu.
+ GtkWidget* menu_;
+
+ // True when we should ignore "activate" signals. Used to prevent
+ // menu items from getting activated when we are setting up the
+ // menu.
+ static bool block_activation_;
+
+ // We must free these at shutdown.
+ std::vector<MenuGtk*> submenus_we_own_;
+
+ ScopedRunnableMethodFactory<MenuGtk> factory_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_MENU_GTK_H_
diff --git a/chrome/browser/gtk/nine_box.cc b/chrome/browser/ui/gtk/nine_box.cc
index 9d65387..6cfe959 100644
--- a/chrome/browser/gtk/nine_box.cc
+++ b/chrome/browser/ui/gtk/nine_box.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/nine_box.h b/chrome/browser/ui/gtk/nine_box.h
new file mode 100644
index 0000000..6a8fc85
--- /dev/null
+++ b/chrome/browser/ui/gtk/nine_box.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_NINE_BOX_H_
+#define CHROME_BROWSER_UI_GTK_NINE_BOX_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+// A NineBox manages a set of source images representing a 3x3 grid, where
+// non-corner images can be tiled to make a larger image. It's used to
+// use bitmaps for constructing image-based resizable widgets like buttons.
+//
+// If you want just a vertical image that stretches in height but is fixed
+// in width, only pass in images for the left column (leave others NULL).
+// Similarly, for a horizontal image that stretches in width but is fixed in
+// height, only pass in images for the top row.
+//
+// TODO(port): add support for caching server-side pixmaps of prerendered
+// nineboxes.
+class NineBox {
+ public:
+ // Construct a NineBox with nine images. Images are specified using resource
+ // ids that will be passed to the resource bundle. Use 0 for no image.
+ NineBox(int top_left, int top, int top_right, int left, int center, int right,
+ int bottom_left, int bottom, int bottom_right);
+
+ // Construct a NineBox from a single image and insets indicating the sizes
+ // of the edges and corners.
+ NineBox(int image, int top_margin, int bottom_margin, int left_margin,
+ int right_margin);
+ ~NineBox();
+
+ // Render the NineBox to |dst|.
+ // The images will be tiled to fit into the widget.
+ void RenderToWidget(GtkWidget* dst) const;
+
+ // As above, but rendered partially transparent.
+ void RenderToWidgetWithOpacity(GtkWidget* dst, double opacity) const;
+
+ // Render the top row of images to |dst| between |x1| and |x1| + |width|.
+ // This is split from RenderToWidget so the toolbar can use it.
+ void RenderTopCenterStrip(cairo_t* cr, int x, int y, int width) const;
+
+ // Change all pixels that are white in |images_| to have 0 opacity.
+ void ChangeWhiteToTransparent();
+
+ // Set the shape of |widget| to match that of the ninebox. Note that |widget|
+ // must have its own window and be allocated. Also, currently only the top
+ // three images are used.
+ // TODO(estade): extend this function to use all 9 images (if it's ever
+ // needed).
+ void ContourWidget(GtkWidget* widget) const;
+
+ private:
+ GdkPixbuf* images_[9];
+ bool unref_pixbufs_on_destroy_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_NINE_BOX_H_
diff --git a/chrome/browser/gtk/notifications/balloon_view_gtk.cc b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc
index edb475e..cef0771 100644
--- a/chrome/browser/gtk/notifications/balloon_view_gtk.cc
+++ b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.h b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.h
new file mode 100644
index 0000000..99531c5
--- /dev/null
+++ b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.h
@@ -0,0 +1,130 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Draws the view for the balloons.
+
+#ifndef CHROME_BROWSER_UI_GTK_NOTIFICATIONS_BALLOON_VIEW_GTK_H_
+#define CHROME_BROWSER_UI_GTK_NOTIFICATIONS_BALLOON_VIEW_GTK_H_
+#pragma once
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/gtk/menu_gtk.h"
+#include "chrome/browser/gtk/notifications/balloon_view_host_gtk.h"
+#include "chrome/browser/notifications/balloon.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "gfx/point.h"
+#include "gfx/rect.h"
+#include "gfx/size.h"
+#include "ui/base/animation/animation_delegate.h"
+
+class BalloonCollection;
+class CustomDrawButton;
+class GtkThemeProvider;
+class MenuGtk;
+class NotificationDetails;
+class NotificationOptionsMenuModel;
+class NotificationSource;
+
+namespace ui {
+class SlideAnimation;
+}
+
+// A balloon view is the UI component for desktop notification toasts.
+// It draws a border, and within the border an HTML renderer.
+class BalloonViewImpl : public BalloonView,
+ public MenuGtk::Delegate,
+ public NotificationObserver,
+ public ui::AnimationDelegate {
+ public:
+ explicit BalloonViewImpl(BalloonCollection* collection);
+ ~BalloonViewImpl();
+
+ // BalloonView interface.
+ virtual void Show(Balloon* balloon);
+ virtual void Update();
+ virtual void RepositionToBalloon();
+ virtual void Close(bool by_user);
+ virtual gfx::Size GetSize() const;
+ virtual BalloonHost* GetHost() const;
+
+ private:
+ // NotificationObserver interface.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // ui::AnimationDelegate interface.
+ virtual void AnimationProgressed(const ui::Animation* animation);
+
+ // Do the delayed close work.
+ void DelayedClose(bool by_user);
+
+ // The height of the balloon's shelf.
+ // The shelf is where is close button is located.
+ int GetShelfHeight() const;
+
+ // The width and height that the frame should be. If the balloon inside
+ // changes size, this will not be the same as the actual frame size until
+ // RepositionToBalloon() has been called and the animation completes.
+ int GetDesiredTotalWidth() const;
+ int GetDesiredTotalHeight() const;
+
+ // Where the balloon contents should be placed with respect to the top left
+ // of the frame.
+ gfx::Point GetContentsOffset() const;
+
+ // Where the balloon contents should be in screen coordinates.
+ gfx::Rect GetContentsRectangle() const;
+
+ CHROMEGTK_CALLBACK_0(BalloonViewImpl, void, OnCloseButton);
+ CHROMEGTK_CALLBACK_1(BalloonViewImpl, gboolean, OnExpose, GdkEventExpose*);
+ CHROMEGTK_CALLBACK_0(BalloonViewImpl, void, OnOptionsMenuButton);
+ CHROMEGTK_CALLBACK_0(BalloonViewImpl, gboolean, OnDestroy);
+
+ // Non-owned pointer to the balloon which owns this object.
+ Balloon* balloon_;
+
+ GtkThemeProvider* theme_provider_;
+
+ // The window that contains the frame of the notification.
+ GtkWidget* frame_container_;
+
+ // The widget that contains the shelf.
+ GtkWidget* shelf_;
+
+ // The hbox within the shelf that contains the buttons.
+ GtkWidget* hbox_;
+
+ // The window that contains the contents of the notification.
+ GtkWidget* html_container_;
+
+ // The renderer of the HTML contents.
+ scoped_ptr<BalloonViewHost> html_contents_;
+
+ // The following factory is used to call methods at a later time.
+ ScopedRunnableMethodFactory<BalloonViewImpl> method_factory_;
+
+ // Close button.
+ scoped_ptr<CustomDrawButton> close_button_;
+
+ // An animation to move the balloon on the screen as its position changes.
+ scoped_ptr<ui::SlideAnimation> animation_;
+ gfx::Rect anim_frame_start_;
+ gfx::Rect anim_frame_end_;
+
+ // The options menu.
+ scoped_ptr<MenuGtk> options_menu_;
+ scoped_ptr<NotificationOptionsMenuModel> options_menu_model_;
+ // The button to open the options menu.
+ scoped_ptr<CustomDrawButton> options_menu_button_;
+
+ NotificationRegistrar notification_registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(BalloonViewImpl);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_NOTIFICATIONS_BALLOON_VIEW_GTK_H_
diff --git a/chrome/browser/gtk/notifications/balloon_view_host_gtk.cc b/chrome/browser/ui/gtk/notifications/balloon_view_host_gtk.cc
index 4bd7482..be7a089 100644
--- a/chrome/browser/gtk/notifications/balloon_view_host_gtk.cc
+++ b/chrome/browser/ui/gtk/notifications/balloon_view_host_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/notifications/balloon_view_host_gtk.h b/chrome/browser/ui/gtk/notifications/balloon_view_host_gtk.h
new file mode 100644
index 0000000..c013fa4
--- /dev/null
+++ b/chrome/browser/ui/gtk/notifications/balloon_view_host_gtk.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_NOTIFICATIONS_BALLOON_VIEW_HOST_GTK_H_
+#define CHROME_BROWSER_UI_GTK_NOTIFICATIONS_BALLOON_VIEW_HOST_GTK_H_
+#pragma once
+
+#include "chrome/browser/notifications/balloon_host.h"
+#include "gfx/native_widget_types.h"
+
+class RenderWidgetHostViewGtk;
+
+// BalloonViewHost class is a delegate to the renderer host for the HTML
+// notification. When initialized it creates a new RenderViewHost and loads
+// the contents of the toast into it. It also handles links within the toast,
+// loading them into a new tab.
+class BalloonViewHost : public BalloonHost {
+ public:
+ explicit BalloonViewHost(Balloon* balloon);
+
+ ~BalloonViewHost() {
+ Shutdown();
+ }
+
+ // Changes the size of the balloon.
+ void UpdateActualSize(const gfx::Size& new_size);
+
+ // Accessors.
+ gfx::NativeView native_view() const;
+
+ protected:
+ virtual void InitRenderWidgetHostView();
+ virtual RenderWidgetHostView* render_widget_host_view() const;
+
+ private:
+ // The GTK-specific widget host view. Owned by its native view.
+ RenderWidgetHostViewGtk* render_widget_host_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(BalloonViewHost);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_NOTIFICATIONS_BALLOON_VIEW_HOST_GTK_H_
diff --git a/chrome/browser/gtk/options/advanced_contents_gtk.cc b/chrome/browser/ui/gtk/options/advanced_contents_gtk.cc
index 7b1ad01..c769cf1 100644
--- a/chrome/browser/gtk/options/advanced_contents_gtk.cc
+++ b/chrome/browser/ui/gtk/options/advanced_contents_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/advanced_contents_gtk.h b/chrome/browser/ui/gtk/options/advanced_contents_gtk.h
new file mode 100644
index 0000000..b1d6485
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/advanced_contents_gtk.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_ADVANCED_CONTENTS_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_ADVANCED_CONTENTS_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+
+class Profile;
+class DownloadSection;
+class NetworkSection;
+class PrivacySection;
+class SecuritySection;
+class TranslateSection;
+class WebContentSection;
+
+class AdvancedContentsGtk {
+ public:
+ explicit AdvancedContentsGtk(Profile* profile);
+ virtual ~AdvancedContentsGtk();
+
+ GtkWidget* get_page_widget() const {
+ return page_;
+ }
+
+ private:
+ void Init();
+
+ // The profile.
+ Profile* profile_;
+
+ // The sections of the page.
+ scoped_ptr<DownloadSection> download_section_;
+ scoped_ptr<NetworkSection> network_section_;
+ scoped_ptr<TranslateSection> translate_section_;
+ scoped_ptr<PrivacySection> privacy_section_;
+ scoped_ptr<SecuritySection> security_section_;
+ scoped_ptr<WebContentSection> web_content_section_;
+
+ // The widget containing the advanced options sections.
+ GtkWidget* page_;
+
+ DISALLOW_COPY_AND_ASSIGN(AdvancedContentsGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_ADVANCED_CONTENTS_GTK_H_
diff --git a/chrome/browser/gtk/options/advanced_page_gtk.cc b/chrome/browser/ui/gtk/options/advanced_page_gtk.cc
index 1bab4b4..132e7b4 100644
--- a/chrome/browser/gtk/options/advanced_page_gtk.cc
+++ b/chrome/browser/ui/gtk/options/advanced_page_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/advanced_page_gtk.h b/chrome/browser/ui/gtk/options/advanced_page_gtk.h
new file mode 100644
index 0000000..22eb1fd
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/advanced_page_gtk.h
@@ -0,0 +1,49 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_ADVANCED_PAGE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_ADVANCED_PAGE_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "chrome/browser/gtk/options/advanced_contents_gtk.h"
+#include "chrome/browser/gtk/options/managed_prefs_banner_gtk.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/browser/ui/options/options_page_base.h"
+
+class Profile;
+
+class AdvancedPageGtk : public OptionsPageBase {
+ public:
+ explicit AdvancedPageGtk(Profile* profile);
+ virtual ~AdvancedPageGtk();
+
+ GtkWidget* get_page_widget() const {
+ return page_;
+ }
+
+ private:
+ void Init();
+
+ // Callback for reset to default button.
+ CHROMEGTK_CALLBACK_0(AdvancedPageGtk, void, OnResetToDefaultsClicked);
+
+ // Callback for reset to default confirmation dialog.
+ CHROMEGTK_CALLBACK_1(AdvancedPageGtk, void, OnResetToDefaultsResponse, int);
+
+ // The contents of the scroll box.
+ AdvancedContentsGtk advanced_contents_;
+
+ // The widget containing the options for this page.
+ GtkWidget* page_;
+
+ // Tracks managed preference warning banner state.
+ ManagedPrefsBannerGtk managed_prefs_banner_;
+
+ DISALLOW_COPY_AND_ASSIGN(AdvancedPageGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_ADVANCED_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/content_exception_editor.cc b/chrome/browser/ui/gtk/options/content_exception_editor.cc
index 5f8aa69..709393b 100644
--- a/chrome/browser/gtk/options/content_exception_editor.cc
+++ b/chrome/browser/ui/gtk/options/content_exception_editor.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/content_exception_editor.h b/chrome/browser/ui/gtk/options/content_exception_editor.h
new file mode 100644
index 0000000..833ebf8
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/content_exception_editor.h
@@ -0,0 +1,81 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_CONTENT_EXCEPTION_EDITOR_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_CONTENT_EXCEPTION_EDITOR_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "chrome/browser/content_exceptions_table_model.h"
+#include "chrome/browser/content_setting_combo_model.h"
+#include "chrome/common/content_settings.h"
+#include "chrome/common/content_settings_types.h"
+
+// An editor which lets the user create or edit an individual exception to the
+// current content setting policy. (i.e. let www.google.com always show
+// images). Modal to parent.
+class ContentExceptionEditor {
+ public:
+ class Delegate {
+ public:
+ // Invoked when the user accepts the edit.
+ virtual void AcceptExceptionEdit(
+ const ContentSettingsPattern& pattern,
+ ContentSetting setting,
+ bool is_off_the_record,
+ int index,
+ bool is_new) = 0;
+
+ protected:
+ virtual ~Delegate() {}
+ };
+
+ ContentExceptionEditor(GtkWindow* parent,
+ Delegate* delegate,
+ ContentExceptionsTableModel* model,
+ bool allow_off_the_record,
+ int index,
+ const ContentSettingsPattern& pattern,
+ ContentSetting setting,
+ bool is_off_the_record);
+ virtual ~ContentExceptionEditor() {}
+
+ private:
+ // Returns true if we're adding a new item.
+ bool is_new() const { return index_ == -1; }
+
+ bool IsPatternValid(const ContentSettingsPattern& pattern,
+ bool is_off_the_record) const;
+
+ void UpdateImage(GtkWidget* image, bool is_valid);
+
+ // GTK callbacks
+ CHROMEGTK_CALLBACK_0(ContentExceptionEditor, void, OnEntryChanged);
+ CHROMEGTK_CALLBACK_1(ContentExceptionEditor, void, OnResponse, int);
+ CHROMEGTK_CALLBACK_0(ContentExceptionEditor, void, OnWindowDestroy);
+
+ Delegate* delegate_;
+ ContentExceptionsTableModel* model_;
+
+ // The model for Combobox widget.
+ ContentSettingComboModel cb_model_;
+
+ // Index of the item being edited. If -1, indicates this is a new entry.
+ const int index_;
+ const ContentSettingsPattern pattern_;
+ const ContentSetting setting_;
+
+ // UI widgets.
+ GtkWidget* dialog_;
+ GtkWidget* entry_;
+ GtkWidget* pattern_image_;
+ GtkWidget* action_combo_;
+ GtkWidget* otr_checkbox_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContentExceptionEditor);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_CONTENT_EXCEPTION_EDITOR_H_
diff --git a/chrome/browser/gtk/options/content_exceptions_window_gtk.cc b/chrome/browser/ui/gtk/options/content_exceptions_window_gtk.cc
index 1189096..4bf3f73 100644
--- a/chrome/browser/gtk/options/content_exceptions_window_gtk.cc
+++ b/chrome/browser/ui/gtk/options/content_exceptions_window_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/content_exceptions_window_gtk.h b/chrome/browser/ui/gtk/options/content_exceptions_window_gtk.h
new file mode 100644
index 0000000..75a0fb1
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/content_exceptions_window_gtk.h
@@ -0,0 +1,120 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_CONTENT_EXCEPTIONS_WINDOW_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_CONTENT_EXCEPTIONS_WINDOW_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <string>
+
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/content_exceptions_table_model.h"
+#include "chrome/browser/gtk/gtk_tree.h"
+#include "chrome/browser/gtk/options/content_exception_editor.h"
+#include "chrome/common/content_settings.h"
+#include "chrome/common/content_settings_types.h"
+
+class HostContentSettingsMap;
+
+// Dialog that lists each of the exceptions to the current content policy, and
+// has options for adding/editing/removing entries. Modal to parrent.
+class ContentExceptionsWindowGtk : public gtk_tree::TableAdapter::Delegate,
+ public ContentExceptionEditor::Delegate {
+ public:
+ static void ShowExceptionsWindow(GtkWindow* window,
+ HostContentSettingsMap* map,
+ HostContentSettingsMap* off_the_record_map,
+ ContentSettingsType content_type);
+
+ ~ContentExceptionsWindowGtk();
+
+ // gtk_tree::TableAdapter::Delegate implementation:
+ virtual void SetColumnValues(int row, GtkTreeIter* iter);
+
+ // ContentExceptionEditor::Delegate implementation:
+ virtual void AcceptExceptionEdit(
+ const ContentSettingsPattern& pattern,
+ ContentSetting setting,
+ bool is_off_the_record,
+ int index,
+ bool is_new);
+
+ private:
+ // Column ids for |list_store_|.
+ enum {
+ COL_PATTERN,
+ COL_ACTION,
+ COL_OTR,
+ COL_COUNT
+ };
+
+ ContentExceptionsWindowGtk(GtkWindow* parent,
+ HostContentSettingsMap* map,
+ HostContentSettingsMap* off_the_record_map,
+ ContentSettingsType type);
+
+ // Updates which buttons are enabled.
+ void UpdateButtonState();
+
+ // Callbacks for the buttons.
+ CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, Add);
+ CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, Edit);
+ CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, Remove);
+ CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, RemoveAll);
+
+ // Returns the title of the window (changes based on what ContentSettingsType
+ // was set to in the constructor).
+ std::string GetWindowTitle() const;
+
+ // Gets the selected indicies in the two list stores. Indicies are returned
+ // in <list_store_, sort_list_store_> order.
+ void GetSelectedModelIndices(std::set<std::pair<int, int> >* indices);
+
+ // GTK Callbacks
+ CHROMEGTK_CALLBACK_2(ContentExceptionsWindowGtk, void,
+ OnTreeViewRowActivate, GtkTreePath*, GtkTreeViewColumn*);
+ CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, OnWindowDestroy);
+ CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void,
+ OnTreeSelectionChanged);
+
+ // The list presented in |treeview_|. Separate from |list_store_|, the list
+ // that backs |sort_model_|. This separation comes so the user can sort the
+ // data on screen without changing the underlying |list_store_|.
+ GtkTreeModel* sort_list_store_;
+
+ // The backing to |sort_list_store_|. Doesn't change when sorted.
+ GtkListStore* list_store_;
+
+ // The C++, views-ish, cross-platform model class that actually contains the
+ // gold standard data.
+ scoped_ptr<ContentExceptionsTableModel> model_;
+
+ // True if we also show exceptions from an OTR profile.
+ bool allow_off_the_record_;
+
+ // The adapter that ferries data back and forth between |model_| and
+ // |list_store_| whenever either of them change.
+ scoped_ptr<gtk_tree::TableAdapter> model_adapter_;
+
+ // The exception window.
+ GtkWidget* dialog_;
+
+ // The treeview that presents the site/action pairs.
+ GtkWidget* treeview_;
+
+ // The current user selection from |treeview_|.
+ GtkTreeSelection* treeview_selection_;
+
+ // Buttons.
+ GtkWidget* edit_button_;
+ GtkWidget* remove_button_;
+ GtkWidget* remove_all_button_;
+
+ friend class ContentExceptionsWindowGtkUnittest;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_CONTENT_EXCEPTIONS_WINDOW_GTK_H_
diff --git a/chrome/browser/gtk/options/content_exceptions_window_gtk_unittest.cc b/chrome/browser/ui/gtk/options/content_exceptions_window_gtk_unittest.cc
index 8af7c55..4e68470 100644
--- a/chrome/browser/gtk/options/content_exceptions_window_gtk_unittest.cc
+++ b/chrome/browser/ui/gtk/options/content_exceptions_window_gtk_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/options/content_filter_page_gtk.cc b/chrome/browser/ui/gtk/options/content_filter_page_gtk.cc
index 1bbbd52..d463c2a 100644
--- a/chrome/browser/gtk/options/content_filter_page_gtk.cc
+++ b/chrome/browser/ui/gtk/options/content_filter_page_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/content_filter_page_gtk.h b/chrome/browser/ui/gtk/options/content_filter_page_gtk.h
new file mode 100644
index 0000000..82daa24
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/content_filter_page_gtk.h
@@ -0,0 +1,72 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_CONTENT_FILTER_PAGE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_CONTENT_FILTER_PAGE_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "chrome/browser/content_settings/host_content_settings_map.h"
+#include "chrome/browser/ui/options/options_page_base.h"
+#include "chrome/common/content_settings.h"
+#include "chrome/common/content_settings_types.h"
+#include "chrome/common/notification_registrar.h"
+
+class ContentSettingsDetails;
+
+// A page in the content settings window. Used for everything but the Cookies
+// page (which has a much more complex dialog). A |content_type| is passed into
+// the constructor and the correct strings and settings are used.
+class ContentFilterPageGtk : public OptionsPageBase {
+ public:
+ ContentFilterPageGtk(Profile* profile, ContentSettingsType content_type);
+ virtual ~ContentFilterPageGtk();
+
+ GtkWidget* get_page_widget() const {
+ return page_;
+ }
+
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ private:
+ // This method is called during initialization to set the initial state of the
+ // buttons and called after a default content setting change (either value
+ // change or "is managed" state).
+ virtual void UpdateButtonsState();
+
+ virtual void NotifyContentSettingsChanged(
+ const ContentSettingsDetails* details);
+
+ // Builds the content of the dialog.
+ GtkWidget* InitGroup();
+
+ CHROMEGTK_CALLBACK_0(ContentFilterPageGtk, void, OnAllowToggled);
+ CHROMEGTK_CALLBACK_0(ContentFilterPageGtk, void, OnExceptionsClicked);
+ CHROMEGTK_CALLBACK_0(ContentFilterPageGtk, void, OnPluginsPageLinkClicked);
+
+ ContentSettingsType content_type_;
+
+ GtkWidget* page_;
+
+ // Controls for the content filter tab page.
+ GtkWidget* allow_radio_;
+ GtkWidget* ask_radio_;
+ GtkWidget* block_radio_;
+
+ GtkWidget* exceptions_button_;
+
+ NotificationRegistrar registrar_;
+
+ // If state of the UI is not changed by a user-action we need to ignore
+ // "toggled" events.
+ bool ignore_toggle_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContentFilterPageGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_CONTENT_FILTER_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/content_page_gtk.cc b/chrome/browser/ui/gtk/options/content_page_gtk.cc
index 0d39ad9..54ad10e 100644
--- a/chrome/browser/gtk/options/content_page_gtk.cc
+++ b/chrome/browser/ui/gtk/options/content_page_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/content_page_gtk.h b/chrome/browser/ui/gtk/options/content_page_gtk.h
new file mode 100644
index 0000000..571ab3c
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/content_page_gtk.h
@@ -0,0 +1,120 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_CONTENT_PAGE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_CONTENT_PAGE_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <string>
+
+#include "app/gtk_signal.h"
+#include "chrome/browser/autofill/personal_data_manager.h"
+#include "chrome/browser/gtk/options/managed_prefs_banner_gtk.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/ui/options/options_page_base.h"
+
+class Profile;
+
+class ContentPageGtk : public OptionsPageBase,
+ public ProfileSyncServiceObserver {
+ public:
+ explicit ContentPageGtk(Profile* profile);
+ ~ContentPageGtk();
+
+ GtkWidget* get_page_widget() const {
+ return page_;
+ }
+
+ // ProfileSyncServiceObserver method.
+ virtual void OnStateChanged();
+
+ private:
+ // Updates various sync controls based on the current sync state.
+ void UpdateSyncControls();
+
+ // Overridden from OptionsPageBase.
+ virtual void NotifyPrefChanged(const std::string* pref_name);
+
+ // Overridden from OptionsPageBase.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Update content area after a theme changed.
+ void ObserveThemeChanged();
+
+ // Initialize the option group widgets, return their container.
+ GtkWidget* InitPasswordSavingGroup();
+ GtkWidget* InitFormAutoFillGroup();
+ GtkWidget* InitBrowsingDataGroup();
+ GtkWidget* InitThemesGroup();
+ GtkWidget* InitSyncGroup();
+
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnImportButtonClicked);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnGtkThemeButtonClicked);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnResetDefaultThemeButtonClicked);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnGetThemesButtonClicked);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnSystemTitleBarRadioToggled);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnShowPasswordsButtonClicked);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnPasswordRadioToggled);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnAutoFillButtonClicked);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnSyncStartStopButtonClicked);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnSyncCustomizeButtonClicked);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnSyncActionLinkClicked);
+ CHROMEGTK_CALLBACK_1(ContentPageGtk, void, OnStopSyncDialogResponse, int);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnPrivacyDashboardLinkClicked);
+
+ // Widgets for the Password saving group.
+ GtkWidget* passwords_asktosave_radio_;
+ GtkWidget* passwords_neversave_radio_;
+ GtkWidget* show_passwords_button_;
+
+ // Widgets for the AutoFill group.
+ GtkWidget* autofill_button_;
+
+ // Widgets for the Appearance group.
+ GtkWidget* system_title_bar_show_radio_;
+ GtkWidget* system_title_bar_hide_radio_;
+ GtkWidget* themes_reset_button_;
+#if defined(TOOLKIT_GTK)
+ GtkWidget* gtk_theme_button_;
+#endif
+
+ // Widgets for the Sync group.
+ GtkWidget* sync_status_label_background_;
+ GtkWidget* sync_status_label_;
+ GtkWidget* sync_action_link_background_;
+ GtkWidget* sync_action_link_;
+ GtkWidget* sync_start_stop_button_;
+ GtkWidget* sync_customize_button_;
+ GtkWidget* privacy_dashboard_link_;
+
+ // The parent GtkTable widget
+ GtkWidget* page_;
+
+ // Pref members.
+ BooleanPrefMember ask_to_save_passwords_;
+ BooleanPrefMember form_autofill_enabled_;
+ BooleanPrefMember use_custom_chrome_frame_;
+
+ // Flag to ignore gtk callbacks while we are loading prefs, to avoid
+ // then turning around and saving them again.
+ bool initializing_;
+
+ NotificationRegistrar registrar_;
+
+ // Cached pointer to ProfileSyncService, if it exists. Kept up to date
+ // and NULL-ed out on destruction.
+ ProfileSyncService* sync_service_;
+
+ // Tracks managed preference warning banner state.
+ ManagedPrefsBannerGtk managed_prefs_banner_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContentPageGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_CONTENT_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/content_settings_window_gtk.cc b/chrome/browser/ui/gtk/options/content_settings_window_gtk.cc
index 293cc99..03ef51a 100644
--- a/chrome/browser/gtk/options/content_settings_window_gtk.cc
+++ b/chrome/browser/ui/gtk/options/content_settings_window_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/content_settings_window_gtk.h b/chrome/browser/ui/gtk/options/content_settings_window_gtk.h
new file mode 100644
index 0000000..6fe483a
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/content_settings_window_gtk.h
@@ -0,0 +1,73 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_CONTENT_SETTINGS_WINDOW_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_CONTENT_SETTINGS_WINDOW_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/gtk/options/cookie_filter_page_gtk.h"
+#include "chrome/browser/gtk/options/content_filter_page_gtk.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/common/content_settings_types.h"
+
+class AccessibleWidgetHelper;
+
+// A window that presents options to the user for blocking various kinds of
+// content in webpages (cookies, javascript, images, popups).
+class ContentSettingsWindowGtk {
+ public:
+ // Shows the current content settings page, opening a new one if it doesn't
+ // exist.
+ static void Show(GtkWindow* parent, ContentSettingsType page,
+ Profile* profile);
+ static void RegisterUserPrefs(PrefService* prefs);
+
+ explicit ContentSettingsWindowGtk(GtkWindow* parent, Profile* profile);
+ virtual ~ContentSettingsWindowGtk();
+
+ private:
+ // Shows the Tab corresponding to the specified Content Settings page.
+ void ShowContentSettingsTab(ContentSettingsType page);
+
+ CHROMEGTK_CALLBACK_2(ContentSettingsWindowGtk, void, OnSwitchPage,
+ GtkNotebookPage*, guint);
+ CHROMEGTK_CALLBACK_0(ContentSettingsWindowGtk, void, OnWindowDestroy);
+ CHROMEG_CALLBACK_0(ContentSettingsWindowGtk, void, OnListSelectionChanged,
+ GtkTreeSelection*);
+
+ // The options dialog.
+ GtkWidget* dialog_;
+
+ // The container of the option pages.
+ GtkWidget* notebook_;
+ GtkWidget* list_;
+
+ // The Profile associated with these options.
+ Profile* profile_;
+
+ // The last page the user was on when they opened the ContentSettings window.
+ IntegerPrefMember last_selected_page_;
+
+ // The individual page implementations. Note that we have a specialized one
+ // for cookies (which have more complex rules) and use the same basic page
+ // layout for each other type.
+ CookieFilterPageGtk cookie_page_;
+ ContentFilterPageGtk image_page_;
+ ContentFilterPageGtk javascript_page_;
+ ContentFilterPageGtk plugin_page_;
+ ContentFilterPageGtk popup_page_;
+ ContentFilterPageGtk geolocation_page_;
+ ContentFilterPageGtk notifications_page_;
+
+ // Helper object to manage accessibility metadata.
+ scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContentSettingsWindowGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_CONTENT_SETTINGS_WINDOW_GTK_H_
diff --git a/chrome/browser/gtk/options/cookie_filter_page_gtk.cc b/chrome/browser/ui/gtk/options/cookie_filter_page_gtk.cc
index 908b6ce..e2303c0 100644
--- a/chrome/browser/gtk/options/cookie_filter_page_gtk.cc
+++ b/chrome/browser/ui/gtk/options/cookie_filter_page_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/cookie_filter_page_gtk.h b/chrome/browser/ui/gtk/options/cookie_filter_page_gtk.h
new file mode 100644
index 0000000..dbd361d
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/cookie_filter_page_gtk.h
@@ -0,0 +1,77 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_COOKIE_FILTER_PAGE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_COOKIE_FILTER_PAGE_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <string>
+
+#include "app/gtk_signal.h"
+#include "chrome/browser/content_settings/host_content_settings_map.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/browser/ui/options/options_page_base.h"
+
+class Profile;
+
+// A page in the content settings window for cookie options. This dialog has
+// more options as is more complicated then all the other pages implemented
+// with ContentPageGtk.
+class CookieFilterPageGtk : public OptionsPageBase {
+ public:
+ explicit CookieFilterPageGtk(Profile* profile);
+ virtual ~CookieFilterPageGtk();
+
+ GtkWidget* get_page_widget() const {
+ return page_;
+ }
+
+ private:
+ // Updates the UI state.
+ virtual void UpdateUiState();
+
+ // Overridden from OptionsPageBase
+ virtual void NotifyPrefChanged(const std::string* pref_name);
+ virtual void HighlightGroup(OptionsGroup highlight_group);
+
+ CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnCookiesAllowToggled);
+ CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnExceptionsClicked);
+ CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnBlockThirdPartyToggled);
+ CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnClearOnCloseToggled);
+ CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnShowCookiesClicked);
+ CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnFlashLinkClicked);
+
+ GtkWidget* InitCookieStoringGroup();
+
+ // Widgets of the cookie storing group
+ GtkWidget* allow_radio_;
+ GtkWidget* block_radio_;
+
+ GtkWidget* exceptions_button_;
+ GtkWidget* block_3rdparty_check_;
+ GtkWidget* clear_on_close_check_;
+ GtkWidget* show_cookies_button_;
+
+ // The parent GtkTable widget
+ GtkWidget* page_;
+
+ // If state of the UI is not changed by a user-action we need to ignore
+ // "toggled" events.
+ bool ignore_toggle_;
+
+ // Clear locally stored site data on exit pref.
+ BooleanPrefMember clear_site_data_on_exit_;
+
+ // Block third-party-cookies.
+ BooleanPrefMember block_third_party_cookies_;
+
+ // Managed default-cookies-setting.
+ IntegerPrefMember managed_default_cookies_setting_;
+
+ DISALLOW_COPY_AND_ASSIGN(CookieFilterPageGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_COOKIE_FILTER_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/cookies_view.cc b/chrome/browser/ui/gtk/options/cookies_view.cc
index 9b4cedd..ccb09c9 100644
--- a/chrome/browser/gtk/options/cookies_view.cc
+++ b/chrome/browser/ui/gtk/options/cookies_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/cookies_view.h b/chrome/browser/ui/gtk/options/cookies_view.h
new file mode 100644
index 0000000..fd52da2
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/cookies_view.h
@@ -0,0 +1,151 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This is the Gtk implementation of the Cookie Manager dialog.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_COOKIES_VIEW_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_COOKIES_VIEW_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/gtest_prod_util.h"
+#include "base/scoped_ptr.h"
+#include "base/task.h"
+#include "chrome/browser/browsing_data_appcache_helper.h"
+#include "chrome/browser/browsing_data_database_helper.h"
+#include "chrome/browser/browsing_data_indexed_db_helper.h"
+#include "chrome/browser/browsing_data_local_storage_helper.h"
+#include "chrome/browser/gtk/gtk_chrome_cookie_view.h"
+#include "chrome/browser/gtk/gtk_tree.h"
+#include "net/base/cookie_monster.h"
+
+class CookieDisplayGtk;
+class CookiesTreeModel;
+class CookiesViewTest;
+class Profile;
+
+// CookiesView is thread-hostile, and should only be called on the UI thread.
+// Usage:
+// CookiesView::Show(profile);
+// Once the CookiesView is shown, it is responsible for deleting itself when the
+// user closes the dialog.
+
+class CookiesView : public gtk_tree::TreeAdapter::Delegate {
+ public:
+ virtual ~CookiesView();
+
+ // Create (if necessary) and show the cookie manager window.
+ static void Show(
+ GtkWindow* parent,
+ Profile* profile,
+ BrowsingDataDatabaseHelper* browsing_data_database_helper,
+ BrowsingDataLocalStorageHelper* browsing_data_local_storage_helper,
+ BrowsingDataAppCacheHelper* browsing_data_appcache_helper,
+ BrowsingDataIndexedDBHelper* browsing_data_indexed_db_helper);
+
+ // gtk_tree::TreeAdapter::Delegate implementation.
+ virtual void OnAnyModelUpdateStart();
+ virtual void OnAnyModelUpdate();
+
+ private:
+ CookiesView(
+ GtkWindow* parent,
+ Profile* profile,
+ BrowsingDataDatabaseHelper* browsing_data_database_helper,
+ BrowsingDataLocalStorageHelper* browsing_data_local_storage_helper,
+ BrowsingDataAppCacheHelper* browsing_data_appcache_helper,
+ BrowsingDataIndexedDBHelper* browsing_data_indexed_db_helper);
+
+ // A method only used in unit tests that sets a bit inside this class that
+ // lets it be stack allocated.
+ void TestDestroySynchronously();
+
+ // Initialize the dialog contents and layout.
+ void Init(GtkWindow* parent);
+
+ // Set the initial selection and tree expanded state.
+ void SetInitialTreeState();
+
+ // Set sensitivity of buttons based on selection and filter state.
+ void EnableControls();
+
+ // Remove any cookies that are currently selected.
+ void RemoveSelectedItems();
+
+ CHROMEGTK_CALLBACK_1(CookiesView, void, OnResponse, int);
+ CHROMEGTK_CALLBACK_0(CookiesView, void, OnWindowDestroy);
+ // Callback for the table.
+ CHROMEGTK_CALLBACK_0(CookiesView, void, OnTreeViewSelectionChange);
+ CHROMEGTK_CALLBACK_1(CookiesView, gboolean, OnTreeViewKeyPress,
+ GdkEventKey*);
+ CHROMEGTK_CALLBACK_2(CookiesView, void, OnTreeViewRowExpanded,
+ GtkTreeIter*, GtkTreePath*);
+ // Callbacks for user actions filtering the list.
+ CHROMEGTK_CALLBACK_0(CookiesView, void, OnFilterEntryActivated);
+ CHROMEGTK_CALLBACK_0(CookiesView, void, OnFilterEntryChanged);
+ CHROMEGTK_CALLBACK_0(CookiesView, void, OnFilterClearButtonClicked);
+
+ // Filter the list against the text in |filter_entry_|.
+ void UpdateFilterResults();
+
+
+ // The parent widget.
+ GtkWidget* dialog_;
+
+ // Widgets of the dialog.
+ GtkWidget* description_label_;
+ GtkWidget* filter_entry_;
+ GtkWidget* filter_clear_button_;
+ GtkWidget* remove_button_;
+ GtkWidget* remove_all_button_;
+
+ // The table listing the cookies.
+ GtkWidget* tree_;
+ GtkTreeSelection* selection_;
+
+ GtkWidget* cookie_display_;
+
+ // The profile and related helpers.
+ Profile* profile_;
+ scoped_refptr<BrowsingDataDatabaseHelper> browsing_data_database_helper_;
+ scoped_refptr<BrowsingDataLocalStorageHelper>
+ browsing_data_local_storage_helper_;
+ scoped_refptr<BrowsingDataAppCacheHelper> browsing_data_appcache_helper_;
+ scoped_refptr<BrowsingDataIndexedDBHelper> browsing_data_indexed_db_helper_;
+
+ // A factory to construct Runnable Methods so that we can be called back to
+ // re-evaluate the model after the search query string changes.
+ ScopedRunnableMethodFactory<CookiesView> filter_update_factory_;
+
+ // The Cookies Table model.
+ scoped_ptr<CookiesTreeModel> cookies_tree_model_;
+ scoped_ptr<gtk_tree::TreeAdapter> cookies_tree_adapter_;
+
+ // A reference to the "destroy" signal handler for this object. We disconnect
+ // from this signal if we need to be destroyed synchronously.
+ gulong destroy_handler_;
+
+ // Whether we own |dialog_| or the other way around.
+ bool destroy_dialog_in_destructor_;
+
+ friend class CookiesViewTest;
+ FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, Empty);
+ FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, Noop);
+ FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, RemoveAll);
+ FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, RemoveAllWithDefaultSelected);
+ FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, Remove);
+ FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, RemoveCookiesByType);
+ FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, RemoveByDomain);
+ FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, RemoveDefaultSelection);
+ FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, Filter);
+ FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, FilterRemoveAll);
+ FRIEND_TEST_ALL_PREFIXES(CookiesViewTest, FilterRemove);
+
+ DISALLOW_COPY_AND_ASSIGN(CookiesView);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_COOKIES_VIEW_H_
diff --git a/chrome/browser/gtk/options/cookies_view_unittest.cc b/chrome/browser/ui/gtk/options/cookies_view_unittest.cc
index 8087cf8..61f70fd 100644
--- a/chrome/browser/gtk/options/cookies_view_unittest.cc
+++ b/chrome/browser/ui/gtk/options/cookies_view_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/options/fonts_languages_window_gtk.cc b/chrome/browser/ui/gtk/options/fonts_languages_window_gtk.cc
index e37cb1c..e8ce90a 100644
--- a/chrome/browser/gtk/options/fonts_languages_window_gtk.cc
+++ b/chrome/browser/ui/gtk/options/fonts_languages_window_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/options/fonts_page_gtk.cc b/chrome/browser/ui/gtk/options/fonts_page_gtk.cc
index cbe39c3..f6ef7bc 100644
--- a/chrome/browser/gtk/options/fonts_page_gtk.cc
+++ b/chrome/browser/ui/gtk/options/fonts_page_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/fonts_page_gtk.h b/chrome/browser/ui/gtk/options/fonts_page_gtk.h
new file mode 100644
index 0000000..020a7b3
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/fonts_page_gtk.h
@@ -0,0 +1,75 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// The fonts page of the fonts & languages options dialog, which contains font
+// family and size settings, as well as the default encoding option.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_FONTS_PAGE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_FONTS_PAGE_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/character_encoding.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/browser/ui/options/options_page_base.h"
+
+class DefaultEncodingComboboxModel;
+
+class FontsPageGtk : public OptionsPageBase {
+ public:
+ explicit FontsPageGtk(Profile* profile);
+ virtual ~FontsPageGtk();
+
+ GtkWidget* get_page_widget() const { return page_; }
+
+ private:
+ void Init();
+ void InitDefaultEncodingComboBox();
+
+ // Overridden from OptionsPageBase.
+ virtual void NotifyPrefChanged(const std::string* pref_name);
+
+ // Retrieve the font selection from the button and save it to the prefs. Also
+ // ensure the button(s) are displayed in the proper size, as the
+ // GtkFontSelector returns the value in points not pixels.
+ void SetFontsFromButton(StringPrefMember* name_pref,
+ IntegerPrefMember* size_pref,
+ GtkWidget* font_button);
+
+ CHROMEGTK_CALLBACK_0(FontsPageGtk, void, OnSerifFontSet);
+ CHROMEGTK_CALLBACK_0(FontsPageGtk, void, OnSansFontSet);
+ CHROMEGTK_CALLBACK_0(FontsPageGtk, void, OnFixedFontSet);
+ CHROMEGTK_CALLBACK_0(FontsPageGtk, void, OnDefaultEncodingChanged);
+
+ // The font chooser widgets
+ GtkWidget* serif_font_button_;
+ GtkWidget* sans_font_button_;
+ GtkWidget* fixed_font_button_;
+
+ // The default encoding combobox widget.
+ GtkWidget* default_encoding_combobox_;
+ scoped_ptr<DefaultEncodingComboboxModel> default_encoding_combobox_model_;
+
+ // The widget containing the options for this page.
+ GtkWidget* page_;
+
+ // Font name preferences.
+ StringPrefMember serif_name_;
+ StringPrefMember sans_serif_name_;
+ StringPrefMember fixed_width_name_;
+
+ // Font size preferences, in pixels.
+ IntegerPrefMember variable_width_size_;
+ IntegerPrefMember fixed_width_size_;
+
+ // Default encoding preference.
+ StringPrefMember default_encoding_;
+
+ DISALLOW_COPY_AND_ASSIGN(FontsPageGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_FONTS_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/general_page_gtk.cc b/chrome/browser/ui/gtk/options/general_page_gtk.cc
index 4646b12..c541eab 100644
--- a/chrome/browser/gtk/options/general_page_gtk.cc
+++ b/chrome/browser/ui/gtk/options/general_page_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/general_page_gtk.h b/chrome/browser/ui/gtk/options/general_page_gtk.h
new file mode 100644
index 0000000..88492de
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/general_page_gtk.h
@@ -0,0 +1,179 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_GENERAL_PAGE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_GENERAL_PAGE_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <string>
+
+#include "app/gtk_signal.h"
+#include "chrome/browser/gtk/gtk_tree.h"
+#include "chrome/browser/gtk/options/managed_prefs_banner_gtk.h"
+#include "chrome/browser/prefs/pref_change_registrar.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/browser/search_engines/template_url_model_observer.h"
+#include "chrome/browser/shell_integration.h"
+#include "chrome/browser/ui/options/options_page_base.h"
+#include "googleurl/src/gurl.h"
+
+class AccessibleWidgetHelper;
+class CustomHomePagesTableModel;
+class Profile;
+class TemplateURLModel;
+
+class GeneralPageGtk : public OptionsPageBase,
+ public TemplateURLModelObserver,
+ public ShellIntegration::DefaultBrowserObserver,
+ public gtk_tree::TableAdapter::Delegate {
+ public:
+ explicit GeneralPageGtk(Profile* profile);
+ ~GeneralPageGtk();
+
+ GtkWidget* get_page_widget() const { return page_; }
+
+ private:
+ GtkWindow* GetWindow();
+
+ // Overridden from OptionsPageBase
+ virtual void NotifyPrefChanged(const std::string* pref_name);
+ virtual void HighlightGroup(OptionsGroup highlight_group);
+
+ // Initialize the option group widgets, return their container
+ GtkWidget* InitStartupGroup();
+ GtkWidget* InitHomepageGroup();
+ GtkWidget* InitDefaultSearchGroup();
+ GtkWidget* InitDefaultBrowserGroup();
+
+ // Saves the startup preference from the values in the ui
+ void SaveStartupPref();
+
+ // Set the custom url list using the pages currently open
+ void SetCustomUrlListFromCurrentPages();
+
+ // Callback from UrlPickerDialogGtk, for adding custom urls manually.
+ // If a single row in the list is selected, the new url will be inserted
+ // before that row. Otherwise the new row will be added to the end.
+ void OnAddCustomUrl(const GURL& url);
+
+ // Removes urls that are currently selected
+ void RemoveSelectedCustomUrls();
+
+ // Overridden from TemplateURLModelObserver.
+ // Populates the default search engine combobox from the model.
+ virtual void OnTemplateURLModelChanged();
+
+ // Set the default search engine pref to the combo box active item.
+ void SetDefaultSearchEngineFromComboBox();
+
+ // Set the default search engine combo box state.
+ void EnableDefaultSearchEngineComboBox(bool enable);
+
+ // Copies the home page preferences from the gui controls to
+ // kNewTabPageIsHomePage and kHomePage. If an empty or null-host
+ // URL is specified, then we revert to using NewTab page as the Homepage.
+ void UpdateHomepagePrefs();
+
+ // Enables or disables the field for entering a custom homepage URL.
+ void EnableHomepageURLField(bool enabled);
+
+ // Sets the state and enables/disables the radio buttons that control
+ // if the home page is the new tab page.
+ void UpdateHomepageIsNewTabRadio(bool homepage_is_new_tab, bool enabled);
+
+ CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnStartupRadioToggled);
+ CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnStartupAddCustomPageClicked);
+ CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnStartupRemoveCustomPageClicked);
+ CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnStartupUseCurrentPageClicked);
+ CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnNewTabIsHomePageToggled);
+ CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnHomepageUseUrlEntryChanged);
+ CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnShowHomeButtonToggled);
+ CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnDefaultSearchEngineChanged);
+ CHROMEGTK_CALLBACK_0(GeneralPageGtk, void,
+ OnDefaultSearchManageEnginesClicked);
+ CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnInstantToggled);
+ CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnBrowserUseAsDefaultClicked);
+ CHROMEGTK_CALLBACK_1(GeneralPageGtk, void, OnInstantLabelSizeAllocate,
+ GtkAllocation*);
+ CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnSearchLearnMoreClicked);
+
+ CHROMEG_CALLBACK_0(GeneralPageGtk, void, OnStartupPagesSelectionChanged,
+ GtkTreeSelection*);
+
+ // Enables/Disables the controls associated with the custom start pages
+ // option if that preference is not selected.
+ void EnableCustomHomepagesControls(bool enable);
+
+ // ShellIntegration::DefaultBrowserObserver implementation.
+ virtual void SetDefaultBrowserUIState(
+ ShellIntegration::DefaultBrowserUIState state);
+
+ // gtk_tree::TableAdapter::Delegate implementation.
+ virtual void SetColumnValues(int row, GtkTreeIter* iter);
+
+ // Widgets of the startup group
+ GtkWidget* startup_homepage_radio_;
+ GtkWidget* startup_last_session_radio_;
+ GtkWidget* startup_custom_radio_;
+ GtkWidget* startup_custom_pages_tree_;
+ GtkListStore* startup_custom_pages_store_;
+ GtkTreeSelection* startup_custom_pages_selection_;
+ GtkWidget* startup_add_custom_page_button_;
+ GtkWidget* startup_remove_custom_page_button_;
+ GtkWidget* startup_use_current_page_button_;
+
+ // The model for |startup_custom_pages_store_|.
+ scoped_ptr<CustomHomePagesTableModel> startup_custom_pages_table_model_;
+ scoped_ptr<gtk_tree::TableAdapter> startup_custom_pages_table_adapter_;
+
+ // Widgets and prefs of the homepage group
+ GtkWidget* homepage_use_newtab_radio_;
+ GtkWidget* homepage_use_url_radio_;
+ GtkWidget* homepage_use_url_entry_;
+ GtkWidget* homepage_show_home_button_checkbox_;
+ BooleanPrefMember new_tab_page_is_home_page_;
+ StringPrefMember homepage_;
+ BooleanPrefMember show_home_button_;
+
+ // Widgets and data of the default search group
+ GtkWidget* default_search_engine_combobox_;
+ GtkListStore* default_search_engines_model_;
+ GtkWidget* default_search_manage_engines_button_;
+ TemplateURLModel* template_url_model_;
+ GtkWidget* instant_checkbox_;
+ // This widget acts as the indent for the instant warning label.
+ GtkWidget* instant_indent_;
+ BooleanPrefMember instant_;
+
+ // Widgets of the default browser group
+ GtkWidget* default_browser_status_label_;
+ GtkWidget* default_browser_use_as_default_button_;
+
+ // The parent GtkTable widget
+ GtkWidget* page_;
+
+ // Flag to ignore gtk callbacks while we are populating default search urls.
+ bool default_search_initializing_;
+
+ // Flag to ignore gtk callbacks while we are loading prefs, to avoid
+ // then turning around and saving them again.
+ bool initializing_;
+
+ // The helper object that performs default browser set/check tasks.
+ scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_;
+
+ // Helper object to manage accessibility metadata.
+ scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
+
+ // Tracks managed preference warning banner state.
+ ManagedPrefsBannerGtk managed_prefs_banner_;
+
+ PrefChangeRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(GeneralPageGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_GENERAL_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/languages_page_gtk.cc b/chrome/browser/ui/gtk/options/languages_page_gtk.cc
index 6a400db..659b49a 100644
--- a/chrome/browser/gtk/options/languages_page_gtk.cc
+++ b/chrome/browser/ui/gtk/options/languages_page_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/languages_page_gtk.h b/chrome/browser/ui/gtk/options/languages_page_gtk.h
new file mode 100644
index 0000000..adecbbb
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/languages_page_gtk.h
@@ -0,0 +1,132 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// The languages page of the Languages & languages options dialog, which
+// contains accept-languages and spellchecker language options.
+//
+// Note that we intentionally do not implement the application locale setting,
+// as it does not make sense on Linux, where locale is set through the LANG and
+// LC_* environment variables.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_LANGUAGES_PAGE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_LANGUAGES_PAGE_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <string>
+
+#include "app/gtk_signal.h"
+#include "base/gtest_prod_util.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/gtk/gtk_tree.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/browser/ui/options/options_page_base.h"
+
+class LanguageComboboxModel;
+class LanguageOrderTableModel;
+
+class LanguagesPageGtk
+ : public OptionsPageBase,
+ public gtk_tree::TableAdapter::Delegate {
+ public:
+ explicit LanguagesPageGtk(Profile* profile);
+ virtual ~LanguagesPageGtk();
+
+ GtkWidget* get_page_widget() const { return page_; }
+
+ // gtk_tree::TableAdapter::Delegate implementation.
+ virtual void OnAnyModelUpdate();
+ virtual void SetColumnValues(int row, GtkTreeIter* iter);
+
+ // Callback from AddLanguageDialog.
+ void OnAddLanguage(const std::string& new_language);
+
+ private:
+ // Column ids for |language_order_store_|.
+ enum {
+ COL_LANG,
+ COL_COUNT,
+ };
+
+ void Init();
+
+ // Enable buttons based on selection state.
+ void EnableControls();
+
+ // Get the row number of the first selected row or -1 if no row is selected.
+ int FirstSelectedRowNum();
+
+ // Overridden from OptionsPageBase.
+ virtual void NotifyPrefChanged(const std::string* pref_name);
+
+ // Callbacks for accept languages widgets.
+ CHROMEG_CALLBACK_0(LanguagesPageGtk, void, OnSelectionChanged,
+ GtkTreeSelection*);
+ CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnAddButtonClicked);
+ CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnRemoveButtonClicked);
+ CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnMoveUpButtonClicked);
+ CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnMoveDownButtonClicked);
+
+ // Callbacks for spellchecker option widgets.
+ CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnEnableSpellCheckingToggled);
+ CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void,
+ OnEnableAutoSpellCheckingToggled);
+ CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnDictionaryLanguageChanged);
+
+ // The accept languages widgets.
+ GtkListStore* language_order_store_;
+ GtkWidget* language_order_tree_;
+ GtkTreeSelection* language_order_selection_;
+ GtkWidget* move_up_button_;
+ GtkWidget* move_down_button_;
+ GtkWidget* add_button_;
+ GtkWidget* remove_button_;
+
+ // The spell checking widgets.
+ GtkWidget* dictionary_language_combobox_;
+ GtkWidget* enable_autospellcorrect_checkbox_;
+ GtkWidget* enable_spellchecking_checkbox_;
+
+ // The widget containing the options for this page.
+ GtkWidget* page_;
+
+ // The model for |language_order_store_|.
+ scoped_ptr<LanguageOrderTableModel> language_order_table_model_;
+ scoped_ptr<gtk_tree::TableAdapter> language_order_table_adapter_;
+
+ // Accept languages pref.
+ StringPrefMember accept_languages_;
+
+ // The spellchecker "dictionary language" pref and model.
+ StringPrefMember dictionary_language_;
+ scoped_ptr<LanguageComboboxModel> dictionary_language_model_;
+
+ // If a language was auto-added to accept_languages_ due to being selected as
+ // the dictionary language, it is saved in this string, so that it can be
+ // removed if the dictionary language is changed again.
+ std::string spellcheck_language_added_;
+
+ // SpellChecker enable pref.
+ BooleanPrefMember enable_spellcheck_;
+
+ // Auto spell correction pref.
+ BooleanPrefMember enable_autospellcorrect_;
+
+ // Flag to ignore gtk callbacks while we are loading prefs, to avoid
+ // then turning around and saving them again.
+ bool initializing_;
+
+ friend class LanguagesPageGtkTest;
+ FRIEND_TEST_ALL_PREFIXES(LanguagesPageGtkTest, RemoveAcceptLang);
+ FRIEND_TEST_ALL_PREFIXES(LanguagesPageGtkTest, RemoveMultipleAcceptLang);
+ FRIEND_TEST_ALL_PREFIXES(LanguagesPageGtkTest, MoveAcceptLang);
+ FRIEND_TEST_ALL_PREFIXES(LanguagesPageGtkTest, AddAcceptLang);
+ FRIEND_TEST_ALL_PREFIXES(LanguagesPageGtkTest, EnableSpellChecking);
+ FRIEND_TEST_ALL_PREFIXES(LanguagesPageGtkTest, DictionaryLanguage);
+
+ DISALLOW_COPY_AND_ASSIGN(LanguagesPageGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_LANGUAGES_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/languages_page_gtk_unittest.cc b/chrome/browser/ui/gtk/options/languages_page_gtk_unittest.cc
index 0cb6298..440b975 100644
--- a/chrome/browser/gtk/options/languages_page_gtk_unittest.cc
+++ b/chrome/browser/ui/gtk/options/languages_page_gtk_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/options/managed_prefs_banner_gtk.cc b/chrome/browser/ui/gtk/options/managed_prefs_banner_gtk.cc
index a402656..1ba6765 100644
--- a/chrome/browser/gtk/options/managed_prefs_banner_gtk.cc
+++ b/chrome/browser/ui/gtk/options/managed_prefs_banner_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/managed_prefs_banner_gtk.h b/chrome/browser/ui/gtk/options/managed_prefs_banner_gtk.h
new file mode 100644
index 0000000..8a1ec85
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/managed_prefs_banner_gtk.h
@@ -0,0 +1,36 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_MANAGED_PREFS_BANNER_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_MANAGED_PREFS_BANNER_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "chrome/browser/policy/managed_prefs_banner_base.h"
+
+// Constructs and maintains a GTK widget displaying a warning banner. The banner
+// is displayed on the preferences dialog whenever there are options that are
+// not settable by the user due to policy.
+class ManagedPrefsBannerGtk : public policy::ManagedPrefsBannerBase {
+ public:
+ ManagedPrefsBannerGtk(PrefService* prefs, OptionsPage page);
+ virtual ~ManagedPrefsBannerGtk() { }
+
+ GtkWidget* banner_widget() { return banner_widget_; }
+
+ protected:
+ // Update widget visibility.
+ virtual void OnUpdateVisibility();
+
+ private:
+ // Construct the widget.
+ void InitWidget();
+
+ GtkWidget* banner_widget_;
+
+ DISALLOW_COPY_AND_ASSIGN(ManagedPrefsBannerGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_MANAGED_PREFS_BANNER_GTK_H_
diff --git a/chrome/browser/gtk/options/options_layout_gtk.cc b/chrome/browser/ui/gtk/options/options_layout_gtk.cc
index d0ae714..01007d1 100644
--- a/chrome/browser/gtk/options/options_layout_gtk.cc
+++ b/chrome/browser/ui/gtk/options/options_layout_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/options_layout_gtk.h b/chrome/browser/ui/gtk/options/options_layout_gtk.h
new file mode 100644
index 0000000..5add467
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/options_layout_gtk.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_OPTIONS_LAYOUT_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_OPTIONS_LAYOUT_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+#include <string>
+
+#include "base/basictypes.h"
+
+class OptionsLayoutBuilderGtk {
+ public:
+ virtual ~OptionsLayoutBuilderGtk() {}
+
+ GtkWidget* get_page_widget() {
+ return page_;
+ }
+
+ // Adds an option group to the table. Handles layout and the placing of
+ // separators between groups. If expandable is true, the content widget will
+ // be allowed to expand and fill any extra space when the dialog is resized.
+ virtual void AddOptionGroup(const std::string& title, GtkWidget* content,
+ bool expandable) = 0;
+
+ // Adds a widget without title or special layout. If expandable is true, the
+ // content widget will be allowed to expand and fill any extra space when the
+ // dialog is resized.
+ virtual void AddWidget(GtkWidget* content, bool expandable) = 0;
+
+ // Creates a default option layout builder. The default layout builder
+ // follows the GNOME HIG.
+ static OptionsLayoutBuilderGtk* Create();
+
+ // Creates a compact option layout builder, if the screen is compact.
+ // Otherwise, creates a default one.
+ static OptionsLayoutBuilderGtk* CreateOptionallyCompactLayout();
+
+ protected:
+ // The parent widget
+ GtkWidget* page_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_OPTIONS_LAYOUT_GTK_H_
diff --git a/chrome/browser/gtk/options/options_window_gtk.cc b/chrome/browser/ui/gtk/options/options_window_gtk.cc
index c2e997e..1a0bccf 100644
--- a/chrome/browser/gtk/options/options_window_gtk.cc
+++ b/chrome/browser/ui/gtk/options/options_window_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc b/chrome/browser/ui/gtk/options/passwords_exceptions_page_gtk.cc
index 4146d9f..7170bb8 100644
--- a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc
+++ b/chrome/browser/ui/gtk/options/passwords_exceptions_page_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/passwords_exceptions_page_gtk.h b/chrome/browser/ui/gtk/options/passwords_exceptions_page_gtk.h
new file mode 100644
index 0000000..7ffa5a4
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/passwords_exceptions_page_gtk.h
@@ -0,0 +1,95 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_PASSWORDS_EXCEPTIONS_PAGE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_PASSWORDS_EXCEPTIONS_PAGE_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <vector>
+
+#include "app/gtk_signal.h"
+#include "chrome/browser/password_manager/password_store.h"
+
+class Profile;
+
+// A page in the show saved passwords dialog that lists what sites we never
+// show passwords for, with controls for the user to add/remove sites from that
+// list.
+class PasswordsExceptionsPageGtk {
+ public:
+ explicit PasswordsExceptionsPageGtk(Profile* profile);
+ virtual ~PasswordsExceptionsPageGtk();
+
+ GtkWidget* get_page_widget() const { return page_; }
+
+ private:
+ // Initialize the exception tree widget, setting the member variables.
+ void InitExceptionTree();
+
+ // The password store associated with the currently active profile.
+ PasswordStore* GetPasswordStore();
+
+ // Sets the exception list contents to the given data. We take ownership of
+ // the PasswordForms in the vector.
+ void SetExceptionList(const std::vector<webkit_glue::PasswordForm*>& result);
+
+ CHROMEGTK_CALLBACK_0(PasswordsExceptionsPageGtk, void, OnRemoveButtonClicked);
+ CHROMEGTK_CALLBACK_0(PasswordsExceptionsPageGtk, void,
+ OnRemoveAllButtonClicked);
+
+ CHROMEG_CALLBACK_0(PasswordsExceptionsPageGtk, void,
+ OnExceptionSelectionChanged, GtkTreeSelection*);
+
+ // Sorting function.
+ static gint CompareSite(GtkTreeModel* model,
+ GtkTreeIter* a, GtkTreeIter* b,
+ gpointer window);
+
+ // A short class to mediate requests to the password store.
+ class ExceptionListPopulater : public PasswordStoreConsumer {
+ public:
+ explicit ExceptionListPopulater(PasswordsExceptionsPageGtk* page)
+ : page_(page),
+ pending_login_query_(0) {
+ }
+
+ // Send a query to the password store to populate an
+ // PasswordsExceptionsPageGtk.
+ void populate();
+
+ // PasswordStoreConsumer implementation.
+ // Send the password store's reply back to the PasswordsExceptionsPageGtk.
+ virtual void OnPasswordStoreRequestDone(
+ int handle, const std::vector<webkit_glue::PasswordForm*>& result);
+
+ private:
+ PasswordsExceptionsPageGtk* page_;
+ int pending_login_query_;
+ };
+
+ // Password store consumer for populating the exception list.
+ ExceptionListPopulater populater;
+
+ // Widgets for the buttons.
+ GtkWidget* remove_button_;
+ GtkWidget* remove_all_button_;
+
+ // Widgets for the exception table.
+ GtkWidget* exception_tree_;
+ GtkListStore* exception_list_store_;
+ GtkTreeModel* exception_list_sort_;
+ GtkTreeSelection* exception_selection_;
+
+ // The parent GtkHBox widget.
+ GtkWidget* page_;
+
+ Profile* profile_;
+ std::vector<webkit_glue::PasswordForm*> exception_list_;
+
+ DISALLOW_COPY_AND_ASSIGN(PasswordsExceptionsPageGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_PASSWORDS_EXCEPTIONS_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/passwords_exceptions_window_gtk.cc b/chrome/browser/ui/gtk/options/passwords_exceptions_window_gtk.cc
index d516f58..4a0c17c 100644
--- a/chrome/browser/gtk/options/passwords_exceptions_window_gtk.cc
+++ b/chrome/browser/ui/gtk/options/passwords_exceptions_window_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/passwords_exceptions_window_gtk.h b/chrome/browser/ui/gtk/options/passwords_exceptions_window_gtk.h
new file mode 100644
index 0000000..b6c5c6c
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/passwords_exceptions_window_gtk.h
@@ -0,0 +1,13 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_PASSWORDS_EXCEPTIONS_WINDOW_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_PASSWORDS_EXCEPTIONS_WINDOW_GTK_H_
+#pragma once
+
+class Profile;
+
+void ShowPasswordsExceptionsWindow(Profile* profile);
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_PASSWORDS_EXCEPTIONS_WINDOW_GTK_H_
diff --git a/chrome/browser/gtk/options/passwords_page_gtk.cc b/chrome/browser/ui/gtk/options/passwords_page_gtk.cc
index 7a58f15..03ade51 100644
--- a/chrome/browser/gtk/options/passwords_page_gtk.cc
+++ b/chrome/browser/ui/gtk/options/passwords_page_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/passwords_page_gtk.h b/chrome/browser/ui/gtk/options/passwords_page_gtk.h
new file mode 100644
index 0000000..e4d0140
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/passwords_page_gtk.h
@@ -0,0 +1,115 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_PASSWORDS_PAGE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_PASSWORDS_PAGE_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <string>
+#include <vector>
+
+#include "app/gtk_signal.h"
+#include "chrome/browser/password_manager/password_store.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/common/notification_observer.h"
+
+class Profile;
+
+class PasswordsPageGtk : public NotificationObserver {
+ public:
+ explicit PasswordsPageGtk(Profile* profile);
+ virtual ~PasswordsPageGtk();
+
+ GtkWidget* get_page_widget() const { return page_; }
+
+ private:
+ // Initialize the password tree widget, setting the member variables.
+ void InitPasswordTree();
+
+ // The password store associated with the currently active profile.
+ PasswordStore* GetPasswordStore();
+
+ // Sets the password list contents to the given data. We take ownership of
+ // the PasswordForms in the vector.
+ void SetPasswordList(const std::vector<webkit_glue::PasswordForm*>& result);
+
+ // Helper that hides the password.
+ void HidePassword();
+
+ // NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Handles changes to the observed preferences and updates the UI.
+ void OnPrefChanged(const std::string& pref_name);
+
+ CHROMEGTK_CALLBACK_0(PasswordsPageGtk, void, OnRemoveButtonClicked);
+ CHROMEGTK_CALLBACK_0(PasswordsPageGtk, void, OnRemoveAllButtonClicked);
+ CHROMEGTK_CALLBACK_1(PasswordsPageGtk, void, OnRemoveAllConfirmResponse, int);
+ CHROMEGTK_CALLBACK_0(PasswordsPageGtk, void, OnShowPasswordButtonClicked);
+ CHROMEGTK_CALLBACK_0(PasswordsPageGtk, void, OnShowPasswordButtonRealized);
+
+ CHROMEG_CALLBACK_0(PasswordsPageGtk, void, OnPasswordSelectionChanged,
+ GtkTreeSelection*);
+
+ // Sorting functions.
+ static gint CompareSite(GtkTreeModel* model,
+ GtkTreeIter* a, GtkTreeIter* b,
+ gpointer window);
+ static gint CompareUsername(GtkTreeModel* model,
+ GtkTreeIter* a, GtkTreeIter* b,
+ gpointer window);
+
+ // A short class to mediate requests to the password store.
+ class PasswordListPopulater : public PasswordStoreConsumer {
+ public:
+ explicit PasswordListPopulater(PasswordsPageGtk* page)
+ : page_(page),
+ pending_login_query_(0) {
+ }
+
+ // Send a query to the password store to populate a PasswordsPageGtk.
+ void populate();
+
+ // Send the password store's reply back to the PasswordsPageGtk.
+ virtual void OnPasswordStoreRequestDone(
+ int handle, const std::vector<webkit_glue::PasswordForm*>& result);
+
+ private:
+ PasswordsPageGtk* page_;
+ int pending_login_query_;
+ };
+
+ // Password store consumer for populating the password list.
+ PasswordListPopulater populater;
+
+ // Widgets for the buttons.
+ GtkWidget* remove_button_;
+ GtkWidget* remove_all_button_;
+ GtkWidget* show_password_button_;
+
+ // Widget for the shown password
+ GtkWidget* password_;
+ bool password_showing_;
+
+ // Widgets for the password table.
+ GtkWidget* password_tree_;
+ GtkListStore* password_list_store_;
+ GtkTreeModel* password_list_sort_;
+ GtkTreeSelection* password_selection_;
+
+ // The parent GtkHBox widget and GtkWindow window.
+ GtkWidget* page_;
+
+ Profile* profile_;
+ BooleanPrefMember allow_show_passwords_;
+ std::vector<webkit_glue::PasswordForm*> password_list_;
+
+ DISALLOW_COPY_AND_ASSIGN(PasswordsPageGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_PASSWORDS_PAGE_GTK_H_
diff --git a/chrome/browser/gtk/options/simple_content_exceptions_window.cc b/chrome/browser/ui/gtk/options/simple_content_exceptions_window.cc
index 58676f3..d7abc37 100644
--- a/chrome/browser/gtk/options/simple_content_exceptions_window.cc
+++ b/chrome/browser/ui/gtk/options/simple_content_exceptions_window.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/simple_content_exceptions_window.h b/chrome/browser/ui/gtk/options/simple_content_exceptions_window.h
new file mode 100644
index 0000000..cedee8b
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/simple_content_exceptions_window.h
@@ -0,0 +1,80 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_WINDOW_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_WINDOW_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/gtk/gtk_tree.h"
+#include "chrome/browser/remove_rows_table_model.h"
+#include "chrome/common/content_settings.h"
+#include "chrome/common/content_settings_types.h"
+
+class SimpleContentExceptionsWindow
+ : public gtk_tree::TableAdapter::Delegate {
+ public:
+ // Takes ownership of |model|.
+ static void ShowExceptionsWindow(GtkWindow* parent,
+ RemoveRowsTableModel* model,
+ int tile_message_id);
+
+ virtual ~SimpleContentExceptionsWindow();
+
+ // gtk_tree::TableAdapter::Delegate implementation:
+ virtual void SetColumnValues(int row, GtkTreeIter* iter);
+ virtual void OnAnyModelUpdateStart();
+ virtual void OnAnyModelUpdate();
+
+ private:
+ // Takes ownership of |model|.
+ SimpleContentExceptionsWindow(GtkWindow* parent,
+ RemoveRowsTableModel* model,
+ int title_message_id);
+
+ // Updates which buttons are enabled.
+ void UpdateButtonState();
+
+ // Callbacks for the buttons.
+ CHROMEGTK_CALLBACK_0(SimpleContentExceptionsWindow, void, Remove);
+ CHROMEGTK_CALLBACK_0(SimpleContentExceptionsWindow, void, RemoveAll);
+
+ CHROMEGTK_CALLBACK_0(SimpleContentExceptionsWindow, void,
+ OnWindowDestroy);
+ CHROMEGTK_CALLBACK_0(SimpleContentExceptionsWindow, void,
+ OnTreeSelectionChanged);
+
+ // The list presented in |treeview_|; a gobject instead of a C++ object.
+ GtkListStore* list_store_;
+
+ // The C++, views-ish, cross-platform model class that actually contains the
+ // gold standard data.
+ scoped_ptr<RemoveRowsTableModel> model_;
+
+ // The adapter that ferries data back and forth between |model_| and
+ // |list_store_| whenever either of them change.
+ scoped_ptr<gtk_tree::TableAdapter> model_adapter_;
+
+ // The exception window.
+ GtkWidget* dialog_;
+
+ // The treeview that presents the site/action pairs.
+ GtkWidget* treeview_;
+
+ // The current user selection from |treeview_|.
+ GtkTreeSelection* treeview_selection_;
+
+ // Whether to ignore selection changes. This is set during model updates,
+ // when the list store may be inconsistent with the table model.
+ bool ignore_selection_changes_;
+
+ // Buttons.
+ GtkWidget* remove_button_;
+ GtkWidget* remove_all_button_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_WINDOW_H_
diff --git a/chrome/browser/gtk/options/url_picker_dialog_gtk.cc b/chrome/browser/ui/gtk/options/url_picker_dialog_gtk.cc
index 9f7ed06..bfcc461 100644
--- a/chrome/browser/gtk/options/url_picker_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/options/url_picker_dialog_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/options/url_picker_dialog_gtk.h b/chrome/browser/ui/gtk/options/url_picker_dialog_gtk.h
new file mode 100644
index 0000000..fdd55cd
--- /dev/null
+++ b/chrome/browser/ui/gtk/options/url_picker_dialog_gtk.h
@@ -0,0 +1,93 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OPTIONS_URL_PICKER_DIALOG_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OPTIONS_URL_PICKER_DIALOG_GTK_H_
+#pragma once
+
+#include <string>
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/callback.h"
+#include "chrome/browser/gtk/gtk_tree.h"
+#include "chrome/browser/history/history.h"
+
+class AccessibleWidgetHelper;
+class GURL;
+class Profile;
+class PossibleURLModel;
+
+class UrlPickerDialogGtk : public gtk_tree::TableAdapter::Delegate {
+ public:
+ typedef Callback1<const GURL&>::Type UrlPickerCallback;
+
+ UrlPickerDialogGtk(UrlPickerCallback* callback,
+ Profile* profile,
+ GtkWindow* parent);
+
+ ~UrlPickerDialogGtk();
+
+ // gtk_tree::TableAdapter::Delegate implementation.
+ virtual void SetColumnValues(int row, GtkTreeIter* iter);
+
+ private:
+ // Call the callback based on url entry.
+ void AddURL();
+
+ // Set sensitivity of buttons based on url entry state.
+ void EnableControls();
+
+ // Return the entry-formatted url for path in the sorted model.
+ std::string GetURLForPath(GtkTreePath* path) const;
+
+ // GTK sorting callbacks.
+ static gint CompareTitle(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b,
+ gpointer window);
+ static gint CompareURL(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b,
+ gpointer window);
+
+ CHROMEGTK_CALLBACK_0(UrlPickerDialogGtk, void, OnUrlEntryChanged);
+ CHROMEGTK_CALLBACK_2(UrlPickerDialogGtk, void, OnHistoryRowActivated,
+ GtkTreePath*, GtkTreeViewColumn*);
+ CHROMEGTK_CALLBACK_1(UrlPickerDialogGtk, void, OnResponse, int);
+ CHROMEGTK_CALLBACK_0(UrlPickerDialogGtk, void, OnWindowDestroy);
+
+ // Callback for user selecting rows in recent history list.
+ CHROMEG_CALLBACK_0(UrlPickerDialogGtk, void, OnHistorySelectionChanged,
+ GtkTreeSelection*)
+
+ // The dialog window.
+ GtkWidget* dialog_;
+
+ // The text entry for manually adding an URL.
+ GtkWidget* url_entry_;
+
+ // The add button (we need a reference to it so we can de-activate it when the
+ // |url_entry_| is empty.)
+ GtkWidget* add_button_;
+
+ // The recent history list.
+ GtkWidget* history_tree_;
+ GtkListStore* history_list_store_;
+ GtkTreeModel* history_list_sort_;
+ GtkTreeSelection* history_selection_;
+
+ // Profile.
+ Profile* profile_;
+
+ // The table model.
+ scoped_ptr<PossibleURLModel> url_table_model_;
+ scoped_ptr<gtk_tree::TableAdapter> url_table_adapter_;
+
+ // Called if the user selects an url.
+ UrlPickerCallback* callback_;
+
+ // Helper object to manage accessibility metadata.
+ scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
+
+ DISALLOW_COPY_AND_ASSIGN(UrlPickerDialogGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OPTIONS_URL_PICKER_DIALOG_GTK_H_
diff --git a/chrome/browser/gtk/overflow_button.cc b/chrome/browser/ui/gtk/overflow_button.cc
index 9397799..73290f5 100644
--- a/chrome/browser/gtk/overflow_button.cc
+++ b/chrome/browser/ui/gtk/overflow_button.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/overflow_button.h b/chrome/browser/ui/gtk/overflow_button.h
new file mode 100644
index 0000000..61e921c
--- /dev/null
+++ b/chrome/browser/ui/gtk/overflow_button.h
@@ -0,0 +1,38 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_OVERFLOW_BUTTON_H_
+#define CHROME_BROWSER_UI_GTK_OVERFLOW_BUTTON_H_
+#pragma once
+
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+
+typedef struct _GtkWidget GtkWidget;
+class Profile;
+
+// An overflow chevron button. The button itself is a plain gtk_chrome_button,
+// and this class handles theming it.
+class OverflowButton : public NotificationObserver {
+ public:
+ explicit OverflowButton(Profile* profile);
+ virtual ~OverflowButton();
+
+ GtkWidget* widget() { return widget_.get(); }
+
+ private:
+ // NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ OwnedWidgetGtk widget_;
+
+ Profile* profile_;
+
+ NotificationRegistrar registrar_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OVERFLOW_BUTTON_H_
diff --git a/chrome/browser/gtk/owned_widget_gtk.cc b/chrome/browser/ui/gtk/owned_widget_gtk.cc
index 2315371..297b1a9 100644
--- a/chrome/browser/gtk/owned_widget_gtk.cc
+++ b/chrome/browser/ui/gtk/owned_widget_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/owned_widget_gtk.h b/chrome/browser/ui/gtk/owned_widget_gtk.h
new file mode 100644
index 0000000..aaa8fe9
--- /dev/null
+++ b/chrome/browser/ui/gtk/owned_widget_gtk.h
@@ -0,0 +1,90 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This class assists you in dealing with a specific situation when managing
+// ownership between a C++ object and a GTK widget. It is common to have a
+// C++ object which encapsulates a GtkWidget, and that widget is exposed from
+// the object for use outside of the class. In this situation, you commonly
+// want the GtkWidget's lifetime to match its C++ object's lifetime. Using an
+// OwnedWigetGtk will take ownership over the initial reference of the
+// GtkWidget, so that it is "owned" by the C++ object. Example usage:
+//
+// class FooViewGtk() {
+// public:
+// FooViewGtk() { }
+// ~FooViewGtk() { widget_.Destroy(); }
+// void Init() { vbox_.Own(gtk_vbox_new()); }
+// GtkWidget* widget() { return vbox_.get() }; // Host my widget!
+// private:
+// OwnedWidgetGtk vbox_;
+// };
+//
+// This design will ensure that the widget stays alive from the call to Own()
+// until the call to Destroy().
+//
+// - Details of the problem and OwnedWidgetGtk's solution:
+// In order to make passing ownership more convenient for newly created
+// widgets, GTK has a concept of a "floating" reference. All GtkObjects (and
+// thus GtkWidgets) inherit from GInitiallyUnowned. When they are created, the
+// object starts with a reference count of 1, but has its floating flag set.
+// When it is put into a container for the first time, that container will
+// "sink" the floating reference, and the count will still be 1. Now the
+// container owns the widget, and if we remove the widget from the container,
+// the widget is destroyed. This style of ownership often causes problems when
+// you have an object encapsulating the widget. If we just use a raw
+// GtkObject* with no specific ownership management, we push the widget's
+// ownership onto the user of the class. Now the C++ object can't depend on
+// the widget being valid, since it doesn't manage its lifetime. If the widget
+// was removed from a container, removing its only reference, it would be
+// destroyed (from the C++ object's perspective) unexpectantly destroyed. The
+// solution is fairly simple, make sure that the C++ object owns the widget,
+// and thus it is also responsible for destroying it. This boils down to:
+// GtkWidget* widget = gtk_widget_new();
+// g_object_ref_sink(widget); // Claim the initial floating reference.
+// ...
+// gtk_destroy_widget(widget); // Ask all code to destroy their references.
+// g_object_unref(widget); // Destroy the initial reference we had claimed.
+
+#ifndef CHROME_BROWSER_UI_GTK_OWNED_WIDGET_GTK_H_
+#define CHROME_BROWSER_UI_GTK_OWNED_WIDGET_GTK_H_
+#pragma once
+
+#include "base/basictypes.h"
+
+typedef struct _GtkWidget GtkWidget;
+
+class OwnedWidgetGtk {
+ public:
+ // Create an instance that isn't managing any ownership.
+ OwnedWidgetGtk() : widget_(NULL) { }
+ // Create an instance that owns |widget|.
+ explicit OwnedWidgetGtk(GtkWidget* widget) : widget_(NULL) { Own(widget); }
+
+ ~OwnedWidgetGtk();
+
+ // Return the currently owned widget, or NULL if no widget is owned.
+ GtkWidget* get() const { return widget_; }
+ GtkWidget* operator->() const { return widget_; }
+
+ // Takes ownership of a widget, by taking the initial floating reference of
+ // the GtkWidget. It is expected that Own() is called right after the widget
+ // has been created, and before any other references to the widget might have
+ // been added. It is valid to never call Own(), in which case Destroy() will
+ // do nothing. If Own() has been called, you must explicitly call Destroy().
+ void Own(GtkWidget* widget);
+
+ // You must call Destroy() after you have called Own(). Calling Destroy()
+ // will call gtk_widget_destroy(), and drop our reference to the widget.
+ // After a call to Destroy(), you may call Own() again. NOTE: It is expected
+ // that after gtk_widget_destroy we will be holding the only reference left
+ // on the object. We assert this in debug mode to help catch any leaks.
+ void Destroy();
+
+ private:
+ GtkWidget* widget_;
+
+ DISALLOW_COPY_AND_ASSIGN(OwnedWidgetGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_OWNED_WIDGET_GTK_H_
diff --git a/chrome/browser/gtk/page_info_bubble_gtk.cc b/chrome/browser/ui/gtk/page_info_bubble_gtk.cc
index 6bfa77c..fef4b59 100644
--- a/chrome/browser/gtk/page_info_bubble_gtk.cc
+++ b/chrome/browser/ui/gtk/page_info_bubble_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/pk11_password_dialog.cc b/chrome/browser/ui/gtk/pk11_password_dialog.cc
index 42040b3..92c2bb5 100644
--- a/chrome/browser/gtk/pk11_password_dialog.cc
+++ b/chrome/browser/ui/gtk/pk11_password_dialog.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/process_singleton_dialog.cc b/chrome/browser/ui/gtk/process_singleton_dialog.cc
index 26fc1b4..da55fd8 100644
--- a/chrome/browser/gtk/process_singleton_dialog.cc
+++ b/chrome/browser/ui/gtk/process_singleton_dialog.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/process_singleton_dialog.h b/chrome/browser/ui/gtk/process_singleton_dialog.h
new file mode 100644
index 0000000..e46803e
--- /dev/null
+++ b/chrome/browser/ui/gtk/process_singleton_dialog.h
@@ -0,0 +1,35 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_PROCESS_SINGLETON_DIALOG_H_
+#define CHROME_BROWSER_UI_GTK_PROCESS_SINGLETON_DIALOG_H_
+#pragma once
+
+#include <string>
+
+#include <gtk/gtk.h>
+
+#include "base/basictypes.h"
+
+// Displays an error to the user when the ProcessSingleton cannot acquire the
+// lock. This runs the message loop itself as the browser message loop has not
+// started by that point in the startup process.
+class ProcessSingletonDialog {
+ public:
+ // Shows the dialog, and returns once the dialog has been closed.
+ static void ShowAndRun(const std::string& message);
+
+ private:
+ explicit ProcessSingletonDialog(const std::string& message);
+
+ static void OnResponse(GtkWidget* widget,
+ int response,
+ ProcessSingletonDialog* dialog);
+
+ GtkWidget* dialog_;
+
+ DISALLOW_COPY_AND_ASSIGN(ProcessSingletonDialog);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_PROCESS_SINGLETON_DIALOG_H_
diff --git a/chrome/browser/gtk/reload_button_gtk.cc b/chrome/browser/ui/gtk/reload_button_gtk.cc
index 9ee0e29..4af3be3 100644
--- a/chrome/browser/gtk/reload_button_gtk.cc
+++ b/chrome/browser/ui/gtk/reload_button_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/reload_button_gtk.h b/chrome/browser/ui/gtk/reload_button_gtk.h
new file mode 100644
index 0000000..82662f7
--- /dev/null
+++ b/chrome/browser/ui/gtk/reload_button_gtk.h
@@ -0,0 +1,103 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_RELOAD_BUTTON_GTK_H_
+#define CHROME_BROWSER_UI_GTK_RELOAD_BUTTON_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/timer.h"
+#include "chrome/browser/gtk/custom_button.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+
+class Browser;
+class GtkThemeProvider;
+class LocationBarViewGtk;
+class Task;
+
+class ReloadButtonGtk : public NotificationObserver {
+ public:
+ enum Mode { MODE_RELOAD = 0, MODE_STOP };
+
+ ReloadButtonGtk(LocationBarViewGtk* location_bar, Browser* browser);
+ ~ReloadButtonGtk();
+
+ GtkWidget* widget() const { return widget_.get(); }
+
+ // Ask for a specified button state. If |force| is true this will be applied
+ // immediately.
+ void ChangeMode(Mode mode, bool force);
+
+ // Provide NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& /* details */);
+
+ private:
+ friend class ReloadButtonGtkTest;
+
+ CHROMEGTK_CALLBACK_0(ReloadButtonGtk, void, OnClicked);
+ CHROMEGTK_CALLBACK_1(ReloadButtonGtk, gboolean, OnExpose, GdkEventExpose*);
+ CHROMEGTK_CALLBACK_1(ReloadButtonGtk,
+ gboolean,
+ OnLeaveNotify,
+ GdkEventCrossing*);
+ CHROMEGTK_CALLBACK_4(ReloadButtonGtk,
+ gboolean,
+ OnQueryTooltip,
+ gint,
+ gint,
+ gboolean,
+ GtkTooltip*);
+
+ void UpdateThemeButtons();
+
+ void OnDoubleClickTimer();
+ void OnStopToReloadTimer();
+
+ base::OneShotTimer<ReloadButtonGtk> double_click_timer_;
+ base::OneShotTimer<ReloadButtonGtk> stop_to_reload_timer_;
+
+ // These may be NULL when testing.
+ LocationBarViewGtk* const location_bar_;
+ Browser* const browser_;
+
+ // The mode we should be in assuming no timers are running.
+ Mode intended_mode_;
+
+ // The currently-visible mode - this may differ from the intended mode.
+ Mode visible_mode_;
+
+ // Used to listen for theme change notifications.
+ NotificationRegistrar registrar_;
+
+ GtkThemeProvider* theme_provider_;
+
+ CustomDrawButtonBase reload_;
+ CustomDrawButtonBase stop_;
+ CustomDrawHoverController hover_controller_;
+
+ OwnedWidgetGtk widget_;
+
+ // The delay times for the timers. These are members so that tests can modify
+ // them.
+ base::TimeDelta double_click_timer_delay_;
+ base::TimeDelta stop_to_reload_timer_delay_;
+
+ // TESTING ONLY
+ // True if we should pretend the button is hovered.
+ bool testing_mouse_hovered_;
+ // Increments when we would tell the browser to "reload", so
+ // test code can tell whether we did so (as there may be no |browser_|).
+ int testing_reload_count_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ReloadButtonGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_RELOAD_BUTTON_GTK_H_
diff --git a/chrome/browser/gtk/reload_button_gtk_unittest.cc b/chrome/browser/ui/gtk/reload_button_gtk_unittest.cc
index fddb358..3e39017 100644
--- a/chrome/browser/gtk/reload_button_gtk_unittest.cc
+++ b/chrome/browser/ui/gtk/reload_button_gtk_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/repost_form_warning_gtk.cc b/chrome/browser/ui/gtk/repost_form_warning_gtk.cc
index 1740b29..dfd1ac6 100644
--- a/chrome/browser/gtk/repost_form_warning_gtk.cc
+++ b/chrome/browser/ui/gtk/repost_form_warning_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/repost_form_warning_gtk.h b/chrome/browser/ui/gtk/repost_form_warning_gtk.h
new file mode 100644
index 0000000..6f97302
--- /dev/null
+++ b/chrome/browser/ui/gtk/repost_form_warning_gtk.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_REPOST_FORM_WARNING_GTK_H_
+#define CHROME_BROWSER_UI_GTK_REPOST_FORM_WARNING_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/gtk/constrained_window_gtk.h"
+
+class RepostFormWarningController;
+
+// Displays a dialog that warns the user that they are about to resubmit
+// a form.
+// To display the dialog, allocate this object on the heap. It will open the
+// dialog from its constructor and then delete itself when the user dismisses
+// the dialog.
+class RepostFormWarningGtk : public ConstrainedDialogDelegate {
+ public:
+ RepostFormWarningGtk(GtkWindow* parent, TabContents* tab_contents);
+
+ // ConstrainedDialogDelegate methods
+ virtual GtkWidget* GetWidgetRoot();
+
+ virtual void DeleteDelegate();
+
+ private:
+ virtual ~RepostFormWarningGtk();
+
+ // Callbacks
+ CHROMEGTK_CALLBACK_0(RepostFormWarningGtk, void, OnRefresh);
+ CHROMEGTK_CALLBACK_0(RepostFormWarningGtk, void, OnCancel);
+ CHROMEGTK_CALLBACK_1(RepostFormWarningGtk,
+ void,
+ OnHierarchyChanged,
+ GtkWidget*);
+
+ scoped_ptr<RepostFormWarningController> controller_;
+
+ GtkWidget* dialog_;
+ GtkWidget* ok_;
+ GtkWidget* cancel_;
+
+ DISALLOW_COPY_AND_ASSIGN(RepostFormWarningGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_REPOST_FORM_WARNING_GTK_H_
diff --git a/chrome/browser/gtk/rounded_window.cc b/chrome/browser/ui/gtk/rounded_window.cc
index f0d827d..5851072 100644
--- a/chrome/browser/gtk/rounded_window.cc
+++ b/chrome/browser/ui/gtk/rounded_window.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/rounded_window.h b/chrome/browser/ui/gtk/rounded_window.h
new file mode 100644
index 0000000..52b611f
--- /dev/null
+++ b/chrome/browser/ui/gtk/rounded_window.h
@@ -0,0 +1,64 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_ROUNDED_WINDOW_H_
+#define CHROME_BROWSER_UI_GTK_ROUNDED_WINDOW_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+namespace gtk_util {
+
+// Symbolic names for arguments to |rounded_edges| in ActAsRoundedWindow().
+enum RoundedBorders {
+ ROUNDED_NONE = 0,
+ ROUNDED_BOTTOM_LEFT = 1 << 0,
+ ROUNDED_TOP_LEFT = 1 << 1,
+ ROUNDED_TOP_RIGHT = 1 << 2,
+ ROUNDED_TOP = (1 << 1) | (1 << 2),
+ ROUNDED_BOTTOM_RIGHT = 1 << 3,
+ ROUNDED_ALL = 0xF
+};
+
+// Symbolic names for arguments to |drawn_borders| in ActAsRoundedWindow().
+enum BorderEdge {
+ BORDER_NONE = 0,
+ BORDER_LEFT = 1 << 0,
+ BORDER_TOP = 1 << 1,
+ BORDER_RIGHT = 1 << 2,
+ BORDER_BOTTOM = 1 << 3,
+ BORDER_ALL = 0xF
+};
+
+// Sets up the passed in widget that has its own GdkWindow with an expose
+// handler that forces the window shape into roundness. Caller should not set
+// an "expose-event" handler on |widget|; if caller needs to do custom
+// rendering, use SetRoundedWindowExposeFunction() instead. |rounded_edges|
+// control which corners are rounded. |drawn_borders| border control which
+// sides have a visible border drawn in |color|.
+void ActAsRoundedWindow(
+ GtkWidget* widget, const GdkColor& color, int corner_size,
+ int rounded_edges, int drawn_borders);
+
+// Undoes most of the actions of ActAsRoundedWindow().
+void StopActingAsRoundedWindow(GtkWidget* widget);
+
+// Returns true if the window is rounded.
+bool IsActingAsRoundedWindow(GtkWidget* widget);
+
+// Sets edge and border properties on a widget that has already been configured
+// with ActAsRoundedWindow().
+void SetRoundedWindowEdgesAndBorders(GtkWidget* widget,
+ int corner_size,
+ int rounded_edges,
+ int drawn_borders);
+
+// Sets the color of the border on a widget that has already been configured
+// with ActAsRoundedWindow().
+void SetRoundedWindowBorderColor(GtkWidget* widget, GdkColor color);
+
+
+} // namespace gtk_util
+
+#endif // CHROME_BROWSER_UI_GTK_ROUNDED_WINDOW_H_
diff --git a/chrome/browser/gtk/sad_tab_gtk.cc b/chrome/browser/ui/gtk/sad_tab_gtk.cc
index aeae7d8..1a3dc27 100644
--- a/chrome/browser/gtk/sad_tab_gtk.cc
+++ b/chrome/browser/ui/gtk/sad_tab_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/sad_tab_gtk.h b/chrome/browser/ui/gtk/sad_tab_gtk.h
new file mode 100644
index 0000000..b2300d1
--- /dev/null
+++ b/chrome/browser/ui/gtk/sad_tab_gtk.h
@@ -0,0 +1,40 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_SAD_TAB_GTK_H_
+#define CHROME_BROWSER_UI_GTK_SAD_TAB_GTK_H_
+#pragma once
+
+typedef struct _GtkWidget GtkWidget;
+
+#include "app/gtk_signal.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+
+class TabContents;
+
+class SadTabGtk {
+ public:
+ enum Kind {
+ CRASHED, // The tab crashed. Display the "Aw, Snap!" page.
+ KILLED // The tab was killed. Display the killed tab page.
+ };
+
+ explicit SadTabGtk(TabContents* tab_contents, Kind kind);
+ virtual ~SadTabGtk();
+
+ GtkWidget* widget() const { return event_box_.get(); }
+
+ private:
+ CHROMEGTK_CALLBACK_0(SadTabGtk, void, OnLinkButtonClick);
+
+ void OnLinkButtonClick();
+
+ TabContents* tab_contents_;
+ OwnedWidgetGtk event_box_;
+ Kind kind_;
+
+ DISALLOW_COPY_AND_ASSIGN(SadTabGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_SAD_TAB_GTK_H_
diff --git a/chrome/browser/gtk/slide_animator_gtk.cc b/chrome/browser/ui/gtk/slide_animator_gtk.cc
index a3ae9cc..9e09a3f 100644
--- a/chrome/browser/gtk/slide_animator_gtk.cc
+++ b/chrome/browser/ui/gtk/slide_animator_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/slide_animator_gtk.h b/chrome/browser/ui/gtk/slide_animator_gtk.h
new file mode 100644
index 0000000..a8f6b97
--- /dev/null
+++ b/chrome/browser/ui/gtk/slide_animator_gtk.h
@@ -0,0 +1,123 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// A helper class for animating the display of native widget content.
+// Currently only handle vertical sliding, but could be extended to handle
+// horizontal slides or other types of animations.
+//
+// NOTE: This does not handle clipping. If you are not careful, you will
+// wind up with visibly overlapping widgets. If you need clipping, you can
+// extend the constructor to take an option to give |fixed| its own GdkWindow
+// (via gtk_fixed_set_has_window).
+
+#ifndef CHROME_BROWSER_UI_GTK_SLIDE_ANIMATOR_GTK_H_
+#define CHROME_BROWSER_UI_GTK_SLIDE_ANIMATOR_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "base/scoped_ptr.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "ui/base/animation/animation_delegate.h"
+
+namespace ui {
+class SlideAnimation;
+}
+
+class SlideAnimatorGtk : public ui::AnimationDelegate {
+ public:
+ class Delegate {
+ public:
+ // Called when a call to Close() finishes animating.
+ virtual void Closed() = 0;
+
+ protected:
+ virtual ~Delegate() {}
+ };
+
+ enum Direction {
+ DOWN,
+ UP
+ };
+
+ // |child| is the widget we pack into |widget_|.
+ // |direction| indicates which side the contents will appear to come from.
+ // |duration| is the duration of the slide in milliseconds, or 0 for default.
+ // |linear| controls how the animation progresses. If true, the
+ // velocity of the slide is constant over time, otherwise it goes a bit faster
+ // at the beginning and slows to a halt.
+ // |delegate| may be NULL.
+ SlideAnimatorGtk(GtkWidget* child,
+ Direction direction,
+ int duration,
+ bool linear,
+ bool control_child_size,
+ Delegate* delegate);
+
+ virtual ~SlideAnimatorGtk();
+
+ GtkWidget* widget() { return widget_.get(); }
+
+ // Slide open.
+ void Open();
+
+ // Immediately show the widget.
+ void OpenWithoutAnimation();
+
+ // Slide shut.
+ void Close();
+
+ // End the current animation.
+ void End();
+
+ // Immediately hide the widget.
+ void CloseWithoutAnimation();
+
+ // Returns whether the widget is visible.
+ bool IsShowing();
+
+ // Returns whether the widget is currently showing the close animation.
+ bool IsClosing();
+
+ // Returns whether the widget is currently showing the open or close
+ // animation.
+ bool IsAnimating();
+
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
+
+ // Used during testing; disable or enable animations (default is enabled).
+ static void SetAnimationsForTesting(bool enable);
+
+ private:
+ static void OnChildSizeAllocate(GtkWidget* child,
+ GtkAllocation* allocation,
+ SlideAnimatorGtk* slider);
+
+ scoped_ptr<ui::SlideAnimation> animation_;
+
+ // The top level widget of the SlideAnimatorGtk. It is a GtkFixed.
+ OwnedWidgetGtk widget_;
+
+ // The widget passed to us at construction time, and the only direct child of
+ // |widget_|.
+ GtkWidget* child_;
+
+ // The direction of the slide.
+ Direction direction_;
+
+ // The object to inform about certain events. It may be NULL.
+ Delegate* delegate_;
+
+ // We need to move the child widget to (0, -height), but we don't know its
+ // height until it has been allocated. This variable will be true until the
+ // child widget has been allocated, at which point we will move it, and then
+ // set this variable to false to indicate it should not be moved again.
+ bool child_needs_move_;
+
+ static bool animations_enabled_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_SLIDE_ANIMATOR_GTK_H_
diff --git a/chrome/browser/gtk/ssl_client_certificate_selector.cc b/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc
index 1be694b..635c5a99 100644
--- a/chrome/browser/gtk/ssl_client_certificate_selector.cc
+++ b/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/status_bubble_gtk.cc b/chrome/browser/ui/gtk/status_bubble_gtk.cc
index 06c33d0e..48557e0 100644
--- a/chrome/browser/gtk/status_bubble_gtk.cc
+++ b/chrome/browser/ui/gtk/status_bubble_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/status_bubble_gtk.h b/chrome/browser/ui/gtk/status_bubble_gtk.h
new file mode 100644
index 0000000..6ecb031
--- /dev/null
+++ b/chrome/browser/ui/gtk/status_bubble_gtk.h
@@ -0,0 +1,176 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_STATUS_BUBBLE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_STATUS_BUBBLE_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <string>
+
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+#include "base/timer.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/browser/ui/status_bubble.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "gfx/point.h"
+#include "googleurl/src/gurl.h"
+#include "ui/base/animation/animation_delegate.h"
+
+class GtkThemeProvider;
+class Profile;
+
+namespace ui {
+class SlideAnimation;
+}
+
+// GTK implementation of StatusBubble. Unlike Windows, our status bubble
+// doesn't have the nice leave-the-window effect since we can't rely on the
+// window manager to not try to be "helpful" and center our popups, etc.
+// We therefore position it absolutely in a GtkFixed, that we don't own.
+class StatusBubbleGtk : public StatusBubble,
+ public NotificationObserver,
+ public ui::AnimationDelegate {
+ public:
+ explicit StatusBubbleGtk(Profile* profile);
+ virtual ~StatusBubbleGtk();
+
+ bool flip_horizontally() const { return flip_horizontally_; }
+ int y_offset() const { return y_offset_; }
+
+ // StatusBubble implementation.
+ virtual void SetStatus(const string16& status);
+ virtual void SetURL(const GURL& url, const string16& languages);
+ virtual void Hide();
+ virtual void MouseMoved(const gfx::Point& location, bool left_content);
+
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
+
+ // Called when the download shelf becomes visible or invisible.
+ // This is used by to ensure that the status bubble does not obscure
+ // the download shelf, when it is visible.
+ virtual void UpdateDownloadShelfVisibility(bool visible);
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Top of the widget hierarchy for a StatusBubble. This top level widget is
+ // guarenteed to have its gtk_widget_name set to "status-bubble" for
+ // identification.
+ GtkWidget* widget() { return container_.get(); }
+
+ private:
+ // Sets the text of the label widget and controls visibility. (As contrasted
+ // with setting the current status or URL text, which may be ignored for now).
+ void SetStatusTextTo(const std::string& status_utf8);
+
+ // Sets the status text to the current value of |url_|, eliding it as
+ // necessary.
+ void SetStatusTextToURL();
+
+ // Sets the status bubble's location in the parent GtkFixed, shows the widget
+ // and makes sure that the status bubble has the highest z-order.
+ void Show();
+
+ // Builds the widgets, containers, etc.
+ void InitWidgets();
+
+ // Notification from the window that we should retheme ourself.
+ void UserChangedTheme();
+
+ // Sets whether the bubble should be flipped horizontally and displayed on the
+ // opposite side of the tab contents. Reshapes the container and queues a
+ // redraw if necessary.
+ void SetFlipHorizontally(bool flip_horizontally);
+
+ // Expand the bubble up to the full width of the browser, so that the entire
+ // URL may be seen. Called after the user hovers over a link for sufficient
+ // time.
+ void ExpandURL();
+
+ // Adjust the actual size of the bubble by changing the label's size request.
+ void UpdateLabelSizeRequest();
+
+ // Returns true if the status bubble is in the expand-state (i.e., is
+ // currently expanded or in the process of expanding).
+ bool expanded() {
+ return expand_animation_.get();
+ }
+
+ CHROMEGTK_CALLBACK_1(StatusBubbleGtk, gboolean, HandleMotionNotify,
+ GdkEventMotion*);
+
+ CHROMEGTK_CALLBACK_1(StatusBubbleGtk, gboolean, HandleEnterNotify,
+ GdkEventCrossing*);
+
+ NotificationRegistrar registrar_;
+
+ // Provides colors.
+ GtkThemeProvider* theme_provider_;
+
+ // The toplevel event box.
+ OwnedWidgetGtk container_;
+
+ // The GtkAlignment holding |label_|.
+ GtkWidget* padding_;
+
+ // The GtkLabel holding the text.
+ GtkWidget* label_;
+
+ // The status text we want to display when there are no URLs to display.
+ std::string status_text_;
+
+ // The URL we are displaying for.
+ GURL url_;
+
+ // The possibly elided url text we want to display.
+ std::string url_text_;
+
+ // Used to determine the character set that the user can read (for eliding
+ // the url text).
+ string16 languages_;
+
+ // A timer that hides our window after a delay.
+ base::OneShotTimer<StatusBubbleGtk> hide_timer_;
+
+ // A timer that expands our window after a delay.
+ base::OneShotTimer<StatusBubbleGtk> expand_timer_;
+
+ // The animation for resizing the status bubble on long hovers.
+ scoped_ptr<ui::SlideAnimation> expand_animation_;
+
+ // The start and end width of the current resize animation.
+ int start_width_;
+ int desired_width_;
+
+ // Should the bubble be flipped horizontally (e.g. displayed on the right for
+ // an LTR language)? We move the bubble to the other side of the tab contents
+ // rather than sliding it down when the download shelf is visible.
+ bool flip_horizontally_;
+
+ // Vertical offset used to hide the status bubble as the pointer nears it.
+ int y_offset_;
+
+ // If the download shelf is visible, do not obscure it.
+ bool download_shelf_is_visible_;
+
+ // 'location' and 'left_content' values from the last invocation of
+ // MouseMoved(). We hang onto these so we can move the bubble if necessary
+ // when its text changes, triggering a size change.
+ gfx::Point last_mouse_location_;
+ bool last_mouse_left_content_;
+
+ // Shortly after the cursor enters the status bubble, we'll get a message
+ // that the cursor left the content area. This lets us ignore that.
+ bool ignore_next_left_content_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_STATUS_BUBBLE_GTK_H_
diff --git a/chrome/browser/gtk/status_icons/status_icon_gtk.cc b/chrome/browser/ui/gtk/status_icons/status_icon_gtk.cc
index 7268b00..2891b46 100644
--- a/chrome/browser/gtk/status_icons/status_icon_gtk.cc
+++ b/chrome/browser/ui/gtk/status_icons/status_icon_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/status_icons/status_icon_gtk.h b/chrome/browser/ui/gtk/status_icons/status_icon_gtk.h
new file mode 100644
index 0000000..cc9a3cd
--- /dev/null
+++ b/chrome/browser/ui/gtk/status_icons/status_icon_gtk.h
@@ -0,0 +1,47 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_STATUS_ICONS_STATUS_ICON_GTK_H_
+#define CHROME_BROWSER_UI_GTK_STATUS_ICONS_STATUS_ICON_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "chrome/browser/status_icons/status_icon.h"
+
+class MenuGtk;
+class SkBitmap;
+
+class StatusIconGtk : public StatusIcon {
+ public:
+ StatusIconGtk();
+ virtual ~StatusIconGtk();
+
+ // Overridden from StatusIcon:
+ virtual void SetImage(const SkBitmap& image);
+ virtual void SetPressedImage(const SkBitmap& image);
+ virtual void SetToolTip(const string16& tool_tip);
+
+ // Exposed for testing.
+ CHROMEGTK_CALLBACK_0(StatusIconGtk, void, OnClick);
+
+ protected:
+ // Overridden from StatusIcon.
+ virtual void UpdatePlatformContextMenu(menus::MenuModel* menu);
+
+ private:
+ // Callback invoked when user right-clicks on the status icon.
+ CHROMEGTK_CALLBACK_2(StatusIconGtk, void, OnPopupMenu, guint, guint);
+
+ // The currently-displayed icon for the window.
+ GtkStatusIcon* icon_;
+
+ // The context menu for this icon (if any).
+ scoped_ptr<MenuGtk> menu_;
+
+ DISALLOW_COPY_AND_ASSIGN(StatusIconGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_STATUS_ICONS_STATUS_ICON_GTK_H_
diff --git a/chrome/browser/gtk/status_icons/status_tray_gtk.cc b/chrome/browser/ui/gtk/status_icons/status_tray_gtk.cc
index 98cf98c..6412af0 100644
--- a/chrome/browser/gtk/status_icons/status_tray_gtk.cc
+++ b/chrome/browser/ui/gtk/status_icons/status_tray_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/status_icons/status_tray_gtk.h b/chrome/browser/ui/gtk/status_icons/status_tray_gtk.h
new file mode 100644
index 0000000..28d0d7a
--- /dev/null
+++ b/chrome/browser/ui/gtk/status_icons/status_tray_gtk.h
@@ -0,0 +1,24 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_STATUS_ICONS_STATUS_TRAY_GTK_H_
+#define CHROME_BROWSER_UI_GTK_STATUS_ICONS_STATUS_TRAY_GTK_H_
+#pragma once
+
+#include "chrome/browser/status_icons/status_tray.h"
+
+class StatusTrayGtk : public StatusTray {
+ public:
+ StatusTrayGtk();
+ ~StatusTrayGtk();
+
+ protected:
+ // Overriden from StatusTray:
+ virtual StatusIcon* CreatePlatformStatusIcon();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(StatusTrayGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_STATUS_ICONS_STATUS_TRAY_GTK_H_
diff --git a/chrome/browser/gtk/status_icons/status_tray_gtk_unittest.cc b/chrome/browser/ui/gtk/status_icons/status_tray_gtk_unittest.cc
index 0e28e9e..afc12ae 100644
--- a/chrome/browser/gtk/status_icons/status_tray_gtk_unittest.cc
+++ b/chrome/browser/ui/gtk/status_icons/status_tray_gtk_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/tab_contents_container_gtk.cc b/chrome/browser/ui/gtk/tab_contents_container_gtk.cc
index b189e81..fd4a643 100644
--- a/chrome/browser/gtk/tab_contents_container_gtk.cc
+++ b/chrome/browser/ui/gtk/tab_contents_container_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/tab_contents_container_gtk.h b/chrome/browser/ui/gtk/tab_contents_container_gtk.h
new file mode 100644
index 0000000..a2ecf3b
--- /dev/null
+++ b/chrome/browser/ui/gtk/tab_contents_container_gtk.h
@@ -0,0 +1,110 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_TAB_CONTENTS_CONTAINER_GTK_H_
+#define CHROME_BROWSER_UI_GTK_TAB_CONTENTS_CONTAINER_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/browser/gtk/view_id_util.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+
+class RenderViewHost;
+class StatusBubbleGtk;
+class TabContents;
+
+typedef struct _GtkFloatingContainer GtkFloatingContainer;
+
+class TabContentsContainerGtk : public NotificationObserver,
+ public ViewIDUtil::Delegate {
+ public:
+ explicit TabContentsContainerGtk(StatusBubbleGtk* status_bubble);
+ ~TabContentsContainerGtk();
+
+ void Init();
+
+ // Make the specified tab visible.
+ void SetTabContents(TabContents* tab_contents);
+ TabContents* GetTabContents() const { return tab_contents_; }
+
+ // Gets the tab contents currently being displayed (either |tab_contents_| or
+ // |preview_contents_|).
+ TabContents* GetVisibleTabContents();
+
+ void SetPreviewContents(TabContents* preview);
+ void PopPreviewContents();
+
+ // Remove the tab from the hierarchy.
+ void DetachTabContents(TabContents* tab_contents);
+
+ // NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ GtkWidget* widget() { return floating_.get(); }
+
+ // ViewIDUtil::Delegate implementation ---------------------------------------
+ virtual GtkWidget* GetWidgetForViewID(ViewID id);
+
+ private:
+ // Called when a TabContents is destroyed. This gives us a chance to clean
+ // up our internal state if the TabContents is somehow destroyed before we
+ // get notified.
+ void TabContentsDestroyed(TabContents* contents);
+
+ // Handler for |floating_|'s "set-floating-position" signal. During this
+ // callback, we manually set the position of the status bubble.
+ static void OnSetFloatingPosition(
+ GtkFloatingContainer* container, GtkAllocation* allocation,
+ TabContentsContainerGtk* tab_contents_container);
+
+ // Add |contents| to the container and start showing it.
+ void PackTabContents(TabContents* contents);
+
+ // Stop showing |contents|.
+ void HideTabContents(TabContents* contents);
+
+ // Removes |preview_contents_|.
+ void RemovePreviewContents();
+
+ // Handle focus traversal on the tab contents container. Focus should not
+ // traverse to the preview contents.
+ CHROMEGTK_CALLBACK_1(TabContentsContainerGtk, gboolean, OnFocus,
+ GtkDirectionType);
+
+ NotificationRegistrar registrar_;
+
+ // The TabContents for the currently selected tab. This will be showing unless
+ // there is a preview contents.
+ TabContents* tab_contents_;
+
+ // The current preview contents (for instant). If non-NULL, it will be
+ // visible.
+ TabContents* preview_contents_;
+
+ // The status bubble manager. Always non-NULL.
+ StatusBubbleGtk* status_bubble_;
+
+ // Top of the TabContentsContainerGtk widget hierarchy. A cross between a
+ // GtkBin and a GtkFixed, |floating_| has |expanded_| as its one "real" child,
+ // and the various things that hang off the bottom (status bubble, etc) have
+ // their positions manually set in OnSetFloatingPosition.
+ OwnedWidgetGtk floating_;
+
+ // We insert and remove TabContents GtkWidgets into this expanded_. This
+ // should not be a GtkVBox since there were errors with timing where the vbox
+ // was horizontally split with the top half displaying the current TabContents
+ // and bottom half displaying the loading page.
+ GtkWidget* expanded_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabContentsContainerGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_TAB_CONTENTS_CONTAINER_GTK_H_
diff --git a/chrome/browser/gtk/tab_contents_drag_source.cc b/chrome/browser/ui/gtk/tab_contents_drag_source.cc
index eedfe83..8f547ed8 100644
--- a/chrome/browser/gtk/tab_contents_drag_source.cc
+++ b/chrome/browser/ui/gtk/tab_contents_drag_source.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/tab_contents_drag_source.h b/chrome/browser/ui/gtk/tab_contents_drag_source.h
new file mode 100644
index 0000000..9327c31
--- /dev/null
+++ b/chrome/browser/ui/gtk/tab_contents_drag_source.h
@@ -0,0 +1,110 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_TAB_CONTENTS_DRAG_SOURCE_H_
+#define CHROME_BROWSER_UI_GTK_TAB_CONTENTS_DRAG_SOURCE_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "app/gtk_signal_registrar.h"
+#include "base/basictypes.h"
+#include "base/file_path.h"
+#include "base/message_loop.h"
+#include "base/string16.h"
+#include "gfx/point.h"
+#include "gfx/native_widget_types.h"
+#include "googleurl/src/gurl.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h"
+
+class SkBitmap;
+class TabContents;
+class TabContentsView;
+struct WebDropData;
+
+// TabContentsDragSource takes care of managing the drag from a TabContents
+// with Gtk.
+class TabContentsDragSource : public MessageLoopForUI::Observer {
+ public:
+ explicit TabContentsDragSource(TabContentsView* tab_contents_view);
+ ~TabContentsDragSource();
+
+ TabContents* tab_contents() const;
+
+ // Starts a drag for the tab contents this TabContentsDragSource was
+ // created for.
+ void StartDragging(const WebDropData& drop_data,
+ WebKit::WebDragOperationsMask allowed_ops,
+ GdkEventButton* last_mouse_down,
+ const SkBitmap& image,
+ const gfx::Point& image_offset);
+
+ // MessageLoop::Observer implementation:
+ virtual void WillProcessEvent(GdkEvent* event);
+ virtual void DidProcessEvent(GdkEvent* event);
+
+ private:
+ CHROMEGTK_CALLBACK_2(TabContentsDragSource, gboolean, OnDragFailed,
+ GdkDragContext*, GtkDragResult);
+ CHROMEGTK_CALLBACK_1(TabContentsDragSource, void, OnDragBegin,
+ GdkDragContext*);
+ CHROMEGTK_CALLBACK_1(TabContentsDragSource, void, OnDragEnd,
+ GdkDragContext*);
+ CHROMEGTK_CALLBACK_4(TabContentsDragSource, void, OnDragDataGet,
+ GdkDragContext*, GtkSelectionData*, guint, guint);
+ CHROMEGTK_CALLBACK_1(TabContentsDragSource, gboolean, OnDragIconExpose,
+ GdkEventExpose*);
+
+ gfx::NativeView GetContentNativeView() const;
+
+ // The view we're manging the drag for.
+ TabContentsView* tab_contents_view_;
+
+ // The drop data for the current drag (for drags that originate in the render
+ // view). Non-NULL iff there is a current drag.
+ scoped_ptr<WebDropData> drop_data_;
+
+ // The image used for depicting the drag, and the offset between the cursor
+ // and the top left pixel.
+ GdkPixbuf* drag_pixbuf_;
+ gfx::Point image_offset_;
+
+ // The mime type for the file contents of the current drag (if any).
+ GdkAtom drag_file_mime_type_;
+
+ // Whether the current drag has failed. Meaningless if we are not the source
+ // for a current drag.
+ bool drag_failed_;
+
+ // This is the widget we use to initiate drags. Since we don't use the
+ // renderer widget, we can persist drags even when our contents is switched
+ // out. We can't use an OwnedWidgetGtk because the GtkInvisible widget
+ // initialization code sinks the reference.
+ GtkWidget* drag_widget_;
+
+ // Context created once drag starts. A NULL value indicates that there is
+ // no drag currently in progress.
+ GdkDragContext* drag_context_;
+
+ // The file mime type for a drag-out download.
+ string16 wide_download_mime_type_;
+
+ // The file name to be saved to for a drag-out download.
+ FilePath download_file_name_;
+
+ // The URL to download from for a drag-out download.
+ GURL download_url_;
+
+ // The widget that provides visual feedback for the drag. We can't use
+ // an OwnedWidgetGtk because the GtkWindow initialization code sinks
+ // the reference.
+ GtkWidget* drag_icon_;
+
+ GtkSignalRegistrar signals_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabContentsDragSource);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_TAB_CONTENTS_DRAG_SOURCE_H_
diff --git a/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.cc b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc
index a204b29..8b8631a 100644
--- a/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.cc
+++ b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h
new file mode 100644
index 0000000..87cc31f
--- /dev/null
+++ b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h
@@ -0,0 +1,272 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_TABS_DRAGGED_TAB_CONTROLLER_GTK_H_
+#define CHROME_BROWSER_UI_GTK_TABS_DRAGGED_TAB_CONTROLLER_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <set>
+
+#include "app/x11_util.h"
+#include "base/scoped_ptr.h"
+#include "base/timer.h"
+#include "chrome/browser/tab_contents/tab_contents_delegate.h"
+#include "chrome/browser/ui/tabs/dock_info.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+
+class DraggedTabGtk;
+class TabGtk;
+class TabStripGtk;
+class TabContentsWrapper;
+
+class DraggedTabControllerGtk : public NotificationObserver,
+ public TabContentsDelegate {
+ public:
+ DraggedTabControllerGtk(TabGtk* source_tab, TabStripGtk* source_tabstrip);
+ virtual ~DraggedTabControllerGtk();
+
+ // Capture information needed to be used during a drag session for this
+ // controller's associated source Tab and TabStrip. |mouse_offset| is the
+ // distance of the mouse pointer from the Tab's origin.
+ void CaptureDragInfo(const gfx::Point& mouse_offset);
+
+ // Responds to drag events subsequent to StartDrag. If the mouse moves a
+ // sufficient distance before the mouse is released, a drag session is
+ // initiated.
+ void Drag();
+
+ // Complete the current drag session. If the drag session was canceled
+ // because the user pressed Escape or something interrupted it, |canceled|
+ // is true so the helper can revert the state to the world before the drag
+ // begun. Returns whether the tab has been destroyed.
+ bool EndDrag(bool canceled);
+
+ // Retrieve the source tab if the TabContents specified matches the one being
+ // dragged by this controller, or NULL if the specified TabContents is not
+ // the same as the one being dragged.
+ TabGtk* GetDragSourceTabForContents(TabContents* contents) const;
+
+ // Returns true if the specified tab matches the tab being dragged.
+ bool IsDragSourceTab(const TabGtk* tab) const;
+
+ // Returns true if the specified tab is detached.
+ bool IsTabDetached(const TabGtk* tab) const;
+
+ private:
+ // Enumeration of the ways a drag session can end.
+ enum EndDragType {
+ // Drag session exited normally: the user released the mouse.
+ NORMAL,
+
+ // The drag session was canceled (alt-tab during drag, escape ...)
+ CANCELED,
+
+ // The tab (NavigationController) was destroyed during the drag.
+ TAB_DESTROYED
+ };
+
+ // Overridden from TabContentsDelegate:
+ virtual void OpenURLFromTab(TabContents* source,
+ const GURL& url,
+ const GURL& referrer,
+ WindowOpenDisposition disposition,
+ PageTransition::Type transition);
+ virtual void NavigationStateChanged(const TabContents* source,
+ unsigned changed_flags);
+ virtual void AddNewContents(TabContents* source,
+ TabContents* new_contents,
+ WindowOpenDisposition disposition,
+ const gfx::Rect& initial_pos,
+ bool user_gesture);
+ virtual void ActivateContents(TabContents* contents);
+ virtual void DeactivateContents(TabContents* contents);
+ virtual void LoadingStateChanged(TabContents* source);
+ virtual void CloseContents(TabContents* source);
+ virtual void MoveContents(TabContents* source, const gfx::Rect& pos);
+ virtual bool IsPopup(TabContents* source);
+ virtual void ToolbarSizeChanged(TabContents* source, bool is_animating);
+ virtual void URLStarredChanged(TabContents* source, bool starred);
+ virtual void UpdateTargetURL(TabContents* source, const GURL& url);
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Initialize the offset used to calculate the position to create windows
+ // in |GetWindowCreatePoint|.
+ void InitWindowCreatePoint();
+
+ // Returns the point where a detached window should be created given the
+ // current mouse position.
+ gfx::Point GetWindowCreatePoint() const;
+
+ // Sets the TabContents being dragged with the specified |new_contents|.
+ void SetDraggedContents(TabContentsWrapper* new_contents);
+
+ // Move the DraggedTabView according to the current mouse screen position,
+ // potentially updating the source and other TabStrips.
+ void ContinueDragging();
+
+ // Handles moving the Tab within a TabStrip as well as updating the View.
+ void MoveTab(const gfx::Point& screen_point);
+
+ // Returns the compatible TabStrip that is under the specified point (screen
+ // coordinates), or NULL if there is none.
+ TabStripGtk* GetTabStripForPoint(const gfx::Point& screen_point);
+
+ // Returns the specified |tabstrip| if it contains the specified point
+ // (screen coordinates), NULL if it does not.
+ TabStripGtk* GetTabStripIfItContains(TabStripGtk* tabstrip,
+ const gfx::Point& screen_point) const;
+
+ // Attach the dragged Tab to the specified TabStrip.
+ void Attach(TabStripGtk* attached_tabstrip, const gfx::Point& screen_point);
+
+ // Detach the dragged Tab from the current TabStrip.
+ void Detach();
+
+ // Converts a screen point to a point relative to the tab strip.
+ gfx::Point ConvertScreenPointToTabStripPoint(TabStripGtk* tabstrip,
+ const gfx::Point& screen_point);
+
+ // Retrieve the bounds of the DraggedTabGtk, relative to the attached
+ // TabStrip, given location of the dragged tab in screen coordinates.
+ gfx::Rect GetDraggedTabTabStripBounds(const gfx::Point& screen_point);
+
+ // Returns the index where the dragged TabContents should be inserted into
+ // the attached TabStripModel given the DraggedTabView's bounds
+ // |dragged_bounds| in coordinates relative to the attached TabStrip.
+ // |is_tab_attached| is true if the tab has already been added.
+ int GetInsertionIndexForDraggedBounds(const gfx::Rect& dragged_bounds,
+ bool is_tab_attached) const;
+
+ // Get the position of the dragged tab relative to the attached tab strip.
+ gfx::Point GetDraggedTabPoint(const gfx::Point& screen_point);
+
+ // Finds the Tab within the specified TabStrip that corresponds to the
+ // dragged TabContents.
+ TabGtk* GetTabMatchingDraggedContents(TabStripGtk* tabstrip) const;
+
+ // Does the work for EndDrag. Returns whether the tab has been destroyed.
+ bool EndDragImpl(EndDragType how_end);
+
+ // If the drag was aborted for some reason, this function is called to un-do
+ // the changes made during the drag operation.
+ void RevertDrag();
+
+ // Finishes the drag operation. Returns true if the drag controller should
+ // be destroyed immediately, false otherwise.
+ bool CompleteDrag();
+
+ // Create the DraggedTabGtk if it does not yet exist.
+ void EnsureDraggedTab();
+
+ // Utility for getting the mouse position in screen coordinates.
+ gfx::Point GetCursorScreenPoint() const;
+
+ // Gets the screen bounds of a tab.
+ static gfx::Rect GetTabScreenBounds(TabGtk* tab);
+
+ // Utility to convert the specified TabStripModel index to something valid
+ // for the attached TabStrip.
+ int NormalizeIndexToAttachedTabStrip(int index) const;
+
+ // Hides the window that contains the tab strip the current drag session was
+ // initiated from.
+ void HideWindow();
+
+ // Presents the window that was hidden by HideWindow.
+ void ShowWindow();
+
+ // Closes a hidden frame at the end of a drag session.
+ void CleanUpHiddenFrame();
+
+ // Cleans up a source tab that is no longer used.
+ void CleanUpSourceTab();
+
+ // Completes the drag session after the view has animated to its final
+ // position.
+ void OnAnimateToBoundsComplete();
+
+ // Activates whichever window is under the mouse.
+ void BringWindowUnderMouseToFront();
+
+ // Handles registering for notifications.
+ NotificationRegistrar registrar_;
+
+ // The TabContents being dragged.
+ TabContentsWrapper* dragged_contents_;
+
+ // The original TabContentsDelegate of |dragged_contents_|, before it was
+ // detached from the browser window. We store this so that we can forward
+ // certain delegate notifications back to it if we can't handle them locally.
+ TabContentsDelegate* original_delegate_;
+
+ // The tab that initiated the drag session.
+ TabGtk* source_tab_;
+
+ // The tab strip |source_tab_| originated from.
+ TabStripGtk* source_tabstrip_;
+
+ // This is the index of the |source_tab_| in |source_tabstrip_| when the drag
+ // began. This is used to restore the previous state if the drag is aborted.
+ int source_model_index_;
+
+ // The TabStrip the dragged Tab is currently attached to, or NULL if the
+ // dragged Tab is detached.
+ TabStripGtk* attached_tabstrip_;
+
+ // The visual representation of the dragged Tab.
+ scoped_ptr<DraggedTabGtk> dragged_tab_;
+
+ // The position of the mouse (in screen coordinates) at the start of the drag
+ // operation. This is used to calculate minimum elasticity before a
+ // DraggedTabView is constructed.
+ gfx::Point start_screen_point_;
+
+ // This is the offset of the mouse from the top left of the Tab where
+ // dragging begun. This is used to ensure that the dragged view is always
+ // positioned at the correct location during the drag, and to ensure that the
+ // detached window is created at the right location.
+ gfx::Point mouse_offset_;
+
+ // A hint to use when positioning new windows created by detaching Tabs. This
+ // is the distance of the mouse from the top left of the dragged tab as if it
+ // were the distance of the mouse from the top left of the first tab in the
+ // attached TabStrip from the top left of the window.
+ gfx::Point window_create_point_;
+
+ // Whether we're in the destructor or not. Makes sure we don't destroy the
+ // drag controller more than once.
+ bool in_destructor_;
+
+ // The horizontal position of the mouse cursor in screen coordinates at the
+ // time of the last re-order event.
+ int last_move_screen_x_;
+
+ // DockInfo for the tabstrip.
+ DockInfo dock_info_;
+
+ typedef std::set<GtkWidget*> DockWindows;
+ DockWindows dock_windows_;
+
+ // Is the tab mini?
+ const bool mini_;
+
+ // Is the tab pinned?
+ const bool pinned_;
+
+ // Timer used to bring the window under the cursor to front. If the user
+ // stops moving the mouse for a brief time over a browser window, it is
+ // brought to front.
+ base::OneShotTimer<DraggedTabControllerGtk> bring_to_front_timer_;
+
+ DISALLOW_COPY_AND_ASSIGN(DraggedTabControllerGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_TABS_DRAGGED_TAB_CONTROLLER_GTK_H_
diff --git a/chrome/browser/gtk/tabs/dragged_tab_gtk.cc b/chrome/browser/ui/gtk/tabs/dragged_tab_gtk.cc
index 299f183..3fbeefd 100644
--- a/chrome/browser/gtk/tabs/dragged_tab_gtk.cc
+++ b/chrome/browser/ui/gtk/tabs/dragged_tab_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/tabs/dragged_tab_gtk.h b/chrome/browser/ui/gtk/tabs/dragged_tab_gtk.h
new file mode 100644
index 0000000..5ba35fd
--- /dev/null
+++ b/chrome/browser/ui/gtk/tabs/dragged_tab_gtk.h
@@ -0,0 +1,147 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_TABS_DRAGGED_TAB_GTK_H_
+#define CHROME_BROWSER_UI_GTK_TABS_DRAGGED_TAB_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "base/callback.h"
+#include "base/scoped_ptr.h"
+#include "base/task.h"
+#include "gfx/canvas.h"
+#include "gfx/point.h"
+#include "gfx/rect.h"
+#include "gfx/size.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
+
+class TabContents;
+class TabRendererGtk;
+
+class DraggedTabGtk : public ui::AnimationDelegate {
+ public:
+ DraggedTabGtk(TabContents* datasource,
+ const gfx::Point& mouse_tab_offset,
+ const gfx::Size& contents_size,
+ bool mini);
+ virtual ~DraggedTabGtk();
+
+ // Moves the dragged tab to the appropriate location given the mouse
+ // pointer at |screen_point|.
+ void MoveTo(const gfx::Point& screen_point);
+
+ // Sets the offset of the mouse from the upper left corner of the tab.
+ void set_mouse_tab_offset(const gfx::Point& offset) {
+ mouse_tab_offset_ = offset;
+ }
+
+ // Notifies the dragged tab that it has become attached to a tabstrip.
+ void Attach(int selected_width);
+
+ // Resizes the dragged tab to a width of |width|.
+ void Resize(int width);
+
+ // Notifies the dragged tab that it has been detached from a tabstrip.
+ void Detach();
+
+ // Notifies the dragged tab that it should update itself.
+ void Update();
+
+ // Animates the dragged tab to the specified bounds, then calls back to
+ // |callback|.
+ typedef Callback0::Type AnimateToBoundsCallback;
+ void AnimateToBounds(const gfx::Rect& bounds,
+ AnimateToBoundsCallback* callback);
+
+ // Returns the size of the dragged tab. Used when attaching to a tabstrip
+ // to determine where to place the tab in the attached tabstrip.
+ const gfx::Size& attached_tab_size() const { return attached_tab_size_; }
+
+ GtkWidget* widget() const { return container_; }
+
+ private:
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
+
+ // Arranges the contents of the dragged tab.
+ void Layout();
+
+ // Gets the preferred size of the dragged tab.
+ gfx::Size GetPreferredSize();
+
+ // Resizes the container to fit the content for the current attachment mode.
+ void ResizeContainer();
+
+ // Utility for scaling a size by the current scaling factor.
+ int ScaleValue(int value);
+
+ // Returns the bounds of the container window.
+ gfx::Rect bounds() const;
+
+ // Sets the color map of the container window to allow the window to be
+ // transparent.
+ void SetContainerColorMap();
+
+ // Sets full transparency for the container window. This is used if
+ // compositing is available for the screen.
+ void SetContainerTransparency();
+
+ // Sets the shape mask for the container window to emulate a transparent
+ // container window. This is used if compositing is not available for the
+ // screen.
+ // |surface| represents the tab only (not the render view).
+ void SetContainerShapeMask(cairo_surface_t* surface);
+
+ // expose-event handler that notifies when the tab needs to be redrawn.
+ static gboolean OnExposeEvent(GtkWidget* widget, GdkEventExpose* event,
+ DraggedTabGtk* dragged_tab);
+
+ // The tab contents that the dragged tab contains.
+ TabContents* data_source_;
+
+ // The window that contains the dragged tab or tab contents.
+ GtkWidget* container_;
+
+ // The fixed widget that we use to contain the tab renderer so that the
+ // tab widget won't be resized.
+ GtkWidget* fixed_;
+
+ // The renderer that paints the dragged tab.
+ scoped_ptr<TabRendererGtk> renderer_;
+
+ // True if the view is currently attached to a tabstrip. Controls rendering
+ // and sizing modes.
+ bool attached_;
+
+ // The unscaled offset of the mouse from the top left of the dragged tab.
+ // This is used to maintain an appropriate offset for the mouse pointer when
+ // dragging scaled and unscaled representations, and also to calculate the
+ // position of detached windows.
+ gfx::Point mouse_tab_offset_;
+
+ // The size of the tab renderer when the dragged tab is attached to a
+ // tabstrip.
+ gfx::Size attached_tab_size_;
+
+ // The dimensions of the TabContents being dragged.
+ gfx::Size contents_size_;
+
+ // The animation used to slide the attached tab to its final location.
+ ui::SlideAnimation close_animation_;
+
+ // A callback notified when the animation is complete.
+ scoped_ptr<Callback0::Type> animation_callback_;
+
+ // The start and end bounds of the animation sequence.
+ gfx::Rect animation_start_bounds_;
+ gfx::Rect animation_end_bounds_;
+
+ DISALLOW_COPY_AND_ASSIGN(DraggedTabGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_TABS_DRAGGED_TAB_GTK_H_
diff --git a/chrome/browser/gtk/tabs/tab_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_gtk.cc
index c0f8e82..ae6de10 100644
--- a/chrome/browser/gtk/tabs/tab_gtk.cc
+++ b/chrome/browser/ui/gtk/tabs/tab_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/tabs/tab_gtk.h b/chrome/browser/ui/gtk/tabs/tab_gtk.h
new file mode 100644
index 0000000..27078ca
--- /dev/null
+++ b/chrome/browser/ui/gtk/tabs/tab_gtk.h
@@ -0,0 +1,213 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_TABS_TAB_GTK_H_
+#define CHROME_BROWSER_UI_GTK_TABS_TAB_GTK_H_
+#pragma once
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/message_loop.h"
+#include "chrome/browser/gtk/tabs/tab_renderer_gtk.h"
+#include "chrome/browser/tabs/tab_strip_model.h"
+
+namespace gfx {
+class Path;
+}
+
+class ThemeProvider;
+
+class TabGtk : public TabRendererGtk,
+ public MessageLoopForUI::Observer {
+ public:
+ // An interface implemented by an object that can help this Tab complete
+ // various actions. The index parameter is the index of this Tab in the
+ // TabRenderer::Model.
+ class TabDelegate {
+ public:
+ // Returns true if the specified Tab is selected.
+ virtual bool IsTabSelected(const TabGtk* tab) const = 0;
+
+ // Returns true if the specified Tab is pinned.
+ virtual bool IsTabPinned(const TabGtk* tab) const = 0;
+
+ // Returns true if the specified Tab is detached.
+ virtual bool IsTabDetached(const TabGtk* tab) const = 0;
+
+ // Selects the specified Tab.
+ virtual void SelectTab(TabGtk* tab) = 0;
+
+ // Closes the specified Tab.
+ virtual void CloseTab(TabGtk* tab) = 0;
+
+ // Returns true if the specified command is enabled for the specified Tab.
+ virtual bool IsCommandEnabledForTab(
+ TabStripModel::ContextMenuCommand command_id,
+ const TabGtk* tab) const = 0;
+
+ // Executes the specified command for the specified Tab.
+ virtual void ExecuteCommandForTab(
+ TabStripModel::ContextMenuCommand command_id, TabGtk* tab) = 0;
+
+ // Starts/Stops highlighting the tabs that will be affected by the
+ // specified command for the specified Tab.
+ virtual void StartHighlightTabsForCommand(
+ TabStripModel::ContextMenuCommand command_id, TabGtk* tab) = 0;
+ virtual void StopHighlightTabsForCommand(
+ TabStripModel::ContextMenuCommand command_id, TabGtk* tab) = 0;
+ virtual void StopAllHighlighting() = 0;
+
+ // Potentially starts a drag for the specified Tab.
+ virtual void MaybeStartDrag(TabGtk* tab, const gfx::Point& point) = 0;
+
+ // Continues dragging a Tab.
+ virtual void ContinueDrag(GdkDragContext* context) = 0;
+
+ // Ends dragging a Tab. |canceled| is true if the drag was aborted in a way
+ // other than the user releasing the mouse. Returns whether the tab has been
+ // destroyed.
+ virtual bool EndDrag(bool canceled) = 0;
+
+ // Returns true if the associated TabStrip's delegate supports tab moving or
+ // detaching. Used by the Frame to determine if dragging on the Tab
+ // itself should move the window in cases where there's only one
+ // non drag-able Tab.
+ virtual bool HasAvailableDragActions() const = 0;
+
+ // Returns the theme provider for icons and colors.
+ virtual ThemeProvider* GetThemeProvider() = 0;
+
+ protected:
+ virtual ~TabDelegate() {}
+ };
+
+ explicit TabGtk(TabDelegate* delegate);
+ virtual ~TabGtk();
+
+ // Access the delegate.
+ TabDelegate* delegate() const { return delegate_; }
+
+ GtkWidget* widget() const { return event_box_; }
+
+ // Used to set/check whether this Tab is being animated closed.
+ void set_closing(bool closing) { closing_ = closing; }
+ bool closing() const { return closing_; }
+
+ // Used to set/check whether this Tab is being dragged.
+ void set_dragging(bool dragging) { dragging_ = dragging; }
+ bool dragging() const { return dragging_; }
+
+ // TabRendererGtk overrides:
+ virtual bool IsSelected() const;
+ virtual bool IsVisible() const;
+ virtual void SetVisible(bool visible) const;
+ virtual void CloseButtonClicked();
+ virtual void UpdateData(TabContents* contents, bool app, bool loading_only);
+ virtual void SetBounds(const gfx::Rect& bounds);
+
+ private:
+ class ContextMenuController;
+ class TabGtkObserverHelper;
+ friend class ContextMenuController;
+
+ // MessageLoop::Observer implementation:
+ virtual void WillProcessEvent(GdkEvent* event);
+ virtual void DidProcessEvent(GdkEvent* event);
+
+ // button-press-event handler that handles mouse clicks.
+ CHROMEGTK_CALLBACK_1(TabGtk, gboolean, OnButtonPressEvent, GdkEventButton*);
+
+ // button-release-event handler that handles mouse click releases.
+ CHROMEGTK_CALLBACK_1(TabGtk, gboolean, OnButtonReleaseEvent, GdkEventButton*);
+
+ // drag-begin is emitted when the drag is started. We connect so that we can
+ // set the drag icon to a transparent pixbuf.
+ CHROMEGTK_CALLBACK_1(TabGtk, void, OnDragBegin, GdkDragContext*);
+
+ // drag-failed is emitted when the drag is finished. In our case the signal
+ // does not imply failure as we don't use the drag-n-drop API to transfer drop
+ // data.
+ CHROMEGTK_CALLBACK_2(TabGtk, gboolean, OnDragFailed, GdkDragContext*,
+ GtkDragResult);
+
+ // When a drag is ending, a fake button release event is passed to the drag
+ // widget to fake letting go of the mouse button. We need a callback for
+ // this event because it is the only way to catch drag end events when the
+ // user presses space or return.
+ CHROMEGTK_CALLBACK_1(TabGtk, gboolean, OnDragButtonReleased, GdkEventButton*);
+
+ // Shows the context menu.
+ void ShowContextMenu();
+
+ // Invoked when the context menu closes.
+ void ContextMenuClosed();
+
+ // Sets whether the tooltip should be shown or not, depending on the size of
+ // the tab.
+ void UpdateTooltipState();
+
+ // Creates the drag widget used to track a drag operation.
+ void CreateDragWidget();
+
+ // Destroys the drag widget.
+ void DestroyDragWidget();
+
+ // Starts the dragging operation. |drag_offset| is the offset inside the tab
+ // bounds where the grab occurred.
+ void StartDragging(gfx::Point drag_offset);
+
+ // Ends the dragging operations. |canceled| is true if the operation was
+ // canceled.
+ void EndDrag(bool canceled);
+
+ // An instance of a delegate object that can perform various actions based on
+ // user gestures.
+ TabDelegate* delegate_;
+
+ // True if the tab is being animated closed.
+ bool closing_;
+
+ // True if the tab is being dragged.
+ bool dragging_;
+
+ // The context menu controller.
+ scoped_ptr<ContextMenuController> menu_controller_;
+
+ // The windowless widget used to collect input events for the tab. We can't
+ // use an OwnedWidgetGtk because of the way the dragged tab controller
+ // destroys the source tab. The source tab is destroyed when the drag ends
+ // before we let gtk handle the end of the drag. This results in the widget
+ // having an extra reference, which will cause OwnedWidgetGtk.Destroy to
+ // DCHECK.
+ GtkWidget* event_box_;
+
+ // A copy of the last button press event, used to initiate a drag.
+ GdkEvent* last_mouse_down_;
+
+ // A GtkInivisible used to track the drag event. GtkInvisibles are of the
+ // type GInitiallyUnowned, but the widget initialization code sinks the
+ // reference, so we can't used an OwnedWidgetGtk here.
+ GtkWidget* drag_widget_;
+
+ // The cached width of the title in pixels, updated whenever the title
+ // changes.
+ int title_width_;
+
+ // Keep track of whether or not we have an observer.
+ scoped_ptr<TabGtkObserverHelper> observer_;
+
+ // Used to destroy the drag widget after a return to the message loop.
+ ScopedRunnableMethodFactory<TabGtk> destroy_factory_;
+
+ // Due to a bug in GTK+, we need to force the end of a drag when we get a
+ // mouse release event on the the dragged widget, otherwise, we don't know
+ // when the drag has ended when the user presses space or enter. We queue
+ // a task to end the drag and only run it if GTK+ didn't send us the
+ // drag-failed event.
+ ScopedRunnableMethodFactory<TabGtk> drag_end_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_TABS_TAB_GTK_H_
diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc
index 3b5cb50..7811700 100644
--- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
+++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h
new file mode 100644
index 0000000..a5bffa4
--- /dev/null
+++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h
@@ -0,0 +1,456 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_TABS_TAB_RENDERER_GTK_H_
+#define CHROME_BROWSER_UI_GTK_TABS_TAB_RENDERER_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+#include <map>
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "base/string16.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "gfx/canvas.h"
+#include "gfx/font.h"
+#include "gfx/rect.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/base/animation/animation_delegate.h"
+
+namespace gfx {
+class Size;
+} // namespace gfx
+
+class CustomDrawButton;
+class GtkThemeProvider;
+class TabContents;
+class ThemeProvider;
+
+namespace ui {
+class SlideAnimation;
+class ThrobAnimation;
+}
+
+class TabRendererGtk : public ui::AnimationDelegate,
+ public NotificationObserver {
+ public:
+ // Possible animation states.
+ enum AnimationState {
+ ANIMATION_NONE,
+ ANIMATION_WAITING,
+ ANIMATION_LOADING
+ };
+
+ class LoadingAnimation : public NotificationObserver {
+ public:
+ struct Data {
+ explicit Data(ThemeProvider* theme_provider);
+ Data(int loading, int waiting, int waiting_to_loading);
+
+ SkBitmap* waiting_animation_frames;
+ SkBitmap* loading_animation_frames;
+ int loading_animation_frame_count;
+ int waiting_animation_frame_count;
+ int waiting_to_loading_frame_count_ratio;
+ };
+
+ explicit LoadingAnimation(ThemeProvider* theme_provider);
+
+ // Used in unit tests to inject specific data.
+ explicit LoadingAnimation(const LoadingAnimation::Data& data);
+
+ virtual ~LoadingAnimation();
+
+ // Advance the loading animation to the next frame, or hide the animation if
+ // the tab isn't loading. Returns |true| if the icon area needs to be
+ // repainted.
+ bool ValidateLoadingAnimation(AnimationState animation_state);
+
+ AnimationState animation_state() const { return animation_state_; }
+ int animation_frame() const { return animation_frame_; }
+
+ const SkBitmap* waiting_animation_frames() const {
+ return data_->waiting_animation_frames;
+ }
+ const SkBitmap* loading_animation_frames() const {
+ return data_->loading_animation_frames;
+ }
+
+ // Provide NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ private:
+ scoped_ptr<Data> data_;
+
+ // Used to listen for theme change notifications.
+ NotificationRegistrar registrar_;
+
+ // Gives us our throbber images.
+ ThemeProvider* theme_provider_;
+
+ // Current state of the animation.
+ AnimationState animation_state_;
+
+ // The current index into the Animation image strip.
+ int animation_frame_;
+
+ DISALLOW_COPY_AND_ASSIGN(LoadingAnimation);
+ };
+
+ explicit TabRendererGtk(ThemeProvider* theme_provider);
+ virtual ~TabRendererGtk();
+
+ // TabContents. If only the loading state was updated, the loading_only flag
+ // should be specified. If other things change, set this flag to false to
+ // update everything.
+ virtual void UpdateData(TabContents* contents, bool app, bool loading_only);
+
+ // Sets the blocked state of the tab.
+ void SetBlocked(bool pinned);
+ bool is_blocked() const;
+
+ // Sets the mini-state of the tab.
+ void set_mini(bool mini) { data_.mini = mini; }
+ bool mini() const { return data_.mini; }
+
+ // Sets the app state of the tab.
+ void set_app(bool app) { data_.app = app; }
+ bool app() const { return data_.app; }
+
+ // Are we in the process of animating a mini tab state change on this tab?
+ void set_animating_mini_change(bool value) {
+ data_.animating_mini_change = value;
+ }
+
+ // Updates the display to reflect the contents of this TabRenderer's model.
+ void UpdateFromModel();
+
+ // Returns true if the Tab is selected, false otherwise.
+ virtual bool IsSelected() const;
+
+ // Returns true if the Tab is visible, false otherwise.
+ virtual bool IsVisible() const;
+
+ // Sets the visibility of the Tab.
+ virtual void SetVisible(bool visible) const;
+
+ // Paints the tab into |canvas|.
+ virtual void Paint(gfx::Canvas* canvas);
+
+ // Paints the tab into a SkBitmap.
+ virtual SkBitmap PaintBitmap();
+
+ // Paints the tab, and keeps the result server-side. The returned surface must
+ // be freed with cairo_surface_destroy().
+ virtual cairo_surface_t* PaintToSurface();
+
+ // There is no PaintNow available, so the fastest we can do is schedule a
+ // paint with the windowing system.
+ virtual void SchedulePaint();
+
+ // Notifies the Tab that the close button has been clicked.
+ virtual void CloseButtonClicked();
+
+ // Sets the bounds of the tab.
+ virtual void SetBounds(const gfx::Rect& bounds);
+
+ // Provide NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Advance the loading animation to the next frame, or hide the animation if
+ // the tab isn't loading. Returns |true| if the icon area needs to be
+ // repainted.
+ bool ValidateLoadingAnimation(AnimationState animation_state);
+
+ // Repaint only the area of the tab that contains the favicon.
+ void PaintFavIconArea(GdkEventExpose* event);
+
+ // Returns whether the Tab should display a favicon.
+ bool ShouldShowIcon() const;
+
+ // Returns the minimum possible size of a single unselected Tab.
+ static gfx::Size GetMinimumUnselectedSize();
+ // Returns the minimum possible size of a selected Tab. Selected tabs must
+ // always show a close button and have a larger minimum size than unselected
+ // tabs.
+ static gfx::Size GetMinimumSelectedSize();
+ // Returns the preferred size of a single Tab, assuming space is
+ // available.
+ static gfx::Size GetStandardSize();
+
+ // Returns the width for mini-tabs. Mini-tabs always have this width.
+ static int GetMiniWidth();
+
+ // Loads the images to be used for the tab background.
+ static void LoadTabImages();
+
+ // Sets the colors used for painting text on the tabs.
+ static void SetSelectedTitleColor(SkColor color);
+ static void SetUnselectedTitleColor(SkColor color);
+
+ static gfx::Font* title_font() { return title_font_; }
+
+ // Returns the bounds of the Tab.
+ int x() const { return bounds_.x(); }
+ int y() const { return bounds_.y(); }
+ int width() const { return bounds_.width(); }
+ int height() const { return bounds_.height(); }
+
+ gfx::Rect bounds() const { return bounds_; }
+
+ gfx::Rect favicon_bounds() const { return favicon_bounds_; }
+
+ // Returns the non-mirrored (LTR) bounds of this tab.
+ gfx::Rect GetNonMirroredBounds(GtkWidget* parent) const;
+
+ // Returns the requested bounds of the tab.
+ gfx::Rect GetRequisition() const;
+
+ GtkWidget* widget() const { return tab_.get(); }
+
+ // Start/stop the mini-tab title animation.
+ void StartMiniTabTitleAnimation();
+ void StopMiniTabTitleAnimation();
+
+ void set_vertical_offset(int offset) { background_offset_y_ = offset; }
+
+ protected:
+ const gfx::Rect& title_bounds() const { return title_bounds_; }
+ const gfx::Rect& close_button_bounds() const { return close_button_bounds_; }
+
+ // Returns the title of the Tab.
+ string16 GetTitle() const;
+
+ // enter-notify-event handler that signals when the mouse enters the tab.
+ CHROMEGTK_CALLBACK_1(TabRendererGtk, gboolean, OnEnterNotifyEvent,
+ GdkEventCrossing*);
+
+ // leave-notify-event handler that signals when the mouse enters the tab.
+ CHROMEGTK_CALLBACK_1(TabRendererGtk, gboolean, OnLeaveNotifyEvent,
+ GdkEventCrossing*);
+
+ private:
+ class FavIconCrashAnimation;
+
+ // The data structure used to hold cached bitmaps. We need to manually free
+ // the bitmap in CachedBitmap when we remove it from |cached_bitmaps_|. We
+ // handle this when we replace images in the map and in the destructor.
+ struct CachedBitmap {
+ int bg_offset_x;
+ int bg_offset_y;
+ SkBitmap* bitmap;
+ };
+ typedef std::map<std::pair<const SkBitmap*, const SkBitmap*>, CachedBitmap>
+ BitmapCache;
+
+ // Model data. We store this here so that we don't need to ask the underlying
+ // model, which is tricky since instances of this object can outlive the
+ // corresponding objects in the underlying model.
+ struct TabData {
+ TabData()
+ : is_default_favicon(false),
+ loading(false),
+ crashed(false),
+ off_the_record(false),
+ show_icon(true),
+ mini(false),
+ blocked(false),
+ animating_mini_change(false),
+ app(false) {
+ }
+
+ SkBitmap favicon;
+ bool is_default_favicon;
+ string16 title;
+ bool loading;
+ bool crashed;
+ bool off_the_record;
+ bool show_icon;
+ bool mini;
+ bool blocked;
+ bool animating_mini_change;
+ bool app;
+ };
+
+ // TODO(jhawkins): Move into TabResources class.
+ struct TabImage {
+ SkBitmap* image_l;
+ SkBitmap* image_c;
+ SkBitmap* image_r;
+ int l_width;
+ int r_width;
+ int y_offset;
+ };
+
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
+
+ // Starts/Stops the crash animation.
+ void StartCrashAnimation();
+ void StopCrashAnimation();
+
+ // Return true if the crash animation is currently running.
+ bool IsPerformingCrashAnimation() const;
+
+ // Set the temporary offset for the favicon. This is used during animation.
+ void SetFavIconHidingOffset(int offset);
+
+ void DisplayCrashedFavIcon();
+ void ResetCrashedFavIcon();
+
+ // Generates the bounds for the interior items of the tab.
+ void Layout();
+
+ // Returns the local bounds of the tab. This returns the rect
+ // {0, 0, width(), height()} for now, as we don't yet support borders.
+ gfx::Rect GetLocalBounds();
+
+ // Moves the close button widget within the GtkFixed container.
+ void MoveCloseButtonWidget();
+
+ // Returns the largest of the favicon, title text, and the close button.
+ static int GetContentHeight();
+
+ // A helper method for generating the masked bitmaps used to draw the curved
+ // edges of tabs. We cache the generated bitmaps because they can take a
+ // long time to compute.
+ SkBitmap* GetMaskedBitmap(const SkBitmap* mask,
+ const SkBitmap* background,
+ int bg_offset_x,
+ int bg_offset_y);
+ BitmapCache cached_bitmaps_;
+
+ // Paints the tab, minus the close button.
+ void PaintTab(GdkEventExpose* event);
+
+ // Paint various portions of the Tab
+ void PaintTitle(gfx::Canvas* canvas);
+ void PaintIcon(gfx::Canvas* canvas);
+ void PaintTabBackground(gfx::Canvas* canvas);
+ void PaintInactiveTabBackground(gfx::Canvas* canvas);
+ void PaintActiveTabBackground(gfx::Canvas* canvas);
+ void PaintLoadingAnimation(gfx::Canvas* canvas);
+
+ // Returns the number of favicon-size elements that can fit in the tab's
+ // current size.
+ int IconCapacity() const;
+
+
+ // Returns whether the Tab should display a close button.
+ bool ShouldShowCloseBox() const;
+
+ CustomDrawButton* MakeCloseButton();
+
+ // Gets the throb value for the tab. When a tab is not selected the
+ // active background is drawn at |GetThrobValue()|%. This is used for hover
+ // and mini-tab title change effects.
+ double GetThrobValue();
+
+ // Handles the clicked signal for the close button.
+ CHROMEGTK_CALLBACK_0(TabRendererGtk, void, OnCloseButtonClicked);
+
+ // Handles middle clicking the close button.
+ CHROMEGTK_CALLBACK_1(TabRendererGtk, gboolean, OnCloseButtonMouseRelease,
+ GdkEventButton*);
+
+ // expose-event handler that redraws the tab.
+ CHROMEGTK_CALLBACK_1(TabRendererGtk, gboolean, OnExposeEvent,
+ GdkEventExpose*);
+
+ // size-allocate handler used to update the current bounds of the tab.
+ CHROMEGTK_CALLBACK_1(TabRendererGtk, void, OnSizeAllocate, GtkAllocation*);
+
+ // TODO(jhawkins): Move to TabResources.
+ static void InitResources();
+ static bool initialized_;
+
+ // The bounds of various sections of the display.
+ gfx::Rect favicon_bounds_;
+ gfx::Rect title_bounds_;
+ gfx::Rect close_button_bounds_;
+
+ TabData data_;
+
+ static TabImage tab_active_;
+ static TabImage tab_inactive_;
+ static TabImage tab_alpha_;
+
+ static gfx::Font* title_font_;
+ static int title_font_height_;
+
+ static int close_button_width_;
+ static int close_button_height_;
+
+ static SkColor selected_title_color_;
+ static SkColor unselected_title_color_;
+
+ // The GtkDrawingArea we draw the tab on.
+ OwnedWidgetGtk tab_;
+
+ // Whether we're showing the icon. It is cached so that we can detect when it
+ // changes and layout appropriately.
+ bool showing_icon_;
+
+ // Whether we are showing the close button. It is cached so that we can
+ // detect when it changes and layout appropriately.
+ bool showing_close_button_;
+
+ // The offset used to animate the favicon location.
+ int fav_icon_hiding_offset_;
+
+ // The animation object used to swap the favicon with the sad tab icon.
+ scoped_ptr<FavIconCrashAnimation> crash_animation_;
+
+ // Set when the crashed favicon should be displayed.
+ bool should_display_crashed_favicon_;
+
+ // The bounds of this Tab.
+ gfx::Rect bounds_;
+
+ // The requested bounds of this tab. These bounds are relative to the
+ // tabstrip.
+ gfx::Rect requisition_;
+
+ // Hover animation.
+ scoped_ptr<ui::SlideAnimation> hover_animation_;
+
+ // Animation used when the title of an inactive mini-tab changes.
+ scoped_ptr<ui::ThrobAnimation> mini_title_animation_;
+
+ // Contains the loading animation state.
+ LoadingAnimation loading_animation_;
+
+ // The offset used to paint the tab theme images.
+ int background_offset_x_;
+
+ // The vertical offset used to paint the tab theme images. Controlled by the
+ // tabstrip and plumbed here to offset the theme image by the size of the
+ // alignment in the BrowserTitlebar.
+ int background_offset_y_;
+
+ GtkThemeProvider* theme_provider_;
+
+ // The close button.
+ scoped_ptr<CustomDrawButton> close_button_;
+
+ // The current color of the close button.
+ SkColor close_button_color_;
+
+ // Used to listen for theme change notifications.
+ NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabRendererGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_TABS_TAB_RENDERER_GTK_H_
diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk_unittest.cc b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk_unittest.cc
index 10189da..4ad8af66 100644
--- a/chrome/browser/gtk/tabs/tab_renderer_gtk_unittest.cc
+++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
index 233ad58..4bf2b85 100644
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h
new file mode 100644
index 0000000..d6dfe70
--- /dev/null
+++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h
@@ -0,0 +1,466 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_TABS_TAB_STRIP_GTK_H_
+#define CHROME_BROWSER_UI_GTK_TABS_TAB_STRIP_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+#include <vector>
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/task.h"
+#include "base/message_loop.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/browser/gtk/tabstrip_origin_provider.h"
+#include "chrome/browser/gtk/tabs/tab_gtk.h"
+#include "chrome/browser/gtk/view_id_util.h"
+#include "chrome/browser/tabs/tab_strip_model.h"
+#include "chrome/common/notification_observer.h"
+#include "gfx/rect.h"
+
+class BrowserWindowGtk;
+class CustomDrawButton;
+class DraggedTabControllerGtk;
+class GtkThemeProvider;
+
+class TabStripGtk : public TabStripModelObserver,
+ public TabGtk::TabDelegate,
+ public MessageLoopForUI::Observer,
+ public NotificationObserver,
+ public TabstripOriginProvider,
+ public ViewIDUtil::Delegate {
+ public:
+ class TabAnimation;
+
+ TabStripGtk(TabStripModel* model, BrowserWindowGtk* window);
+ virtual ~TabStripGtk();
+
+ // Initialize and load the TabStrip into a container.
+ // TODO(tc): Pass in theme provider so we can properly theme the tabs.
+ void Init();
+
+ void Show();
+ void Hide();
+
+ TabStripModel* model() const { return model_; }
+
+ BrowserWindowGtk* window() const { return window_; }
+
+ GtkWidget* widget() const { return tabstrip_.get(); }
+
+ // Returns true if there is an active drag session.
+ bool IsDragSessionActive() const { return drag_controller_.get() != NULL; }
+
+ // Returns true if a tab is being dragged into this tabstrip.
+ bool IsActiveDropTarget() const;
+
+ // Sets the bounds of the tabs.
+ void Layout();
+
+ // Queues a draw for the tabstrip widget.
+ void SchedulePaint();
+
+ // Sets the bounds of the tabstrip.
+ void SetBounds(const gfx::Rect& bounds);
+
+ // Returns the bounds of the tabstrip.
+ const gfx::Rect& bounds() const { return bounds_; }
+
+ // Updates loading animations for the TabStrip.
+ void UpdateLoadingAnimations();
+
+ // Return true if this tab strip is compatible with the provided tab strip.
+ // Compatible tab strips can transfer tabs during drag and drop.
+ bool IsCompatibleWith(TabStripGtk* other);
+
+ // Returns true if Tabs in this TabStrip are currently changing size or
+ // position.
+ bool IsAnimating() const;
+
+ // Destroys the active drag controller.
+ void DestroyDragController();
+
+ // Removes the drag source tab from this tabstrip, and deletes it.
+ void DestroyDraggedSourceTab(TabGtk* tab);
+
+ // Retrieve the ideal bounds for the Tab at the specified index.
+ gfx::Rect GetIdealBounds(int index);
+
+ // Sets the vertical offset that each tab will use to offset against the
+ // background image. Passed in from the titlebar and based on the size of the
+ // alignment that sits above the tabstrip.
+ void SetVerticalOffset(int offset);
+
+ // TabstripOriginProvider implementation -------------------------------------
+ virtual gfx::Point GetTabStripOriginForWidget(GtkWidget* widget);
+
+ // ViewIDUtil::Delegate implementation ---------------------------------------
+ virtual GtkWidget* GetWidgetForViewID(ViewID id);
+
+ protected:
+ // TabStripModelObserver implementation:
+ virtual void TabInsertedAt(TabContentsWrapper* contents,
+ int index,
+ bool foreground);
+ virtual void TabDetachedAt(TabContentsWrapper* contents, int index);
+ virtual void TabSelectedAt(TabContentsWrapper* old_contents,
+ TabContentsWrapper* contents,
+ int index,
+ bool user_gesture);
+ virtual void TabMoved(TabContentsWrapper* contents,
+ int from_index,
+ int to_index);
+ virtual void TabChangedAt(TabContentsWrapper* contents, int index,
+ TabChangeType change_type);
+ virtual void TabReplacedAt(TabStripModel* tab_strip_model,
+ TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
+ int index);
+ virtual void TabMiniStateChanged(TabContentsWrapper* contents, int index);
+ virtual void TabBlockedStateChanged(TabContentsWrapper* contents,
+ int index);
+
+ // TabGtk::TabDelegate implementation:
+ virtual bool IsTabSelected(const TabGtk* tab) const;
+ virtual bool IsTabPinned(const TabGtk* tab) const;
+ virtual bool IsTabDetached(const TabGtk* tab) const;
+ virtual void SelectTab(TabGtk* tab);
+ virtual void CloseTab(TabGtk* tab);
+ virtual bool IsCommandEnabledForTab(
+ TabStripModel::ContextMenuCommand command_id, const TabGtk* tab) const;
+ virtual void ExecuteCommandForTab(
+ TabStripModel::ContextMenuCommand command_id, TabGtk* tab);
+ virtual void StartHighlightTabsForCommand(
+ TabStripModel::ContextMenuCommand command_id, TabGtk* tab);
+ virtual void StopHighlightTabsForCommand(
+ TabStripModel::ContextMenuCommand command_id, TabGtk* tab);
+ virtual void StopAllHighlighting();
+ virtual void MaybeStartDrag(TabGtk* tab, const gfx::Point& point);
+ virtual void ContinueDrag(GdkDragContext* context);
+ virtual bool EndDrag(bool canceled);
+ virtual bool HasAvailableDragActions() const;
+ virtual ThemeProvider* GetThemeProvider();
+
+ // MessageLoop::Observer implementation:
+ virtual void WillProcessEvent(GdkEvent* event);
+ virtual void DidProcessEvent(GdkEvent* event);
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Horizontal gap between mini-tabs and normal tabs.
+ static const int mini_to_non_mini_gap_;
+
+ private:
+ friend class BrowserWindowGtk;
+ friend class DraggedTabControllerGtk;
+ friend class InsertTabAnimation;
+ friend class MiniMoveAnimation;
+ friend class MiniTabAnimation;
+ friend class MoveTabAnimation;
+ friend class RemoveTabAnimation;
+ friend class ResizeLayoutAnimation;
+ friend class TabAnimation;
+
+ struct TabData {
+ TabGtk* tab;
+ gfx::Rect ideal_bounds;
+ };
+
+ // Used during a drop session of a url. Tracks the position of the drop as
+ // well as a window used to highlight where the drop occurs.
+ class DropInfo {
+ public:
+ DropInfo(int index, bool drop_before, bool point_down);
+ virtual ~DropInfo();
+
+ // TODO(jhawkins): Factor out this code into a TransparentContainer class.
+
+ // expose-event handler that redraws the drop indicator.
+ CHROMEGTK_CALLBACK_1(DropInfo, gboolean, OnExposeEvent, GdkEventExpose*);
+
+ // Sets the color map of the container window to allow the window to be
+ // transparent.
+ void SetContainerColorMap();
+
+ // Sets full transparency for the container window. This is used if
+ // compositing is available for the screen.
+ void SetContainerTransparency();
+
+ // Sets the shape mask for the container window to emulate a transparent
+ // container window. This is used if compositing is not available for the
+ // screen.
+ void SetContainerShapeMask();
+
+ // Creates the container widget.
+ void CreateContainer();
+
+ // Destroys the container widget.
+ void DestroyContainer();
+
+ // Index of the tab to drop on. If drop_before is true, the drop should
+ // occur between the tab at drop_index - 1 and drop_index.
+ // WARNING: if drop_before is true it is possible this will == tab_count,
+ // which indicates the drop should create a new tab at the end of the tabs.
+ int drop_index;
+ bool drop_before;
+
+ // Direction the arrow should point in. If true, the arrow is displayed
+ // above the tab and points down. If false, the arrow is displayed beneath
+ // the tab and points up.
+ bool point_down;
+
+ // Transparent container window used to render the drop indicator over the
+ // tabstrip and toolbar.
+ GtkWidget* container;
+
+ // The drop indicator image.
+ GdkPixbuf* drop_arrow;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DropInfo);
+ };
+
+ // expose-event handler that redraws the tabstrip
+ CHROMEGTK_CALLBACK_1(TabStripGtk, gboolean, OnExpose, GdkEventExpose*);
+
+ // size-allocate handler that gets the new bounds of the tabstrip.
+ CHROMEGTK_CALLBACK_1(TabStripGtk, void, OnSizeAllocate, GtkAllocation*);
+
+ // drag-motion handler that is signaled when the user performs a drag in the
+ // tabstrip bounds.
+ CHROMEGTK_CALLBACK_4(TabStripGtk, gboolean, OnDragMotion, GdkDragContext*,
+ gint, gint, guint);
+
+ // drag-drop handler that is notified when the user finishes a drag.
+ CHROMEGTK_CALLBACK_4(TabStripGtk, gboolean, OnDragDrop, GdkDragContext*,
+ gint, gint, guint);
+
+ // drag-leave handler that is signaled when the mouse leaves the tabstrip
+ // during a drag.
+ CHROMEGTK_CALLBACK_2(TabStripGtk, gboolean, OnDragLeave, GdkDragContext*,
+ guint);
+
+ // drag-data-received handler that receives the data associated with the drag.
+ CHROMEGTK_CALLBACK_6(TabStripGtk, gboolean, OnDragDataReceived,
+ GdkDragContext*, gint, gint, GtkSelectionData*,
+ guint, guint);
+
+ // Handles the clicked signal from the new tab button.
+ CHROMEGTK_CALLBACK_0(TabStripGtk, void, OnNewTabClicked);
+
+ // Sets the bounds of the tab and moves the tab widget to those bounds.
+ void SetTabBounds(TabGtk* tab, const gfx::Rect& bounds);
+
+ // Returns true if |rects| are all areas that match up with tab favicons.
+ // |rects| must be sorted from left to right. |tabs_to_paint| are the tab
+ // positions that match the rects.
+ bool CanPaintOnlyFavIcons(const GdkRectangle* rects,
+ int num_rects,
+ std::vector<int>* tabs_to_paint);
+
+ // Paints the tab favicon areas for tabs in |tabs_to_paint|.
+ void PaintOnlyFavIcons(GdkEventExpose* event,
+ const std::vector<int>& tabs_to_paint);
+
+ // Initializes the new tab button.
+ CustomDrawButton* MakeNewTabButton();
+
+ // Gets the number of Tabs in the collection.
+ int GetTabCount() const;
+
+ // Returns the number of mini-tabs.
+ int GetMiniTabCount() const;
+
+ // Retrieves the Tab at the specified index. Take care in using this, you may
+ // need to use GetTabAtAdjustForAnimation.
+ TabGtk* GetTabAt(int index) const;
+
+ // Returns the tab at the specified index. If a remove animation is on going
+ // and the index is >= the index of the tab being removed, the index is
+ // incremented. While a remove operation is on going the indices of the model
+ // do not line up with the indices of the view. This method adjusts the index
+ // accordingly.
+ //
+ // Use this instead of GetTabAt if the index comes from the model.
+ TabGtk* GetTabAtAdjustForAnimation(int index) const;
+
+ // Returns the exact (unrounded) current width of each tab.
+ void GetCurrentTabWidths(double* unselected_width,
+ double* selected_width) const;
+
+ // Returns the exact (unrounded) desired width of each tab, based on the
+ // desired strip width and number of tabs. If
+ // |width_of_tabs_for_mouse_close_| is nonnegative we use that value in
+ // calculating the desired strip width; otherwise we use the current width.
+ // |mini_tab_count| gives the number of mini-tabs, and |tab_count| the
+ // number of mini and non-mini-tabs.
+ void GetDesiredTabWidths(int tab_count,
+ int mini_tab_count,
+ double* unselected_width,
+ double* selected_width) const;
+
+ // Returns the horizontal offset before the tab at |tab_index|.
+ int GetTabHOffset(int tab_index);
+
+ // Returns the x-coordinate tabs start from.
+ int tab_start_x() const;
+
+ // Perform an animated resize-relayout of the TabStrip immediately. The
+ // value returned indicates whether a resize actually took place.
+ bool ResizeLayoutTabs();
+
+ // Returns whether or not the cursor is currently in the "tab strip zone"
+ // which is defined as the region above the TabStrip and a bit below it.
+ bool IsCursorInTabStripZone() const;
+
+ // Ensure that the message loop observer used for event spying is added and
+ // removed appropriately so we can tell when to resize layout the tab strip.
+ void AddMessageLoopObserver();
+ void RemoveMessageLoopObserver();
+
+ // Calculates the available width for tabs, assuming a Tab is to be closed.
+ int GetAvailableWidthForTabs(TabGtk* last_tab) const;
+
+ // Finds the index of the TabContents corresponding to |tab| in our
+ // associated TabStripModel, or -1 if there is none (e.g. the specified |tab|
+ // is being animated closed).
+ int GetIndexOfTab(const TabGtk* tab) const;
+
+ // Cleans up the tab from the TabStrip at the specified |index|.
+ void RemoveTabAt(int index);
+
+ // Called from the message loop observer when a mouse movement has occurred
+ // anywhere over our containing window.
+ void HandleGlobalMouseMoveEvent();
+
+ // Generates the ideal bounds of the TabStrip when all Tabs have finished
+ // animating to their desired position/bounds. This is used by the standard
+ // Layout method and other callers like the DraggedTabController that need
+ // stable representations of Tab positions.
+ void GenerateIdealBounds();
+
+ // Lays out the New Tab button, assuming the right edge of the last Tab on
+ // the TabStrip at |last_tab_right|. |unselected_width| is the width of
+ // unselected tabs at the moment this function is called. The value changes
+ // during animations, so we can't use current_unselected_width_.
+ void LayoutNewTabButton(double last_tab_right, double unselected_width);
+
+ // -- Link Drag & Drop ------------------------------------------------------
+
+ // Returns the bounds to render the drop at, in screen coordinates. Sets
+ // |is_beneath| to indicate whether the arrow is beneath the tab, or above
+ // it.
+ gfx::Rect GetDropBounds(int drop_index, bool drop_before, bool* is_beneath);
+
+ // Updates the location of the drop based on the event.
+ void UpdateDropIndex(GdkDragContext* context, gint x, gint y);
+
+ // Sets the location of the drop, repainting as necessary.
+ void SetDropIndex(int index, bool drop_before);
+
+ // Determines whether the data is acceptable by the tabstrip and opens a new
+ // tab with the data as URL if it is. Returns true if the drop was
+ // successful.
+ bool CompleteDrop(guchar* data, bool is_plain_text);
+
+ // Returns the image to use for indicating a drop on a tab. If is_down is
+ // true, this returns an arrow pointing down.
+ static GdkPixbuf* GetDropArrowImage(bool is_down);
+
+ // -- Animations -------------------------------------------------------------
+
+ // Stops the current animation.
+ void StopAnimation();
+
+ // A generic Layout method for various classes of TabStrip animations,
+ // including Insert, Remove and Resize Layout cases.
+ void AnimationLayout(double unselected_width);
+
+ // Starts various types of TabStrip animations.
+ void StartInsertTabAnimation(int index);
+ void StartRemoveTabAnimation(int index, TabContents* contents);
+ void StartMoveTabAnimation(int from_index, int to_index);
+ void StartMiniTabAnimation(int index);
+ void StartMiniMoveTabAnimation(int from_index,
+ int to_index,
+ const gfx::Rect& start_bounds);
+ void StartResizeLayoutAnimation();
+
+ // Notifies the TabStrip that the specified TabAnimation has completed.
+ // Optionally a full Layout will be performed, specified by |layout|.
+ void FinishAnimation(TabAnimation* animation, bool layout);
+
+ NotificationRegistrar registrar_;
+
+ // The Tabs we contain, and their last generated "good" bounds.
+ std::vector<TabData> tab_data_;
+
+ // The current widths of various types of tabs. We save these so that, as
+ // users close tabs while we're holding them at the same size, we can lay out
+ // tabs exactly and eliminate the "pixel jitter" we'd get from just leaving
+ // them all at their existing, rounded widths.
+ double current_unselected_width_;
+ double current_selected_width_;
+
+ // If this value is nonnegative, it is used in GetDesiredTabWidths() to
+ // calculate how much space in the tab strip to use for tabs. Most of the
+ // time this will be -1, but while we're handling closing a tab via the mouse,
+ // we'll set this to the edge of the last tab before closing, so that if we
+ // are closing the last tab and need to resize immediately, we'll resize only
+ // back to this width, thus once again placing the last tab under the mouse
+ // cursor.
+ int available_width_for_tabs_;
+
+ // True if a resize layout animation should be run a short delay after the
+ // mouse exits the TabStrip.
+ bool needs_resize_layout_;
+
+ // The GtkFixed widget.
+ OwnedWidgetGtk tabstrip_;
+
+ // The bounds of the tabstrip.
+ gfx::Rect bounds_;
+
+ // The amount to offset tab backgrounds when we are using an autogenerated
+ // tab background image.
+ int tab_vertical_offset_;
+
+ // Our model.
+ TabStripModel* model_;
+
+ // The BrowserWindowGtk containing this tab strip.
+ BrowserWindowGtk* window_;
+
+ // Theme resources.
+ GtkThemeProvider* theme_provider_;
+
+ // The currently running animation.
+ scoped_ptr<TabAnimation> active_animation_;
+
+ // The New Tab button.
+ scoped_ptr<CustomDrawButton> newtab_button_;
+
+ // Valid for the lifetime of a drag over us.
+ scoped_ptr<DropInfo> drop_info_;
+
+ // The controller for a drag initiated from a Tab. Valid for the lifetime of
+ // the drag session.
+ scoped_ptr<DraggedTabControllerGtk> drag_controller_;
+
+ // A factory that is used to construct a delayed callback to the
+ // ResizeLayoutTabsNow method.
+ ScopedRunnableMethodFactory<TabStripGtk> resize_layout_factory_;
+
+ // True if the tabstrip has already been added as a MessageLoop observer.
+ bool added_as_message_loop_observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabStripGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_TABS_TAB_STRIP_GTK_H_
diff --git a/chrome/browser/ui/gtk/tabstrip_origin_provider.h b/chrome/browser/ui/gtk/tabstrip_origin_provider.h
new file mode 100644
index 0000000..bba83c3
--- /dev/null
+++ b/chrome/browser/ui/gtk/tabstrip_origin_provider.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_TABSTRIP_ORIGIN_PROVIDER_H_
+#define CHROME_BROWSER_UI_GTK_TABSTRIP_ORIGIN_PROVIDER_H_
+#pragma once
+
+namespace gfx{
+class Point;
+}
+
+// Abstract interface that provides an offset of a widget. Many pieces of the
+// UI don't need the full BrowserWindowGtk, but just need information about
+// it's position relative to the tabstrip to draw correctly. This interface
+// exists to make it easier to test piece by piece.
+class TabstripOriginProvider {
+ public:
+ virtual ~TabstripOriginProvider() { }
+
+ // Return the origin of the tab strip in coordinates relative to where we
+ // start drawing the background theme image. This is the x coordinate of
+ // the origin of the GdkWindow of widget(), but the y coordinate of the origin
+ // of widget() itself.
+ // Used to help other widgets draw their background relative to the tabstrip.
+ // Should only be called after both the tabstrip and |widget| have been
+ // allocated.
+ virtual gfx::Point GetTabStripOriginForWidget(GtkWidget* widget) = 0;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_TABSTRIP_ORIGIN_PROVIDER_H_
diff --git a/chrome/browser/gtk/task_manager_gtk.cc b/chrome/browser/ui/gtk/task_manager_gtk.cc
index ccc5f73..b032e20 100644
--- a/chrome/browser/gtk/task_manager_gtk.cc
+++ b/chrome/browser/ui/gtk/task_manager_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/task_manager_gtk.h b/chrome/browser/ui/gtk/task_manager_gtk.h
new file mode 100644
index 0000000..2f90ddf
--- /dev/null
+++ b/chrome/browser/ui/gtk/task_manager_gtk.h
@@ -0,0 +1,233 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_TASK_MANAGER_GTK_H_
+#define CHROME_BROWSER_UI_GTK_TASK_MANAGER_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include <string>
+
+#include "app/gtk_signal.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/task_manager/task_manager.h"
+#include "grit/generated_resources.h"
+
+#if defined(TOOLKIT_VIEWS)
+namespace gfx {
+class Point;
+}
+#endif
+
+class TaskManagerGtk : public TaskManagerModelObserver {
+ public:
+ TaskManagerGtk();
+ virtual ~TaskManagerGtk();
+
+ // TaskManagerModelObserver
+ virtual void OnModelChanged();
+ virtual void OnItemsChanged(int start, int length);
+ virtual void OnItemsAdded(int start, int length);
+ virtual void OnItemsRemoved(int start, int length);
+
+ // Creates the task manager if it doesn't exist; otherwise, it activates the
+ // existing task manager window.
+ static void Show();
+
+ private:
+ class ContextMenuController;
+ friend class ContextMenuController;
+
+ // Initializes the task manager dialog.
+ void Init();
+
+ // Set |dialog_|'s initial size, using its previous size if that was saved.
+ void SetInitialDialogSize();
+
+ // Connects the ctrl-w accelerator to the dialog.
+ void ConnectAccelerators();
+
+ // Sets up the treeview widget.
+ void CreateTaskManagerTreeview();
+
+ // Returns the model data for a given |row| and |col_id|.
+ std::string GetModelText(int row, int col_id);
+
+ // Retrieves the resource icon from the model for |row|.
+ GdkPixbuf* GetModelIcon(int row);
+
+ // Sets the treeview row data. |row| is an index into the model and |iter|
+ // is the current position in the treeview.
+ void SetRowDataFromModel(int row, GtkTreeIter* iter);
+
+ // Queries the treeview for the selected rows, and kills those processes.
+ void KillSelectedProcesses();
+
+ // Opens the context menu used to select the task manager columns.
+#if defined(TOOLKIT_VIEWS)
+ void ShowContextMenu(const gfx::Point& point);
+#else
+ void ShowContextMenu();
+#endif
+
+ // Opens about:memory in a new foreground tab.
+ void OnLinkActivated();
+
+ // Compare implementation used for sorting columns.
+ gint CompareImpl(GtkTreeModel* tree_model, GtkTreeIter* a,
+ GtkTreeIter* b, int id);
+
+ // Response signal handler that notifies us of dialog destruction.
+ CHROMEGTK_CALLBACK_0(TaskManagerGtk, void, OnDestroy);
+
+ // Response signal handler that notifies us of dialog responses.
+ CHROMEGTK_CALLBACK_1(TaskManagerGtk, void, OnResponse, gint);
+
+ // Realize signal handler to set the page column's initial size.
+ CHROMEG_CALLBACK_0(TaskManagerGtk, void, OnTreeViewRealize, GtkTreeView*);
+
+ // Changed signal handler that is sent when the treeview selection changes.
+ CHROMEG_CALLBACK_0(TaskManagerGtk, void, OnSelectionChanged,
+ GtkTreeSelection*);
+
+ // row-activated handler that foregrounds a process on activation (e.g.,
+ // double-click).
+ CHROMEGTK_CALLBACK_2(TaskManagerGtk, void, OnRowActivated,
+ GtkTreePath*, GtkTreeViewColumn*);
+
+ // button-release-event handler that opens the right-click context menu.
+ CHROMEGTK_CALLBACK_1(TaskManagerGtk, gboolean, OnButtonReleaseEvent,
+ GdkEventButton*);
+
+ // Handles an accelerator being pressed.
+ CHROMEG_CALLBACK_3(TaskManagerGtk, gboolean, OnGtkAccelerator,
+ GtkAccelGroup*, GObject*, guint, GdkModifierType);
+
+ // Page sorting callback.
+ static gint ComparePage(GtkTreeModel* model, GtkTreeIter* a,
+ GtkTreeIter* b, gpointer task_manager) {
+ return reinterpret_cast<TaskManagerGtk*>(task_manager)->
+ CompareImpl(model, a, b, IDS_TASK_MANAGER_PAGE_COLUMN);
+ }
+
+ // Shared memory sorting callback.
+ static gint CompareSharedMemory(GtkTreeModel* model, GtkTreeIter* a,
+ GtkTreeIter* b, gpointer task_manager) {
+ return reinterpret_cast<TaskManagerGtk*>(task_manager)->
+ CompareImpl(model, a, b, IDS_TASK_MANAGER_SHARED_MEM_COLUMN);
+ }
+
+ // Private memory sorting callback.
+ static gint ComparePrivateMemory(GtkTreeModel* model, GtkTreeIter* a,
+ GtkTreeIter* b, gpointer task_manager) {
+ return reinterpret_cast<TaskManagerGtk*>(task_manager)->
+ CompareImpl(model, a, b, IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN);
+ }
+
+ // Javascript memory sorting callback.
+ static gint CompareV8Memory(GtkTreeModel* model, GtkTreeIter* a,
+ GtkTreeIter* b, gpointer task_manager) {
+ return reinterpret_cast<TaskManagerGtk*>(task_manager)->
+ CompareImpl(model, a, b,
+ IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN);
+ }
+
+ // CPU sorting callback.
+ static gint CompareCPU(GtkTreeModel* model, GtkTreeIter* a,
+ GtkTreeIter* b, gpointer task_manager) {
+ return reinterpret_cast<TaskManagerGtk*>(task_manager)->
+ CompareImpl(model, a, b, IDS_TASK_MANAGER_CPU_COLUMN);
+ }
+
+ // Network sorting callback.
+ static gint CompareNetwork(GtkTreeModel* model, GtkTreeIter* a,
+ GtkTreeIter* b, gpointer task_manager) {
+ return reinterpret_cast<TaskManagerGtk*>(task_manager)->
+ CompareImpl(model, a, b, IDS_TASK_MANAGER_NET_COLUMN);
+ }
+
+ // Process ID sorting callback.
+ static gint CompareProcessID(GtkTreeModel* model, GtkTreeIter* a,
+ GtkTreeIter* b, gpointer task_manager) {
+ return reinterpret_cast<TaskManagerGtk*>(task_manager)->
+ CompareImpl(model, a, b, IDS_TASK_MANAGER_PROCESS_ID_COLUMN);
+ }
+
+ // WebCore Image Cache sorting callback.
+ static gint CompareWebCoreImageCache(GtkTreeModel* model, GtkTreeIter* a,
+ GtkTreeIter* b, gpointer task_manager) {
+ return reinterpret_cast<TaskManagerGtk*>(task_manager)->
+ CompareImpl(model, a, b, IDS_TASK_MANAGER_WEBCORE_IMAGE_CACHE_COLUMN);
+ }
+
+ // WebCore Scripts Cache sorting callback.
+ static gint CompareWebCoreScriptsCache(GtkTreeModel* model, GtkTreeIter* a,
+ GtkTreeIter* b,
+ gpointer task_manager) {
+ return reinterpret_cast<TaskManagerGtk*>(task_manager)->
+ CompareImpl(model, a, b, IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN);
+ }
+
+ // WebCore CSS Cache sorting callback.
+ static gint CompareWebCoreCssCache(GtkTreeModel* model, GtkTreeIter* a,
+ GtkTreeIter* b, gpointer task_manager) {
+ return reinterpret_cast<TaskManagerGtk*>(task_manager)->
+ CompareImpl(model, a, b, IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN);
+ }
+
+ // Sqlite memory sorting callback.
+ static gint CompareSqliteMemoryUsed(GtkTreeModel* model, GtkTreeIter* a,
+ GtkTreeIter* b, gpointer task_manager) {
+ return reinterpret_cast<TaskManagerGtk*>(task_manager)->
+ CompareImpl(model, a, b, IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN);
+ }
+
+ // Goats Teleported sorting callback.
+ static gint CompareGoatsTeleported(GtkTreeModel* model, GtkTreeIter* a,
+ GtkTreeIter* b, gpointer task_manager) {
+ return reinterpret_cast<TaskManagerGtk*>(task_manager)->
+ CompareImpl(model, a, b, IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN);
+ }
+
+ // The task manager.
+ TaskManager* task_manager_;
+
+ // Our model.
+ TaskManagerModel* model_;
+
+ // The task manager dialog window.
+ GtkWidget* dialog_;
+
+ // The treeview that contains the process list.
+ GtkWidget* treeview_;
+
+ // The list of processes.
+ GtkListStore* process_list_;
+ GtkTreeModel* process_list_sort_;
+
+ // The number of processes in |process_list_|.
+ int process_count_;
+
+ // The id of the |dialog_| destroy signal handler.
+ gulong destroy_handler_id_;
+
+ // The context menu controller.
+ scoped_ptr<ContextMenuController> menu_controller_;
+
+ GtkAccelGroup* accel_group_;
+
+ // An open task manager window. There can only be one open at a time. This
+ // is reset to NULL when the window is closed.
+ static TaskManagerGtk* instance_;
+
+ // We edit the selection in the OnSelectionChanged handler, and we use this
+ // variable to prevent ourselves from handling further changes that we
+ // ourselves caused.
+ bool ignore_selection_changed_;
+
+ DISALLOW_COPY_AND_ASSIGN(TaskManagerGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_TASK_MANAGER_GTK_H_
diff --git a/chrome/browser/gtk/theme_install_bubble_view_gtk.cc b/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.cc
index a08d393..366fa8e 100644
--- a/chrome/browser/gtk/theme_install_bubble_view_gtk.cc
+++ b/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.h b/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.h
new file mode 100644
index 0000000..9a963ef
--- /dev/null
+++ b/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.h
@@ -0,0 +1,62 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_THEME_INSTALL_BUBBLE_VIEW_GTK_H_
+#define CHROME_BROWSER_UI_GTK_THEME_INSTALL_BUBBLE_VIEW_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+
+class ThemeInstallBubbleViewGtk : public NotificationObserver {
+ public:
+ static void Show(GtkWindow* parent);
+
+ // NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ private:
+ explicit ThemeInstallBubbleViewGtk(GtkWidget* parent);
+
+ virtual ~ThemeInstallBubbleViewGtk();
+
+ void increment_num_loading() { num_loads_extant_++; }
+
+ // Create the widget hierarchy.
+ void InitWidgets();
+
+ // Reposition |widget_| to be centered over |parent_|.
+ void MoveWindow();
+
+ // Our parent is going down; self destruct.
+ CHROMEGTK_CALLBACK_0(ThemeInstallBubbleViewGtk, gboolean, OnUnmapEvent);
+
+ // Draw the background. This is only signalled if we are using a compositing
+ // window manager, otherwise we just use ActAsRoundedWindow().
+ CHROMEGTK_CALLBACK_1(ThemeInstallBubbleViewGtk, gboolean,
+ OnExpose, GdkEventExpose*);
+
+ GtkWidget* widget_;
+
+ // The parent browser window, over which we position ourselves.
+ GtkWidget* parent_;
+
+ // The number of loads we represent. When it reaches 0 we delete ourselves.
+ int num_loads_extant_;
+
+ NotificationRegistrar registrar_;
+
+ // Our one instance. We don't allow more than one to exist at a time.
+ static ThemeInstallBubbleViewGtk* instance_;
+
+ DISALLOW_COPY_AND_ASSIGN(ThemeInstallBubbleViewGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_THEME_INSTALL_BUBBLE_VIEW_GTK_H_
diff --git a/chrome/browser/gtk/translate/after_translate_infobar_gtk.cc b/chrome/browser/ui/gtk/translate/after_translate_infobar_gtk.cc
index 3f36ca6..25dcdd9 100644
--- a/chrome/browser/gtk/translate/after_translate_infobar_gtk.cc
+++ b/chrome/browser/ui/gtk/translate/after_translate_infobar_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/translate/after_translate_infobar_gtk.h b/chrome/browser/ui/gtk/translate/after_translate_infobar_gtk.h
new file mode 100644
index 0000000..61bb9d2
--- /dev/null
+++ b/chrome/browser/ui/gtk/translate/after_translate_infobar_gtk.h
@@ -0,0 +1,40 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_TRANSLATE_AFTER_TRANSLATE_INFOBAR_GTK_H_
+#define CHROME_BROWSER_UI_GTK_TRANSLATE_AFTER_TRANSLATE_INFOBAR_GTK_H_
+#pragma once
+
+#include "base/task.h"
+#include "chrome/browser/gtk/translate/translate_infobar_base_gtk.h"
+
+class TranslateInfoBarDelegate;
+
+class AfterTranslateInfoBar : public TranslateInfoBarBase {
+ public:
+ explicit AfterTranslateInfoBar(TranslateInfoBarDelegate* delegate);
+ virtual ~AfterTranslateInfoBar();
+
+ // Overridden from TranslateInfoBarBase:
+ virtual void Init();
+
+ protected:
+ virtual bool ShowOptionsMenuButton() const;
+
+ private:
+ CHROMEGTK_CALLBACK_0(AfterTranslateInfoBar, void, OnOriginalLanguageModified);
+ CHROMEGTK_CALLBACK_0(AfterTranslateInfoBar, void, OnTargetLanguageModified);
+ CHROMEGTK_CALLBACK_0(AfterTranslateInfoBar, void, OnRevertPressed);
+
+ // These methods set the original/target language on the
+ // TranslateInfobarDelegate.
+ void SetOriginalLanguage(int language_index);
+ void SetTargetLanguage(int language_index);
+
+ ScopedRunnableMethodFactory<AfterTranslateInfoBar> method_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(AfterTranslateInfoBar);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_TRANSLATE_AFTER_TRANSLATE_INFOBAR_GTK_H_
diff --git a/chrome/browser/gtk/translate/before_translate_infobar_gtk.cc b/chrome/browser/ui/gtk/translate/before_translate_infobar_gtk.cc
index 01a94ff..1e11263 100644
--- a/chrome/browser/gtk/translate/before_translate_infobar_gtk.cc
+++ b/chrome/browser/ui/gtk/translate/before_translate_infobar_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/translate/before_translate_infobar_gtk.h b/chrome/browser/ui/gtk/translate/before_translate_infobar_gtk.h
new file mode 100644
index 0000000..d6db052
--- /dev/null
+++ b/chrome/browser/ui/gtk/translate/before_translate_infobar_gtk.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_TRANSLATE_BEFORE_TRANSLATE_INFOBAR_GTK_H_
+#define CHROME_BROWSER_UI_GTK_TRANSLATE_BEFORE_TRANSLATE_INFOBAR_GTK_H_
+#pragma once
+
+#include "chrome/browser/gtk/translate/translate_infobar_base_gtk.h"
+
+class TranslateInfoBarDelegate;
+
+class BeforeTranslateInfoBar : public TranslateInfoBarBase {
+ public:
+ explicit BeforeTranslateInfoBar(TranslateInfoBarDelegate* delegate);
+ virtual ~BeforeTranslateInfoBar();
+
+ // Overridden from TranslateInfoBarBase:
+ virtual void Init();
+
+ protected:
+ virtual bool ShowOptionsMenuButton() const;
+
+ private:
+ CHROMEGTK_CALLBACK_0(BeforeTranslateInfoBar, void, OnLanguageModified);
+ CHROMEGTK_CALLBACK_0(BeforeTranslateInfoBar, void, OnAcceptPressed);
+ CHROMEGTK_CALLBACK_0(BeforeTranslateInfoBar, void, OnDenyPressed);
+ CHROMEGTK_CALLBACK_0(BeforeTranslateInfoBar, void, OnNeverTranslatePressed);
+ CHROMEGTK_CALLBACK_0(BeforeTranslateInfoBar, void, OnAlwaysTranslatePressed);
+
+ DISALLOW_COPY_AND_ASSIGN(BeforeTranslateInfoBar);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_TRANSLATE_BEFORE_TRANSLATE_INFOBAR_GTK_H_
diff --git a/chrome/browser/gtk/translate/translate_infobar_base_gtk.cc b/chrome/browser/ui/gtk/translate/translate_infobar_base_gtk.cc
index 3d78de4..6ee6240 100644
--- a/chrome/browser/gtk/translate/translate_infobar_base_gtk.cc
+++ b/chrome/browser/ui/gtk/translate/translate_infobar_base_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/translate/translate_infobar_base_gtk.h b/chrome/browser/ui/gtk/translate/translate_infobar_base_gtk.h
new file mode 100644
index 0000000..0027d25
--- /dev/null
+++ b/chrome/browser/ui/gtk/translate/translate_infobar_base_gtk.h
@@ -0,0 +1,89 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_TRANSLATE_TRANSLATE_INFOBAR_BASE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_TRANSLATE_TRANSLATE_INFOBAR_BASE_GTK_H_
+#pragma once
+
+#include "chrome/browser/translate/translate_infobar_view.h"
+#include "chrome/browser/gtk/infobar_gtk.h"
+#include "ui/base/animation/animation_delegate.h"
+
+class MenuGtk;
+class OptionsMenuModel;
+class TranslateInfoBarDelegate;
+
+// This class contains some of the base functionality that translate infobars
+// use.
+class TranslateInfoBarBase : public TranslateInfoBarView,
+ public InfoBar,
+ public ui::AnimationDelegate {
+ public:
+ explicit TranslateInfoBarBase(TranslateInfoBarDelegate* delegate);
+ virtual ~TranslateInfoBarBase();
+
+ // Initializes the infobar widgets. Should be called after the object has been
+ // created.
+ virtual void Init();
+
+ // Overridden from InfoBar:
+ virtual void GetTopColor(InfoBarDelegate::Type type,
+ double* r, double* g, double *b);
+ virtual void GetBottomColor(InfoBarDelegate::Type type,
+ double* r, double* g, double *b);
+
+ // Overridden from TranslateInfoBarView:
+ virtual void OriginalLanguageChanged() {}
+ virtual void TargetLanguageChanged() {}
+
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation);
+
+ protected:
+ // Sub-classes that want to have the options menu button showing sould
+ // override and return true.
+ virtual bool ShowOptionsMenuButton() const;
+
+ // Creates a label with the appropriate font and color for the translate
+ // infobars.
+ GtkWidget* CreateLabel(const std::string& text);
+
+ // Creates a combobox that displays the languages currently available.
+ // |selected_language| is the language index (as used in the
+ // TranslateInfoDelegate) that should be selected initially.
+ // |exclude_language| is the language index of the language that should not be
+ // included in the list (-1 means no language excluded).
+ GtkWidget* CreateLanguageCombobox(int selected_language,
+ int exclude_language);
+
+ // Given an above-constructed combobox, returns the currently selected
+ // language id.
+ static int GetLanguageComboboxActiveId(GtkComboBox* combo);
+
+ // Convenience to retrieve the TranslateInfoBarDelegate for this infobar.
+ TranslateInfoBarDelegate* GetDelegate() const;
+
+ private:
+ // Builds a button with an arrow in it to emulate the menu-button style from
+ // the windows version.
+ static GtkWidget* BuildOptionsMenuButton();
+
+ // The menu displayed when the Options button is pressed.
+ scoped_ptr<OptionsMenuModel> options_menu_model_;
+ scoped_ptr<MenuGtk> options_menu_menu_;
+
+ CHROMEGTK_CALLBACK_0(TranslateInfoBarBase, void, OnOptionsClicked);
+
+ // A percentage to average the normal page action background with the error
+ // background. When 0, the infobar background should be pure PAGE_ACTION_TYPE.
+ // When 1, the infobar background should be pure WARNING_TYPE.
+ double background_error_percent_;
+
+ // Changes the color of the background from normal to error color and back.
+ scoped_ptr<ui::SlideAnimation> background_color_animation_;
+
+ DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarBase);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_TRANSLATE_TRANSLATE_INFOBAR_BASE_GTK_H_
diff --git a/chrome/browser/gtk/translate/translate_message_infobar_gtk.cc b/chrome/browser/ui/gtk/translate/translate_message_infobar_gtk.cc
index 0f61bca..74659a9 100644
--- a/chrome/browser/gtk/translate/translate_message_infobar_gtk.cc
+++ b/chrome/browser/ui/gtk/translate/translate_message_infobar_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/translate/translate_message_infobar_gtk.h b/chrome/browser/ui/gtk/translate/translate_message_infobar_gtk.h
new file mode 100644
index 0000000..725e24f
--- /dev/null
+++ b/chrome/browser/ui/gtk/translate/translate_message_infobar_gtk.h
@@ -0,0 +1,27 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_TRANSLATE_TRANSLATE_MESSAGE_INFOBAR_GTK_H_
+#define CHROME_BROWSER_UI_GTK_TRANSLATE_TRANSLATE_MESSAGE_INFOBAR_GTK_H_
+#pragma once
+
+#include "chrome/browser/gtk/translate/translate_infobar_base_gtk.h"
+
+class TranslateInfoBarDelegate;
+
+class TranslateMessageInfoBar : public TranslateInfoBarBase {
+ public:
+ explicit TranslateMessageInfoBar(TranslateInfoBarDelegate* delegate);
+ virtual ~TranslateMessageInfoBar();
+
+ // Overridden from TranslateInfoBarBase:
+ virtual void Init();
+
+ private:
+ CHROMEGTK_CALLBACK_0(TranslateMessageInfoBar, void, OnButtonPressed);
+
+ DISALLOW_COPY_AND_ASSIGN(TranslateMessageInfoBar);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_TRANSLATE_TRANSLATE_MESSAGE_INFOBAR_GTK_H_
diff --git a/chrome/browser/gtk/update_recommended_dialog.cc b/chrome/browser/ui/gtk/update_recommended_dialog.cc
index d9b4316..fd12814 100644
--- a/chrome/browser/gtk/update_recommended_dialog.cc
+++ b/chrome/browser/ui/gtk/update_recommended_dialog.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/update_recommended_dialog.h b/chrome/browser/ui/gtk/update_recommended_dialog.h
new file mode 100644
index 0000000..ccce4e3
--- /dev/null
+++ b/chrome/browser/ui/gtk/update_recommended_dialog.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_UPDATE_RECOMMENDED_DIALOG_H_
+#define CHROME_BROWSER_UI_GTK_UPDATE_RECOMMENDED_DIALOG_H_
+#pragma once
+
+#include "app/gtk_integers.h"
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+
+typedef struct _GtkWidget GtkWidget;
+typedef struct _GtkWindow GtkWindow;
+
+class UpdateRecommendedDialog {
+ public:
+ static void Show(GtkWindow* parent);
+
+ private:
+ CHROMEGTK_CALLBACK_1(UpdateRecommendedDialog, void, OnResponse, gint);
+
+ explicit UpdateRecommendedDialog(GtkWindow* parent);
+ ~UpdateRecommendedDialog();
+
+ GtkWidget* dialog_;
+
+ DISALLOW_COPY_AND_ASSIGN(UpdateRecommendedDialog);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_UPDATE_RECOMMENDED_DIALOG_H_
diff --git a/chrome/browser/gtk/view_id_util.cc b/chrome/browser/ui/gtk/view_id_util.cc
index 2b8e396..6e732bc 100644
--- a/chrome/browser/gtk/view_id_util.cc
+++ b/chrome/browser/ui/gtk/view_id_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/browser/ui/gtk/view_id_util.h b/chrome/browser/ui/gtk/view_id_util.h
new file mode 100644
index 0000000..278de6e
--- /dev/null
+++ b/chrome/browser/ui/gtk/view_id_util.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_VIEW_ID_UTIL_H_
+#define CHROME_BROWSER_UI_GTK_VIEW_ID_UTIL_H_
+#pragma once
+
+#include "chrome/browser/ui/view_ids.h"
+
+typedef struct _GtkWidget GtkWidget;
+
+class ViewIDUtil {
+ public:
+ // Use this delegate to override default view id searches.
+ class Delegate {
+ public:
+ virtual GtkWidget* GetWidgetForViewID(ViewID id) = 0;
+
+ protected:
+ virtual ~Delegate() {}
+ };
+
+ // If you set the ID via this function, it will also set the name of your
+ // widget to a human-readable value for debugging.
+ static void SetID(GtkWidget* widget, ViewID id);
+
+ static GtkWidget* GetWidget(GtkWidget* root, ViewID id);
+
+ static void SetDelegateForWidget(GtkWidget* widget, Delegate* delegate);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_VIEW_ID_UTIL_H_
diff --git a/chrome/browser/gtk/view_id_util_browsertest.cc b/chrome/browser/ui/gtk/view_id_util_browsertest.cc
index 62ab99c..154ed20 100644
--- a/chrome/browser/gtk/view_id_util_browsertest.cc
+++ b/chrome/browser/ui/gtk/view_id_util_browsertest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index c65ba62..f3352e9 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1330,252 +1330,252 @@
'browser/gpu_process_host.h',
'browser/gpu_process_host_ui_shim.cc',
'browser/gpu_process_host_ui_shim.h',
- 'browser/gtk/about_chrome_dialog.cc',
- 'browser/gtk/about_chrome_dialog.h',
- 'browser/gtk/accelerators_gtk.cc',
- 'browser/gtk/accelerators_gtk.h',
- 'browser/gtk/accessibility_event_router_gtk.cc',
- 'browser/gtk/accessibility_event_router_gtk.h',
- 'browser/gtk/accessible_widget_helper_gtk.cc',
- 'browser/gtk/accessible_widget_helper_gtk.h',
- 'browser/gtk/back_forward_button_gtk.cc',
- 'browser/gtk/back_forward_button_gtk.h',
- 'browser/gtk/bookmark_bar_gtk.cc',
- 'browser/gtk/bookmark_bar_gtk.h',
- 'browser/gtk/bookmark_bar_instructions_gtk.cc',
- 'browser/gtk/bookmark_bar_instructions_gtk.h',
- 'browser/gtk/bookmark_bubble_gtk.cc',
- 'browser/gtk/bookmark_bubble_gtk.h',
- 'browser/gtk/bookmark_editor_gtk.cc',
- 'browser/gtk/bookmark_editor_gtk.h',
- 'browser/gtk/bookmark_menu_controller_gtk.cc',
- 'browser/gtk/bookmark_menu_controller_gtk.h',
- 'browser/gtk/bookmark_tree_model.cc',
- 'browser/gtk/bookmark_tree_model.h',
- 'browser/gtk/bookmark_utils_gtk.cc',
- 'browser/gtk/bookmark_utils_gtk.h',
- 'browser/gtk/browser_actions_toolbar_gtk.cc',
- 'browser/gtk/browser_actions_toolbar_gtk.h',
- 'browser/gtk/browser_titlebar.cc',
- 'browser/gtk/browser_titlebar.h',
- 'browser/gtk/browser_toolbar_gtk.cc',
- 'browser/gtk/browser_toolbar_gtk.h',
- 'browser/gtk/browser_window_factory_gtk.cc',
- 'browser/gtk/browser_window_gtk.cc',
- 'browser/gtk/browser_window_gtk.h',
- 'browser/gtk/cairo_cached_surface.cc',
- 'browser/gtk/cairo_cached_surface.h',
- 'browser/gtk/certificate_dialogs.cc',
- 'browser/gtk/certificate_dialogs.h',
- 'browser/gtk/certificate_viewer.cc',
- 'browser/gtk/certificate_viewer.h',
- 'browser/gtk/chrome_gtk_frame.cc',
- 'browser/gtk/chrome_gtk_frame.h',
- 'browser/gtk/clear_browsing_data_dialog_gtk.cc',
- 'browser/gtk/clear_browsing_data_dialog_gtk.h',
- 'browser/gtk/collected_cookies_gtk.cc',
- 'browser/gtk/collected_cookies_gtk.h',
- 'browser/gtk/constrained_html_delegate_gtk.cc',
- 'browser/gtk/constrained_window_gtk.cc',
- 'browser/gtk/constrained_window_gtk.h',
- 'browser/gtk/content_setting_bubble_gtk.cc',
- 'browser/gtk/content_setting_bubble_gtk.h',
- 'browser/gtk/gconf_titlebar_listener.cc',
- 'browser/gtk/gconf_titlebar_listener.h',
- 'browser/gtk/gtk_chrome_cookie_view.cc',
- 'browser/gtk/gtk_chrome_cookie_view.h',
- 'browser/gtk/create_application_shortcuts_dialog_gtk.cc',
- 'browser/gtk/create_application_shortcuts_dialog_gtk.h',
- 'browser/gtk/custom_button.cc',
- 'browser/gtk/custom_button.h',
- 'browser/gtk/custom_drag.cc',
- 'browser/gtk/custom_drag.h',
- 'browser/gtk/dialogs_gtk.cc',
- 'browser/gtk/download_in_progress_dialog_gtk.cc',
- 'browser/gtk/download_in_progress_dialog_gtk.h',
- 'browser/gtk/download_item_gtk.cc',
- 'browser/gtk/download_item_gtk.h',
- 'browser/gtk/download_shelf_gtk.cc',
- 'browser/gtk/download_shelf_gtk.h',
- 'browser/gtk/download_started_animation_gtk.cc',
- 'browser/gtk/edit_search_engine_dialog.cc',
- 'browser/gtk/edit_search_engine_dialog.h',
- 'browser/gtk/extension_infobar_gtk.cc',
- 'browser/gtk/extension_infobar_gtk.h',
- 'browser/gtk/extension_install_prompt_gtk.cc',
- 'browser/gtk/extension_install_prompt2_gtk.cc',
- 'browser/gtk/extension_installed_bubble_gtk.cc',
- 'browser/gtk/extension_installed_bubble_gtk.h',
- 'browser/gtk/extension_view_gtk.cc',
- 'browser/gtk/extension_view_gtk.h',
- 'browser/gtk/extension_popup_gtk.cc',
- 'browser/gtk/extension_popup_gtk.h',
- 'browser/gtk/external_protocol_dialog_gtk.cc',
- 'browser/gtk/external_protocol_dialog_gtk.h',
- 'browser/gtk/find_bar_gtk.cc',
- 'browser/gtk/find_bar_gtk.h',
- 'browser/gtk/first_run_bubble.cc',
- 'browser/gtk/first_run_bubble.h',
- 'browser/gtk/first_run_dialog.cc',
- 'browser/gtk/first_run_dialog.h',
- 'browser/gtk/focus_store_gtk.cc',
- 'browser/gtk/focus_store_gtk.h',
- 'browser/gtk/fullscreen_exit_bubble_gtk.cc',
- 'browser/gtk/fullscreen_exit_bubble_gtk.h',
- 'browser/gtk/gtk_chrome_button.cc',
- 'browser/gtk/gtk_chrome_button.h',
- 'browser/gtk/gtk_chrome_link_button.cc',
- 'browser/gtk/gtk_chrome_link_button.h',
- 'browser/gtk/gtk_chrome_shrinkable_hbox.cc',
- 'browser/gtk/gtk_chrome_shrinkable_hbox.h',
- 'browser/gtk/gtk_custom_menu.cc',
- 'browser/gtk/gtk_custom_menu.h',
- 'browser/gtk/gtk_custom_menu_item.cc',
- 'browser/gtk/gtk_custom_menu_item.h',
- 'browser/gtk/gtk_expanded_container.cc',
- 'browser/gtk/gtk_expanded_container.h',
- 'browser/gtk/gtk_floating_container.cc',
- 'browser/gtk/gtk_floating_container.h',
- 'browser/gtk/gtk_theme_provider.cc',
- 'browser/gtk/gtk_theme_provider.h',
- 'browser/gtk/gtk_tree.cc',
- 'browser/gtk/gtk_tree.h',
- 'browser/gtk/gtk_util.cc',
- 'browser/gtk/gtk_util.h',
- 'browser/gtk/hover_controller_gtk.cc',
- 'browser/gtk/hover_controller_gtk.h',
- 'browser/gtk/html_dialog_gtk.cc',
- 'browser/gtk/html_dialog_gtk.h',
- 'browser/gtk/hung_renderer_dialog_gtk.cc',
- 'browser/gtk/import_dialog_gtk.cc',
- 'browser/gtk/import_dialog_gtk.h',
- 'browser/gtk/import_lock_dialog_gtk.cc',
- 'browser/gtk/import_lock_dialog_gtk.h',
- 'browser/gtk/import_progress_dialog_gtk.cc',
- 'browser/gtk/import_progress_dialog_gtk.h',
- 'browser/gtk/info_bubble_gtk.cc',
- 'browser/gtk/info_bubble_gtk.h',
- 'browser/gtk/info_bubble_accelerators_gtk.cc',
- 'browser/gtk/info_bubble_accelerators_gtk.h',
- 'browser/gtk/infobar_arrow_model.cc',
- 'browser/gtk/infobar_arrow_model.h',
- 'browser/gtk/infobar_container_gtk.cc',
- 'browser/gtk/infobar_container_gtk.h',
- 'browser/gtk/infobar_gtk.cc',
- 'browser/gtk/infobar_gtk.h',
- 'browser/gtk/instant_confirm_dialog_gtk.cc',
- 'browser/gtk/instant_confirm_dialog_gtk.h',
- 'browser/gtk/js_modal_dialog_gtk.cc',
- 'browser/gtk/js_modal_dialog_gtk.h',
- 'browser/gtk/keyword_editor_view.cc',
- 'browser/gtk/keyword_editor_view.h',
- 'browser/gtk/location_bar_view_gtk.cc',
- 'browser/gtk/location_bar_view_gtk.h',
- 'browser/gtk/menu_bar_helper.cc',
- 'browser/gtk/menu_bar_helper.h',
- 'browser/gtk/menu_gtk.cc',
- 'browser/gtk/menu_gtk.h',
- 'browser/gtk/nine_box.cc',
- 'browser/gtk/nine_box.h',
- 'browser/gtk/notifications/balloon_view_gtk.cc',
- 'browser/gtk/notifications/balloon_view_gtk.h',
- 'browser/gtk/notifications/balloon_view_host_gtk.cc',
- 'browser/gtk/notifications/balloon_view_host_gtk.h',
- 'browser/gtk/options/advanced_contents_gtk.cc',
- 'browser/gtk/options/advanced_contents_gtk.h',
- 'browser/gtk/options/advanced_page_gtk.cc',
- 'browser/gtk/options/advanced_page_gtk.h',
- 'browser/gtk/options/content_exception_editor.cc',
- 'browser/gtk/options/content_exception_editor.h',
- 'browser/gtk/options/content_exceptions_window_gtk.cc',
- 'browser/gtk/options/content_exceptions_window_gtk.h',
- 'browser/gtk/options/content_filter_page_gtk.cc',
- 'browser/gtk/options/content_filter_page_gtk.h',
- 'browser/gtk/options/content_page_gtk.cc',
- 'browser/gtk/options/content_page_gtk.h',
- 'browser/gtk/options/content_settings_window_gtk.cc',
- 'browser/gtk/options/content_settings_window_gtk.h',
- 'browser/gtk/options/cookie_filter_page_gtk.cc',
- 'browser/gtk/options/cookie_filter_page_gtk.h',
- 'browser/gtk/options/cookies_view.cc',
- 'browser/gtk/options/cookies_view.h',
- 'browser/gtk/options/fonts_languages_window_gtk.cc',
- 'browser/gtk/options/fonts_page_gtk.cc',
- 'browser/gtk/options/fonts_page_gtk.h',
- 'browser/gtk/options/general_page_gtk.cc',
- 'browser/gtk/options/general_page_gtk.h',
- 'browser/gtk/options/languages_page_gtk.cc',
- 'browser/gtk/options/languages_page_gtk.h',
- 'browser/gtk/options/managed_prefs_banner_gtk.cc',
- 'browser/gtk/options/managed_prefs_banner_gtk.h',
- 'browser/gtk/options/options_layout_gtk.cc',
- 'browser/gtk/options/options_layout_gtk.h',
- 'browser/gtk/options/options_window_gtk.cc',
- 'browser/gtk/options/passwords_exceptions_page_gtk.cc',
- 'browser/gtk/options/passwords_exceptions_page_gtk.h',
- 'browser/gtk/options/passwords_exceptions_window_gtk.cc',
- 'browser/gtk/options/passwords_exceptions_window_gtk.h',
- 'browser/gtk/options/passwords_page_gtk.cc',
- 'browser/gtk/options/passwords_page_gtk.h',
- 'browser/gtk/options/simple_content_exceptions_window.cc',
- 'browser/gtk/options/simple_content_exceptions_window.h',
- 'browser/gtk/options/url_picker_dialog_gtk.cc',
- 'browser/gtk/options/url_picker_dialog_gtk.h',
- 'browser/gtk/overflow_button.cc',
- 'browser/gtk/overflow_button.h',
- 'browser/gtk/owned_widget_gtk.cc',
- 'browser/gtk/owned_widget_gtk.h',
- 'browser/gtk/page_info_bubble_gtk.cc',
- 'browser/gtk/pk11_password_dialog.cc',
- 'browser/gtk/process_singleton_dialog.cc',
- 'browser/gtk/process_singleton_dialog.h',
- 'browser/gtk/reload_button_gtk.cc',
- 'browser/gtk/reload_button_gtk.h',
- 'browser/gtk/repost_form_warning_gtk.cc',
- 'browser/gtk/repost_form_warning_gtk.h',
- 'browser/gtk/rounded_window.cc',
- 'browser/gtk/rounded_window.h',
- 'browser/gtk/sad_tab_gtk.cc',
- 'browser/gtk/sad_tab_gtk.h',
- 'browser/gtk/slide_animator_gtk.cc',
- 'browser/gtk/slide_animator_gtk.h',
- 'browser/gtk/ssl_client_certificate_selector.cc',
- 'browser/gtk/status_bubble_gtk.cc',
- 'browser/gtk/status_bubble_gtk.h',
- 'browser/gtk/status_icons/status_icon_gtk.h',
- 'browser/gtk/status_icons/status_icon_gtk.cc',
- 'browser/gtk/status_icons/status_tray_gtk.h',
- 'browser/gtk/status_icons/status_tray_gtk.cc',
- 'browser/gtk/tab_contents_container_gtk.cc',
- 'browser/gtk/tab_contents_container_gtk.h',
- 'browser/gtk/tab_contents_drag_source.cc',
- 'browser/gtk/tab_contents_drag_source.h',
- 'browser/gtk/tabs/dragged_tab_controller_gtk.cc',
- 'browser/gtk/tabs/dragged_tab_controller_gtk.h',
- 'browser/gtk/tabs/dragged_tab_gtk.cc',
- 'browser/gtk/tabs/dragged_tab_gtk.h',
- 'browser/gtk/tabs/tab_gtk.cc',
- 'browser/gtk/tabs/tab_gtk.h',
- 'browser/gtk/tabs/tab_renderer_gtk.cc',
- 'browser/gtk/tabs/tab_renderer_gtk.h',
- 'browser/gtk/tabs/tab_strip_gtk.cc',
- 'browser/gtk/tabs/tab_strip_gtk.h',
- 'browser/gtk/task_manager_gtk.cc',
- 'browser/gtk/task_manager_gtk.h',
- 'browser/gtk/theme_install_bubble_view_gtk.cc',
- 'browser/gtk/theme_install_bubble_view_gtk.h',
- 'browser/gtk/translate/after_translate_infobar_gtk.cc',
- 'browser/gtk/translate/after_translate_infobar_gtk.h',
- 'browser/gtk/translate/before_translate_infobar_gtk.cc',
- 'browser/gtk/translate/before_translate_infobar_gtk.h',
- 'browser/gtk/translate/translate_infobar_base_gtk.cc',
- 'browser/gtk/translate/translate_infobar_base_gtk.h',
- 'browser/gtk/translate/translate_message_infobar_gtk.cc',
- 'browser/gtk/translate/translate_message_infobar_gtk.h',
- 'browser/gtk/update_recommended_dialog.cc',
- 'browser/gtk/update_recommended_dialog.h',
- 'browser/gtk/view_id_util.cc',
- 'browser/gtk/view_id_util.h',
+ 'browser/ui/gtk/about_chrome_dialog.cc',
+ 'browser/ui/gtk/about_chrome_dialog.h',
+ 'browser/ui/gtk/accelerators_gtk.cc',
+ 'browser/ui/gtk/accelerators_gtk.h',
+ 'browser/ui/gtk/accessibility_event_router_gtk.cc',
+ 'browser/ui/gtk/accessibility_event_router_gtk.h',
+ 'browser/ui/gtk/accessible_widget_helper_gtk.cc',
+ 'browser/ui/gtk/accessible_widget_helper_gtk.h',
+ 'browser/ui/gtk/back_forward_button_gtk.cc',
+ 'browser/ui/gtk/back_forward_button_gtk.h',
+ 'browser/ui/gtk/bookmark_bar_gtk.cc',
+ 'browser/ui/gtk/bookmark_bar_gtk.h',
+ 'browser/ui/gtk/bookmark_bar_instructions_gtk.cc',
+ 'browser/ui/gtk/bookmark_bar_instructions_gtk.h',
+ 'browser/ui/gtk/bookmark_bubble_gtk.cc',
+ 'browser/ui/gtk/bookmark_bubble_gtk.h',
+ 'browser/ui/gtk/bookmark_editor_gtk.cc',
+ 'browser/ui/gtk/bookmark_editor_gtk.h',
+ 'browser/ui/gtk/bookmark_menu_controller_gtk.cc',
+ 'browser/ui/gtk/bookmark_menu_controller_gtk.h',
+ 'browser/ui/gtk/bookmark_tree_model.cc',
+ 'browser/ui/gtk/bookmark_tree_model.h',
+ 'browser/ui/gtk/bookmark_utils_gtk.cc',
+ 'browser/ui/gtk/bookmark_utils_gtk.h',
+ 'browser/ui/gtk/browser_actions_toolbar_gtk.cc',
+ 'browser/ui/gtk/browser_actions_toolbar_gtk.h',
+ 'browser/ui/gtk/browser_titlebar.cc',
+ 'browser/ui/gtk/browser_titlebar.h',
+ 'browser/ui/gtk/browser_toolbar_gtk.cc',
+ 'browser/ui/gtk/browser_toolbar_gtk.h',
+ 'browser/ui/gtk/browser_window_factory_gtk.cc',
+ 'browser/ui/gtk/browser_window_gtk.cc',
+ 'browser/ui/gtk/browser_window_gtk.h',
+ 'browser/ui/gtk/cairo_cached_surface.cc',
+ 'browser/ui/gtk/cairo_cached_surface.h',
+ 'browser/ui/gtk/certificate_dialogs.cc',
+ 'browser/ui/gtk/certificate_dialogs.h',
+ 'browser/ui/gtk/certificate_viewer.cc',
+ 'browser/ui/gtk/certificate_viewer.h',
+ 'browser/ui/gtk/chrome_gtk_frame.cc',
+ 'browser/ui/gtk/chrome_gtk_frame.h',
+ 'browser/ui/gtk/clear_browsing_data_dialog_gtk.cc',
+ 'browser/ui/gtk/clear_browsing_data_dialog_gtk.h',
+ 'browser/ui/gtk/collected_cookies_gtk.cc',
+ 'browser/ui/gtk/collected_cookies_gtk.h',
+ 'browser/ui/gtk/constrained_html_delegate_gtk.cc',
+ 'browser/ui/gtk/constrained_window_gtk.cc',
+ 'browser/ui/gtk/constrained_window_gtk.h',
+ 'browser/ui/gtk/content_setting_bubble_gtk.cc',
+ 'browser/ui/gtk/content_setting_bubble_gtk.h',
+ 'browser/ui/gtk/gconf_titlebar_listener.cc',
+ 'browser/ui/gtk/gconf_titlebar_listener.h',
+ 'browser/ui/gtk/gtk_chrome_cookie_view.cc',
+ 'browser/ui/gtk/gtk_chrome_cookie_view.h',
+ 'browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc',
+ 'browser/ui/gtk/create_application_shortcuts_dialog_gtk.h',
+ 'browser/ui/gtk/custom_button.cc',
+ 'browser/ui/gtk/custom_button.h',
+ 'browser/ui/gtk/custom_drag.cc',
+ 'browser/ui/gtk/custom_drag.h',
+ 'browser/ui/gtk/dialogs_gtk.cc',
+ 'browser/ui/gtk/download_in_progress_dialog_gtk.cc',
+ 'browser/ui/gtk/download_in_progress_dialog_gtk.h',
+ 'browser/ui/gtk/download_item_gtk.cc',
+ 'browser/ui/gtk/download_item_gtk.h',
+ 'browser/ui/gtk/download_shelf_gtk.cc',
+ 'browser/ui/gtk/download_shelf_gtk.h',
+ 'browser/ui/gtk/download_started_animation_gtk.cc',
+ 'browser/ui/gtk/edit_search_engine_dialog.cc',
+ 'browser/ui/gtk/edit_search_engine_dialog.h',
+ 'browser/ui/gtk/extension_infobar_gtk.cc',
+ 'browser/ui/gtk/extension_infobar_gtk.h',
+ 'browser/ui/gtk/extension_install_prompt_gtk.cc',
+ 'browser/ui/gtk/extension_install_prompt2_gtk.cc',
+ 'browser/ui/gtk/extension_installed_bubble_gtk.cc',
+ 'browser/ui/gtk/extension_installed_bubble_gtk.h',
+ 'browser/ui/gtk/extension_view_gtk.cc',
+ 'browser/ui/gtk/extension_view_gtk.h',
+ 'browser/ui/gtk/extension_popup_gtk.cc',
+ 'browser/ui/gtk/extension_popup_gtk.h',
+ 'browser/ui/gtk/external_protocol_dialog_gtk.cc',
+ 'browser/ui/gtk/external_protocol_dialog_gtk.h',
+ 'browser/ui/gtk/find_bar_gtk.cc',
+ 'browser/ui/gtk/find_bar_gtk.h',
+ 'browser/ui/gtk/first_run_bubble.cc',
+ 'browser/ui/gtk/first_run_bubble.h',
+ 'browser/ui/gtk/first_run_dialog.cc',
+ 'browser/ui/gtk/first_run_dialog.h',
+ 'browser/ui/gtk/focus_store_gtk.cc',
+ 'browser/ui/gtk/focus_store_gtk.h',
+ 'browser/ui/gtk/fullscreen_exit_bubble_gtk.cc',
+ 'browser/ui/gtk/fullscreen_exit_bubble_gtk.h',
+ 'browser/ui/gtk/gtk_chrome_button.cc',
+ 'browser/ui/gtk/gtk_chrome_button.h',
+ 'browser/ui/gtk/gtk_chrome_link_button.cc',
+ 'browser/ui/gtk/gtk_chrome_link_button.h',
+ 'browser/ui/gtk/gtk_chrome_shrinkable_hbox.cc',
+ 'browser/ui/gtk/gtk_chrome_shrinkable_hbox.h',
+ 'browser/ui/gtk/gtk_custom_menu.cc',
+ 'browser/ui/gtk/gtk_custom_menu.h',
+ 'browser/ui/gtk/gtk_custom_menu_item.cc',
+ 'browser/ui/gtk/gtk_custom_menu_item.h',
+ 'browser/ui/gtk/gtk_expanded_container.cc',
+ 'browser/ui/gtk/gtk_expanded_container.h',
+ 'browser/ui/gtk/gtk_floating_container.cc',
+ 'browser/ui/gtk/gtk_floating_container.h',
+ 'browser/ui/gtk/gtk_theme_provider.cc',
+ 'browser/ui/gtk/gtk_theme_provider.h',
+ 'browser/ui/gtk/gtk_tree.cc',
+ 'browser/ui/gtk/gtk_tree.h',
+ 'browser/ui/gtk/gtk_util.cc',
+ 'browser/ui/gtk/gtk_util.h',
+ 'browser/ui/gtk/hover_controller_gtk.cc',
+ 'browser/ui/gtk/hover_controller_gtk.h',
+ 'browser/ui/gtk/html_dialog_gtk.cc',
+ 'browser/ui/gtk/html_dialog_gtk.h',
+ 'browser/ui/gtk/hung_renderer_dialog_gtk.cc',
+ 'browser/ui/gtk/import_dialog_gtk.cc',
+ 'browser/ui/gtk/import_dialog_gtk.h',
+ 'browser/ui/gtk/import_lock_dialog_gtk.cc',
+ 'browser/ui/gtk/import_lock_dialog_gtk.h',
+ 'browser/ui/gtk/import_progress_dialog_gtk.cc',
+ 'browser/ui/gtk/import_progress_dialog_gtk.h',
+ 'browser/ui/gtk/info_bubble_gtk.cc',
+ 'browser/ui/gtk/info_bubble_gtk.h',
+ 'browser/ui/gtk/info_bubble_accelerators_gtk.cc',
+ 'browser/ui/gtk/info_bubble_accelerators_gtk.h',
+ 'browser/ui/gtk/infobar_arrow_model.cc',
+ 'browser/ui/gtk/infobar_arrow_model.h',
+ 'browser/ui/gtk/infobar_container_gtk.cc',
+ 'browser/ui/gtk/infobar_container_gtk.h',
+ 'browser/ui/gtk/infobar_gtk.cc',
+ 'browser/ui/gtk/infobar_gtk.h',
+ 'browser/ui/gtk/instant_confirm_dialog_gtk.cc',
+ 'browser/ui/gtk/instant_confirm_dialog_gtk.h',
+ 'browser/ui/gtk/js_modal_dialog_gtk.cc',
+ 'browser/ui/gtk/js_modal_dialog_gtk.h',
+ 'browser/ui/gtk/keyword_editor_view.cc',
+ 'browser/ui/gtk/keyword_editor_view.h',
+ 'browser/ui/gtk/location_bar_view_gtk.cc',
+ 'browser/ui/gtk/location_bar_view_gtk.h',
+ 'browser/ui/gtk/menu_bar_helper.cc',
+ 'browser/ui/gtk/menu_bar_helper.h',
+ 'browser/ui/gtk/menu_gtk.cc',
+ 'browser/ui/gtk/menu_gtk.h',
+ 'browser/ui/gtk/nine_box.cc',
+ 'browser/ui/gtk/nine_box.h',
+ 'browser/ui/gtk/notifications/balloon_view_gtk.cc',
+ 'browser/ui/gtk/notifications/balloon_view_gtk.h',
+ 'browser/ui/gtk/notifications/balloon_view_host_gtk.cc',
+ 'browser/ui/gtk/notifications/balloon_view_host_gtk.h',
+ 'browser/ui/gtk/options/advanced_contents_gtk.cc',
+ 'browser/ui/gtk/options/advanced_contents_gtk.h',
+ 'browser/ui/gtk/options/advanced_page_gtk.cc',
+ 'browser/ui/gtk/options/advanced_page_gtk.h',
+ 'browser/ui/gtk/options/content_exception_editor.cc',
+ 'browser/ui/gtk/options/content_exception_editor.h',
+ 'browser/ui/gtk/options/content_exceptions_window_gtk.cc',
+ 'browser/ui/gtk/options/content_exceptions_window_gtk.h',
+ 'browser/ui/gtk/options/content_filter_page_gtk.cc',
+ 'browser/ui/gtk/options/content_filter_page_gtk.h',
+ 'browser/ui/gtk/options/content_page_gtk.cc',
+ 'browser/ui/gtk/options/content_page_gtk.h',
+ 'browser/ui/gtk/options/content_settings_window_gtk.cc',
+ 'browser/ui/gtk/options/content_settings_window_gtk.h',
+ 'browser/ui/gtk/options/cookie_filter_page_gtk.cc',
+ 'browser/ui/gtk/options/cookie_filter_page_gtk.h',
+ 'browser/ui/gtk/options/cookies_view.cc',
+ 'browser/ui/gtk/options/cookies_view.h',
+ 'browser/ui/gtk/options/fonts_languages_window_gtk.cc',
+ 'browser/ui/gtk/options/fonts_page_gtk.cc',
+ 'browser/ui/gtk/options/fonts_page_gtk.h',
+ 'browser/ui/gtk/options/general_page_gtk.cc',
+ 'browser/ui/gtk/options/general_page_gtk.h',
+ 'browser/ui/gtk/options/languages_page_gtk.cc',
+ 'browser/ui/gtk/options/languages_page_gtk.h',
+ 'browser/ui/gtk/options/managed_prefs_banner_gtk.cc',
+ 'browser/ui/gtk/options/managed_prefs_banner_gtk.h',
+ 'browser/ui/gtk/options/options_layout_gtk.cc',
+ 'browser/ui/gtk/options/options_layout_gtk.h',
+ 'browser/ui/gtk/options/options_window_gtk.cc',
+ 'browser/ui/gtk/options/passwords_exceptions_page_gtk.cc',
+ 'browser/ui/gtk/options/passwords_exceptions_page_gtk.h',
+ 'browser/ui/gtk/options/passwords_exceptions_window_gtk.cc',
+ 'browser/ui/gtk/options/passwords_exceptions_window_gtk.h',
+ 'browser/ui/gtk/options/passwords_page_gtk.cc',
+ 'browser/ui/gtk/options/passwords_page_gtk.h',
+ 'browser/ui/gtk/options/simple_content_exceptions_window.cc',
+ 'browser/ui/gtk/options/simple_content_exceptions_window.h',
+ 'browser/ui/gtk/options/url_picker_dialog_gtk.cc',
+ 'browser/ui/gtk/options/url_picker_dialog_gtk.h',
+ 'browser/ui/gtk/overflow_button.cc',
+ 'browser/ui/gtk/overflow_button.h',
+ 'browser/ui/gtk/owned_widget_gtk.cc',
+ 'browser/ui/gtk/owned_widget_gtk.h',
+ 'browser/ui/gtk/page_info_bubble_gtk.cc',
+ 'browser/ui/gtk/pk11_password_dialog.cc',
+ 'browser/ui/gtk/process_singleton_dialog.cc',
+ 'browser/ui/gtk/process_singleton_dialog.h',
+ 'browser/ui/gtk/reload_button_gtk.cc',
+ 'browser/ui/gtk/reload_button_gtk.h',
+ 'browser/ui/gtk/repost_form_warning_gtk.cc',
+ 'browser/ui/gtk/repost_form_warning_gtk.h',
+ 'browser/ui/gtk/rounded_window.cc',
+ 'browser/ui/gtk/rounded_window.h',
+ 'browser/ui/gtk/sad_tab_gtk.cc',
+ 'browser/ui/gtk/sad_tab_gtk.h',
+ 'browser/ui/gtk/slide_animator_gtk.cc',
+ 'browser/ui/gtk/slide_animator_gtk.h',
+ 'browser/ui/gtk/ssl_client_certificate_selector.cc',
+ 'browser/ui/gtk/status_bubble_gtk.cc',
+ 'browser/ui/gtk/status_bubble_gtk.h',
+ 'browser/ui/gtk/status_icons/status_icon_gtk.h',
+ 'browser/ui/gtk/status_icons/status_icon_gtk.cc',
+ 'browser/ui/gtk/status_icons/status_tray_gtk.h',
+ 'browser/ui/gtk/status_icons/status_tray_gtk.cc',
+ 'browser/ui/gtk/tab_contents_container_gtk.cc',
+ 'browser/ui/gtk/tab_contents_container_gtk.h',
+ 'browser/ui/gtk/tab_contents_drag_source.cc',
+ 'browser/ui/gtk/tab_contents_drag_source.h',
+ 'browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc',
+ 'browser/ui/gtk/tabs/dragged_tab_controller_gtk.h',
+ 'browser/ui/gtk/tabs/dragged_tab_gtk.cc',
+ 'browser/ui/gtk/tabs/dragged_tab_gtk.h',
+ 'browser/ui/gtk/tabs/tab_gtk.cc',
+ 'browser/ui/gtk/tabs/tab_gtk.h',
+ 'browser/ui/gtk/tabs/tab_renderer_gtk.cc',
+ 'browser/ui/gtk/tabs/tab_renderer_gtk.h',
+ 'browser/ui/gtk/tabs/tab_strip_gtk.cc',
+ 'browser/ui/gtk/tabs/tab_strip_gtk.h',
+ 'browser/ui/gtk/task_manager_gtk.cc',
+ 'browser/ui/gtk/task_manager_gtk.h',
+ 'browser/ui/gtk/theme_install_bubble_view_gtk.cc',
+ 'browser/ui/gtk/theme_install_bubble_view_gtk.h',
+ 'browser/ui/gtk/translate/after_translate_infobar_gtk.cc',
+ 'browser/ui/gtk/translate/after_translate_infobar_gtk.h',
+ 'browser/ui/gtk/translate/before_translate_infobar_gtk.cc',
+ 'browser/ui/gtk/translate/before_translate_infobar_gtk.h',
+ 'browser/ui/gtk/translate/translate_infobar_base_gtk.cc',
+ 'browser/ui/gtk/translate/translate_infobar_base_gtk.h',
+ 'browser/ui/gtk/translate/translate_message_infobar_gtk.cc',
+ 'browser/ui/gtk/translate/translate_message_infobar_gtk.h',
+ 'browser/ui/gtk/update_recommended_dialog.cc',
+ 'browser/ui/gtk/update_recommended_dialog.h',
+ 'browser/ui/gtk/view_id_util.cc',
+ 'browser/ui/gtk/view_id_util.h',
'browser/hang_monitor/hung_plugin_action.cc',
'browser/hang_monitor/hung_plugin_action.h',
'browser/hang_monitor/hung_window_detector.cc',
@@ -3567,8 +3567,8 @@
}],
['use_gconf==0', {
'sources!': [
- 'browser/gtk/gconf_titlebar_listener.cc',
- 'browser/gtk/gconf_titlebar_listener.h',
+ 'browser/ui/gtk/gconf_titlebar_listener.cc',
+ 'browser/ui/gtk/gconf_titlebar_listener.h',
],
}],
['use_gnome_keyring==0', {
@@ -4160,80 +4160,79 @@
['include', '^browser/ui/views/wrench_menu.h'],
['include', '^browser/ui/window_sizer.cc'],
['include', '^browser/ui/window_sizer.h'],
- # Exclude all of browser/gtk, then include the things we want.
- ['exclude', '^browser/gtk'],
- ['include', '^browser/gtk/accessibility_event_router_gtk.cc'],
- ['include', '^browser/gtk/accessibility_event_router_gtk.h'],
- ['include', '^browser/gtk/accessible_widget_helper_gtk.cc'],
- ['include', '^browser/gtk/accessible_widget_helper_gtk.h'],
- ['include', '^browser/gtk/bookmark_editor_gtk.cc'],
- ['include', '^browser/gtk/bookmark_editor_gtk.h'],
- ['include', '^browser/gtk/bookmark_tree_model.cc'],
- ['include', '^browser/gtk/bookmark_tree_model.h'],
- ['include', '^browser/gtk/bookmark_utils_gtk.cc'],
- ['include', '^browser/gtk/bookmark_utils_gtk.h'],
- ['include', '^browser/gtk/cairo_cached_surface.cc'],
- ['include', '^browser/gtk/cairo_cached_surface.h'],
- ['include', '^browser/gtk/clear_browsing_data_dialog_gtk.cc'],
- ['include', '^browser/gtk/clear_browsing_data_dialog_gtk.h'],
- ['include', '^browser/gtk/certificate_dialogs.cc'],
- ['include', '^browser/gtk/certificate_dialogs.h'],
- ['include', '^browser/gtk/certificate_viewer.cc'],
- ['include', '^browser/gtk/certificate_viewer.h'],
- ['include', '^browser/gtk/chrome_gtk_frame.cc'],
- ['include', '^browser/gtk/chrome_gtk_frame.h'],
- ['include', '^browser/gtk/collected_cookies_gtk.cc'],
- ['include', '^browser/gtk/collected_cookies_gtk.h'],
- ['include', '^browser/gtk/constrained_window_gtk.cc'],
- ['include', '^browser/gtk/constrained_window_gtk.h'],
- ['include', '^browser/gtk/gtk_chrome_cookie_view.cc'],
- ['include', '^browser/gtk/gtk_chrome_cookie_view.h'],
- ['include', '^browser/gtk/download_started_animation_gtk.cc'],
- ['include', '^browser/gtk/edit_search_engine_dialog.cc'],
- ['include', '^browser/gtk/edit_search_engine_dialog.h'],
- ['include', '^browser/gtk/first_run_dialog.cc'],
- ['include', '^browser/gtk/first_run_dialog.h'],
- ['include', '^browser/gtk/gtk_chrome_button.cc'],
- ['include', '^browser/gtk/gtk_chrome_button.h'],
- ['include', '^browser/gtk/gtk_chrome_link_button.cc'],
- ['include', '^browser/gtk/gtk_chrome_link_button.h'],
- ['include', '^browser/gtk/gtk_custom_menu_item.cc'],
- ['include', '^browser/gtk/gtk_floating_container.cc'],
- ['include', '^browser/gtk/gtk_floating_container.h'],
- ['include', '^browser/gtk/gtk_theme_provider.cc'],
- ['include', '^browser/gtk/gtk_theme_provider.h'],
- ['include', '^browser/gtk/gtk_tree.cc'],
- ['include', '^browser/gtk/gtk_tree.h'],
- ['include', '^browser/gtk/gtk_util.cc'],
- ['include', '^browser/gtk/gtk_util.h'],
- ['include', '^browser/gtk/hover_controller_gtk.cc'],
- ['include', '^browser/gtk/hover_controller_gtk.h'],
- ['include', '^browser/gtk/hung_renderer_dialog_gtk.cc'],
- ['include', '^browser/gtk/import_dialog_gtk.cc'],
- ['include', '^browser/gtk/import_dialog_gtk.h'],
- ['include', '^browser/gtk/import_progress_dialog_gtk.cc'],
- ['include', '^browser/gtk/import_progress_dialog_gtk.h'],
- ['include', '^browser/gtk/import_lock_dialog_gtk.cc'],
- ['include', '^browser/gtk/import_lock_dialog_gtk.h'],
- ['include', '^browser/gtk/keyword_editor_view.cc'],
- ['include', '^browser/gtk/keyword_editor_view.h'],
- ['include', '^browser/gtk/nine_box.cc'],
- ['include', '^browser/gtk/nine_box.h'],
- ['include', '^browser/gtk/options/'],
- ['include', '^browser/gtk/owned_widget_gtk.cc'],
- ['include', '^browser/gtk/owned_widget_gtk.h'],
- ['include', '^browser/gtk/pk11_password_dialog.cc'],
- ['include', '^browser/gtk/pk11_password_dialog.h'],
- ['include', '^browser/gtk/popup_blocked_animation_gtk.cc'],
- ['include', '^browser/gtk/repost_form_warning_gtk.cc'],
- ['include', '^browser/gtk/repost_form_warning_gtk.h'],
- ['include', '^browser/gtk/ssl_client_certificate_selector.cc'],
- ['include', '^browser/gtk/tab_contents_drag_source.cc'],
- ['include', '^browser/gtk/tab_contents_drag_source.h'],
- ['include', '^browser/gtk/task_manager_gtk.cc'],
- ['include', '^browser/gtk/task_manager_gtk.h'],
- ['include', '^browser/gtk/view_id_util.cc'],
- ['include', '^browser/gtk/view_id_util.h'],
+ # Exclude all of browser/ui/gtk, then include the things we want.
+ ['exclude', '^browser/ui/gtk'],
+ ['include', '^browser/ui/gtk/accessibility_event_router_gtk.cc'],
+ ['include', '^browser/ui/gtk/accessibility_event_router_gtk.h'],
+ ['include', '^browser/ui/gtk/accessible_widget_helper_gtk.cc'],
+ ['include', '^browser/ui/gtk/accessible_widget_helper_gtk.h'],
+ ['include', '^browser/ui/gtk/bookmark_editor_gtk.cc'],
+ ['include', '^browser/ui/gtk/bookmark_editor_gtk.h'],
+ ['include', '^browser/ui/gtk/bookmark_tree_model.cc'],
+ ['include', '^browser/ui/gtk/bookmark_tree_model.h'],
+ ['include', '^browser/ui/gtk/bookmark_utils_gtk.cc'],
+ ['include', '^browser/ui/gtk/bookmark_utils_gtk.h'],
+ ['include', '^browser/ui/gtk/cairo_cached_surface.cc'],
+ ['include', '^browser/ui/gtk/cairo_cached_surface.h'],
+ ['include', '^browser/ui/gtk/clear_browsing_data_dialog_gtk.cc'],
+ ['include', '^browser/ui/gtk/clear_browsing_data_dialog_gtk.h'],
+ ['include', '^browser/ui/gtk/certificate_dialogs.cc'],
+ ['include', '^browser/ui/gtk/certificate_dialogs.h'],
+ ['include', '^browser/ui/gtk/certificate_viewer.cc'],
+ ['include', '^browser/ui/gtk/certificate_viewer.h'],
+ ['include', '^browser/ui/gtk/chrome_gtk_frame.cc'],
+ ['include', '^browser/ui/gtk/chrome_gtk_frame.h'],
+ ['include', '^browser/ui/gtk/collected_cookies_gtk.cc'],
+ ['include', '^browser/ui/gtk/collected_cookies_gtk.h'],
+ ['include', '^browser/ui/gtk/constrained_window_gtk.cc'],
+ ['include', '^browser/ui/gtk/constrained_window_gtk.h'],
+ ['include', '^browser/ui/gtk/gtk_chrome_cookie_view.cc'],
+ ['include', '^browser/ui/gtk/gtk_chrome_cookie_view.h'],
+ ['include', '^browser/ui/gtk/download_started_animation_gtk.cc'],
+ ['include', '^browser/ui/gtk/edit_search_engine_dialog.cc'],
+ ['include', '^browser/ui/gtk/edit_search_engine_dialog.h'],
+ ['include', '^browser/ui/gtk/first_run_dialog.cc'],
+ ['include', '^browser/ui/gtk/first_run_dialog.h'],
+ ['include', '^browser/ui/gtk/gtk_chrome_button.cc'],
+ ['include', '^browser/ui/gtk/gtk_chrome_button.h'],
+ ['include', '^browser/ui/gtk/gtk_chrome_link_button.cc'],
+ ['include', '^browser/ui/gtk/gtk_chrome_link_button.h'],
+ ['include', '^browser/ui/gtk/gtk_custom_menu_item.cc'],
+ ['include', '^browser/ui/gtk/gtk_floating_container.cc'],
+ ['include', '^browser/ui/gtk/gtk_floating_container.h'],
+ ['include', '^browser/ui/gtk/gtk_theme_provider.cc'],
+ ['include', '^browser/ui/gtk/gtk_theme_provider.h'],
+ ['include', '^browser/ui/gtk/gtk_tree.cc'],
+ ['include', '^browser/ui/gtk/gtk_tree.h'],
+ ['include', '^browser/ui/gtk/gtk_util.cc'],
+ ['include', '^browser/ui/gtk/gtk_util.h'],
+ ['include', '^browser/ui/gtk/hover_controller_gtk.cc'],
+ ['include', '^browser/ui/gtk/hover_controller_gtk.h'],
+ ['include', '^browser/ui/gtk/hung_renderer_dialog_gtk.cc'],
+ ['include', '^browser/ui/gtk/import_dialog_gtk.cc'],
+ ['include', '^browser/ui/gtk/import_dialog_gtk.h'],
+ ['include', '^browser/ui/gtk/import_progress_dialog_gtk.cc'],
+ ['include', '^browser/ui/gtk/import_progress_dialog_gtk.h'],
+ ['include', '^browser/ui/gtk/import_lock_dialog_gtk.cc'],
+ ['include', '^browser/ui/gtk/import_lock_dialog_gtk.h'],
+ ['include', '^browser/ui/gtk/keyword_editor_view.cc'],
+ ['include', '^browser/ui/gtk/keyword_editor_view.h'],
+ ['include', '^browser/ui/gtk/nine_box.cc'],
+ ['include', '^browser/ui/gtk/nine_box.h'],
+ ['include', '^browser/ui/gtk/options/'],
+ ['include', '^browser/ui/gtk/owned_widget_gtk.cc'],
+ ['include', '^browser/ui/gtk/owned_widget_gtk.h'],
+ ['include', '^browser/ui/gtk/pk11_password_dialog.cc'],
+ ['include', '^browser/ui/gtk/popup_blocked_animation_gtk.cc'],
+ ['include', '^browser/ui/gtk/repost_form_warning_gtk.cc'],
+ ['include', '^browser/ui/gtk/repost_form_warning_gtk.h'],
+ ['include', '^browser/ui/gtk/ssl_client_certificate_selector.cc'],
+ ['include', '^browser/ui/gtk/tab_contents_drag_source.cc'],
+ ['include', '^browser/ui/gtk/tab_contents_drag_source.h'],
+ ['include', '^browser/ui/gtk/task_manager_gtk.cc'],
+ ['include', '^browser/ui/gtk/task_manager_gtk.h'],
+ ['include', '^browser/ui/gtk/view_id_util.cc'],
+ ['include', '^browser/ui/gtk/view_id_util.h'],
# Other excluded stuff.
['exclude', '^browser/autocomplete/autocomplete_popup_view_gtk.cc'],
@@ -4262,9 +4261,9 @@
# non-ChromeOS views Linux builds.
['OS=="linux" and toolkit_views==1 and chromeos==0', {
'sources/': [
- ['include', '^browser/gtk/dialogs_gtk.cc'],
- ['include', '^browser/gtk/external_protocol_dialog_gtk.cc'],
- ['include', '^browser/gtk/external_protocol_dialog_gtk.h'],
+ ['include', '^browser/ui/gtk/dialogs_gtk.cc'],
+ ['include', '^browser/ui/gtk/external_protocol_dialog_gtk.cc'],
+ ['include', '^browser/ui/gtk/external_protocol_dialog_gtk.h'],
['include', '^browser/ui/views/notifications/balloon_view.cc'],
['include', '^browser/ui/views/notifications/balloon_view.h'],
['include', '^browser/ui/views/frame/browser_non_client_frame_view_factory_gtk.cc'],
@@ -4293,8 +4292,8 @@
['exclude', '^browser/ui/views/tab_contents/tab_contents_view_gtk.cc'],
['exclude', '^browser/ui/views/tab_contents/tab_contents_view_gtk.h'],
# TODO(anicolao): exclude these once we have DOMUI dialogs
- # ['exclude', '^browser/gtk/constrained_window_gtk.cc'],
- # ['exclude', '^browser/gtk/constrained_window_gtk.h'],
+ # ['exclude', '^browser/ui/gtk/constrained_window_gtk.cc'],
+ # ['exclude', '^browser/ui/gtk/constrained_window_gtk.h'],
],
}],
['OS=="linux" and chromeos==1',{
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index ca9aec5..716b8f5 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -328,7 +328,7 @@
'browser/browser_keyevents_browsertest.cc',
'browser/collected_cookies_uitest.cc',
'browser/debugger/devtools_sanity_unittest.cc',
- 'browser/gtk/bookmark_bar_gtk_interactive_uitest.cc',
+ 'browser/ui/gtk/bookmark_bar_gtk_interactive_uitest.cc',
'browser/instant/instant_browsertest.cc',
'browser/notifications/notifications_interactive_uitest.cc',
'browser/ui/views/bookmark_bar_view_test.cc',
@@ -369,7 +369,7 @@
}],
['OS=="linux" and toolkit_views==1', {
'sources!': [
- 'browser/gtk/bookmark_bar_gtk_interactive_uitest.cc',
+ 'browser/ui/gtk/bookmark_bar_gtk_interactive_uitest.cc',
# TODO(port)
'test/interactive_ui/npapi_interactive_test.cc',
],
@@ -1202,20 +1202,20 @@
'browser/google/google_update_settings_unittest.cc',
'browser/google/google_url_tracker_unittest.cc',
'browser/gpu_blacklist_unittest.cc',
- 'browser/gtk/accessibility_event_router_gtk_unittest.cc',
- 'browser/gtk/bookmark_bar_gtk_unittest.cc',
- 'browser/gtk/bookmark_editor_gtk_unittest.cc',
- 'browser/gtk/bookmark_utils_gtk_unittest.cc',
- 'browser/gtk/gtk_chrome_shrinkable_hbox_unittest.cc',
- 'browser/gtk/gtk_expanded_container_unittest.cc',
- 'browser/gtk/gtk_theme_provider_unittest.cc',
- 'browser/gtk/keyword_editor_view_unittest.cc',
- 'browser/gtk/options/content_exceptions_window_gtk_unittest.cc',
- 'browser/gtk/options/cookies_view_unittest.cc',
- 'browser/gtk/options/languages_page_gtk_unittest.cc',
- 'browser/gtk/reload_button_gtk_unittest.cc',
- 'browser/gtk/status_icons/status_tray_gtk_unittest.cc',
- 'browser/gtk/tabs/tab_renderer_gtk_unittest.cc',
+ 'browser/ui/gtk/accessibility_event_router_gtk_unittest.cc',
+ 'browser/ui/gtk/bookmark_bar_gtk_unittest.cc',
+ 'browser/ui/gtk/bookmark_editor_gtk_unittest.cc',
+ 'browser/ui/gtk/bookmark_utils_gtk_unittest.cc',
+ 'browser/ui/gtk/gtk_chrome_shrinkable_hbox_unittest.cc',
+ 'browser/ui/gtk/gtk_expanded_container_unittest.cc',
+ 'browser/ui/gtk/gtk_theme_provider_unittest.cc',
+ 'browser/ui/gtk/keyword_editor_view_unittest.cc',
+ 'browser/ui/gtk/options/content_exceptions_window_gtk_unittest.cc',
+ 'browser/ui/gtk/options/cookies_view_unittest.cc',
+ 'browser/ui/gtk/options/languages_page_gtk_unittest.cc',
+ 'browser/ui/gtk/reload_button_gtk_unittest.cc',
+ 'browser/ui/gtk/status_icons/status_tray_gtk_unittest.cc',
+ 'browser/ui/gtk/tabs/tab_renderer_gtk_unittest.cc',
'browser/history/expire_history_backend_unittest.cc',
'browser/history/history_backend_unittest.cc',
'browser/history/history_querying_unittest.cc',
@@ -1780,15 +1780,15 @@
['toolkit_views==1', {
'sources!': [
'browser/autocomplete/autocomplete_popup_view_gtk_unittest.cc',
- 'browser/gtk/bookmark_bar_gtk_unittest.cc',
- 'browser/gtk/bookmark_editor_gtk_unittest.cc',
- 'browser/gtk/gtk_chrome_shrinkable_hbox_unittest.cc',
- 'browser/gtk/gtk_expanded_container_unittest.cc',
- 'browser/gtk/gtk_theme_provider_unittest.cc',
- 'browser/gtk/options/cookies_view_unittest.cc',
- 'browser/gtk/options/languages_page_gtk_unittest.cc',
- 'browser/gtk/reload_button_gtk_unittest.cc',
- 'browser/gtk/status_icons/status_tray_gtk_unittest.cc',
+ 'browser/ui/gtk/bookmark_bar_gtk_unittest.cc',
+ 'browser/ui/gtk/bookmark_editor_gtk_unittest.cc',
+ 'browser/ui/gtk/gtk_chrome_shrinkable_hbox_unittest.cc',
+ 'browser/ui/gtk/gtk_expanded_container_unittest.cc',
+ 'browser/ui/gtk/gtk_theme_provider_unittest.cc',
+ 'browser/ui/gtk/options/cookies_view_unittest.cc',
+ 'browser/ui/gtk/options/languages_page_gtk_unittest.cc',
+ 'browser/ui/gtk/reload_button_gtk_unittest.cc',
+ 'browser/ui/gtk/status_icons/status_tray_gtk_unittest.cc',
],
}],
],
@@ -1802,7 +1802,7 @@
],
}, { # else: OS != "linux"
'sources!': [
- 'browser/gtk/tabs/tab_renderer_gtk_unittest.cc',
+ 'browser/ui/gtk/tabs/tab_renderer_gtk_unittest.cc',
'browser/renderer_host/gtk_key_bindings_handler_unittest.cc',
'../views/focus/accelerator_handler_gtk_unittest.cc',
],
@@ -1831,7 +1831,7 @@
# Blocked on bookmark manager.
'browser/bookmarks/bookmark_context_menu_controller_unittest.cc',
'browser/ui/tabs/dock_info_unittest.cc',
- 'browser/gtk/reload_button_gtk_unittest.cc',
+ 'browser/ui/gtk/reload_button_gtk_unittest.cc',
'browser/password_manager/password_store_default_unittest.cc',
'tools/convert_dict/convert_dict_unittest.cc',
'../third_party/hunspell/google/hunspell_tests.cc',
@@ -1950,7 +1950,7 @@
'../views/views.gyp:views',
],
'sources!': [
- 'browser/gtk/tabs/tab_renderer_gtk_unittest.cc',
+ 'browser/ui/gtk/tabs/tab_renderer_gtk_unittest.cc',
],
}, { # else: toolkit_views == 0
'sources/': [
@@ -2134,7 +2134,7 @@
'browser/first_run/first_run_browsertest.cc',
'browser/geolocation/access_token_store_browsertest.cc',
'browser/geolocation/geolocation_browsertest.cc',
- 'browser/gtk/view_id_util_browsertest.cc',
+ 'browser/ui/gtk/view_id_util_browsertest.cc',
'browser/history/history_browsertest.cc',
'browser/idbbindingutilities_browsertest.cc',
'browser/in_process_webkit/dom_storage_browsertest.cc',
@@ -2218,7 +2218,7 @@
['OS!="linux" or toolkit_views==1', {
'sources!': [
'browser/extensions/browser_action_test_util_gtk.cc',
- 'browser/gtk/view_id_util_browsertest.cc',
+ 'browser/ui/gtk/view_id_util_browsertest.cc',
],
}],
['OS=="win"', {