summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-09 07:35:32 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-09 07:35:32 +0000
commit213dac2f0bff9162502fe325b6ebb85a255efcb2 (patch)
tree3640cb1f19976e38677b8632537d2d41f8444d0f
parent6de53d401aa8dc6c7e0a9874c71a95ce88ade50d (diff)
downloadchromium_src-213dac2f0bff9162502fe325b6ebb85a255efcb2.zip
chromium_src-213dac2f0bff9162502fe325b6ebb85a255efcb2.tar.gz
chromium_src-213dac2f0bff9162502fe325b6ebb85a255efcb2.tar.bz2
Move browser/views to browser/ui/views
TBR=brettw BUG=none TEST=none Review URL: http://codereview.chromium.org/4694005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65508 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-xchrome/browser/ui/views/PRESUBMIT.py (renamed from chrome/browser/views/PRESUBMIT.py)0
-rw-r--r--chrome/browser/ui/views/about_chrome_view.cc (renamed from chrome/browser/views/about_chrome_view.cc)0
-rw-r--r--chrome/browser/ui/views/about_chrome_view.h173
-rw-r--r--chrome/browser/ui/views/about_ipc_dialog.cc (renamed from chrome/browser/views/about_ipc_dialog.cc)0
-rw-r--r--chrome/browser/ui/views/about_ipc_dialog.h79
-rw-r--r--chrome/browser/ui/views/accelerator_table_gtk.cc (renamed from chrome/browser/views/accelerator_table_gtk.cc)0
-rw-r--r--chrome/browser/ui/views/accelerator_table_gtk.h32
-rw-r--r--chrome/browser/ui/views/accessibility_event_router_views.cc (renamed from chrome/browser/views/accessibility_event_router_views.cc)0
-rw-r--r--chrome/browser/ui/views/accessibility_event_router_views.h154
-rw-r--r--chrome/browser/ui/views/accessibility_event_router_views_unittest.cc (renamed from chrome/browser/views/accessibility_event_router_views_unittest.cc)0
-rw-r--r--chrome/browser/ui/views/accessible_pane_view.cc (renamed from chrome/browser/views/accessible_pane_view.cc)0
-rw-r--r--chrome/browser/ui/views/accessible_pane_view.h100
-rw-r--r--chrome/browser/ui/views/accessible_view_helper.cc (renamed from chrome/browser/views/accessible_view_helper.cc)0
-rw-r--r--chrome/browser/ui/views/accessible_view_helper.h83
-rw-r--r--chrome/browser/ui/views/app_launched_animation_win.cc (renamed from chrome/browser/views/app_launched_animation_win.cc)0
-rw-r--r--chrome/browser/ui/views/appcache_info_view.cc (renamed from chrome/browser/views/appcache_info_view.cc)0
-rw-r--r--chrome/browser/ui/views/appcache_info_view.h24
-rw-r--r--chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc (renamed from chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc)0
-rw-r--r--chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h177
-rw-r--r--chrome/browser/ui/views/autocomplete/autocomplete_popup_gtk.cc (renamed from chrome/browser/views/autocomplete/autocomplete_popup_gtk.cc)0
-rw-r--r--chrome/browser/ui/views/autocomplete/autocomplete_popup_gtk.h28
-rw-r--r--chrome/browser/ui/views/autocomplete/autocomplete_popup_win.cc (renamed from chrome/browser/views/autocomplete/autocomplete_popup_win.cc)0
-rw-r--r--chrome/browser/ui/views/autocomplete/autocomplete_popup_win.h33
-rw-r--r--chrome/browser/ui/views/autofill_profiles_view_win.cc (renamed from chrome/browser/views/autofill_profiles_view_win.cc)0
-rw-r--r--chrome/browser/ui/views/autofill_profiles_view_win.h440
-rw-r--r--chrome/browser/ui/views/bookmark_bar_instructions_view.cc (renamed from chrome/browser/views/bookmark_bar_instructions_view.cc)0
-rw-r--r--chrome/browser/ui/views/bookmark_bar_instructions_view.h68
-rw-r--r--chrome/browser/ui/views/bookmark_bar_view.cc (renamed from chrome/browser/views/bookmark_bar_view.cc)0
-rw-r--r--chrome/browser/ui/views/bookmark_bar_view.h508
-rw-r--r--chrome/browser/ui/views/bookmark_bar_view_test.cc (renamed from chrome/browser/views/bookmark_bar_view_test.cc)0
-rw-r--r--chrome/browser/ui/views/bookmark_bar_view_unittest.cc (renamed from chrome/browser/views/bookmark_bar_view_unittest.cc)0
-rw-r--r--chrome/browser/ui/views/bookmark_bubble_view.cc (renamed from chrome/browser/views/bookmark_bubble_view.cc)0
-rw-r--r--chrome/browser/ui/views/bookmark_bubble_view.h162
-rw-r--r--chrome/browser/ui/views/bookmark_context_menu.cc (renamed from chrome/browser/views/bookmark_context_menu.cc)0
-rw-r--r--chrome/browser/ui/views/bookmark_context_menu.h76
-rw-r--r--chrome/browser/ui/views/bookmark_context_menu_controller_views.cc (renamed from chrome/browser/views/bookmark_context_menu_controller_views.cc)0
-rw-r--r--chrome/browser/ui/views/bookmark_context_menu_controller_views.h93
-rw-r--r--chrome/browser/ui/views/bookmark_context_menu_test.cc (renamed from chrome/browser/views/bookmark_context_menu_test.cc)0
-rw-r--r--chrome/browser/ui/views/bookmark_editor_view.cc (renamed from chrome/browser/views/bookmark_editor_view.cc)0
-rw-r--r--chrome/browser/ui/views/bookmark_editor_view.h265
-rw-r--r--chrome/browser/ui/views/bookmark_editor_view_unittest.cc (renamed from chrome/browser/views/bookmark_editor_view_unittest.cc)0
-rw-r--r--chrome/browser/ui/views/bookmark_menu_controller_views.cc (renamed from chrome/browser/views/bookmark_menu_controller_views.cc)0
-rw-r--r--chrome/browser/ui/views/bookmark_menu_controller_views.h200
-rw-r--r--chrome/browser/ui/views/browser_actions_container.cc (renamed from chrome/browser/views/browser_actions_container.cc)0
-rw-r--r--chrome/browser/ui/views/browser_actions_container.h509
-rw-r--r--chrome/browser/ui/views/browser_actions_container_browsertest.cc (renamed from chrome/browser/views/browser_actions_container_browsertest.cc)0
-rw-r--r--chrome/browser/ui/views/browser_bubble.cc (renamed from chrome/browser/views/browser_bubble.cc)0
-rw-r--r--chrome/browser/ui/views/browser_bubble.h131
-rw-r--r--chrome/browser/ui/views/browser_bubble_gtk.cc (renamed from chrome/browser/views/browser_bubble_gtk.cc)0
-rw-r--r--chrome/browser/ui/views/browser_bubble_win.cc (renamed from chrome/browser/views/browser_bubble_win.cc)0
-rw-r--r--chrome/browser/ui/views/browser_dialogs.h130
-rw-r--r--chrome/browser/ui/views/browser_keyboard_accessibility_test_win.cc (renamed from chrome/browser/views/browser_keyboard_accessibility_test_win.cc)0
-rw-r--r--chrome/browser/ui/views/bubble_border.cc (renamed from chrome/browser/views/bubble_border.cc)0
-rw-r--r--chrome/browser/ui/views/bubble_border.h172
-rw-r--r--chrome/browser/ui/views/certificate_viewer_win.cc (renamed from chrome/browser/views/certificate_viewer_win.cc)0
-rw-r--r--chrome/browser/ui/views/chrome_views_delegate.cc (renamed from chrome/browser/views/chrome_views_delegate.cc)0
-rw-r--r--chrome/browser/ui/views/chrome_views_delegate.h39
-rw-r--r--chrome/browser/ui/views/clear_browsing_data.cc (renamed from chrome/browser/views/clear_browsing_data.cc)0
-rw-r--r--chrome/browser/ui/views/clear_browsing_data.h128
-rw-r--r--chrome/browser/ui/views/clear_browsing_data_view.cc (renamed from chrome/browser/views/clear_browsing_data_view.cc)0
-rw-r--r--chrome/browser/ui/views/clear_browsing_data_view.h121
-rw-r--r--chrome/browser/ui/views/clear_data_view.cc (renamed from chrome/browser/views/clear_data_view.cc)0
-rw-r--r--chrome/browser/ui/views/clear_data_view.h99
-rw-r--r--chrome/browser/ui/views/clear_server_data.cc (renamed from chrome/browser/views/clear_server_data.cc)0
-rw-r--r--chrome/browser/ui/views/clear_server_data.h118
-rw-r--r--chrome/browser/ui/views/collected_cookies_win.cc (renamed from chrome/browser/views/collected_cookies_win.cc)0
-rw-r--r--chrome/browser/ui/views/collected_cookies_win.h96
-rw-r--r--chrome/browser/ui/views/confirm_message_box_dialog.cc (renamed from chrome/browser/views/confirm_message_box_dialog.cc)0
-rw-r--r--chrome/browser/ui/views/confirm_message_box_dialog.h100
-rw-r--r--chrome/browser/ui/views/constrained_html_delegate_win.cc (renamed from chrome/browser/views/constrained_html_delegate_win.cc)0
-rw-r--r--chrome/browser/ui/views/constrained_window_win.cc (renamed from chrome/browser/views/constrained_window_win.cc)0
-rw-r--r--chrome/browser/ui/views/constrained_window_win.h77
-rw-r--r--chrome/browser/ui/views/content_setting_bubble_contents.cc (renamed from chrome/browser/views/content_setting_bubble_contents.cc)0
-rw-r--r--chrome/browser/ui/views/content_setting_bubble_contents.h104
-rw-r--r--chrome/browser/ui/views/cookie_info_view.cc (renamed from chrome/browser/views/cookie_info_view.cc)0
-rw-r--r--chrome/browser/ui/views/cookie_info_view.h123
-rw-r--r--chrome/browser/ui/views/create_application_shortcut_view.cc (renamed from chrome/browser/views/create_application_shortcut_view.cc)0
-rw-r--r--chrome/browser/ui/views/create_application_shortcut_view.h93
-rw-r--r--chrome/browser/ui/views/database_info_view.cc (renamed from chrome/browser/views/database_info_view.cc)0
-rw-r--r--chrome/browser/ui/views/database_info_view.h56
-rw-r--r--chrome/browser/ui/views/database_open_info_view.cc (renamed from chrome/browser/views/database_open_info_view.cc)0
-rw-r--r--chrome/browser/ui/views/database_open_info_view.h33
-rw-r--r--chrome/browser/ui/views/default_search_view.cc (renamed from chrome/browser/views/default_search_view.cc)0
-rw-r--r--chrome/browser/ui/views/default_search_view.h65
-rw-r--r--chrome/browser/ui/views/detachable_toolbar_view.cc (renamed from chrome/browser/views/detachable_toolbar_view.cc)0
-rw-r--r--chrome/browser/ui/views/detachable_toolbar_view.h91
-rw-r--r--chrome/browser/ui/views/dialog_stubs_gtk.cc (renamed from chrome/browser/views/dialog_stubs_gtk.cc)0
-rw-r--r--chrome/browser/ui/views/dom_view.cc (renamed from chrome/browser/views/dom_view.cc)0
-rw-r--r--chrome/browser/ui/views/dom_view.h59
-rw-r--r--chrome/browser/ui/views/dom_view_browsertest.cc (renamed from chrome/browser/views/dom_view_browsertest.cc)0
-rw-r--r--chrome/browser/ui/views/download_item_view.cc (renamed from chrome/browser/views/download_item_view.cc)0
-rw-r--r--chrome/browser/ui/views/download_item_view.h276
-rw-r--r--chrome/browser/ui/views/download_shelf_view.cc (renamed from chrome/browser/views/download_shelf_view.cc)0
-rw-r--r--chrome/browser/ui/views/download_shelf_view.h155
-rw-r--r--chrome/browser/ui/views/download_started_animation_win.cc (renamed from chrome/browser/views/download_started_animation_win.cc)0
-rw-r--r--chrome/browser/ui/views/dropdown_bar_host.cc (renamed from chrome/browser/views/dropdown_bar_host.cc)0
-rw-r--r--chrome/browser/ui/views/dropdown_bar_host.h188
-rw-r--r--chrome/browser/ui/views/dropdown_bar_host_gtk.cc (renamed from chrome/browser/views/dropdown_bar_host_gtk.cc)0
-rw-r--r--chrome/browser/ui/views/dropdown_bar_host_win.cc (renamed from chrome/browser/views/dropdown_bar_host_win.cc)0
-rw-r--r--chrome/browser/ui/views/dropdown_bar_view.h54
-rw-r--r--chrome/browser/ui/views/edit_search_engine_dialog.cc (renamed from chrome/browser/views/edit_search_engine_dialog.cc)0
-rw-r--r--chrome/browser/ui/views/edit_search_engine_dialog.h105
-rw-r--r--chrome/browser/ui/views/event_utils.cc (renamed from chrome/browser/views/event_utils.cc)0
-rw-r--r--chrome/browser/ui/views/event_utils.h28
-rw-r--r--chrome/browser/ui/views/extensions/browser_action_drag_data.cc (renamed from chrome/browser/views/extensions/browser_action_drag_data.cc)0
-rw-r--r--chrome/browser/ui/views/extensions/browser_action_drag_data.h64
-rw-r--r--chrome/browser/ui/views/extensions/browser_action_drag_data_unittest.cc (renamed from chrome/browser/views/extensions/browser_action_drag_data_unittest.cc)0
-rw-r--r--chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc (renamed from chrome/browser/views/extensions/browser_action_overflow_menu_controller.cc)0
-rw-r--r--chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h117
-rw-r--r--chrome/browser/ui/views/extensions/extension_install_prompt.cc (renamed from chrome/browser/views/extensions/extension_install_prompt.cc)0
-rw-r--r--chrome/browser/ui/views/extensions/extension_install_prompt2.cc (renamed from chrome/browser/views/extensions/extension_install_prompt2.cc)0
-rw-r--r--chrome/browser/ui/views/extensions/extension_installed_bubble.cc (renamed from chrome/browser/views/extensions/extension_installed_bubble.cc)0
-rw-r--r--chrome/browser/ui/views/extensions/extension_installed_bubble.h85
-rw-r--r--chrome/browser/ui/views/extensions/extension_popup.cc (renamed from chrome/browser/views/extensions/extension_popup.cc)0
-rw-r--r--chrome/browser/ui/views/extensions/extension_popup.h224
-rw-r--r--chrome/browser/ui/views/extensions/extension_view.cc (renamed from chrome/browser/views/extensions/extension_view.cc)0
-rw-r--r--chrome/browser/ui/views/extensions/extension_view.h112
-rw-r--r--chrome/browser/ui/views/external_protocol_dialog.cc (renamed from chrome/browser/views/external_protocol_dialog.cc)0
-rw-r--r--chrome/browser/ui/views/external_protocol_dialog.h59
-rw-r--r--chrome/browser/ui/views/find_bar_host.cc (renamed from chrome/browser/views/find_bar_host.cc)0
-rw-r--r--chrome/browser/ui/views/find_bar_host.h130
-rw-r--r--chrome/browser/ui/views/find_bar_host_gtk.cc (renamed from chrome/browser/views/find_bar_host_gtk.cc)0
-rw-r--r--chrome/browser/ui/views/find_bar_host_interactive_uitest.cc (renamed from chrome/browser/views/find_bar_host_interactive_uitest.cc)0
-rw-r--r--chrome/browser/ui/views/find_bar_host_uitest.cc (renamed from chrome/browser/views/find_bar_host_uitest.cc)0
-rw-r--r--chrome/browser/ui/views/find_bar_host_win.cc (renamed from chrome/browser/views/find_bar_host_win.cc)0
-rw-r--r--chrome/browser/ui/views/find_bar_view.cc (renamed from chrome/browser/views/find_bar_view.cc)0
-rw-r--r--chrome/browser/ui/views/find_bar_view.h126
-rw-r--r--chrome/browser/ui/views/first_run_bubble.cc (renamed from chrome/browser/views/first_run_bubble.cc)0
-rw-r--r--chrome/browser/ui/views/first_run_bubble.h56
-rw-r--r--chrome/browser/ui/views/first_run_search_engine_view.cc (renamed from chrome/browser/views/first_run_search_engine_view.cc)0
-rw-r--r--chrome/browser/ui/views/first_run_search_engine_view.h144
-rw-r--r--chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc (renamed from chrome/browser/views/frame/app_panel_browser_frame_view.cc)0
-rw-r--r--chrome/browser/ui/views/frame/app_panel_browser_frame_view.h130
-rw-r--r--chrome/browser/ui/views/frame/browser_bubble_host.cc (renamed from chrome/browser/views/frame/browser_bubble_host.cc)0
-rw-r--r--chrome/browser/ui/views/frame/browser_bubble_host.h43
-rw-r--r--chrome/browser/ui/views/frame/browser_frame.h80
-rw-r--r--chrome/browser/ui/views/frame/browser_frame_gtk.cc (renamed from chrome/browser/views/frame/browser_frame_gtk.cc)0
-rw-r--r--chrome/browser/ui/views/frame/browser_frame_gtk.h85
-rw-r--r--chrome/browser/ui/views/frame/browser_frame_win.cc (renamed from chrome/browser/views/frame/browser_frame_win.cc)0
-rw-r--r--chrome/browser/ui/views/frame/browser_frame_win.h101
-rw-r--r--chrome/browser/ui/views/frame/browser_non_client_frame_view.h33
-rw-r--r--chrome/browser/ui/views/frame/browser_root_view.cc (renamed from chrome/browser/views/frame/browser_root_view.cc)0
-rw-r--r--chrome/browser/ui/views/frame/browser_root_view.h63
-rw-r--r--chrome/browser/ui/views/frame/browser_view.cc (renamed from chrome/browser/views/frame/browser_view.cc)0
-rw-r--r--chrome/browser/ui/views/frame/browser_view.h654
-rw-r--r--chrome/browser/ui/views/frame/browser_view_layout.cc (renamed from chrome/browser/views/frame/browser_view_layout.cc)0
-rw-r--r--chrome/browser/ui/views/frame/browser_view_layout.h112
-rw-r--r--chrome/browser/ui/views/frame/contents_container.cc (renamed from chrome/browser/views/frame/contents_container.cc)0
-rw-r--r--chrome/browser/ui/views/frame/contents_container.h86
-rw-r--r--chrome/browser/ui/views/frame/glass_browser_frame_view.cc (renamed from chrome/browser/views/frame/glass_browser_frame_view.cc)0
-rw-r--r--chrome/browser/ui/views/frame/glass_browser_frame_view.h103
-rw-r--r--chrome/browser/ui/views/frame/opaque_browser_frame_view.cc (renamed from chrome/browser/views/frame/opaque_browser_frame_view.cc)0
-rw-r--r--chrome/browser/ui/views/frame/opaque_browser_frame_view.h148
-rw-r--r--chrome/browser/ui/views/frame/popup_non_client_frame_view.cc (renamed from chrome/browser/views/frame/popup_non_client_frame_view.cc)0
-rw-r--r--chrome/browser/ui/views/frame/popup_non_client_frame_view.h40
-rw-r--r--chrome/browser/ui/views/fullscreen_exit_bubble.cc (renamed from chrome/browser/views/fullscreen_exit_bubble.cc)0
-rw-r--r--chrome/browser/ui/views/fullscreen_exit_bubble.h107
-rw-r--r--chrome/browser/ui/views/generic_info_view.cc (renamed from chrome/browser/views/generic_info_view.cc)0
-rw-r--r--chrome/browser/ui/views/generic_info_view.h67
-rw-r--r--chrome/browser/ui/views/generic_info_view_unittest.cc (renamed from chrome/browser/views/generic_info_view_unittest.cc)0
-rw-r--r--chrome/browser/ui/views/html_dialog_view.cc (renamed from chrome/browser/views/html_dialog_view.cc)0
-rw-r--r--chrome/browser/ui/views/html_dialog_view.h88
-rw-r--r--chrome/browser/ui/views/html_dialog_view_browsertest.cc (renamed from chrome/browser/views/html_dialog_view_browsertest.cc)0
-rw-r--r--chrome/browser/ui/views/hung_renderer_view.cc (renamed from chrome/browser/views/hung_renderer_view.cc)0
-rw-r--r--chrome/browser/ui/views/importer_lock_view.cc (renamed from chrome/browser/views/importer_lock_view.cc)0
-rw-r--r--chrome/browser/ui/views/importer_lock_view.h48
-rw-r--r--chrome/browser/ui/views/importer_view.cc (renamed from chrome/browser/views/importer_view.cc)0
-rw-r--r--chrome/browser/ui/views/importer_view.h109
-rw-r--r--chrome/browser/ui/views/importing_progress_view.cc (renamed from chrome/browser/views/importing_progress_view.cc)0
-rw-r--r--chrome/browser/ui/views/importing_progress_view.h95
-rw-r--r--chrome/browser/ui/views/indexed_db_info_view.cc (renamed from chrome/browser/views/indexed_db_info_view.cc)0
-rw-r--r--chrome/browser/ui/views/indexed_db_info_view.h55
-rw-r--r--chrome/browser/ui/views/info_bubble.cc (renamed from chrome/browser/views/info_bubble.cc)0
-rw-r--r--chrome/browser/ui/views/info_bubble.h307
-rw-r--r--chrome/browser/ui/views/info_bubble_unittest.cc (renamed from chrome/browser/views/info_bubble_unittest.cc)0
-rw-r--r--chrome/browser/ui/views/infobars/after_translate_infobar.cc (renamed from chrome/browser/views/infobars/after_translate_infobar.cc)0
-rw-r--r--chrome/browser/ui/views/infobars/after_translate_infobar.h79
-rw-r--r--chrome/browser/ui/views/infobars/before_translate_infobar.cc (renamed from chrome/browser/views/infobars/before_translate_infobar.cc)0
-rw-r--r--chrome/browser/ui/views/infobars/before_translate_infobar.h76
-rw-r--r--chrome/browser/ui/views/infobars/extension_infobar.cc (renamed from chrome/browser/views/infobars/extension_infobar.cc)0
-rw-r--r--chrome/browser/ui/views/infobars/extension_infobar.h72
-rw-r--r--chrome/browser/ui/views/infobars/infobar_button_border.cc (renamed from chrome/browser/views/infobars/infobar_button_border.cc)0
-rw-r--r--chrome/browser/ui/views/infobars/infobar_button_border.h53
-rw-r--r--chrome/browser/ui/views/infobars/infobar_container.cc (renamed from chrome/browser/views/infobars/infobar_container.cc)0
-rw-r--r--chrome/browser/ui/views/infobars/infobar_container.h94
-rw-r--r--chrome/browser/ui/views/infobars/infobar_text_button.cc (renamed from chrome/browser/views/infobars/infobar_text_button.cc)0
-rw-r--r--chrome/browser/ui/views/infobars/infobar_text_button.h38
-rw-r--r--chrome/browser/ui/views/infobars/infobars.cc (renamed from chrome/browser/views/infobars/infobars.cc)0
-rw-r--r--chrome/browser/ui/views/infobars/infobars.h251
-rw-r--r--chrome/browser/ui/views/infobars/translate_infobar_base.cc (renamed from chrome/browser/views/infobars/translate_infobar_base.cc)0
-rw-r--r--chrome/browser/ui/views/infobars/translate_infobar_base.h75
-rw-r--r--chrome/browser/ui/views/infobars/translate_message_infobar.cc (renamed from chrome/browser/views/infobars/translate_message_infobar.cc)0
-rw-r--r--chrome/browser/ui/views/infobars/translate_message_infobar.h29
-rw-r--r--chrome/browser/ui/views/instant_confirm_view.cc (renamed from chrome/browser/views/instant_confirm_view.cc)0
-rw-r--r--chrome/browser/ui/views/instant_confirm_view.h41
-rw-r--r--chrome/browser/ui/views/js_modal_dialog_views.cc (renamed from chrome/browser/views/js_modal_dialog_views.cc)0
-rw-r--r--chrome/browser/ui/views/js_modal_dialog_views.h60
-rw-r--r--chrome/browser/ui/views/keyword_editor_view.cc (renamed from chrome/browser/views/keyword_editor_view.cc)0
-rw-r--r--chrome/browser/ui/views/keyword_editor_view.h117
-rw-r--r--chrome/browser/ui/views/list_background.h37
-rw-r--r--chrome/browser/ui/views/local_storage_info_view.cc (renamed from chrome/browser/views/local_storage_info_view.cc)0
-rw-r--r--chrome/browser/ui/views/local_storage_info_view.h57
-rw-r--r--chrome/browser/ui/views/local_storage_set_item_info_view.cc (renamed from chrome/browser/views/local_storage_set_item_info_view.cc)0
-rw-r--r--chrome/browser/ui/views/local_storage_set_item_info_view.h60
-rw-r--r--chrome/browser/ui/views/location_bar/click_handler.cc (renamed from chrome/browser/views/location_bar/click_handler.cc)0
-rw-r--r--chrome/browser/ui/views/location_bar/click_handler.h34
-rw-r--r--chrome/browser/ui/views/location_bar/content_setting_image_view.cc (renamed from chrome/browser/views/location_bar/content_setting_image_view.cc)0
-rw-r--r--chrome/browser/ui/views/location_bar/content_setting_image_view.h61
-rw-r--r--chrome/browser/ui/views/location_bar/ev_bubble_view.cc (renamed from chrome/browser/views/location_bar/ev_bubble_view.cc)0
-rw-r--r--chrome/browser/ui/views/location_bar/ev_bubble_view.h38
-rw-r--r--chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc (renamed from chrome/browser/views/location_bar/icon_label_bubble_view.cc)0
-rw-r--r--chrome/browser/ui/views/location_bar/icon_label_bubble_view.h64
-rw-r--r--chrome/browser/ui/views/location_bar/keyword_hint_view.cc (renamed from chrome/browser/views/location_bar/keyword_hint_view.cc)0
-rw-r--r--chrome/browser/ui/views/location_bar/keyword_hint_view.h62
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.cc (renamed from chrome/browser/views/location_bar/location_bar_view.cc)0
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.h404
-rw-r--r--chrome/browser/ui/views/location_bar/location_icon_view.cc (renamed from chrome/browser/views/location_bar/location_icon_view.cc)0
-rw-r--r--chrome/browser/ui/views/location_bar/location_icon_view.h35
-rw-r--r--chrome/browser/ui/views/location_bar/page_action_image_view.cc (renamed from chrome/browser/views/location_bar/page_action_image_view.cc)0
-rw-r--r--chrome/browser/ui/views/location_bar/page_action_image_view.h113
-rw-r--r--chrome/browser/ui/views/location_bar/page_action_with_badge_view.cc (renamed from chrome/browser/views/location_bar/page_action_with_badge_view.cc)0
-rw-r--r--chrome/browser/ui/views/location_bar/page_action_with_badge_view.h37
-rw-r--r--chrome/browser/ui/views/location_bar/selected_keyword_view.cc (renamed from chrome/browser/views/location_bar/selected_keyword_view.cc)0
-rw-r--r--chrome/browser/ui/views/location_bar/selected_keyword_view.h59
-rw-r--r--chrome/browser/ui/views/location_bar/star_view.cc (renamed from chrome/browser/views/location_bar/star_view.cc)0
-rw-r--r--chrome/browser/ui/views/location_bar/star_view.h48
-rw-r--r--chrome/browser/ui/views/login_view.cc (renamed from chrome/browser/views/login_view.cc)0
-rw-r--r--chrome/browser/ui/views/login_view.h82
-rw-r--r--chrome/browser/ui/views/modal_dialog_delegate.cc (renamed from chrome/browser/views/modal_dialog_delegate.cc)0
-rw-r--r--chrome/browser/ui/views/modal_dialog_delegate.h31
-rw-r--r--chrome/browser/ui/views/notifications/balloon_view.cc (renamed from chrome/browser/views/notifications/balloon_view.cc)0
-rw-r--r--chrome/browser/ui/views/notifications/balloon_view.h171
-rw-r--r--chrome/browser/ui/views/notifications/balloon_view_host.cc (renamed from chrome/browser/views/notifications/balloon_view_host.cc)0
-rw-r--r--chrome/browser/ui/views/notifications/balloon_view_host.h59
-rw-r--r--chrome/browser/ui/views/options/advanced_contents_view.cc (renamed from chrome/browser/views/options/advanced_contents_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/advanced_contents_view.h39
-rw-r--r--chrome/browser/ui/views/options/advanced_page_view.cc (renamed from chrome/browser/views/options/advanced_page_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/advanced_page_view.h46
-rw-r--r--chrome/browser/ui/views/options/content_exceptions_table_view.cc (renamed from chrome/browser/views/options/content_exceptions_table_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/content_exceptions_table_view.h31
-rw-r--r--chrome/browser/ui/views/options/content_filter_page_view.cc (renamed from chrome/browser/views/options/content_filter_page_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/content_filter_page_view.h49
-rw-r--r--chrome/browser/ui/views/options/content_page_view.cc (renamed from chrome/browser/views/options/content_page_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/content_page_view.h117
-rw-r--r--chrome/browser/ui/views/options/content_settings_window_view.cc (renamed from chrome/browser/views/options/content_settings_window_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/content_settings_window_view.h92
-rw-r--r--chrome/browser/ui/views/options/cookie_filter_page_view.cc (renamed from chrome/browser/views/options/cookie_filter_page_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/cookie_filter_page_view.h52
-rw-r--r--chrome/browser/ui/views/options/cookies_view.cc (renamed from chrome/browser/views/options/cookies_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/cookies_view.h159
-rw-r--r--chrome/browser/ui/views/options/exception_editor_view.cc (renamed from chrome/browser/views/options/exception_editor_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/exception_editor_view.h114
-rw-r--r--chrome/browser/ui/views/options/exceptions_page_view.cc (renamed from chrome/browser/views/options/exceptions_page_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/exceptions_page_view.h75
-rw-r--r--chrome/browser/ui/views/options/exceptions_view.cc (renamed from chrome/browser/views/options/exceptions_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/exceptions_view.h117
-rw-r--r--chrome/browser/ui/views/options/fonts_languages_window_view.cc (renamed from chrome/browser/views/options/fonts_languages_window_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/fonts_languages_window_view.h74
-rw-r--r--chrome/browser/ui/views/options/fonts_page_view.cc (renamed from chrome/browser/views/options/fonts_page_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/fonts_page_view.h130
-rw-r--r--chrome/browser/ui/views/options/general_page_view.cc (renamed from chrome/browser/views/options/general_page_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/general_page_view.h172
-rw-r--r--chrome/browser/ui/views/options/languages_page_view.cc (renamed from chrome/browser/views/options/languages_page_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/languages_page_view.h119
-rw-r--r--chrome/browser/ui/views/options/managed_prefs_banner_view.cc (renamed from chrome/browser/views/options/managed_prefs_banner_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/managed_prefs_banner_view.h52
-rw-r--r--chrome/browser/ui/views/options/options_group_view.cc (renamed from chrome/browser/views/options/options_group_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/options_group_view.h63
-rw-r--r--chrome/browser/ui/views/options/options_page_view.cc (renamed from chrome/browser/views/options/options_page_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/options_page_view.h52
-rw-r--r--chrome/browser/ui/views/options/options_window_view.cc (renamed from chrome/browser/views/options/options_window_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/passwords_exceptions_window_view.cc (renamed from chrome/browser/views/options/passwords_exceptions_window_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/passwords_exceptions_window_view.h67
-rw-r--r--chrome/browser/ui/views/options/passwords_page_view.cc (renamed from chrome/browser/views/options/passwords_page_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/passwords_page_view.h200
-rw-r--r--chrome/browser/ui/views/options/plugin_filter_page_view.cc (renamed from chrome/browser/views/options/plugin_filter_page_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/plugin_filter_page_view.h32
-rw-r--r--chrome/browser/ui/views/options/simple_content_exceptions_view.cc (renamed from chrome/browser/views/options/simple_content_exceptions_view.cc)0
-rw-r--r--chrome/browser/ui/views/options/simple_content_exceptions_view.h95
-rw-r--r--chrome/browser/ui/views/page_info_bubble_view.cc (renamed from chrome/browser/views/page_info_bubble_view.cc)0
-rw-r--r--chrome/browser/ui/views/page_info_bubble_view.h83
-rw-r--r--chrome/browser/ui/views/pinned_contents_info_bubble.cc (renamed from chrome/browser/views/pinned_contents_info_bubble.cc)0
-rw-r--r--chrome/browser/ui/views/pinned_contents_info_bubble.h68
-rw-r--r--chrome/browser/ui/views/reload_button.cc (renamed from chrome/browser/views/reload_button.cc)0
-rw-r--r--chrome/browser/ui/views/reload_button.h82
-rw-r--r--chrome/browser/ui/views/reload_button_unittest.cc (renamed from chrome/browser/views/reload_button_unittest.cc)0
-rw-r--r--chrome/browser/ui/views/repost_form_warning_view.cc (renamed from chrome/browser/views/repost_form_warning_view.cc)0
-rw-r--r--chrome/browser/ui/views/repost_form_warning_view.h57
-rw-r--r--chrome/browser/ui/views/restart_message_box.cc (renamed from chrome/browser/views/restart_message_box.cc)0
-rw-r--r--chrome/browser/ui/views/restart_message_box.h43
-rw-r--r--chrome/browser/ui/views/sad_tab_view.cc (renamed from chrome/browser/views/sad_tab_view.cc)0
-rw-r--r--chrome/browser/ui/views/sad_tab_view.h62
-rw-r--r--chrome/browser/ui/views/select_file_dialog.cc (renamed from chrome/browser/views/select_file_dialog.cc)0
-rw-r--r--chrome/browser/ui/views/shell_dialogs_win.cc (renamed from chrome/browser/views/shell_dialogs_win.cc)0
-rw-r--r--chrome/browser/ui/views/shell_dialogs_win_unittest.cc (renamed from chrome/browser/views/shell_dialogs_win_unittest.cc)0
-rw-r--r--chrome/browser/ui/views/ssl_client_certificate_selector_win.cc (renamed from chrome/browser/views/ssl_client_certificate_selector_win.cc)0
-rw-r--r--chrome/browser/ui/views/status_bubble_views.cc (renamed from chrome/browser/views/status_bubble_views.cc)0
-rw-r--r--chrome/browser/ui/views/status_bubble_views.h136
-rw-r--r--chrome/browser/ui/views/status_icons/status_icon_win.cc (renamed from chrome/browser/views/status_icons/status_icon_win.cc)0
-rw-r--r--chrome/browser/ui/views/status_icons/status_icon_win.h65
-rw-r--r--chrome/browser/ui/views/status_icons/status_tray_gtk.cc (renamed from chrome/browser/views/status_icons/status_tray_gtk.cc)0
-rw-r--r--chrome/browser/ui/views/status_icons/status_tray_win.cc (renamed from chrome/browser/views/status_icons/status_tray_win.cc)0
-rw-r--r--chrome/browser/ui/views/status_icons/status_tray_win.h43
-rw-r--r--chrome/browser/ui/views/status_icons/status_tray_win_unittest.cc (renamed from chrome/browser/views/status_icons/status_tray_win_unittest.cc)0
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_container.h48
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc (renamed from chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc)0
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.h46
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc (renamed from chrome/browser/views/tab_contents/native_tab_contents_container_win.cc)0
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.h41
-rw-r--r--chrome/browser/ui/views/tab_contents/render_view_context_menu_views.cc (renamed from chrome/browser/views/tab_contents/render_view_context_menu_views.cc)0
-rw-r--r--chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h47
-rw-r--r--chrome/browser/ui/views/tab_contents/tab_contents_container.cc (renamed from chrome/browser/views/tab_contents/tab_contents_container.cc)0
-rw-r--r--chrome/browser/ui/views/tab_contents/tab_contents_container.h81
-rw-r--r--chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc (renamed from chrome/browser/views/tab_contents/tab_contents_drag_win.cc)0
-rw-r--r--chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h100
-rw-r--r--chrome/browser/ui/views/tab_contents/tab_contents_view_gtk.cc (renamed from chrome/browser/views/tab_contents/tab_contents_view_gtk.cc)0
-rw-r--r--chrome/browser/ui/views/tab_contents/tab_contents_view_gtk.h141
-rw-r--r--chrome/browser/ui/views/tab_contents/tab_contents_view_win.cc (renamed from chrome/browser/views/tab_contents/tab_contents_view_win.cc)0
-rw-r--r--chrome/browser/ui/views/tab_contents/tab_contents_view_win.h152
-rw-r--r--chrome/browser/ui/views/tab_icon_view.cc (renamed from chrome/browser/views/tab_icon_view.cc)0
-rw-r--r--chrome/browser/ui/views/tab_icon_view.h73
-rw-r--r--chrome/browser/ui/views/tabs/base_tab.cc (renamed from chrome/browser/views/tabs/base_tab.cc)0
-rw-r--r--chrome/browser/ui/views/tabs/base_tab.h204
-rw-r--r--chrome/browser/ui/views/tabs/base_tab_strip.cc (renamed from chrome/browser/views/tabs/base_tab_strip.cc)0
-rw-r--r--chrome/browser/ui/views/tabs/base_tab_strip.h266
-rw-r--r--chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc (renamed from chrome/browser/views/tabs/browser_tab_strip_controller.cc)0
-rw-r--r--chrome/browser/ui/views/tabs/browser_tab_strip_controller.h121
-rw-r--r--chrome/browser/ui/views/tabs/dragged_tab_controller.cc (renamed from chrome/browser/views/tabs/dragged_tab_controller.cc)0
-rw-r--r--chrome/browser/ui/views/tabs/dragged_tab_controller.h339
-rw-r--r--chrome/browser/ui/views/tabs/dragged_tab_view.cc (renamed from chrome/browser/views/tabs/dragged_tab_view.cc)0
-rw-r--r--chrome/browser/ui/views/tabs/dragged_tab_view.h103
-rw-r--r--chrome/browser/ui/views/tabs/native_view_photobooth.h44
-rw-r--r--chrome/browser/ui/views/tabs/native_view_photobooth_gtk.cc (renamed from chrome/browser/views/tabs/native_view_photobooth_gtk.cc)0
-rw-r--r--chrome/browser/ui/views/tabs/native_view_photobooth_gtk.h30
-rw-r--r--chrome/browser/ui/views/tabs/native_view_photobooth_win.cc (renamed from chrome/browser/views/tabs/native_view_photobooth_win.cc)0
-rw-r--r--chrome/browser/ui/views/tabs/native_view_photobooth_win.h58
-rw-r--r--chrome/browser/ui/views/tabs/side_tab.cc (renamed from chrome/browser/views/tabs/side_tab.cc)0
-rw-r--r--chrome/browser/ui/views/tabs/side_tab.h44
-rw-r--r--chrome/browser/ui/views/tabs/side_tab_strip.cc (renamed from chrome/browser/views/tabs/side_tab_strip.cc)0
-rw-r--r--chrome/browser/ui/views/tabs/side_tab_strip.h67
-rw-r--r--chrome/browser/ui/views/tabs/tab.cc (renamed from chrome/browser/views/tabs/tab.cc)0
-rw-r--r--chrome/browser/ui/views/tabs/tab.h141
-rw-r--r--chrome/browser/ui/views/tabs/tab_controller.h59
-rw-r--r--chrome/browser/ui/views/tabs/tab_dragging_test.cc (renamed from chrome/browser/views/tabs/tab_dragging_test.cc)0
-rw-r--r--chrome/browser/ui/views/tabs/tab_renderer_data.h46
-rw-r--r--chrome/browser/ui/views/tabs/tab_strip.cc (renamed from chrome/browser/views/tabs/tab_strip.cc)0
-rw-r--r--chrome/browser/ui/views/tabs/tab_strip.h287
-rw-r--r--chrome/browser/ui/views/tabs/tab_strip_controller.h73
-rw-r--r--chrome/browser/ui/views/task_manager_view.cc (renamed from chrome/browser/views/task_manager_view.cc)0
-rw-r--r--chrome/browser/ui/views/textfield_views.cc (renamed from chrome/browser/views/textfield_views.cc)0
-rw-r--r--chrome/browser/ui/views/textfield_views.h27
-rw-r--r--chrome/browser/ui/views/theme_background.cc (renamed from chrome/browser/views/theme_background.cc)0
-rw-r--r--chrome/browser/ui/views/theme_background.h41
-rw-r--r--chrome/browser/ui/views/theme_helpers.cc (renamed from chrome/browser/views/theme_helpers.cc)0
-rw-r--r--chrome/browser/ui/views/theme_helpers.h30
-rw-r--r--chrome/browser/ui/views/theme_install_bubble_view.cc (renamed from chrome/browser/views/theme_install_bubble_view.cc)0
-rw-r--r--chrome/browser/ui/views/theme_install_bubble_view.h79
-rw-r--r--chrome/browser/ui/views/toolbar_view.cc (renamed from chrome/browser/views/toolbar_view.cc)0
-rw-r--r--chrome/browser/ui/views/toolbar_view.h236
-rw-r--r--chrome/browser/ui/views/unhandled_keyboard_event_handler.cc (renamed from chrome/browser/views/unhandled_keyboard_event_handler.cc)0
-rw-r--r--chrome/browser/ui/views/unhandled_keyboard_event_handler.h40
-rw-r--r--chrome/browser/ui/views/uninstall_view.cc (renamed from chrome/browser/views/uninstall_view.cc)0
-rw-r--r--chrome/browser/ui/views/uninstall_view.h62
-rw-r--r--chrome/browser/ui/views/update_recommended_message_box.cc (renamed from chrome/browser/views/update_recommended_message_box.cc)0
-rw-r--r--chrome/browser/ui/views/update_recommended_message_box.h46
-rw-r--r--chrome/browser/ui/views/url_picker.cc (renamed from chrome/browser/views/url_picker.cc)0
-rw-r--r--chrome/browser/ui/views/url_picker.h110
-rw-r--r--chrome/browser/ui/views/user_data_dir_dialog.cc (renamed from chrome/browser/views/user_data_dir_dialog.cc)0
-rw-r--r--chrome/browser/ui/views/user_data_dir_dialog.h72
-rw-r--r--chrome/browser/ui/views/window.cc (renamed from chrome/browser/views/window.cc)0
-rw-r--r--chrome/browser/ui/views/window.h29
-rw-r--r--chrome/browser/ui/views/wrench_menu.cc (renamed from chrome/browser/views/wrench_menu.cc)0
-rw-r--r--chrome/browser/ui/views/wrench_menu.h92
-rw-r--r--chrome/browser/views/about_chrome_view.h168
-rw-r--r--chrome/browser/views/about_ipc_dialog.h74
-rw-r--r--chrome/browser/views/accelerator_table_gtk.h27
-rw-r--r--chrome/browser/views/accessibility_event_router_views.h147
-rw-r--r--chrome/browser/views/accessible_pane_view.h93
-rw-r--r--chrome/browser/views/accessible_view_helper.h76
-rw-r--r--chrome/browser/views/appcache_info_view.h15
-rw-r--r--chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h170
-rw-r--r--chrome/browser/views/autocomplete/autocomplete_popup_gtk.h21
-rw-r--r--chrome/browser/views/autocomplete/autocomplete_popup_win.h26
-rw-r--r--chrome/browser/views/autofill_profiles_view_win.h433
-rw-r--r--chrome/browser/views/bookmark_bar_instructions_view.h61
-rw-r--r--chrome/browser/views/bookmark_bar_view.h501
-rw-r--r--chrome/browser/views/bookmark_bubble_view.h155
-rw-r--r--chrome/browser/views/bookmark_context_menu.h69
-rw-r--r--chrome/browser/views/bookmark_context_menu_controller_views.h86
-rw-r--r--chrome/browser/views/bookmark_editor_view.h258
-rw-r--r--chrome/browser/views/bookmark_editor_viw.h0
-rw-r--r--chrome/browser/views/bookmark_menu_controller_views.h193
-rw-r--r--chrome/browser/views/browser_actions_container.h502
-rw-r--r--chrome/browser/views/browser_bubble.h124
-rw-r--r--chrome/browser/views/browser_dialogs.h123
-rw-r--r--chrome/browser/views/bubble_border.h165
-rw-r--r--chrome/browser/views/chrome_views_delegate.h32
-rw-r--r--chrome/browser/views/clear_browsing_data.h123
-rw-r--r--chrome/browser/views/clear_browsing_data_view.h116
-rw-r--r--chrome/browser/views/clear_data_view.h92
-rw-r--r--chrome/browser/views/clear_server_data.h111
-rw-r--r--chrome/browser/views/collected_cookies_win.h89
-rw-r--r--chrome/browser/views/confirm_message_box_dialog.h95
-rw-r--r--chrome/browser/views/constrained_window_win.h72
-rw-r--r--chrome/browser/views/content_setting_bubble_contents.h97
-rw-r--r--chrome/browser/views/cookie_info_view.h114
-rw-r--r--chrome/browser/views/create_application_shortcut_view.h86
-rw-r--r--chrome/browser/views/database_info_view.h49
-rw-r--r--chrome/browser/views/database_open_info_view.h24
-rw-r--r--chrome/browser/views/default_search_view.h58
-rw-r--r--chrome/browser/views/detachable_toolbar_view.h84
-rw-r--r--chrome/browser/views/dom_view.h54
-rw-r--r--chrome/browser/views/download_item_view.h273
-rw-r--r--chrome/browser/views/download_shelf_view.h152
-rw-r--r--chrome/browser/views/dropdown_bar_host.h181
-rw-r--r--chrome/browser/views/dropdown_bar_view.h47
-rw-r--r--chrome/browser/views/edit_search_engine_dialog.h100
-rw-r--r--chrome/browser/views/event_utils.h27
-rw-r--r--chrome/browser/views/extensions/browser_action_drag_data.h57
-rw-r--r--chrome/browser/views/extensions/browser_action_overflow_menu_controller.h110
-rw-r--r--chrome/browser/views/extensions/extension_installed_bubble.h78
-rw-r--r--chrome/browser/views/extensions/extension_popup.h219
-rw-r--r--chrome/browser/views/extensions/extension_view.h105
-rw-r--r--chrome/browser/views/external_protocol_dialog.h54
-rw-r--r--chrome/browser/views/find_bar_host.h123
-rw-r--r--chrome/browser/views/find_bar_view.h119
-rw-r--r--chrome/browser/views/first_run_bubble.h49
-rw-r--r--chrome/browser/views/first_run_search_engine_view.h135
-rw-r--r--chrome/browser/views/frame/app_panel_browser_frame_view.h123
-rw-r--r--chrome/browser/views/frame/browser_bubble_host.h36
-rw-r--r--chrome/browser/views/frame/browser_frame.h73
-rw-r--r--chrome/browser/views/frame/browser_frame_gtk.h78
-rw-r--r--chrome/browser/views/frame/browser_frame_win.h94
-rw-r--r--chrome/browser/views/frame/browser_non_client_frame_view.h26
-rw-r--r--chrome/browser/views/frame/browser_root_view.h62
-rw-r--r--chrome/browser/views/frame/browser_view.h651
-rw-r--r--chrome/browser/views/frame/browser_view_layout.h103
-rw-r--r--chrome/browser/views/frame/contents_container.h79
-rw-r--r--chrome/browser/views/frame/glass_browser_frame_view.h96
-rw-r--r--chrome/browser/views/frame/opaque_browser_frame_view.h141
-rw-r--r--chrome/browser/views/frame/popup_non_client_frame_view.h33
-rw-r--r--chrome/browser/views/fullscreen_exit_bubble.h106
-rw-r--r--chrome/browser/views/generic_info_view.h58
-rw-r--r--chrome/browser/views/html_dialog_view.h83
-rw-r--r--chrome/browser/views/importer_lock_view.h45
-rw-r--r--chrome/browser/views/importer_view.h102
-rw-r--r--chrome/browser/views/importing_progress_view.h88
-rw-r--r--chrome/browser/views/indexed_db_info_view.h48
-rw-r--r--chrome/browser/views/info_bubble.h300
-rw-r--r--chrome/browser/views/infobars/after_translate_infobar.h72
-rw-r--r--chrome/browser/views/infobars/before_translate_infobar.h69
-rw-r--r--chrome/browser/views/infobars/extension_infobar.h65
-rw-r--r--chrome/browser/views/infobars/infobar_button_border.h46
-rw-r--r--chrome/browser/views/infobars/infobar_container.h87
-rw-r--r--chrome/browser/views/infobars/infobar_text_button.h31
-rw-r--r--chrome/browser/views/infobars/infobars.h244
-rw-r--r--chrome/browser/views/infobars/translate_infobar_base.h68
-rw-r--r--chrome/browser/views/infobars/translate_message_infobar.h22
-rw-r--r--chrome/browser/views/instant_confirm_view.h34
-rw-r--r--chrome/browser/views/js_modal_dialog_views.h53
-rw-r--r--chrome/browser/views/keyword_editor_view.h110
-rw-r--r--chrome/browser/views/list_background.h28
-rw-r--r--chrome/browser/views/local_storage_info_view.h48
-rw-r--r--chrome/browser/views/local_storage_set_item_info_view.h51
-rw-r--r--chrome/browser/views/location_bar/click_handler.h25
-rw-r--r--chrome/browser/views/location_bar/content_setting_image_view.h54
-rw-r--r--chrome/browser/views/location_bar/ev_bubble_view.h29
-rw-r--r--chrome/browser/views/location_bar/icon_label_bubble_view.h57
-rw-r--r--chrome/browser/views/location_bar/keyword_hint_view.h55
-rw-r--r--chrome/browser/views/location_bar/location_bar_view.h397
-rw-r--r--chrome/browser/views/location_bar/location_icon_view.h28
-rw-r--r--chrome/browser/views/location_bar/page_action_image_view.h106
-rw-r--r--chrome/browser/views/location_bar/page_action_with_badge_view.h30
-rw-r--r--chrome/browser/views/location_bar/selected_keyword_view.h52
-rw-r--r--chrome/browser/views/location_bar/star_view.h41
-rw-r--r--chrome/browser/views/login_view.h77
-rw-r--r--chrome/browser/views/modal_dialog_delegate.h22
-rw-r--r--chrome/browser/views/notifications/balloon_view.h164
-rw-r--r--chrome/browser/views/notifications/balloon_view_host.h52
-rw-r--r--chrome/browser/views/options/advanced_contents_view.h36
-rw-r--r--chrome/browser/views/options/advanced_page_view.h39
-rw-r--r--chrome/browser/views/options/content_exceptions_table_view.h24
-rw-r--r--chrome/browser/views/options/content_filter_page_view.h42
-rw-r--r--chrome/browser/views/options/content_page_view.h110
-rw-r--r--chrome/browser/views/options/content_settings_window_view.h83
-rw-r--r--chrome/browser/views/options/cookie_filter_page_view.h43
-rw-r--r--chrome/browser/views/options/cookies_view.h152
-rw-r--r--chrome/browser/views/options/exception_editor_view.h107
-rw-r--r--chrome/browser/views/options/exceptions_page_view.h70
-rw-r--r--chrome/browser/views/options/exceptions_view.h108
-rw-r--r--chrome/browser/views/options/fonts_languages_window_view.h69
-rw-r--r--chrome/browser/views/options/fonts_page_view.h125
-rw-r--r--chrome/browser/views/options/general_page_view.h165
-rw-r--r--chrome/browser/views/options/languages_page_view.h116
-rw-r--r--chrome/browser/views/options/managed_prefs_banner_view.h45
-rw-r--r--chrome/browser/views/options/options_group_view.h60
-rw-r--r--chrome/browser/views/options/options_page_view.h49
-rw-r--r--chrome/browser/views/options/passwords_exceptions_window_view.h62
-rw-r--r--chrome/browser/views/options/passwords_page_view.h195
-rw-r--r--chrome/browser/views/options/plugin_filter_page_view.h23
-rw-r--r--chrome/browser/views/options/simple_content_exceptions_view.h86
-rw-r--r--chrome/browser/views/page_info_bubble_view.h76
-rw-r--r--chrome/browser/views/pinned_contents_info_bubble.h61
-rw-r--r--chrome/browser/views/reload_button.h79
-rw-r--r--chrome/browser/views/repost_form_warning_view.h52
-rw-r--r--chrome/browser/views/restart_message_box.h36
-rw-r--r--chrome/browser/views/sad_tab_view.h57
-rw-r--r--chrome/browser/views/status_bubble_views.h129
-rw-r--r--chrome/browser/views/status_icons/status_icon_win.h58
-rw-r--r--chrome/browser/views/status_icons/status_tray_win.h34
-rw-r--r--chrome/browser/views/tab_contents/native_tab_contents_container.h43
-rw-r--r--chrome/browser/views/tab_contents/native_tab_contents_container_gtk.h41
-rw-r--r--chrome/browser/views/tab_contents/native_tab_contents_container_win.h36
-rw-r--r--chrome/browser/views/tab_contents/render_view_context_menu_views.h40
-rw-r--r--chrome/browser/views/tab_contents/tab_contents_container.h74
-rw-r--r--chrome/browser/views/tab_contents/tab_contents_drag_win.h95
-rw-r--r--chrome/browser/views/tab_contents/tab_contents_view_gtk.h134
-rw-r--r--chrome/browser/views/tab_contents/tab_contents_view_win.h147
-rw-r--r--chrome/browser/views/tab_icon_view.h68
-rw-r--r--chrome/browser/views/tabs/base_tab.h197
-rw-r--r--chrome/browser/views/tabs/base_tab_strip.h259
-rw-r--r--chrome/browser/views/tabs/browser_tab_strip_controller.h112
-rw-r--r--chrome/browser/views/tabs/dragged_tab_controller.h332
-rw-r--r--chrome/browser/views/tabs/dragged_tab_view.h96
-rw-r--r--chrome/browser/views/tabs/native_view_photobooth.h39
-rw-r--r--chrome/browser/views/tabs/native_view_photobooth_gtk.h25
-rw-r--r--chrome/browser/views/tabs/native_view_photobooth_win.h53
-rw-r--r--chrome/browser/views/tabs/side_tab.h37
-rw-r--r--chrome/browser/views/tabs/side_tab_strip.h60
-rw-r--r--chrome/browser/views/tabs/tab.h134
-rw-r--r--chrome/browser/views/tabs/tab_controller.h52
-rw-r--r--chrome/browser/views/tabs/tab_renderer_data.h39
-rw-r--r--chrome/browser/views/tabs/tab_strip.h280
-rw-r--r--chrome/browser/views/tabs/tab_strip_controller.h66
-rw-r--r--chrome/browser/views/textfield_views.h20
-rw-r--r--chrome/browser/views/theme_background.h34
-rw-r--r--chrome/browser/views/theme_helpers.h29
-rw-r--r--chrome/browser/views/theme_install_bubble_view.h72
-rw-r--r--chrome/browser/views/toolbar_view.h229
-rw-r--r--chrome/browser/views/unhandled_keyboard_event_handler.h35
-rw-r--r--chrome/browser/views/uninstall_view.h55
-rw-r--r--chrome/browser/views/update_recommended_message_box.h43
-rw-r--r--chrome/browser/views/url_picker.h103
-rw-r--r--chrome/browser/views/user_data_dir_dialog.h67
-rw-r--r--chrome/browser/views/window.h22
-rw-r--r--chrome/browser/views/wrench_menu.h85
-rw-r--r--chrome/chrome_browser.gypi1168
-rw-r--r--chrome/chrome_tests.gypi72
548 files changed, 19194 insertions, 16958 deletions
diff --git a/chrome/browser/views/PRESUBMIT.py b/chrome/browser/ui/views/PRESUBMIT.py
index 0a3657e..0a3657e 100755
--- a/chrome/browser/views/PRESUBMIT.py
+++ b/chrome/browser/ui/views/PRESUBMIT.py
diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc
index f16f651..f16f651 100644
--- a/chrome/browser/views/about_chrome_view.cc
+++ b/chrome/browser/ui/views/about_chrome_view.cc
diff --git a/chrome/browser/ui/views/about_chrome_view.h b/chrome/browser/ui/views/about_chrome_view.h
new file mode 100644
index 0000000..a2ed439
--- /dev/null
+++ b/chrome/browser/ui/views/about_chrome_view.h
@@ -0,0 +1,173 @@
+// Copyright (c) 2006-2008 The Chromium 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_VIEWS_ABOUT_CHROME_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_ABOUT_CHROME_VIEW_H_
+#pragma once
+
+#include "views/controls/image_view.h"
+#include "views/controls/label.h"
+#include "views/controls/link.h"
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+
+#if defined(OS_WIN) || defined(OS_CHROMEOS)
+#include "chrome/browser/google/google_update.h"
+#endif
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/version_loader.h"
+#endif
+
+namespace views {
+class Textfield;
+class Throbber;
+class Window;
+}
+
+class AccessibleViewHelper;
+class Profile;
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// The AboutChromeView class is responsible for drawing the UI controls of the
+// About Chrome dialog that allows the user to see what version is installed
+// and check for updates.
+//
+////////////////////////////////////////////////////////////////////////////////
+class AboutChromeView : public views::View,
+ public views::DialogDelegate,
+ public views::LinkController
+#if defined(OS_WIN) || defined(OS_CHROMEOS)
+ , public GoogleUpdateStatusListener
+#endif
+ {
+ public:
+ explicit AboutChromeView(Profile* profile);
+ virtual ~AboutChromeView();
+
+ // Initialize the controls on the dialog.
+ void Init();
+
+ // Overridden from views::View:
+ virtual gfx::Size GetPreferredSize();
+ virtual void Layout();
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+
+ // Overridden from views::DialogDelegate:
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool IsDialogButtonEnabled(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool IsDialogButtonVisible(
+ MessageBoxFlags::DialogButton button) const;
+ virtual int GetDefaultDialogButton() const;
+ virtual bool CanResize() const;
+ virtual bool CanMaximize() const;
+ virtual bool IsAlwaysOnTop() const;
+ virtual bool HasAlwaysOnTopMenu() const;
+ virtual bool IsModal() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual bool Accept();
+ virtual views::View* GetContentsView();
+
+ // Overridden from views::LinkController:
+ virtual void LinkActivated(views::Link* source, int event_flags);
+#if defined(OS_WIN) || defined(OS_CHROMEOS)
+ // Overridden from GoogleUpdateStatusListener:
+ virtual void OnReportResults(GoogleUpdateUpgradeResult result,
+ GoogleUpdateErrorCode error_code,
+ const std::wstring& version);
+#endif
+
+ private:
+#if defined(OS_WIN) || defined(OS_CHROMEOS)
+ // Update the UI to show the status of the upgrade.
+ void UpdateStatus(GoogleUpdateUpgradeResult result,
+ GoogleUpdateErrorCode error_code);
+#endif
+
+#if defined(OS_CHROMEOS)
+ // Callback from chromeos::VersionLoader giving the version.
+ void OnOSVersion(chromeos::VersionLoader::Handle handle,
+ std::string version);
+#endif
+
+
+ Profile* profile_;
+
+ // UI elements on the dialog.
+ views::ImageView* about_dlg_background_logo_;
+ views::Label* about_title_label_;
+ views::Textfield* version_label_;
+#if defined(OS_CHROMEOS)
+ views::Textfield* os_version_label_;
+#endif
+ views::Label* copyright_label_;
+ views::Label* main_text_label_;
+ int main_text_label_height_;
+ views::Link* chromium_url_;
+ gfx::Rect chromium_url_rect_;
+ views::Link* open_source_url_;
+ gfx::Rect open_source_url_rect_;
+ views::Link* terms_of_service_url_;
+ gfx::Rect terms_of_service_url_rect_;
+ // UI elements we add to the parent view.
+ scoped_ptr<views::Throbber> throbber_;
+ views::ImageView success_indicator_;
+ views::ImageView update_available_indicator_;
+ views::ImageView timeout_indicator_;
+ views::Label update_label_;
+
+ // The dialog dimensions.
+ gfx::Size dialog_dimensions_;
+
+ // Keeps track of the visible state of the Restart Now button.
+ bool restart_button_visible_;
+
+ // The text to display as the main label of the About box. We draw this text
+ // word for word with the help of the WordIterator, and make room for URLs
+ // which are drawn using views::Link. See also |url_offsets_|.
+ std::wstring main_label_chunk1_;
+ std::wstring main_label_chunk2_;
+ std::wstring main_label_chunk3_;
+ std::wstring main_label_chunk4_;
+ std::wstring main_label_chunk5_;
+ // Determines the order of the two links we draw in the main label.
+ bool chromium_url_appears_first_;
+
+#if defined(OS_WIN) || defined(OS_CHROMEOS)
+ // The class that communicates with Google Update to find out if an update is
+ // available and asks it to start an upgrade.
+ scoped_refptr<GoogleUpdate> google_updater_;
+#endif
+
+ // Our current version.
+ std::wstring current_version_;
+
+ // Additional information about the version (channel and build number).
+ std::wstring version_details_;
+
+ // The version Google Update reports is available to us.
+ std::wstring new_version_available_;
+
+ // Whether text direction is left-to-right or right-to-left.
+ bool text_direction_is_rtl_;
+
+#if defined(OS_CHROMEOS)
+ // Handles asynchronously loading the version.
+ chromeos::VersionLoader loader_;
+
+ // Used to request the version.
+ CancelableRequestConsumer consumer_;
+#endif
+
+ scoped_ptr<AccessibleViewHelper> accessible_view_helper_;
+
+ DISALLOW_COPY_AND_ASSIGN(AboutChromeView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_ABOUT_CHROME_VIEW_H_
diff --git a/chrome/browser/views/about_ipc_dialog.cc b/chrome/browser/ui/views/about_ipc_dialog.cc
index 358e28f..358e28f 100644
--- a/chrome/browser/views/about_ipc_dialog.cc
+++ b/chrome/browser/ui/views/about_ipc_dialog.cc
diff --git a/chrome/browser/ui/views/about_ipc_dialog.h b/chrome/browser/ui/views/about_ipc_dialog.h
new file mode 100644
index 0000000..e78baad
--- /dev/null
+++ b/chrome/browser/ui/views/about_ipc_dialog.h
@@ -0,0 +1,79 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_ABOUT_IPC_DIALOG_H_
+#define CHROME_BROWSER_UI_VIEWS_ABOUT_IPC_DIALOG_H_
+#pragma once
+
+#if defined(OS_WIN) && defined(IPC_MESSAGE_LOG_ENABLED)
+
+#include <atlbase.h>
+#include <atlapp.h>
+#include <atlwin.h>
+#include <atlctrls.h>
+
+#include "base/singleton.h"
+#include "ipc/ipc_logging.h"
+#include "views/controls/button/button.h"
+#include "views/controls/table/table_view.h"
+#include "views/window/dialog_delegate.h"
+
+
+class Profile;
+namespace views {
+class NativeViewHost;
+class TextButton;
+} // namespace views
+
+class AboutIPCDialog : public views::DialogDelegate,
+ public views::ButtonListener,
+ public IPC::Logging::Consumer,
+ public views::View {
+ public:
+ // This dialog is a singleton. If the dialog is already opened, it won't do
+ // anything, so you can just blindly call this function all you want.
+ static void RunDialog();
+
+ virtual ~AboutIPCDialog();
+
+ private:
+ friend struct DefaultSingletonTraits<AboutIPCDialog>;
+
+ AboutIPCDialog();
+
+ // Sets up all UI controls for the dialog.
+ void SetupControls();
+
+ // views::View overrides.
+ virtual gfx::Size GetPreferredSize();
+ virtual views::View* GetContentsView();
+ virtual int GetDialogButtons() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual void Layout();
+
+ // IPC::Logging::Consumer implementation.
+ virtual void Log(const IPC::LogData& data);
+
+ // views::WindowDelegate (via view::DialogDelegate).
+ virtual bool CanResize() const;
+
+ // views::ButtonListener.
+ virtual void ButtonPressed(views::Button* button, const views::Event& event);
+
+ WTL::CListViewCtrl message_list_;
+
+ views::TextButton* track_toggle_;
+ views::TextButton* clear_button_;
+ views::TextButton* filter_button_;
+ views::NativeViewHost* table_;
+
+ // Set to true when we're tracking network status.
+ bool tracking_;
+
+ DISALLOW_COPY_AND_ASSIGN(AboutIPCDialog);
+};
+
+#endif // OS_WIN && IPC_MESSAGE_LOG_ENABLED
+
+#endif // CHROME_BROWSER_UI_VIEWS_ABOUT_IPC_DIALOG_H_
diff --git a/chrome/browser/views/accelerator_table_gtk.cc b/chrome/browser/ui/views/accelerator_table_gtk.cc
index 261420e..261420e 100644
--- a/chrome/browser/views/accelerator_table_gtk.cc
+++ b/chrome/browser/ui/views/accelerator_table_gtk.cc
diff --git a/chrome/browser/ui/views/accelerator_table_gtk.h b/chrome/browser/ui/views/accelerator_table_gtk.h
new file mode 100644
index 0000000..4b38144
--- /dev/null
+++ b/chrome/browser/ui/views/accelerator_table_gtk.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_ACCELERATOR_TABLE_GTK_H_
+#define CHROME_BROWSER_UI_VIEWS_ACCELERATOR_TABLE_GTK_H_
+#pragma once
+
+#include <stdio.h>
+
+#include "app/keyboard_codes.h"
+
+// This contains the list of accelerators for the Linux toolkit_view
+// implementation.
+namespace browser {
+
+ struct AcceleratorMapping {
+ app::KeyboardCode keycode;
+ bool shift_pressed;
+ bool ctrl_pressed;
+ bool alt_pressed;
+ int command_id;
+ };
+
+ // The list of accelerators.
+ extern const AcceleratorMapping kAcceleratorMap[];
+
+ // The numbers of elements in kAcceleratorMap.
+ extern const size_t kAcceleratorMapLength;
+}
+
+#endif // CHROME_BROWSER_UI_VIEWS_ACCELERATOR_TABLE_GTK_H_
diff --git a/chrome/browser/views/accessibility_event_router_views.cc b/chrome/browser/ui/views/accessibility_event_router_views.cc
index 4b1ad00..4b1ad00 100644
--- a/chrome/browser/views/accessibility_event_router_views.cc
+++ b/chrome/browser/ui/views/accessibility_event_router_views.cc
diff --git a/chrome/browser/ui/views/accessibility_event_router_views.h b/chrome/browser/ui/views/accessibility_event_router_views.h
new file mode 100644
index 0000000..3748474
--- /dev/null
+++ b/chrome/browser/ui/views/accessibility_event_router_views.h
@@ -0,0 +1,154 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_ACCESSIBILITY_EVENT_ROUTER_VIEWS_H_
+#define CHROME_BROWSER_UI_VIEWS_ACCESSIBILITY_EVENT_ROUTER_VIEWS_H_
+#pragma once
+
+#include <string>
+
+#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"
+#include "views/accessibility/accessibility_types.h"
+
+class Profile;
+namespace views {
+class View;
+}
+
+// Allows us to use (View*) in a hash_map with gcc.
+#if defined(COMPILER_GCC)
+namespace __gnu_cxx {
+template<>
+struct hash<views::View*> {
+ size_t operator()(views::View* view) const {
+ return reinterpret_cast<size_t>(view);
+ }
+};
+} // namespace __gnu_cxx
+#endif // defined(COMPILER_GCC)
+
+// 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 listeners to many views, then sends an
+// accessibility notification whenever a relevant event occurs in an
+// accessible view.
+//
+// Views 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 AccessibilityEventRouterViews {
+ public:
+ // Internal information about a particular view to override the
+ // information we get directly from the view.
+ struct ViewInfo {
+ ViewInfo() : ignore(false) {}
+
+ // If nonempty, will use this name instead of the view's label.
+ std::string name;
+
+ // If true, will ignore this widget and not send accessibility events.
+ bool ignore;
+ };
+
+ // Get the single instance of this class.
+ static AccessibilityEventRouterViews* GetInstance();
+
+ // Start sending accessibility events for this view and all of its
+ // descendants. Notifications will go to the specified profile.
+ // Returns true on success, false if "view" was already registered.
+ // It is the responsibility of the caller to call RemoveViewTree if
+ // this view is ever deleted; consider using AccessibleViewHelper.
+ bool AddViewTree(views::View* view, Profile* profile);
+
+ // Stop sending accessibility events for this view and all of its
+ // descendants.
+ void RemoveViewTree(views::View* view);
+
+ // Don't send any events for this view.
+ void IgnoreView(views::View* view);
+
+ // Use the following string as the name of this view, instead of the
+ // gtk label associated with the view.
+ void SetViewName(views::View* view, std::string name);
+
+ // Forget all information about this view.
+ void RemoveView(views::View* view);
+
+ // Handle an accessibility event generated by a view.
+ void HandleAccessibilityEvent(
+ views::View* view, AccessibilityTypes::Event event_type);
+
+ private:
+ AccessibilityEventRouterViews();
+ virtual ~AccessibilityEventRouterViews();
+
+ friend struct DefaultSingletonTraits<AccessibilityEventRouterViews>;
+ FRIEND_TEST_ALL_PREFIXES(AccessibilityEventRouterViewsTest,
+ TestFocusNotification);
+
+ // Given a view, determine if it's part of a view tree that's mapped to
+ // a profile and if so, if it's marked as accessible.
+ void FindView(views::View* view, Profile** profile, bool* is_accessible);
+
+ // Checks the type of the view and calls one of the more specific
+ // Send*Notification methods, below.
+ void DispatchAccessibilityNotification(
+ views::View* view, NotificationType type);
+
+ // Return the name of a view.
+ std::string GetViewName(views::View* view);
+
+ // Each of these methods constructs an AccessibilityControlInfo object
+ // and sends a notification of a specific accessibility event.
+ void SendButtonNotification(
+ views::View* view, NotificationType type, Profile* profile);
+ void SendLinkNotification(
+ views::View* view, NotificationType type, Profile* profile);
+ void SendMenuNotification(
+ views::View* view, NotificationType type, Profile* profile);
+ void SendMenuItemNotification(
+ views::View* view, NotificationType type, Profile* profile);
+ void SendLocationBarNotification(
+ views::View* view, NotificationType type, Profile* profile);
+
+ // Return true if it's an event on a menu.
+ bool IsMenuEvent(views::View* view, NotificationType type);
+
+ // Recursively explore all menu items of |menu| and return in |count|
+ // the total number of items, and in |index| the 0-based index of
+ // |item|, if found. Initialize |count| to zero before calling this
+ // method. |index| will be unchanged if the item is not found, so
+ // initialize it to -1 to detect this case.
+ void RecursiveGetMenuItemIndexAndCount(
+ views::View* menu, views::View* item, int* index, int* count);
+
+ // The set of all view tree roots; only descendants of these will generate
+ // accessibility notifications.
+ base::hash_map<views::View*, Profile*> view_tree_profile_map_;
+
+ // Extra information about specific views.
+ base::hash_map<views::View*, ViewInfo> view_info_map_;
+
+ // 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_;
+
+ // Used to defer handling of some events until the next time
+ // through the event loop.
+ ScopedRunnableMethodFactory<AccessibilityEventRouterViews> method_factory_;
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_ACCESSIBILITY_EVENT_ROUTER_VIEWS_H_
diff --git a/chrome/browser/views/accessibility_event_router_views_unittest.cc b/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc
index 7e51ab2..7e51ab2 100644
--- a/chrome/browser/views/accessibility_event_router_views_unittest.cc
+++ b/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc
diff --git a/chrome/browser/views/accessible_pane_view.cc b/chrome/browser/ui/views/accessible_pane_view.cc
index b876940..b876940 100644
--- a/chrome/browser/views/accessible_pane_view.cc
+++ b/chrome/browser/ui/views/accessible_pane_view.cc
diff --git a/chrome/browser/ui/views/accessible_pane_view.h b/chrome/browser/ui/views/accessible_pane_view.h
new file mode 100644
index 0000000..349fc0d
--- /dev/null
+++ b/chrome/browser/ui/views/accessible_pane_view.h
@@ -0,0 +1,100 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_ACCESSIBLE_PANE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_ACCESSIBLE_PANE_VIEW_H_
+#pragma once
+
+#include "base/hash_tables.h"
+#include "base/scoped_ptr.h"
+#include "base/task.h"
+#include "views/focus/focus_manager.h"
+#include "views/view.h"
+
+namespace views {
+class FocusSearch;
+}
+
+// This class provides keyboard access to any view that extends it, typically
+// a toolbar. The user sets focus to a control in this view by pressing
+// F6 to traverse all panes, or by pressing a shortcut that jumps directly
+// to this pane.
+class AccessiblePaneView : public views::View,
+ public views::FocusChangeListener,
+ public views::FocusTraversable {
+ public:
+ AccessiblePaneView();
+ virtual ~AccessiblePaneView();
+
+ // Set focus to the pane with complete keyboard access.
+ // Focus will be restored to the ViewStorage with id |view_storage_id|
+ // if the user escapes. If |initial_focus| is not NULL, that control will get
+ // the initial focus, if it's enabled and focusable. Returns true if
+ // the pane was able to receive focus.
+ virtual bool SetPaneFocus(int view_storage_id, View* initial_focus);
+
+ // Set focus to the pane with complete keyboard access, with the
+ // focus initially set to the default child. Focus will be restored
+ // to the ViewStorage with id |view_storage_id| if the user escapes.
+ // Returns true if the pane was able to receive focus.
+ virtual bool SetPaneFocusAndFocusDefault(int view_storage_id);
+
+ // Overridden from views::View:
+ virtual FocusTraversable* GetPaneFocusTraversable();
+ virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
+ virtual void SetVisible(bool flag);
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+
+ // Overridden from views::FocusChangeListener:
+ virtual void FocusWillChange(View* focused_before,
+ View* focused_now);
+
+ // Overridden from views::FocusTraversable:
+ virtual views::FocusSearch* GetFocusSearch();
+ virtual FocusTraversable* GetFocusTraversableParent();
+ virtual View* GetFocusTraversableParentView();
+
+ protected:
+ // A subclass can override this to provide a default focusable child
+ // other than the first focusable child.
+ virtual views::View* GetDefaultFocusableChild() { return NULL; }
+
+ // Remove pane focus.
+ virtual void RemovePaneFocus();
+
+ // Select all text in the location bar
+ virtual void LocationBarSelectAll();
+
+ void RestoreLastFocusedView();
+
+ View* GetFirstFocusableChild();
+ View* GetLastFocusableChild();
+
+ bool pane_has_focus_;
+
+ ScopedRunnableMethodFactory<AccessiblePaneView> method_factory_;
+
+ // Save the focus manager rather than calling GetFocusManager(),
+ // so that we can remove focus listeners in the destructor.
+ views::FocusManager* focus_manager_;
+
+ // Our custom focus search implementation that traps focus in this
+ // pane and traverses all views that are focusable for accessibility,
+ // not just those that are normally focusable.
+ scoped_ptr<views::FocusSearch> focus_search_;
+
+ // Registered accelerators
+ views::Accelerator home_key_;
+ views::Accelerator end_key_;
+ views::Accelerator escape_key_;
+ views::Accelerator left_key_;
+ views::Accelerator right_key_;
+
+ // Last focused view that issued this traversal.
+ int last_focused_view_storage_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(AccessiblePaneView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_ACCESSIBLE_PANE_VIEW_H_
diff --git a/chrome/browser/views/accessible_view_helper.cc b/chrome/browser/ui/views/accessible_view_helper.cc
index 65caf36..65caf36 100644
--- a/chrome/browser/views/accessible_view_helper.cc
+++ b/chrome/browser/ui/views/accessible_view_helper.cc
diff --git a/chrome/browser/ui/views/accessible_view_helper.h b/chrome/browser/ui/views/accessible_view_helper.h
new file mode 100644
index 0000000..7a6c848
--- /dev/null
+++ b/chrome/browser/ui/views/accessible_view_helper.h
@@ -0,0 +1,83 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_ACCESSIBLE_VIEW_HELPER_H_
+#define CHROME_BROWSER_UI_VIEWS_ACCESSIBLE_VIEW_HELPER_H_
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "base/singleton.h"
+#include "chrome/browser/accessibility_events.h"
+#include "gfx/native_widget_types.h"
+
+#if defined(OS_LINUX)
+#include "chrome/browser/gtk/accessible_widget_helper_gtk.h"
+#endif
+
+class AccessibilityEventRouterViews;
+class Profile;
+namespace views {
+class View;
+}
+
+// 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 a
+// view and all of its descendants. Create an instance of this class for
+// the root of a tree of views (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 ignore a particular
+// view or change its details.
+//
+// All of the information managed by this class is registered with the
+// (global) AccessibilityEventRouterViews and unregistered when this object is
+// destroyed.
+class AccessibleViewHelper {
+ public:
+ // Constructs an AccessibleViewHelper that makes the given view and all
+ // of its descendants accessible for the lifetime of this object,
+ // sending accessibility notifications to the given profile.
+ AccessibleViewHelper(views::View* view_tree, Profile* profile);
+
+ virtual ~AccessibleViewHelper();
+
+ // Sends 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);
+
+ // Uses the following string as the name of this view, instead of
+ // view->GetAccessibleName().
+ void SetViewName(views::View* view, std::string name);
+
+ // Uses the following string id as the name of this view, instead of
+ // view->GetAccessibleName().
+ void SetViewName(views::View* view, int string_id);
+
+ private:
+ // Returns a native view if the given view has a native view in it.
+ gfx::NativeView GetNativeView(views::View* view) const;
+
+ AccessibilityEventRouterViews* accessibility_event_router_;
+ Profile* profile_;
+ views::View* view_tree_;
+ std::string window_title_;
+ std::vector<views::View*> managed_views_;
+
+#if defined(OS_LINUX)
+ scoped_ptr<AccessibleWidgetHelper> widget_helper_;
+#endif
+
+ DISALLOW_COPY_AND_ASSIGN(AccessibleViewHelper);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_ACCESSIBLE_VIEW_HELPER_H_
diff --git a/chrome/browser/views/app_launched_animation_win.cc b/chrome/browser/ui/views/app_launched_animation_win.cc
index 50efc5d..50efc5d 100644
--- a/chrome/browser/views/app_launched_animation_win.cc
+++ b/chrome/browser/ui/views/app_launched_animation_win.cc
diff --git a/chrome/browser/views/appcache_info_view.cc b/chrome/browser/ui/views/appcache_info_view.cc
index 03d3919..03d3919 100644
--- a/chrome/browser/views/appcache_info_view.cc
+++ b/chrome/browser/ui/views/appcache_info_view.cc
diff --git a/chrome/browser/ui/views/appcache_info_view.h b/chrome/browser/ui/views/appcache_info_view.h
new file mode 100644
index 0000000..141524a
--- /dev/null
+++ b/chrome/browser/ui/views/appcache_info_view.h
@@ -0,0 +1,24 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_APPCACHE_INFO_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_APPCACHE_INFO_VIEW_H_
+#pragma once
+
+#include "chrome/browser/views/generic_info_view.h"
+#include "chrome/browser/browsing_data_appcache_helper.h"
+
+// AppCacheInfoView
+// Displays a tabular grid of AppCache information.
+class AppCacheInfoView : public GenericInfoView {
+ public:
+ AppCacheInfoView();
+ void SetAppCacheInfo(const appcache::AppCacheInfo* info);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AppCacheInfoView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_APPCACHE_INFO_VIEW_H_
+
diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
index bfd7321..bfd7321 100644
--- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h
new file mode 100644
index 0000000..e634555
--- /dev/null
+++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h
@@ -0,0 +1,177 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_
+#pragma once
+
+#include "app/slide_animation.h"
+#include "chrome/browser/autocomplete/autocomplete.h"
+#include "chrome/browser/autocomplete/autocomplete_popup_model.h"
+#include "chrome/browser/autocomplete/autocomplete_popup_view.h"
+#include "gfx/font.h"
+#include "views/view.h"
+#include "webkit/glue/window_open_disposition.h"
+
+#if defined(OS_WIN)
+#include "chrome/browser/views/autocomplete/autocomplete_popup_win.h"
+#else
+#include "chrome/browser/views/autocomplete/autocomplete_popup_gtk.h"
+#endif
+
+class AutocompleteEditModel;
+class AutocompleteEditViewWin;
+struct AutocompleteMatch;
+class BubbleBorder;
+class Profile;
+
+// An interface implemented by an object that provides data to populate
+// individual result views.
+class AutocompleteResultViewModel {
+ public:
+ // Returns true if the index is selected.
+ virtual bool IsSelectedIndex(size_t index) const = 0;
+
+ // Returns true if the index is hovered.
+ virtual bool IsHoveredIndex(size_t index) const = 0;
+
+ // Returns the special-case icon we should use for the given index, or NULL
+ // if we should use the default icon.
+ virtual const SkBitmap* GetSpecialIcon(size_t index) const = 0;
+};
+
+// A view representing the contents of the autocomplete popup.
+class AutocompletePopupContentsView : public views::View,
+ public AutocompleteResultViewModel,
+ public AutocompletePopupView,
+ public AnimationDelegate {
+ public:
+ AutocompletePopupContentsView(const gfx::Font& font,
+ AutocompleteEditView* edit_view,
+ AutocompleteEditModel* edit_model,
+ Profile* profile,
+ const views::View* location_bar);
+ virtual ~AutocompletePopupContentsView();
+
+ // Returns the bounds the popup should be shown at. This is the display bounds
+ // and includes offsets for the dropshadow which this view's border renders.
+ gfx::Rect GetPopupBounds() const;
+
+ // Overridden from AutocompletePopupView:
+ virtual bool IsOpen() const;
+ virtual void InvalidateLine(size_t line);
+ virtual void UpdatePopupAppearance();
+ virtual gfx::Rect GetTargetBounds();
+ virtual void PaintUpdatesNow();
+ virtual void OnDragCanceled();
+ virtual AutocompletePopupModel* GetModel();
+
+ // Overridden from AutocompleteResultViewModel:
+ virtual bool IsSelectedIndex(size_t index) const;
+ virtual bool IsHoveredIndex(size_t index) const;
+ virtual const SkBitmap* GetSpecialIcon(size_t index) const;
+
+ // Overridden from AnimationDelegate:
+ virtual void AnimationProgressed(const Animation* animation);
+
+ // Overridden from views::View:
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual void PaintChildren(gfx::Canvas* canvas) {
+ // We paint our children inside Paint().
+ }
+ virtual void Layout();
+ virtual void OnMouseEntered(const views::MouseEvent& event);
+ virtual void OnMouseMoved(const views::MouseEvent& event);
+ virtual void OnMouseExited(const views::MouseEvent& event);
+ virtual bool OnMousePressed(const views::MouseEvent& event);
+ virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
+ virtual bool OnMouseDragged(const views::MouseEvent& event);
+ virtual views::View* GetViewForPoint(const gfx::Point& point);
+
+ private:
+#if defined(OS_WIN)
+ typedef AutocompletePopupWin AutocompletePopupClass;
+#else
+ typedef AutocompletePopupGtk AutocompletePopupClass;
+#endif
+ class InstantOptInView;
+
+ // Returns true if the model has a match at the specified index.
+ bool HasMatchAt(size_t index) const;
+
+ // Returns the match at the specified index within the popup model.
+ const AutocompleteMatch& GetMatchAtIndex(size_t index) const;
+
+ // Fill a path for the contents' roundrect. |bounding_rect| is the rect that
+ // bounds the path.
+ void MakeContentsPath(gfx::Path* path, const gfx::Rect& bounding_rect);
+
+ // Updates the window's blur region for the current size.
+ void UpdateBlurRegion();
+
+ // Makes the contents of the canvas slightly transparent.
+ void MakeCanvasTransparent(gfx::Canvas* canvas);
+
+ // Called when the line at the specified index should be opened with the
+ // provided disposition.
+ void OpenIndex(size_t index, WindowOpenDisposition disposition);
+
+ // Find the index of the match under the given |point|, specified in window
+ // coordinates. Returns AutocompletePopupModel::kNoMatch if there isn't a
+ // match at the specified point.
+ size_t GetIndexForPoint(const gfx::Point& point);
+
+ // Returns the target bounds given the specified content height.
+ gfx::Rect CalculateTargetBounds(int h);
+
+ // Invoked if the user clicks on one of the opt-in buttons. Removes the opt-in
+ // view.
+ void UserPressedOptIn(bool opt_in);
+
+ // The popup that contains this view. We create this, but it deletes itself
+ // when its window is destroyed. This is a WeakPtr because it's possible for
+ // the OS to destroy the window and thus delete this object before we're
+ // deleted, or without our knowledge.
+ base::WeakPtr<AutocompletePopupClass> popup_;
+
+ // The provider of our result set.
+ scoped_ptr<AutocompletePopupModel> model_;
+
+ // The edit view that invokes us.
+ AutocompleteEditView* edit_view_;
+
+ // An object that the popup positions itself against.
+ const views::View* location_bar_;
+
+ // Our border, which can compute our desired bounds.
+ const BubbleBorder* bubble_border_;
+
+ // The font that we should use for result rows. This is based on the font used
+ // by the edit that created us.
+ gfx::Font result_font_;
+
+ // The font used for portions that match the input.
+ gfx::Font result_bold_font_;
+
+ // If the user cancels a dragging action (i.e. by pressing ESC), we don't have
+ // a convenient way to release mouse capture. Instead we use this flag to
+ // simply ignore all remaining drag events, and the eventual mouse release
+ // event. Since OnDragCanceled() can be called when we're not dragging, this
+ // flag is reset to false on a mouse pressed event, to make sure we don't
+ // erroneously ignore the next drag.
+ bool ignore_mouse_drag_;
+
+ // The popup sizes vertically using an animation when the popup is getting
+ // shorter (not larger, that makes it look "slow").
+ SlideAnimation size_animation_;
+ gfx::Rect start_bounds_;
+ gfx::Rect target_bounds_;
+
+ // If non-NULL the instant opt-in-view is visible.
+ views::View* opt_in_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_
diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_gtk.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_gtk.cc
index 4bb7f09..4bb7f09 100644
--- a/chrome/browser/views/autocomplete/autocomplete_popup_gtk.cc
+++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_gtk.cc
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_gtk.h b/chrome/browser/ui/views/autocomplete/autocomplete_popup_gtk.h
new file mode 100644
index 0000000..c2638d6
--- /dev/null
+++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_gtk.h
@@ -0,0 +1,28 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_GTK_H_
+#define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_GTK_H_
+#pragma once
+
+#include "base/weak_ptr.h"
+#include "views/widget/widget_gtk.h"
+
+class AutocompleteEditView;
+class AutocompletePopupContentsView;
+
+class AutocompletePopupGtk
+ : public views::WidgetGtk,
+ public base::SupportsWeakPtr<AutocompletePopupGtk> {
+ public:
+ // Creates the popup and shows it. |edit_view| is the edit that created us.
+ AutocompletePopupGtk(AutocompleteEditView* edit_view,
+ AutocompletePopupContentsView* contents);
+ virtual ~AutocompletePopupGtk();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AutocompletePopupGtk);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_GTK_H_
diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_win.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_win.cc
index e720108..e720108 100644
--- a/chrome/browser/views/autocomplete/autocomplete_popup_win.cc
+++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_win.cc
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_win.h b/chrome/browser/ui/views/autocomplete/autocomplete_popup_win.h
new file mode 100644
index 0000000..bcb7af4
--- /dev/null
+++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_win.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_WIN_H_
+#define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_WIN_H_
+#pragma once
+
+#include "base/weak_ptr.h"
+#include "views/widget/widget_win.h"
+
+class AutocompleteEditView;
+class AutocompletePopupContentsView;
+
+class AutocompletePopupWin
+ : public views::WidgetWin,
+ public base::SupportsWeakPtr<AutocompletePopupWin> {
+ public:
+ // Creates the popup and shows it. |edit_view| is the edit that created us.
+ AutocompletePopupWin(AutocompleteEditView* edit_view,
+ AutocompletePopupContentsView* contents);
+ virtual ~AutocompletePopupWin();
+
+ private:
+ // Overridden from WidgetWin:
+ virtual LRESULT OnMouseActivate(HWND window,
+ UINT hit_test,
+ UINT mouse_message);
+
+ DISALLOW_COPY_AND_ASSIGN(AutocompletePopupWin);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_WIN_H_
diff --git a/chrome/browser/views/autofill_profiles_view_win.cc b/chrome/browser/ui/views/autofill_profiles_view_win.cc
index 414e0ba..414e0ba 100644
--- a/chrome/browser/views/autofill_profiles_view_win.cc
+++ b/chrome/browser/ui/views/autofill_profiles_view_win.cc
diff --git a/chrome/browser/ui/views/autofill_profiles_view_win.h b/chrome/browser/ui/views/autofill_profiles_view_win.h
new file mode 100644
index 0000000..6dbe8dd
--- /dev/null
+++ b/chrome/browser/ui/views/autofill_profiles_view_win.h
@@ -0,0 +1,440 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_AUTOFILL_PROFILES_VIEW_WIN_H_
+#define CHROME_BROWSER_UI_VIEWS_AUTOFILL_PROFILES_VIEW_WIN_H_
+#pragma once
+
+#include <list>
+#include <map>
+#include <vector>
+
+#include "app/combobox_model.h"
+#include "app/table_model.h"
+#include "base/string16.h"
+#include "chrome/browser/autofill/autofill_dialog.h"
+#include "chrome/browser/autofill/autofill_profile.h"
+#include "chrome/browser/autofill/personal_data_manager.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/common/notification_observer.h"
+#include "views/controls/combobox/combobox.h"
+#include "views/controls/link.h"
+#include "views/controls/table/table_view_observer.h"
+#include "views/controls/textfield/textfield.h"
+#include "views/focus/focus_manager.h"
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+
+namespace views {
+class Checkbox;
+class GridLayout;
+class ImageButton;
+class Label;
+class RadioButton;
+class TableView;
+class TextButton;
+} // namespace views
+
+class PrefService;
+class SkBitmap;
+
+///////////////////////////////////////////////////////////////////////////////
+// AutoFillProfilesView
+//
+// The contents of the "AutoFill profiles" dialog window.
+//
+// Overview: has following sub-views:
+// EditableSetViewContents - set of displayed fields for address or credit card,
+// has iterator to std::vector<EditableSetInfo> vector so data could be
+// updated or notifications passes to the dialog view.
+// PhoneSubView - support view for the phone fields sets. used in
+// ScrollViewContents.
+// And there is a support data structure EditableSetInfo which encapsulates
+// editable set (address or credit card) and allows for quick addition and
+// deletion.
+class AutoFillProfilesView : public views::View,
+ public views::DialogDelegate,
+ public views::ButtonListener,
+ public views::LinkController,
+ public views::FocusChangeListener,
+ public views::TableViewObserver,
+ public PersonalDataManager::Observer,
+ public NotificationObserver {
+ public:
+ virtual ~AutoFillProfilesView();
+
+ static int Show(gfx::NativeWindow parent,
+ AutoFillDialogObserver* observer,
+ PersonalDataManager* personal_data_manager,
+ Profile* profile,
+ PrefService* preferences,
+ AutoFillProfile* imported_profile,
+ CreditCard* imported_credit_card);
+
+ protected:
+ // Forward declaration. This struct defined further down.
+ struct EditableSetInfo;
+ // Called when 'Add Address' (|group_type| is
+ // ContentListTableModel::kAddressGroup) or 'Add Credit Card' (|group_type| is
+ // ContentListTableModel::kCreditCardGroup) is clicked.
+ void AddClicked(int group_type);
+ // Called when 'Edit...' is clicked.
+ void EditClicked();
+ // Called when 'Remove' is clicked.
+ void DeleteClicked();
+ // Called when 'Edit' dialog is accepted.
+ void EditAccepted(EditableSetInfo* data, bool new_item);
+
+ // Updates state of the buttons.
+ void UpdateWidgetState();
+
+ // Following two functions are called from opened child dialog to
+ // disable/enable buttons.
+ void ChildWindowOpened();
+ void ChildWindowClosed();
+
+ // Returns warning bitmap to set on warning indicator. If |good| is true it
+ // returns the bitmap idicating validity, if false - indicating error.
+ // Caller owns the bitmap after the call.
+ SkBitmap* GetWarningBitmap(bool good);
+
+ // views::View methods:
+ virtual void Layout();
+ virtual gfx::Size GetPreferredSize();
+ virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
+ views::View* child);
+
+ // views::DialogDelegate methods:
+ virtual int GetDialogButtons() const;
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual View* GetExtraView();
+ virtual bool IsDialogButtonEnabled(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool CanResize() const { return true; }
+ virtual bool CanMaximize() const { return false; }
+ virtual bool IsAlwaysOnTop() const { return false; }
+ virtual bool HasAlwaysOnTopMenu() const { return false; }
+ virtual std::wstring GetWindowTitle() const;
+ virtual void WindowClosing();
+ virtual views::View* GetContentsView();
+ virtual bool Cancel();
+ virtual bool Accept();
+
+ // views::ButtonListener methods:
+ virtual void ButtonPressed(views::Button* sender,
+ const views::Event& event);
+
+ // views::LinkController methods:
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ // views::FocusChangeListener methods:
+ virtual void FocusWillChange(views::View* focused_before,
+ views::View* focused_now);
+
+ // views::TableViewObserver methods:
+ virtual void OnSelectionChanged();
+ virtual void OnDoubleClick();
+
+ // PersonalDataManager::Observer methods:
+ virtual void OnPersonalDataLoaded();
+ virtual void OnPersonalDataChanged();
+
+ // NotificationObserver methods:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Helper structure to keep info on one address or credit card.
+ // Keeps info on one item in EditableSetViewContents.
+ // Also keeps info on opened status. Allows to quickly add and delete items,
+ // and then rebuild EditableSetViewContents.
+ struct EditableSetInfo {
+ bool is_address;
+ // If |is_address| is true |address| has some data and |credit_card|
+ // is empty, and vice versa
+ AutoFillProfile address;
+ CreditCard credit_card;
+
+ explicit EditableSetInfo(const AutoFillProfile* input_address)
+ : address(*input_address),
+ is_address(true) {
+ }
+ explicit EditableSetInfo(const CreditCard* input_credit_card)
+ : credit_card(*input_credit_card),
+ is_address(false) {
+ }
+
+ std::string guid() const {
+ if (is_address)
+ return address.guid();
+ else
+ return credit_card.guid();
+ }
+ };
+
+ private:
+ // Indicates that there was no item focused. After re-building of the lists
+ // first item will be focused.
+ static const int kNoItemFocused = -1;
+
+ struct FocusedItem {
+ int group;
+ int item;
+ FocusedItem() : group(kNoItemFocused), item(kNoItemFocused) {}
+ FocusedItem(int g, int i) : group(g), item(i) {}
+ };
+
+ AutoFillProfilesView(AutoFillDialogObserver* observer,
+ PersonalDataManager* personal_data_manager,
+ Profile* profile,
+ PrefService* preferences,
+ AutoFillProfile* imported_profile,
+ CreditCard* imported_credit_card);
+ void Init();
+
+ void GetData();
+ bool IsDataReady() const;
+ void SaveData();
+
+ // Rebuilds the view by deleting and re-creating sub-views
+ void RebuildView(const FocusedItem& new_focus_index);
+
+ // PhoneSubView encapsulates three phone fields (country, area, and phone)
+ // and label above them, so they could be used together in one grid cell.
+ class PhoneSubView : public views::View,
+ public views::ButtonListener {
+ public:
+ PhoneSubView(AutoFillProfilesView* autofill_view,
+ views::Label* label,
+ views::Textfield* text_phone);
+ virtual ~PhoneSubView() {}
+
+ virtual void ContentsChanged(views::Textfield* sender,
+ const string16& new_contents);
+
+ bool IsValid() const;
+
+ views::Textfield* text_phone() { return text_phone_; }
+
+ protected:
+ // views::View methods:
+ virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
+ views::View* child);
+
+ // public views::ButtonListener method:
+ virtual void ButtonPressed(views::Button* sender,
+ const views::Event& event) {
+ // Only stub is needed, it is never called.
+ NOTREACHED();
+ }
+
+ private:
+ void UpdateButtons();
+ AutoFillProfilesView* autofill_view_;
+ views::Label* label_;
+ views::Textfield* text_phone_;
+ views::ImageButton* phone_warning_button_;
+ bool last_state_;
+
+ DISALLOW_COPY_AND_ASSIGN(PhoneSubView);
+ };
+
+ // Forward declaration.
+ class StringVectorComboboxModel;
+
+ // Sub-view for editing/adding a credit card or address.
+ class EditableSetViewContents : public views::View,
+ public views::DialogDelegate,
+ public views::ButtonListener,
+ public views::Textfield::Controller,
+ public views::Combobox::Listener {
+ public:
+ EditableSetViewContents(AutoFillProfilesView* observer,
+ bool new_item,
+ const EditableSetInfo& field_set);
+ virtual ~EditableSetViewContents() {}
+
+ protected:
+ // views::View methods:
+ virtual void Layout();
+ virtual gfx::Size GetPreferredSize();
+ virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
+ views::View* child);
+
+ // views::DialogDelegate methods:
+ virtual int GetDialogButtons() const;
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool IsDialogButtonEnabled(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool CanResize() const { return false; }
+ virtual bool CanMaximize() const { return false; }
+ virtual bool IsModal() const { return true; }
+ virtual bool HasAlwaysOnTopMenu() const { return false; }
+ virtual std::wstring GetWindowTitle() const;
+ virtual void WindowClosing();
+ virtual views::View* GetContentsView();
+ virtual bool Cancel();
+ virtual bool Accept();
+
+ // views::ButtonListener methods:
+ virtual void ButtonPressed(views::Button* sender,
+ const views::Event& event);
+
+ // views::Textfield::Controller methods:
+ virtual void ContentsChanged(views::Textfield* sender,
+ const string16& new_contents);
+ virtual bool HandleKeystroke(views::Textfield* sender,
+ const views::Textfield::Keystroke& keystroke);
+
+ // views::Combobox::Listener methods:
+ virtual void ItemChanged(views::Combobox* combo_box,
+ int prev_index,
+ int new_index);
+ private:
+ enum TextFields {
+ TEXT_FULL_NAME,
+ TEXT_COMPANY,
+ TEXT_EMAIL,
+ TEXT_ADDRESS_LINE_1,
+ TEXT_ADDRESS_LINE_2,
+ TEXT_ADDRESS_CITY,
+ TEXT_ADDRESS_STATE,
+ TEXT_ADDRESS_ZIP,
+ TEXT_ADDRESS_COUNTRY,
+ TEXT_PHONE_PHONE,
+ TEXT_FAX_PHONE,
+ TEXT_CC_NAME,
+ TEXT_CC_NUMBER,
+ // Must be last.
+ MAX_TEXT_FIELD
+ };
+
+ void InitAddressFields(views::GridLayout* layout);
+ void InitCreditCardFields(views::GridLayout* layout);
+ void InitLayoutGrid(views::GridLayout* layout);
+ views::Label* CreateLeftAlignedLabel(int label_id);
+
+ void UpdateButtons();
+
+ // If |field| is a phone or fax ContentsChanged is passed to the
+ // PhoneSubView, the appropriate fields in |temporary_info_| are updated and
+ // true is returned. Otherwise false is returned.
+ bool UpdateContentsPhoneViews(TextFields field,
+ views::Textfield* sender,
+ const string16& new_contents);
+
+ views::Textfield* text_fields_[MAX_TEXT_FIELD];
+ EditableSetInfo temporary_info_;
+ bool has_credit_card_number_been_edited_;
+ AutoFillProfilesView* observer_;
+ scoped_ptr<StringVectorComboboxModel> combo_box_model_month_;
+ views::Combobox* combo_box_month_;
+ scoped_ptr<StringVectorComboboxModel> combo_box_model_year_;
+ views::Combobox* combo_box_year_;
+ bool new_item_;
+ std::vector<PhoneSubView*> phone_sub_views_;
+
+ struct TextFieldToAutoFill {
+ TextFields text_field;
+ AutoFillFieldType type;
+ };
+
+ static TextFieldToAutoFill address_fields_[];
+ static TextFieldToAutoFill credit_card_fields_[];
+
+ static const int double_column_fill_view_set_id_ = 0;
+ static const int double_column_leading_view_set_id_ = 1;
+ static const int triple_column_fill_view_set_id_ = 2;
+ static const int triple_column_leading_view_set_id_ = 3;
+ static const int four_column_city_state_zip_set_id_ = 4;
+ static const int double_column_ccnumber_cvc_ = 5;
+ static const int three_column_header_ = 6;
+ static const int double_column_ccexpiration_ = 7;
+
+ DISALLOW_COPY_AND_ASSIGN(EditableSetViewContents);
+ };
+
+ class StringVectorComboboxModel : public ComboboxModel {
+ public:
+ StringVectorComboboxModel() {}
+ virtual ~StringVectorComboboxModel() {}
+
+ // Sets the vector of the strings for the combobox. Swaps content with
+ // |source|.
+ void set_cb_strings(std::vector<std::wstring> *source);
+
+ // Overridden from ComboboxModel:
+ virtual int GetItemCount();
+ virtual string16 GetItemAt(int index);
+
+ // Find an index of the item in the model, -1 if not present.
+ int GetIndex(const std::wstring& value);
+
+ private:
+ std::vector<std::wstring> cb_strings_;
+
+ DISALLOW_COPY_AND_ASSIGN(StringVectorComboboxModel);
+ };
+
+ // Model for scrolling credit cards and addresses.
+ class ContentListTableModel : public TableModel {
+ public:
+ ContentListTableModel(std::vector<EditableSetInfo>* profiles,
+ std::vector<EditableSetInfo>* credit_cards);
+ virtual ~ContentListTableModel() {}
+
+ // Two constants defined for indexes of groups. The first one is index
+ // of Add Address button, the second one is the index of Add Credit Card
+ // button.
+ static const int kAddressGroup = 1;
+ static const int kCreditCardGroup = 2;
+
+ void Refresh();
+ void AddItem(int index);
+ void RemoveItem(int index);
+ void UpdateItem(int index);
+
+ // TableModel members:
+ virtual int RowCount();
+ virtual std::wstring GetText(int row, int column_id);
+ virtual bool HasGroups() { return true; }
+ virtual TableModel::Groups GetGroups();
+ virtual int GetGroupID(int row);
+ virtual void SetObserver(TableModelObserver* observer);
+
+ private:
+ std::vector<EditableSetInfo>* profiles_;
+ std::vector<EditableSetInfo>* credit_cards_;
+ TableModelObserver* observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContentListTableModel);
+ };
+
+ AutoFillDialogObserver* observer_;
+ PersonalDataManager* personal_data_manager_;
+ Profile* profile_;
+ PrefService* preferences_;
+ std::vector<EditableSetInfo> profiles_set_;
+ std::vector<EditableSetInfo> credit_card_set_;
+
+ BooleanPrefMember enable_auto_fill_;
+
+ views::Checkbox* enable_auto_fill_button_;
+ views::Button* add_address_button_;
+ views::Button* add_credit_card_button_;
+ views::Button* edit_button_;
+ views::Button* remove_button_;
+ views::TableView* scroll_view_;
+ scoped_ptr<ContentListTableModel> table_model_;
+ views::FocusManager* focus_manager_;
+ bool child_dialog_opened_;
+
+ static AutoFillProfilesView* instance_;
+
+ DISALLOW_COPY_AND_ASSIGN(AutoFillProfilesView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_PROFILES_VIEW_WIN_H_
diff --git a/chrome/browser/views/bookmark_bar_instructions_view.cc b/chrome/browser/ui/views/bookmark_bar_instructions_view.cc
index a89eb2d..a89eb2d 100644
--- a/chrome/browser/views/bookmark_bar_instructions_view.cc
+++ b/chrome/browser/ui/views/bookmark_bar_instructions_view.cc
diff --git a/chrome/browser/ui/views/bookmark_bar_instructions_view.h b/chrome/browser/ui/views/bookmark_bar_instructions_view.h
new file mode 100644
index 0000000..f2f0f23
--- /dev/null
+++ b/chrome/browser/ui/views/bookmark_bar_instructions_view.h
@@ -0,0 +1,68 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_BOOKMARK_BAR_INSTRUCTIONS_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_BOOKMARK_BAR_INSTRUCTIONS_VIEW_H_
+#pragma once
+
+#include "views/view.h"
+#include "views/controls/link.h"
+
+namespace views {
+class Label;
+class Link;
+}
+
+// BookmarkBarInstructionsView is a child of the bookmark bar that is visible
+// when the user has no bookmarks on the bookmark bar.
+// BookmarkBarInstructionsView shows a description of the bookmarks bar along
+// with a link to import bookmarks. Clicking the link results in notifying the
+// delegate.
+class BookmarkBarInstructionsView : public views::View,
+ public views::LinkController {
+ 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 BookmarkBarInstructionsView(Delegate* delegate);
+
+ // View overrides.
+ virtual gfx::Size GetPreferredSize();
+ virtual void Layout();
+ virtual void OnThemeChanged();
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+
+ // LinkController.
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ private:
+ void UpdateColors();
+
+ Delegate* delegate_;
+
+ views::Label* instructions_;
+ views::Link* import_link_;
+
+ // The baseline of the child views. This is -1 if none of the views support a
+ // baseline.
+ int baseline_;
+
+ // Have the colors of the child views been updated? This is initially false
+ // and set to true once we have a valid ThemeProvider.
+ bool updated_colors_;
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkBarInstructionsView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_BOOKMARK_BAR_INSTRUCTIONS_VIEW_H_
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmark_bar_view.cc
index 9188aa5..9188aa5 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/ui/views/bookmark_bar_view.cc
diff --git a/chrome/browser/ui/views/bookmark_bar_view.h b/chrome/browser/ui/views/bookmark_bar_view.h
new file mode 100644
index 0000000..356d944
--- /dev/null
+++ b/chrome/browser/ui/views/bookmark_bar_view.h
@@ -0,0 +1,508 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_BOOKMARK_BAR_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_BOOKMARK_BAR_VIEW_H_
+#pragma once
+
+#include <set>
+
+#include "app/slide_animation.h"
+#include "chrome/browser/bookmarks/bookmark_drag_data.h"
+#include "chrome/browser/bookmarks/bookmark_model_observer.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/views/bookmark_bar_instructions_view.h"
+#include "chrome/browser/views/bookmark_menu_controller_views.h"
+#include "chrome/browser/views/detachable_toolbar_view.h"
+#include "chrome/common/notification_registrar.h"
+#include "views/controls/button/button.h"
+#include "views/controls/menu/view_menu_delegate.h"
+
+class Browser;
+class PageNavigator;
+class PrefService;
+
+namespace views {
+class CustomButton;
+class MenuButton;
+class MenuItemView;
+class TextButton;
+}
+
+// BookmarkBarView renders the BookmarkModel. Each starred entry on the
+// BookmarkBar is rendered as a MenuButton. An additional MenuButton aligned to
+// the right allows the user to quickly see recently starred entries.
+//
+// BookmarkBarView shows the bookmarks from a specific Profile. BookmarkBarView
+// waits until the HistoryService for the profile has been loaded before
+// creating the BookmarkModel.
+class BookmarkBarView : public DetachableToolbarView,
+ public ProfileSyncServiceObserver,
+ public BookmarkModelObserver,
+ public views::ViewMenuDelegate,
+ public views::ButtonListener,
+ public NotificationObserver,
+ public views::ContextMenuController,
+ public views::DragController,
+ public AnimationDelegate,
+ public BookmarkMenuController::Observer,
+ public BookmarkBarInstructionsView::Delegate {
+ friend class ShowFolderMenuTask;
+
+ public:
+ // Constants used in Browser View, as well as here.
+ // How inset the bookmarks bar is when displayed on the new tab page.
+ static const int kNewtabHorizontalPadding;
+ static const int kNewtabVerticalPadding;
+
+ // Maximum size of buttons on the bookmark bar.
+ static const int kMaxButtonWidth;
+
+ // Interface implemented by controllers/views that need to be notified any
+ // time the model changes, typically to cancel an operation that is showing
+ // data from the model such as a menu. This isn't intended as a general
+ // way to be notified of changes, rather for cases where a controller/view is
+ // showing data from the model in a modal like setting and needs to cleanly
+ // exit the modal loop if the model changes out from under it.
+ //
+ // A controller/view that needs this notification should install itself as the
+ // ModelChangeListener via the SetModelChangedListener method when shown and
+ // reset the ModelChangeListener of the BookmarkBarView when it closes by way
+ // of either the SetModelChangedListener method or the
+ // ClearModelChangedListenerIfEquals method.
+ class ModelChangedListener {
+ public:
+ virtual ~ModelChangedListener() {}
+
+ // Invoked when the model changes. Should cancel the edit and close any
+ // dialogs.
+ virtual void ModelChanged() = 0;
+ };
+
+ static const int kNewtabBarHeight;
+
+ BookmarkBarView(Profile* profile, Browser* browser);
+ virtual ~BookmarkBarView();
+
+ // 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_; }
+
+ // Sets the PageNavigator that is used when the user selects an entry on
+ // the bookmark bar.
+ void SetPageNavigator(PageNavigator* navigator);
+
+ // Sets whether the containing browser is showing an infobar. This affects
+ // layout during animation.
+ void set_infobar_visible(bool infobar_visible) {
+ infobar_visible_ = infobar_visible;
+ }
+
+ // DetachableToolbarView methods:
+ virtual bool IsDetached() const;
+ virtual bool IsOnTop() const;
+ virtual double GetAnimationValue() const {
+ return size_animation_->GetCurrentValue();
+ }
+ virtual int GetToolbarOverlap() const {
+ return GetToolbarOverlap(false);
+ }
+
+ // View methods:
+ virtual gfx::Size GetPreferredSize();
+ virtual gfx::Size GetMinimumSize();
+ virtual void Layout();
+ virtual void DidChangeBounds(const gfx::Rect& previous,
+ const gfx::Rect& current);
+ virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
+ virtual void PaintChildren(gfx::Canvas* canvas);
+ virtual bool GetDropFormats(
+ int* formats,
+ std::set<OSExchangeData::CustomFormat>* custom_formats);
+ virtual bool AreDropTypesRequired();
+ virtual bool CanDrop(const OSExchangeData& data);
+ virtual void OnDragEntered(const views::DropTargetEvent& event);
+ virtual int OnDragUpdated(const views::DropTargetEvent& event);
+ virtual void OnDragExited();
+ virtual int OnPerformDrop(const views::DropTargetEvent& event);
+ virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture);
+
+ // AccessiblePaneView methods:
+ virtual bool IsAccessibleViewTraversable(views::View* view);
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+
+ // ProfileSyncServiceObserver method.
+ virtual void OnStateChanged();
+
+ // Called when fullscreen mode toggles on or off; this affects our layout.
+ void OnFullscreenToggled(bool fullscreen);
+
+ // Sets the model change listener to listener.
+ void SetModelChangedListener(ModelChangedListener* listener) {
+ model_changed_listener_ = listener;
+ }
+
+ // If the ModelChangedListener is listener, ModelChangeListener is set to
+ // NULL.
+ void ClearModelChangedListenerIfEquals(ModelChangedListener* listener) {
+ if (model_changed_listener_ == listener)
+ model_changed_listener_ = NULL;
+ }
+
+ // Returns the model change listener.
+ ModelChangedListener* GetModelChangedListener() {
+ return model_changed_listener_;
+ }
+
+ // Returns the page navigator.
+ PageNavigator* GetPageNavigator() { return page_navigator_; }
+
+ // Returns the model.
+ BookmarkModel* GetModel() { return model_; }
+
+ // Returns true if the bookmarks bar preference is set to 'always show'.
+ bool IsAlwaysShown() const;
+
+ // True if we're on a page where the bookmarks bar is always visible.
+ bool OnNewTabPage() const;
+
+ // How much we want the bookmark bar to overlap the toolbar. If |return_max|
+ // is true, we return the maximum overlap rather than the current overlap.
+ int GetToolbarOverlap(bool return_max) const;
+
+ // Whether or not we are animating.
+ bool is_animating() { return size_animation_->is_animating(); }
+
+ // SlideAnimationDelegate implementation.
+ void AnimationProgressed(const Animation* animation);
+ void AnimationEnded(const Animation* animation);
+
+ // BookmarkMenuController::Observer
+ virtual void BookmarkMenuDeleted(BookmarkMenuController* controller);
+
+ // Returns the button at the specified index.
+ views::TextButton* GetBookmarkButton(int index);
+
+ // Returns the button responsible for showing bookmarks in the other bookmark
+ // folder.
+ views::MenuButton* other_bookmarked_button() const {
+ return other_bookmarked_button_;
+ }
+
+ // Returns the active MenuItemView, or NULL if a menu isn't showing.
+ views::MenuItemView* GetMenu();
+
+ // Returns the drop MenuItemView, or NULL if a menu isn't showing.
+ views::MenuItemView* GetDropMenu();
+
+ // Returns the context menu, or null if one isn't showing.
+ views::MenuItemView* GetContextMenu();
+
+ // Returns the button used when not all the items on the bookmark bar fit.
+ views::MenuButton* overflow_button() const { return overflow_button_; }
+
+ // If |loc| is over a bookmark button the node is returned corresponding
+ // to the button and |start_index| is set to 0. If a overflow button is
+ // showing and |loc| is over the overflow button, the bookmark bar node is
+ // returned and |start_index| is set to the index of the first node
+ // contained in the overflow menu.
+ const BookmarkNode* GetNodeForButtonAt(const gfx::Point& loc,
+ int* start_index);
+
+ // Returns the MenuButton for node.
+ views::MenuButton* GetMenuButtonForNode(const BookmarkNode* node);
+
+ // Returns the position to anchor the menu for |button| at, the index of the
+ // first child of the node to build the menu from.
+ void GetAnchorPositionAndStartIndexForButton(
+ views::MenuButton* button,
+ views::MenuItemView::AnchorPosition* anchor,
+ int* start_index);
+
+ // BookmarkBarInstructionsView::Delegate.
+ virtual void ShowImportDialog();
+
+ // If a button is currently throbbing, it is stopped. If immediate is true
+ // the throb stops immediately, otherwise it stops after a couple more
+ // throbs.
+ void StopThrobbing(bool immediate);
+
+ // 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();
+
+ // If true we're running tests. This short circuits a couple of animations.
+ static bool testing_;
+
+ private:
+ class ButtonSeparatorView;
+ struct DropInfo;
+
+ // Task that invokes ShowDropFolderForNode when run. ShowFolderDropMenuTask
+ // deletes itself once run.
+ class ShowFolderDropMenuTask : public Task {
+ public:
+ ShowFolderDropMenuTask(BookmarkBarView* view, const BookmarkNode* node)
+ : view_(view),
+ node_(node) {
+ }
+
+ void Cancel() {
+ view_->show_folder_drop_menu_task_ = NULL;
+ view_ = NULL;
+ }
+
+ virtual void Run() {
+ if (view_) {
+ view_->show_folder_drop_menu_task_ = NULL;
+ view_->ShowDropFolderForNode(node_);
+ }
+ // MessageLoop deletes us.
+ }
+
+ private:
+ BookmarkBarView* view_;
+ const BookmarkNode* node_;
+
+ DISALLOW_COPY_AND_ASSIGN(ShowFolderDropMenuTask);
+ };
+
+ // Creates recent bookmark button and when visible button as well as
+ // calculating the preferred height.
+ void Init();
+
+ // Creates the button showing the other bookmarked items.
+ views::MenuButton* CreateOtherBookmarkedButton();
+
+ // Creates the button used when not all bookmark buttons fit.
+ views::MenuButton* CreateOverflowButton();
+
+ // Invoked when the bookmark bar 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);
+
+ // Invokes added followed by removed.
+ virtual void BookmarkNodeMoved(BookmarkModel* model,
+ const BookmarkNode* old_parent,
+ int old_index,
+ const BookmarkNode* new_parent,
+ int new_index);
+
+ // Notifies ModelChangeListener of change.
+ // If the node was added to the root node, a button is created and added to
+ // this bookmark bar view.
+ virtual void BookmarkNodeAdded(BookmarkModel* model,
+ const BookmarkNode* parent,
+ int index);
+
+ // Implementation for BookmarkNodeAddedImpl.
+ void BookmarkNodeAddedImpl(BookmarkModel* model,
+ const BookmarkNode* parent,
+ int index);
+
+ // Notifies ModelChangeListener of change.
+ // If the node was a child of the root node, the button corresponding to it
+ // is removed.
+ virtual void BookmarkNodeRemoved(BookmarkModel* model,
+ const BookmarkNode* parent,
+ int old_index,
+ const BookmarkNode* node);
+
+ // Implementation for BookmarkNodeRemoved.
+ void BookmarkNodeRemovedImpl(BookmarkModel* model,
+ const BookmarkNode* parent,
+ int index);
+
+ // Notifies ModelChangedListener and invokes BookmarkNodeChangedImpl.
+ virtual void BookmarkNodeChanged(BookmarkModel* model,
+ const BookmarkNode* node);
+
+ // If the node is a child of the root node, the button is updated
+ // appropriately.
+ void BookmarkNodeChangedImpl(BookmarkModel* model, const BookmarkNode* node);
+
+ virtual void BookmarkNodeChildrenReordered(BookmarkModel* model,
+ const BookmarkNode* node);
+
+ // Invoked when the favicon is available. If the node is a child of the
+ // root node, the appropriate button is updated. If a menu is showing, the
+ // call is forwarded to the menu to allow for it to update the icon.
+ virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model,
+ const BookmarkNode* node);
+
+ // DragController method. Determines the node representing sender and invokes
+ // WriteDragData to write the actual data.
+ virtual void WriteDragData(views::View* sender,
+ const gfx::Point& press_pt,
+ OSExchangeData* data);
+
+ virtual int GetDragOperations(views::View* sender, const gfx::Point& p);
+
+ virtual bool CanStartDrag(views::View* sender,
+ const gfx::Point& press_pt,
+ const gfx::Point& p);
+
+ // Writes a BookmarkDragData for node to data.
+ void WriteDragData(const BookmarkNode* node, OSExchangeData* data);
+
+ // ViewMenuDelegate method. Ends up creating a BookmarkMenuController to
+ // show the menu.
+ virtual void RunMenu(views::View* view, const gfx::Point& pt);
+
+ // Invoked when a star entry corresponding to a URL on the bookmark bar is
+ // pressed. Forwards to the PageNavigator to open the URL.
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Invoked for this View, one of the buttons or the 'other' button. Shows the
+ // appropriate context menu.
+ virtual void ShowContextMenu(views::View* source,
+ const gfx::Point& p,
+ bool is_mouse_gesture);
+
+ // Creates the button for rendering the specified bookmark node.
+ views::View* CreateBookmarkButton(const BookmarkNode* node);
+
+ // COnfigures the button from the specified node. This sets the text,
+ // and icon.
+ void ConfigureButton(const BookmarkNode* node, views::TextButton* button);
+
+ // Used when showing the menu allowing the user to choose when the bar is
+ // visible. Return value corresponds to the users preference for when the
+ // bar is visible.
+ virtual bool IsItemChecked(int id) const;
+
+ // Used when showing the menu allowing the user to choose when the bar is
+ // visible. Updates the preferences to match the users choice as appropriate.
+ virtual void ExecuteCommand(int id);
+
+ // NotificationService method.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Overridden from views::View.
+ virtual void OnThemeChanged();
+
+ // If the ModelChangedListener is non-null, ModelChanged is invoked on it.
+ void NotifyModelChanged();
+
+ // Shows the menu used during drag and drop for the specified node.
+ void ShowDropFolderForNode(const BookmarkNode* node);
+
+ // Cancels the timer used to show a drop menu.
+ void StopShowFolderDropMenuTimer();
+
+ // Stars the timer used to show a drop menu for node.
+ void StartShowFolderDropMenuTimer(const BookmarkNode* node);
+
+ // Returns the drop operation and index for the drop based on the event
+ // and data. Returns DragDropTypes::DRAG_NONE if not a valid location.
+ int CalculateDropOperation(const views::DropTargetEvent& event,
+ const BookmarkDragData& data,
+ int* index,
+ bool* drop_on,
+ bool* is_over_overflow,
+ bool* is_over_other);
+
+ // Returns the index of the first hidden bookmark button. If all buttons are
+ // visible, this returns GetBookmarkButtonCount().
+ int GetFirstHiddenNodeIndex();
+
+ // This determines which view should throb and starts it
+ // throbbing (e.g when the bookmark bubble is showing).
+ // If |overflow_only| is true, start throbbing only if |node| is hidden in
+ // the overflow menu.
+ void StartThrobbing(const BookmarkNode* node, bool overflow_only);
+
+ // Updates the colors for all the child objects in the bookmarks bar.
+ void UpdateColors();
+
+ // This method computes the bounds for the bookmark bar items. If
+ // |compute_bounds_only| = TRUE, the bounds for the items are just computed,
+ // but are not set. This mode is used by GetPreferredSize() to obtain the
+ // desired bounds. If |compute_bounds_only| = FALSE, the bounds are set.
+ gfx::Size LayoutItems(bool compute_bounds_only);
+
+ // Creates the sync error button and adds it as a child view.
+ views::TextButton* CreateSyncErrorButton();
+
+ NotificationRegistrar registrar_;
+
+ Profile* profile_;
+
+ // Used for opening urls.
+ PageNavigator* page_navigator_;
+
+ // Model providing details as to the starred entries/groups that should be
+ // shown. This is owned by the Profile.
+ BookmarkModel* model_;
+
+ // Used to manage showing a Menu, either for the most recently bookmarked
+ // entries, or for the a starred group.
+ BookmarkMenuController* bookmark_menu_;
+
+ // Used when showing a menu for drag and drop. That is, if the user drags
+ // over a group this becomes non-null and manages the menu showing the
+ // contents of the node.
+ BookmarkMenuController* bookmark_drop_menu_;
+
+ // Shows the other bookmark entries.
+ views::MenuButton* other_bookmarked_button_;
+
+ // ModelChangeListener.
+ ModelChangedListener* model_changed_listener_;
+
+ // Task used to delay showing of the drop menu.
+ ShowFolderDropMenuTask* show_folder_drop_menu_task_;
+
+ // Used to track drops on the bookmark bar view.
+ scoped_ptr<DropInfo> drop_info_;
+
+ // The sync re-login indicator which appears when the user needs to re-enter
+ // credentials in order to continue syncing.
+ views::TextButton* sync_error_button_;
+
+ // A pointer to the ProfileSyncService instance if one exists.
+ ProfileSyncService* sync_service_;
+
+ // Visible if not all the bookmark buttons fit.
+ views::MenuButton* overflow_button_;
+
+ // BookmarkBarInstructionsView that is visible if there are no bookmarks on
+ // the bookmark bar.
+ views::View* instructions_;
+
+ ButtonSeparatorView* bookmarks_separator_view_;
+
+ // Owning browser. This is NULL during testing.
+ Browser* browser_;
+
+ // True if the owning browser is showing an infobar.
+ bool infobar_visible_;
+
+ // Animation controlling showing and hiding of the bar.
+ scoped_ptr<SlideAnimation> size_animation_;
+
+ // If the bookmark bubble is showing, this is the visible ancestor of the URL.
+ // The visible ancestor is either the other_bookmarked_button_,
+ // overflow_button_ or a button on the bar.
+ views::CustomButton* throbbing_view_;
+
+ // Background for extension toolstrips.
+ SkBitmap toolstrip_background_;
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkBarView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_BOOKMARK_BAR_VIEW_H_
diff --git a/chrome/browser/views/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmark_bar_view_test.cc
index d30d0e4..d30d0e4 100644
--- a/chrome/browser/views/bookmark_bar_view_test.cc
+++ b/chrome/browser/ui/views/bookmark_bar_view_test.cc
diff --git a/chrome/browser/views/bookmark_bar_view_unittest.cc b/chrome/browser/ui/views/bookmark_bar_view_unittest.cc
index 3f66795..3f66795 100644
--- a/chrome/browser/views/bookmark_bar_view_unittest.cc
+++ b/chrome/browser/ui/views/bookmark_bar_view_unittest.cc
diff --git a/chrome/browser/views/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmark_bubble_view.cc
index a1f651b..a1f651b 100644
--- a/chrome/browser/views/bookmark_bubble_view.cc
+++ b/chrome/browser/ui/views/bookmark_bubble_view.cc
diff --git a/chrome/browser/ui/views/bookmark_bubble_view.h b/chrome/browser/ui/views/bookmark_bubble_view.h
new file mode 100644
index 0000000..d411c01c
--- /dev/null
+++ b/chrome/browser/ui/views/bookmark_bubble_view.h
@@ -0,0 +1,162 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_BOOKMARK_BUBBLE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_BOOKMARK_BUBBLE_VIEW_H_
+#pragma once
+
+#include "base/string16.h"
+#include "chrome/browser/bookmarks/recently_used_folders_combo_model.h"
+#include "chrome/browser/views/info_bubble.h"
+#include "gfx/rect.h"
+#include "googleurl/src/gurl.h"
+#include "views/controls/button/button.h"
+#include "views/controls/combobox/combobox.h"
+#include "views/controls/link.h"
+#include "views/view.h"
+
+class Profile;
+
+class BookmarkModel;
+class BookmarkNode;
+
+namespace views {
+class NativeButton;
+class Textfield;
+}
+
+// BookmarkBubbleView is a view intended to be used as the content of an
+// InfoBubble. BookmarkBubbleView provides views for unstarring and editting
+// the bookmark it is created with. Don't create a BookmarkBubbleView directly,
+// instead use the static Show method.
+class BookmarkBubbleView : public views::View,
+ public views::LinkController,
+ public views::ButtonListener,
+ public views::Combobox::Listener,
+ public InfoBubbleDelegate {
+ public:
+ static void Show(views::Window* window,
+ const gfx::Rect& bounds,
+ InfoBubbleDelegate* delegate,
+ Profile* profile,
+ const GURL& url,
+ bool newly_bookmarked);
+
+ static bool IsShowing();
+
+ static void Hide();
+
+ virtual ~BookmarkBubbleView();
+
+ void set_info_bubble(InfoBubble* info_bubble) { info_bubble_ = info_bubble; }
+
+ // Overridden to force a layout.
+ virtual void DidChangeBounds(const gfx::Rect& previous,
+ const gfx::Rect& current);
+
+ // Invoked after the bubble has been shown.
+ virtual void BubbleShown();
+
+ // Override to close on return.
+ virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
+
+ virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
+
+ private:
+ // Creates a BookmarkBubbleView.
+ // |title| is the title of the page. If newly_bookmarked is false, title is
+ // ignored and the title of the bookmark is fetched from the database.
+ BookmarkBubbleView(InfoBubbleDelegate* delegate,
+ Profile* profile,
+ const GURL& url,
+ bool newly_bookmarked);
+ // Creates the child views.
+ void Init();
+
+ // Returns the title to display.
+ string16 GetTitle();
+
+ // LinkController method, either unstars the item or shows the bookmark
+ // editor (depending upon which link was clicked).
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ // ButtonListener method, closes the bubble or opens the edit dialog.
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Combobox::Listener method. Changes the parent of the bookmark.
+ virtual void ItemChanged(views::Combobox* combobox,
+ int prev_index,
+ int new_index);
+
+ // InfoBubbleDelegate methods. These forward to the InfoBubbleDelegate
+ // supplied in the constructor as well as sending out the necessary
+ // notification.
+ virtual void InfoBubbleClosing(InfoBubble* info_bubble,
+ bool closed_by_escape);
+ virtual bool CloseOnEscape();
+ virtual bool FadeInOnShow() { return false; }
+ virtual std::wstring accessible_name();
+
+ // Closes the bubble.
+ void Close();
+
+ // Handle the message when the user presses a button.
+ void HandleButtonPressed(views::Button* sender);
+
+ // Shows the BookmarkEditor.
+ void ShowEditor();
+
+ // Sets the title and parent of the node.
+ void ApplyEdits();
+
+ // The bookmark bubble, if we're showing one.
+ static BookmarkBubbleView* bubble_;
+
+ // The InfoBubble showing us.
+ InfoBubble* info_bubble_;
+
+ // Delegate for the bubble, may be null.
+ InfoBubbleDelegate* delegate_;
+
+ // The profile.
+ Profile* profile_;
+
+ // The bookmark URL.
+ const GURL url_;
+
+ // Title of the bookmark. This is initially the title supplied to the
+ // constructor, which is typically the title of the page.
+ std::wstring title_;
+
+ // If true, the page was just bookmarked.
+ const bool newly_bookmarked_;
+
+ RecentlyUsedFoldersComboModel parent_model_;
+
+ // Link for removing/unstarring the bookmark.
+ views::Link* remove_link_;
+
+ // Button to bring up the editor.
+ views::NativeButton* edit_button_;
+
+ // Button to close the window.
+ views::NativeButton* close_button_;
+
+ // Textfield showing the title of the bookmark.
+ views::Textfield* title_tf_;
+
+ // Combobox showing a handful of folders the user can choose from, including
+ // the current parent.
+ views::Combobox* parent_combobox_;
+
+ // When the destructor is invoked should the bookmark be removed?
+ bool remove_bookmark_;
+
+ // When the destructor is invoked should edits be applied?
+ bool apply_edits_;
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_BOOKMARK_BUBBLE_VIEW_H_
diff --git a/chrome/browser/views/bookmark_context_menu.cc b/chrome/browser/ui/views/bookmark_context_menu.cc
index cdd778a..cdd778a 100644
--- a/chrome/browser/views/bookmark_context_menu.cc
+++ b/chrome/browser/ui/views/bookmark_context_menu.cc
diff --git a/chrome/browser/ui/views/bookmark_context_menu.h b/chrome/browser/ui/views/bookmark_context_menu.h
new file mode 100644
index 0000000..1c7bf3c
--- /dev/null
+++ b/chrome/browser/ui/views/bookmark_context_menu.h
@@ -0,0 +1,76 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_BOOKMARK_CONTEXT_MENU_H_
+#define CHROME_BROWSER_UI_VIEWS_BOOKMARK_CONTEXT_MENU_H_
+#pragma once
+
+#include "chrome/browser/views/bookmark_context_menu_controller_views.h"
+#include "views/controls/menu/menu_delegate.h"
+
+// Observer for the BookmarkContextMenu.
+class BookmarkContextMenuObserver {
+ public:
+ // Invoked before the specified items are removed from the bookmark model.
+ virtual void WillRemoveBookmarks(
+ const std::vector<const BookmarkNode*>& bookmarks) = 0;
+
+ // Invoked after the items have been removed from the model.
+ virtual void DidRemoveBookmarks() = 0;
+
+ protected:
+ virtual ~BookmarkContextMenuObserver() {}
+};
+
+class BookmarkContextMenu : public BookmarkContextMenuControllerViewsDelegate,
+ public views::MenuDelegate {
+ public:
+ BookmarkContextMenu(
+ gfx::NativeWindow parent_window,
+ Profile* profile,
+ PageNavigator* page_navigator,
+ const BookmarkNode* parent,
+ const std::vector<const BookmarkNode*>& selection);
+ virtual ~BookmarkContextMenu();
+
+ // Shows the context menu at the specified point.
+ void RunMenuAt(const gfx::Point& point);
+
+ views::MenuItemView* menu() const { return menu_.get(); }
+
+ void set_observer(BookmarkContextMenuObserver* observer) {
+ observer_ = observer;
+ }
+
+ // Overridden from views::MenuDelegate:
+ virtual void ExecuteCommand(int command_id);
+ virtual bool IsItemChecked(int command_id) const;
+ virtual bool IsCommandEnabled(int command_id) const;
+ virtual bool ShouldCloseAllMenusOnExecute(int id);
+
+ // Overridden from BookmarkContextMenuControllerViewsDelegate:
+ virtual void CloseMenu();
+ virtual void AddItem(int command_id);
+ virtual void AddItemWithStringId(int command_id, int string_id);
+ virtual void AddSeparator();
+ virtual void AddCheckboxItem(int command_id);
+ virtual void WillRemoveBookmarks(
+ const std::vector<const BookmarkNode*>& bookmarks);
+ virtual void DidRemoveBookmarks();
+
+ private:
+ scoped_ptr<BookmarkContextMenuControllerViews> controller_;
+
+ // The parent of dialog boxes opened from the context menu.
+ gfx::NativeWindow parent_window_;
+
+ // The menu itself.
+ scoped_ptr<views::MenuItemView> menu_;
+
+ BookmarkContextMenuObserver* observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenu);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_BOOKMARK_CONTEXT_MENU_H_
diff --git a/chrome/browser/views/bookmark_context_menu_controller_views.cc b/chrome/browser/ui/views/bookmark_context_menu_controller_views.cc
index b2dcde9..b2dcde9 100644
--- a/chrome/browser/views/bookmark_context_menu_controller_views.cc
+++ b/chrome/browser/ui/views/bookmark_context_menu_controller_views.cc
diff --git a/chrome/browser/ui/views/bookmark_context_menu_controller_views.h b/chrome/browser/ui/views/bookmark_context_menu_controller_views.h
new file mode 100644
index 0000000..fc3537a
--- /dev/null
+++ b/chrome/browser/ui/views/bookmark_context_menu_controller_views.h
@@ -0,0 +1,93 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_BOOKMARK_CONTEXT_MENU_CONTROLLER_VIEWS_H_
+#define CHROME_BROWSER_UI_VIEWS_BOOKMARK_CONTEXT_MENU_CONTROLLER_VIEWS_H_
+#pragma once
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "chrome/browser/bookmarks/base_bookmark_model_observer.h"
+#include "gfx/native_widget_types.h"
+
+class Browser;
+class PageNavigator;
+class Profile;
+
+// An interface implemented by an object that performs actions on the actual
+// menu for the controller.
+class BookmarkContextMenuControllerViewsDelegate {
+ public:
+ virtual ~BookmarkContextMenuControllerViewsDelegate() {}
+
+ // Closes the bookmark context menu.
+ virtual void CloseMenu() = 0;
+
+ // Methods that add items to the underlying menu.
+ virtual void AddItem(int command_id) = 0;
+ virtual void AddItemWithStringId(int command_id, int string_id) = 0;
+ virtual void AddSeparator() = 0;
+ virtual void AddCheckboxItem(int command_id) = 0;
+
+ // Sent before bookmarks are removed.
+ virtual void WillRemoveBookmarks(
+ const std::vector<const BookmarkNode*>& bookmarks) {}
+
+ // Sent after bookmarks have been removed.
+ virtual void DidRemoveBookmarks() {}
+};
+
+// BookmarkContextMenuControllerViews creates and manages state for the context
+// menu shown for any bookmark item.
+class BookmarkContextMenuControllerViews : public BaseBookmarkModelObserver {
+ public:
+ // Creates the bookmark context menu.
+ // |profile| is used for opening urls as well as enabling 'open incognito'.
+ // |browser| is used to determine the PageNavigator and may be null.
+ // |navigator| is used if |browser| is null, and is provided for testing.
+ // |parent| is the parent for newly created nodes if |selection| is empty.
+ // |selection| is the nodes the context menu operates on and may be empty.
+ BookmarkContextMenuControllerViews(
+ gfx::NativeWindow parent_window,
+ BookmarkContextMenuControllerViewsDelegate* delegate,
+ Profile* profile,
+ PageNavigator* navigator,
+ const BookmarkNode* parent,
+ const std::vector<const BookmarkNode*>& selection);
+ virtual ~BookmarkContextMenuControllerViews();
+
+ void BuildMenu();
+
+ void ExecuteCommand(int id);
+ bool IsItemChecked(int id) const;
+ bool IsCommandEnabled(int id) const;
+
+ // Accessors:
+ Profile* profile() const { return profile_; }
+ PageNavigator* navigator() const { return navigator_; }
+
+ private:
+ // Overridden from BaseBookmarkModelObserver:
+ // Any change to the model results in closing the menu.
+ virtual void BookmarkModelChanged();
+
+ // Removes the observer from the model and NULLs out model_.
+ BookmarkModel* RemoveModelObserver();
+
+ // Returns true if selection_ has at least one bookmark of type url.
+ bool HasURLs() const;
+
+ gfx::NativeWindow parent_window_;
+ BookmarkContextMenuControllerViewsDelegate* delegate_;
+ Profile* profile_;
+ PageNavigator* navigator_;
+ const BookmarkNode* parent_;
+ std::vector<const BookmarkNode*> selection_;
+ BookmarkModel* model_;
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenuControllerViews);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_BOOKMARK_CONTEXT_MENU_CONTROLLER_VIEWS_H_
diff --git a/chrome/browser/views/bookmark_context_menu_test.cc b/chrome/browser/ui/views/bookmark_context_menu_test.cc
index 8d3f89c..8d3f89c 100644
--- a/chrome/browser/views/bookmark_context_menu_test.cc
+++ b/chrome/browser/ui/views/bookmark_context_menu_test.cc
diff --git a/chrome/browser/views/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmark_editor_view.cc
index 6f892a3..6f892a3 100644
--- a/chrome/browser/views/bookmark_editor_view.cc
+++ b/chrome/browser/ui/views/bookmark_editor_view.cc
diff --git a/chrome/browser/ui/views/bookmark_editor_view.h b/chrome/browser/ui/views/bookmark_editor_view.h
new file mode 100644
index 0000000..1948865
--- /dev/null
+++ b/chrome/browser/ui/views/bookmark_editor_view.h
@@ -0,0 +1,265 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_BOOKMARK_EDITOR_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_BOOKMARK_EDITOR_VIEW_H_
+#pragma once
+
+#include "app/menus/simple_menu_model.h"
+#include "app/tree_node_model.h"
+#include "base/string16.h"
+#include "chrome/browser/bookmarks/bookmark_editor.h"
+#include "chrome/browser/bookmarks/bookmark_model_observer.h"
+#include "views/controls/button/button.h"
+#include "views/controls/textfield/textfield.h"
+#include "views/controls/tree/tree_view.h"
+#include "views/window/dialog_delegate.h"
+#include "testing/gtest/include/gtest/gtest_prod.h"
+
+namespace views {
+class Label;
+class Menu2;
+class NativeButton;
+class Window;
+}
+
+class BookmarkEditorViewTest;
+class GURL;
+class Menu;
+class Profile;
+
+// View that allows the user to edit a bookmark/starred URL. The user can
+// change the URL, title and where the bookmark appears as well as adding
+// new groups and changing the name of other groups. The editor is used for
+// both editing a url bookmark, as well as editing a folder bookmark when
+// created from 'Bookmark all tabs'.
+//
+// Edits are applied to the BookmarkModel when the user presses 'OK'.
+//
+// To use BookmarkEditorView invoke the static show method.
+
+class BookmarkEditorView : public BookmarkEditor,
+ public views::View,
+ public views::ButtonListener,
+ public views::TreeViewController,
+ public views::DialogDelegate,
+ public views::Textfield::Controller,
+ public views::ContextMenuController,
+ public menus::SimpleMenuModel::Delegate,
+ public BookmarkModelObserver {
+ public:
+ // Type of node in the tree. Public purely for testing.
+ typedef TreeNodeWithValue<int64> EditorNode;
+
+ // Model for the TreeView. Trivial subclass that doesn't allow titles with
+ // empty strings. Public purely for testing.
+ class EditorTreeModel : public TreeNodeModel<EditorNode> {
+ public:
+ explicit EditorTreeModel(EditorNode* root)
+ : TreeNodeModel<EditorNode>(root) {}
+
+ virtual void SetTitle(TreeModelNode* node,
+ const string16& title) {
+ if (!title.empty())
+ TreeNodeModel::SetTitle(node, title);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(EditorTreeModel);
+ };
+
+ BookmarkEditorView(Profile* profile,
+ const BookmarkNode* parent,
+ const EditDetails& details,
+ BookmarkEditor::Configuration configuration);
+
+ virtual ~BookmarkEditorView();
+
+ // DialogDelegate methods:
+ virtual bool IsDialogButtonEnabled(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool IsModal() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual bool Accept();
+ virtual bool AreAcceleratorsEnabled(MessageBoxFlags::DialogButton button);
+ virtual views::View* GetContentsView();
+
+ // View methods.
+ virtual void Layout();
+ virtual gfx::Size GetPreferredSize();
+ virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
+ views::View* child);
+
+ // TreeViewObserver methods.
+ virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view);
+ virtual bool CanEdit(views::TreeView* tree_view, TreeModelNode* node);
+
+ // Textfield::Controller methods.
+ virtual void ContentsChanged(views::Textfield* sender,
+ const std::wstring& new_contents);
+ virtual bool HandleKeystroke(views::Textfield* sender,
+ const views::Textfield::Keystroke&) {
+ return false;
+ }
+
+ // NativeButton.
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // menus::SimpleMenuModel::Delegate.
+ 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);
+
+ // Creates a Window and adds the BookmarkEditorView to it. When the window is
+ // closed the BookmarkEditorView is deleted.
+ void Show(HWND parent_hwnd);
+
+ // Closes the dialog.
+ void Close();
+
+ // Shows the context menu.
+ virtual void ShowContextMenu(View* source,
+ const gfx::Point& p,
+ bool is_mouse_gesture);
+
+ private:
+ friend class BookmarkEditorViewTest;
+
+ // Creates the necessary sub-views, configures them, adds them to the layout,
+ // and requests the entries to display from the database.
+ void Init();
+
+ // 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 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();
+
+ // Expands all the nodes in the tree and selects the parent node of the
+ // url we're editing or the most recent parent if the url being editted isn't
+ // starred.
+ void ExpandAndSelect();
+
+ // Creates a returns the new root node. This invokes CreateNodes to do
+ // the real work.
+ EditorNode* CreateRootNode();
+
+ // Adds and creates a child node in b_node for all children of bb_node that
+ // are groups.
+ void CreateNodes(const BookmarkNode* bb_node, EditorNode* b_node);
+
+ // Returns the node with the specified id, or NULL if one can't be found.
+ EditorNode* FindNodeWithID(BookmarkEditorView::EditorNode* node, int64 id);
+
+ // Invokes ApplyEdits with the selected node.
+ void ApplyEdits();
+
+ // Applies the edits done by the user. |parent| gives the parent of the URL
+ // being edited.
+ void ApplyEdits(EditorNode* parent);
+
+ // Recursively adds newly created groups and sets the title of nodes to
+ // match the user edited title.
+ //
+ // bb_node gives the BookmarkNode the edits are to be applied to, with b_node
+ // the source of the edits.
+ //
+ // If b_node == parent_b_node, parent_bb_node is set to bb_node. This is
+ // used to determine the new BookmarkNode parent based on the EditorNode
+ // parent.
+ void ApplyNameChangesAndCreateNewGroups(
+ const BookmarkNode* bb_node,
+ BookmarkEditorView::EditorNode* b_node,
+ BookmarkEditorView::EditorNode* parent_b_node,
+ const BookmarkNode** parent_bb_node);
+
+ // Returns the current url the user has input.
+ GURL GetInputURL() const;
+
+ // Returns the title the user has input.
+ std::wstring GetInputTitle() const;
+
+ // Invoked when the url or title has possibly changed. Updates the background
+ // of Textfields and ok button appropriately.
+ void UserInputChanged();
+
+ // Creates a new group as a child of the selected node. If no node is
+ // selected, the new group is added as a child of the bookmark node. Starts
+ // editing on the new gorup as well.
+ void NewGroup();
+
+ // Creates a new EditorNode as the last child of parent. The new node is
+ // added to the model and returned. This does NOT start editing. This is used
+ // internally by NewGroup and broken into a separate method for testing.
+ EditorNode* AddNewGroup(EditorNode* parent);
+
+ // Profile the entry is from.
+ Profile* profile_;
+
+ // Model driving the TreeView.
+ scoped_ptr<EditorTreeModel> tree_model_;
+
+ // Displays star groups.
+ views::TreeView* tree_view_;
+
+ // Used to create a new group.
+ scoped_ptr<views::NativeButton> new_group_button_;
+
+ // The label for the url text field.
+ views::Label* url_label_;
+
+ // Used for editing the URL.
+ views::Textfield url_tf_;
+
+ // The label for the title text field.
+ views::Label* title_label_;
+
+ // Used for editing the title.
+ views::Textfield title_tf_;
+
+ // Initial parent to select. Is only used if |details_.existing_node| is
+ // NULL.
+ const BookmarkNode* parent_;
+
+ const EditDetails details_;
+
+ // The context menu.
+ scoped_ptr<menus::SimpleMenuModel> context_menu_contents_;
+ scoped_ptr<views::Menu2> context_menu_;
+
+ // 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_;
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkEditorView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_BOOKMARK_EDITOR_VIEW_H_
diff --git a/chrome/browser/views/bookmark_editor_view_unittest.cc b/chrome/browser/ui/views/bookmark_editor_view_unittest.cc
index afeeb4e..afeeb4e 100644
--- a/chrome/browser/views/bookmark_editor_view_unittest.cc
+++ b/chrome/browser/ui/views/bookmark_editor_view_unittest.cc
diff --git a/chrome/browser/views/bookmark_menu_controller_views.cc b/chrome/browser/ui/views/bookmark_menu_controller_views.cc
index c86432e..c86432e 100644
--- a/chrome/browser/views/bookmark_menu_controller_views.cc
+++ b/chrome/browser/ui/views/bookmark_menu_controller_views.cc
diff --git a/chrome/browser/ui/views/bookmark_menu_controller_views.h b/chrome/browser/ui/views/bookmark_menu_controller_views.h
new file mode 100644
index 0000000..68752bd
--- /dev/null
+++ b/chrome/browser/ui/views/bookmark_menu_controller_views.h
@@ -0,0 +1,200 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_BOOKMARK_MENU_CONTROLLER_VIEWS_H_
+#define CHROME_BROWSER_UI_VIEWS_BOOKMARK_MENU_CONTROLLER_VIEWS_H_
+#pragma once
+
+#include <map>
+#include <set>
+
+#include "chrome/browser/bookmarks/base_bookmark_model_observer.h"
+#include "chrome/browser/bookmarks/bookmark_drag_data.h"
+#include "chrome/browser/views/bookmark_context_menu.h"
+#include "gfx/native_widget_types.h"
+#include "views/controls/menu/menu_delegate.h"
+#include "views/controls/menu/menu_item_view.h"
+
+namespace gfx {
+class Rect;
+} // namespace gfx
+
+namespace views {
+class MenuButton;
+} // namespace views
+
+class BookmarkBarView;
+class BookmarkContextMenu;
+class BookmarkNode;
+class Browser;
+class OSExchangeData;
+class PageNavigator;
+class Profile;
+
+// BookmarkMenuController is responsible for showing a menu of bookmarks,
+// each item in the menu represents a bookmark.
+// BookmarkMenuController deletes itself as necessary, although the menu can
+// be explicitly hidden by way of the Cancel method.
+class BookmarkMenuController : public BaseBookmarkModelObserver,
+ public views::MenuDelegate,
+ public BookmarkContextMenuObserver {
+ public:
+ // The observer is notified prior to the menu being deleted.
+ class Observer {
+ public:
+ virtual void BookmarkMenuDeleted(BookmarkMenuController* controller) = 0;
+
+ protected:
+ virtual ~Observer() {}
+ };
+
+ // Creates a BookmarkMenuController showing the children of |node| starting
+ // at index |start_child_index|.
+ BookmarkMenuController(Browser* browser,
+ Profile* profile,
+ PageNavigator* page_navigator,
+ gfx::NativeWindow parent,
+ const BookmarkNode* node,
+ int start_child_index);
+
+ void RunMenuAt(BookmarkBarView* bookmark_bar, bool for_drop);
+
+ // Shows the menu.
+ void RunMenuAt(views::MenuButton* button,
+ views::MenuItemView::AnchorPosition position,
+ bool for_drop);
+
+ // Hides the menu.
+ void Cancel();
+
+ // Returns the node the menu is showing for.
+ const BookmarkNode* node() const { return node_; }
+
+ // Returns the menu.
+ views::MenuItemView* menu() const { return menu_; }
+
+ // Returns the context menu, or NULL if the context menu isn't showing.
+ views::MenuItemView* context_menu() const {
+ return context_menu_.get() ? context_menu_->menu() : NULL;
+ }
+
+ void set_observer(Observer* observer) { observer_ = observer; }
+
+ // MenuDelegate methods.
+ virtual bool IsTriggerableEvent(const views::MouseEvent& e);
+ virtual void ExecuteCommand(int id, int mouse_event_flags);
+ virtual bool GetDropFormats(
+ views::MenuItemView* menu,
+ int* formats,
+ std::set<OSExchangeData::CustomFormat>* custom_formats);
+ virtual bool AreDropTypesRequired(views::MenuItemView* menu);
+ virtual bool CanDrop(views::MenuItemView* menu, const OSExchangeData& data);
+ virtual int GetDropOperation(views::MenuItemView* item,
+ const views::DropTargetEvent& event,
+ DropPosition* position);
+ virtual int OnPerformDrop(views::MenuItemView* menu,
+ DropPosition position,
+ const views::DropTargetEvent& event);
+ virtual bool ShowContextMenu(views::MenuItemView* source,
+ int id,
+ const gfx::Point& p,
+ bool is_mouse_gesture);
+ virtual void DropMenuClosed(views::MenuItemView* menu);
+ virtual bool CanDrag(views::MenuItemView* menu);
+ virtual void WriteDragData(views::MenuItemView* sender, OSExchangeData* data);
+ virtual int GetDragOperations(views::MenuItemView* sender);
+ virtual views::MenuItemView* GetSiblingMenu(
+ views::MenuItemView* menu,
+ const gfx::Point& screen_point,
+ views::MenuItemView::AnchorPosition* anchor,
+ bool* has_mnemonics,
+ views::MenuButton** button);
+ virtual int GetMaxWidthForMenu();
+
+ // BookmarkModelObserver methods.
+ virtual void BookmarkModelChanged();
+ virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model,
+ const BookmarkNode* node);
+
+ // BookmarkContextMenu::Observer methods.
+ virtual void WillRemoveBookmarks(
+ const std::vector<const BookmarkNode*>& bookmarks);
+ virtual void DidRemoveBookmarks();
+
+ private:
+ typedef std::map<const BookmarkNode*, int> NodeToMenuIDMap;
+
+ // BookmarkMenuController deletes itself as necessary.
+ virtual ~BookmarkMenuController();
+
+ // Creates a menu and adds it to node_to_menu_id_map_. This uses
+ // BuildMenu to recursively populate the menu.
+ views::MenuItemView* CreateMenu(const BookmarkNode* parent,
+ int start_child_index);
+
+ // Creates an entry in menu for each child node of |parent| starting at
+ // |start_child_index|.
+ void BuildMenu(const BookmarkNode* parent,
+ int start_child_index,
+ views::MenuItemView* menu,
+ int* next_menu_id);
+
+ // Returns the menu whose id is |id|.
+ views::MenuItemView* GetMenuByID(int id);
+
+ // Does the work of processing WillRemoveBookmarks. On exit the set of removed
+ // menus is added to |removed_menus|. It's up to the caller to delete the
+ // the menus added to |removed_menus|.
+ void WillRemoveBookmarksImpl(
+ const std::vector<const BookmarkNode*>& bookmarks,
+ std::set<views::MenuItemView*>* removed_menus);
+
+ Browser* browser_;
+
+ Profile* profile_;
+
+ PageNavigator* page_navigator_;
+
+ // Parent of menus.
+ gfx::NativeWindow parent_;
+
+ // The node we're showing the contents of.
+ const BookmarkNode* node_;
+
+ // Maps from menu id to BookmarkNode.
+ std::map<int, const BookmarkNode*> menu_id_to_node_map_;
+
+ // Mapping from node to menu id. This only contains entries for nodes of type
+ // URL.
+ NodeToMenuIDMap node_to_menu_id_map_;
+
+ // Current menu.
+ views::MenuItemView* menu_;
+
+ // Data for the drop.
+ BookmarkDragData drop_data_;
+
+ // Used when a context menu is shown.
+ scoped_ptr<BookmarkContextMenu> context_menu_;
+
+ // The observer, may be null.
+ Observer* observer_;
+
+ // Is the menu being shown for a drop?
+ bool for_drop_;
+
+ // The bookmark bar. This is only non-null if we're showing a menu item
+ // for a folder on the bookmark bar and not for drop.
+ BookmarkBarView* bookmark_bar_;
+
+ typedef std::map<const BookmarkNode*, views::MenuItemView*> NodeToMenuMap;
+ NodeToMenuMap node_to_menu_map_;
+
+ // ID of the next menu item.
+ int next_menu_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkMenuController);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_BOOKMARK_MENU_CONTROLLER_VIEWS_H_
diff --git a/chrome/browser/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc
index b630806..b630806 100644
--- a/chrome/browser/views/browser_actions_container.cc
+++ b/chrome/browser/ui/views/browser_actions_container.cc
diff --git a/chrome/browser/ui/views/browser_actions_container.h b/chrome/browser/ui/views/browser_actions_container.h
new file mode 100644
index 0000000..5c5b3b4
--- /dev/null
+++ b/chrome/browser/ui/views/browser_actions_container.h
@@ -0,0 +1,509 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_BROWSER_ACTIONS_CONTAINER_H_
+#define CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_
+#pragma once
+
+#include <set>
+#include <string>
+#include <vector>
+
+#include "app/slide_animation.h"
+#include "base/task.h"
+#include "chrome/browser/extensions/extension_context_menu_model.h"
+#include "chrome/browser/extensions/extension_toolbar_model.h"
+#include "chrome/browser/extensions/image_loading_tracker.h"
+#include "chrome/browser/views/browser_bubble.h"
+#include "chrome/browser/views/extensions/browser_action_overflow_menu_controller.h"
+#include "chrome/browser/views/extensions/extension_popup.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "views/controls/button/menu_button.h"
+#include "views/controls/menu/view_menu_delegate.h"
+#include "views/controls/resize_area.h"
+#include "views/view.h"
+
+class Browser;
+class BrowserActionsContainer;
+class BrowserActionOverflowMenuController;
+class BrowserActionsContainer;
+class Extension;
+class ExtensionAction;
+class ExtensionPopup;
+class PrefService;
+class Profile;
+
+namespace gfx {
+class CanvasSkia;
+}
+
+namespace views {
+class Menu2;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// BrowserActionButton
+
+// The BrowserActionButton is a specialization of the MenuButton class.
+// It acts on a ExtensionAction, in this case a BrowserAction and handles
+// loading the image for the button asynchronously on the file thread.
+class BrowserActionButton : public views::MenuButton,
+ public views::ButtonListener,
+ public ImageLoadingTracker::Observer,
+ public NotificationObserver {
+ public:
+ BrowserActionButton(const Extension* extension,
+ BrowserActionsContainer* panel);
+
+ // Call this instead of delete.
+ void Destroy();
+
+ ExtensionAction* browser_action() const { return browser_action_; }
+ const Extension* extension() { return extension_; }
+
+ // Called to update the display to match the browser action's state.
+ void UpdateState();
+
+ // Returns the default icon, if any.
+ const SkBitmap& default_icon() const { return default_icon_; }
+
+ // Overridden from views::View:
+ virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Overridden from ImageLoadingTracker.
+ virtual void OnImageLoaded(
+ SkBitmap* image, ExtensionResource resource, int index);
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // MenuButton behavior overrides. These methods all default to TextButton
+ // behavior unless this button is a popup. In that case, it uses MenuButton
+ // behavior. MenuButton has the notion of a child popup being shown where the
+ // button will stay in the pushed state until the "menu" (a popup in this
+ // case) is dismissed.
+ virtual bool Activate();
+ virtual bool OnMousePressed(const views::MouseEvent& e);
+ virtual void OnMouseReleased(const views::MouseEvent& e, bool canceled);
+ virtual bool OnKeyReleased(const views::KeyEvent& e);
+ virtual void OnMouseExited(const views::MouseEvent& event);
+ virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture);
+
+ // Does this button's action have a popup?
+ virtual bool IsPopup();
+ virtual GURL GetPopupUrl();
+
+ // Notifications when to set button state to pushed/not pushed (for when the
+ // popup/context menu is hidden or shown by the container).
+ void SetButtonPushed();
+ void SetButtonNotPushed();
+
+ private:
+ virtual ~BrowserActionButton();
+
+ // The browser action this view represents. The ExtensionAction is not owned
+ // by this class.
+ ExtensionAction* browser_action_;
+
+ // The extension associated with the browser action we're displaying.
+ const Extension* extension_;
+
+ // The object that is waiting for the image loading to complete
+ // asynchronously.
+ ImageLoadingTracker tracker_;
+
+ // Whether we are currently showing/just finished showing a context menu.
+ bool showing_context_menu_;
+
+ // The default icon for our browser action. This might be non-empty if the
+ // browser action had a value for default_icon in the manifest.
+ SkBitmap default_icon_;
+
+ // The browser action shelf.
+ BrowserActionsContainer* panel_;
+
+ scoped_refptr<ExtensionContextMenuModel> context_menu_contents_;
+ scoped_ptr<views::Menu2> context_menu_menu_;
+
+ NotificationRegistrar registrar_;
+
+ friend class DeleteTask<BrowserActionButton>;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserActionButton);
+};
+
+
+////////////////////////////////////////////////////////////////////////////////
+// BrowserActionView
+// A single section in the browser action container. This contains the actual
+// BrowserActionButton, as well as the logic to paint the badge.
+
+class BrowserActionView : public views::View {
+ public:
+ BrowserActionView(const Extension* extension, BrowserActionsContainer* panel);
+ virtual ~BrowserActionView();
+
+ BrowserActionButton* button() { return button_; }
+
+ // Allocates a canvas object on the heap and draws into it the icon for the
+ // view as well as the badge (if any). Caller is responsible for deleting the
+ // returned object.
+ gfx::Canvas* GetIconWithBadge();
+
+ // Accessibility accessors, overridden from View.
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+
+ private:
+ virtual void Layout();
+
+ // Override PaintChildren so that we can paint the badge on top of children.
+ virtual void PaintChildren(gfx::Canvas* canvas);
+
+ // The container for this view.
+ BrowserActionsContainer* panel_;
+
+ // The button this view contains.
+ BrowserActionButton* button_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserActionView);
+};
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// The BrowserActionsContainer is a container view, responsible for drawing the
+// browser action icons (extensions that add icons to the toolbar).
+//
+// The container is placed flush against the omnibox and wrench menu, and its
+// layout looks like:
+// rI_I_IcCs
+// Where the letters are as follows:
+// r: An invisible resize area. This is ToolbarView::kStandardSpacing pixels
+// wide and directly adjacent to the omnibox.
+// I: An icon. This is as wide as the IDR_BROWSER_ACTION image.
+// _: kItemSpacing pixels of empty space.
+// c: kChevronSpacing pixels of empty space. Only present if C is present.
+// C: An optional chevron, visible for overflow. As wide as the
+// IDR_BROWSER_ACTIONS_OVERFLOW image.
+// s: ToolbarView::kStandardSpacing pixels of empty space (before the wrench
+// menu).
+// The reason the container contains the trailing space "s", rather than having
+// it be handled by the parent view, is so that when the chevron is invisible
+// and the user starts dragging an icon around, we have the space to draw the
+// ultimate drop indicator. (Otherwise, we'd be trying to draw it into the
+// padding beyond our right edge, and it wouldn't appear.)
+//
+// The BrowserActionsContainer follows a few rules, in terms of user experience:
+//
+// 1) The container can never grow beyond the space needed to show all icons
+// (hereby referred to as the max width).
+// 2) The container can never shrink below the space needed to show just the
+// initial padding and the chevron (ignoring the case where there are no icons
+// to show, in which case the container won't be visible anyway).
+// 3) The container snaps into place (to the pixel count that fits the visible
+// icons) to make sure there is no wasted space at the edges of the container.
+// 4) If the user adds or removes icons (read: installs/uninstalls browser
+// actions) we grow and shrink the container as needed - but ONLY if the
+// container was at max width to begin with.
+// 5) If the container is NOT at max width (has an overflow menu), we respect
+// that size when adding and removing icons and DON'T grow/shrink the container.
+// This means that new icons (which always appear at the far right) will show up
+// in the overflow menu. The install bubble for extensions points to the chevron
+// menu in this case.
+//
+// Resizing the BrowserActionsContainer:
+//
+// The ResizeArea view sends OnResize messages to the BrowserActionsContainer
+// class as the user drags it. This modifies the value for |resize_amount_|.
+// That indicates to the container that a resize is in progress and is used to
+// calculate the size in GetPreferredSize(), though that function never exceeds
+// the defined minimum and maximum size of the container.
+//
+// When the user releases the mouse (ends the resize), we calculate a target
+// size for the container (animation_target_size_), clamp that value to the
+// containers min and max and then animate from the *current* position (that the
+// user has dragged the view to) to the target size.
+//
+// Animating the BrowserActionsContainer:
+//
+// Animations are used when snapping the container to a value that fits all
+// visible icons. This can be triggered when the user finishes resizing the
+// container or when Browser Actions are added/removed.
+//
+// We always animate from the current width (container_width_) to the target
+// size (animation_target_size_), using |resize_amount| to keep track of the
+// animation progress.
+//
+// NOTE: When adding Browser Actions to a maximum width container (no overflow)
+// we make sure to suppress the chevron menu if it wasn't visible. This is
+// because we won't have enough space to show the new Browser Action until the
+// animation ends and we don't want the chevron to flash into view while we are
+// growing the container.
+//
+////////////////////////////////////////////////////////////////////////////////
+class BrowserActionsContainer
+ : public views::View,
+ public views::ViewMenuDelegate,
+ public views::DragController,
+ public views::ResizeArea::ResizeAreaDelegate,
+ public AnimationDelegate,
+ public ExtensionToolbarModel::Observer,
+ public BrowserActionOverflowMenuController::Observer,
+ public ExtensionContextMenuModel::PopupDelegate,
+ public ExtensionPopup::Observer {
+ public:
+ BrowserActionsContainer(Browser* browser, views::View* owner_view);
+ virtual ~BrowserActionsContainer();
+
+ static void RegisterUserPrefs(PrefService* prefs);
+
+ void Init();
+
+ // Get the number of browser actions being displayed.
+ int num_browser_actions() const { return browser_action_views_.size(); }
+
+ // Whether we are performing resize animation on the container.
+ bool animating() const { return animation_target_size_ > 0; }
+
+ // Returns the chevron, if any.
+ const views::View* chevron() const { return chevron_; }
+
+ // Returns the profile this container is associated with.
+ Profile* profile() const { return profile_; }
+
+ // Returns the browser this container is associated with.
+ Browser* browser() const { return browser_; }
+
+ // Returns the current tab's ID, or -1 if there is no current tab.
+ int GetCurrentTabId() const;
+
+ // Get a particular browser action view.
+ BrowserActionView* GetBrowserActionViewAt(int index) {
+ return browser_action_views_[index];
+ }
+
+ // Retrieve the BrowserActionView for |extension|.
+ BrowserActionView* GetBrowserActionView(ExtensionAction* action);
+
+ // Update the views to reflect the state of the browser action icons.
+ void RefreshBrowserActionViews();
+
+ // Sets up the browser action view vector.
+ void CreateBrowserActionViews();
+
+ // Delete all browser action views.
+ void DeleteBrowserActionViews();
+
+ // Called when a browser action becomes visible/hidden.
+ void OnBrowserActionVisibilityChanged();
+
+ // Returns how many browser actions are visible.
+ size_t VisibleBrowserActions() const;
+
+ // Called when the user clicks on the browser action icon.
+ void OnBrowserActionExecuted(BrowserActionButton* button,
+ bool inspect_with_devtools);
+
+ // Overridden from views::View:
+ virtual gfx::Size GetPreferredSize();
+ virtual void Layout();
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+ virtual bool GetDropFormats(
+ int* formats, std::set<OSExchangeData::CustomFormat>* custom_formats);
+ virtual bool AreDropTypesRequired();
+ virtual bool CanDrop(const OSExchangeData& data);
+ virtual void OnDragEntered(const views::DropTargetEvent& event);
+ virtual int OnDragUpdated(const views::DropTargetEvent& event);
+ virtual void OnDragExited();
+ virtual int OnPerformDrop(const views::DropTargetEvent& event);
+ virtual void OnThemeChanged();
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+
+ // Overridden from views::ViewMenuDelegate:
+ virtual void RunMenu(View* source, const gfx::Point& pt);
+
+ // Overridden from views::DragController:
+ virtual void WriteDragData(View* sender,
+ const gfx::Point& press_pt,
+ OSExchangeData* data);
+ virtual int GetDragOperations(View* sender, const gfx::Point& p);
+ virtual bool CanStartDrag(View* sender,
+ const gfx::Point& press_pt,
+ const gfx::Point& p);
+
+ // Overridden from ResizeArea::ResizeAreaDelegate:
+ virtual void OnResize(int resize_amount, bool done_resizing);
+
+ // Overridden from AnimationDelegate:
+ virtual void AnimationProgressed(const Animation* animation);
+ virtual void AnimationEnded(const Animation* animation);
+
+ // Overridden from BrowserActionOverflowMenuController::Observer:
+ virtual void NotifyMenuDeleted(
+ BrowserActionOverflowMenuController* controller);
+
+ // Overridden from ExtensionContextMenuModel::PopupDelegate
+ virtual void InspectPopup(ExtensionAction* action);
+
+ // Overriden from ExtensionPopup::Delegate
+ virtual void ExtensionPopupIsClosing(ExtensionPopup* popup);
+
+ // Moves a browser action with |id| to |new_index|.
+ void MoveBrowserAction(const std::string& extension_id, size_t new_index);
+
+ // Hide the current popup.
+ void HidePopup();
+
+ // Simulate a click on a browser action button. This should only be
+ // used by unit tests.
+ void TestExecuteBrowserAction(int index);
+
+ // Retrieve the current popup. This should only be used by unit tests.
+ ExtensionPopup* TestGetPopup() { return popup_; }
+
+ // Set how many icons the container should show. This should only be used by
+ // unit tests.
+ void TestSetIconVisibilityCount(size_t icons);
+
+ // During testing we can disable animations by setting this flag to true,
+ // so that the bar resizes instantly, instead of having to poll it while it
+ // animates to open/closed status.
+ static bool disable_animations_during_testing_;
+
+ private:
+ friend class BrowserActionView; // So it can access IconHeight().
+ friend class ShowFolderMenuTask;
+
+ typedef std::vector<BrowserActionView*> BrowserActionViews;
+
+ // Returns the width of an icon, optionally with its padding.
+ static int IconWidth(bool include_padding);
+
+ // Returns the height of an icon.
+ static int IconHeight();
+
+ // 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();
+
+ void LoadImages();
+
+ // Sets the initial container width.
+ void SetContainerWidth();
+
+ // Closes the overflow menu if open.
+ void CloseOverflowMenu();
+
+ // Cancels the timer for showing the drop down menu.
+ void StopShowFolderDropMenuTimer();
+
+ // Show the drop down folder after a slight delay.
+ void StartShowFolderDropMenuTimer();
+
+ // Show the overflow menu.
+ void ShowDropFolder();
+
+ // Sets the drop indicator position (and schedules paint if the position has
+ // changed).
+ void SetDropIndicator(int x_pos);
+
+ // Given a number of |icons| and whether to |display_chevron|, returns the
+ // amount of pixels needed to draw the entire container. For convenience,
+ // callers can set |icons| to -1 to mean "all icons".
+ int IconCountToWidth(int icons, bool display_chevron) const;
+
+ // Given a pixel width, returns the number of icons that fit. (This
+ // automatically determines whether a chevron will be needed and includes it
+ // in the calculation.)
+ size_t WidthToIconCount(int pixels) const;
+
+ // Returns the absolute minimum size you can shrink the container down to and
+ // still show it. This assumes a visible chevron because the only way we
+ // would not have a chevron when shrinking down this far is if there were no
+ // icons, in which case the container wouldn't be shown at all.
+ int ContainerMinSize() const;
+
+ // Animate to the target size (unless testing, in which case we go straight to
+ // the target size). This also saves the target number of visible icons in
+ // the pref if we're not off the record.
+ void SaveDesiredSizeAndAnimate(Tween::Type type, size_t num_visible_icons);
+
+ // 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);
+
+ // The vector of browser actions (icons/image buttons for each action). Note
+ // that not every BrowserAction in the ToolbarModel will necessarily be in
+ // this collection. Some extensions may be disabled in incognito windows.
+ BrowserActionViews browser_action_views_;
+
+ Profile* profile_;
+
+ // The Browser object the container is associated with.
+ Browser* browser_;
+
+ // The view that owns us.
+ views::View* owner_view_;
+
+ // The current popup and the button it came from. NULL if no popup.
+ ExtensionPopup* popup_;
+
+ // The button that triggered the current popup (just a reference to a button
+ // from browser_action_views_).
+ BrowserActionButton* popup_button_;
+
+ // The model that tracks the order of the toolbar icons.
+ ExtensionToolbarModel* model_;
+
+ // The current width of the container.
+ int container_width_;
+
+ // The resize area for the container.
+ views::ResizeArea* resize_area_;
+
+ // The chevron for accessing the overflow items.
+ views::MenuButton* chevron_;
+
+ // The menu to show for the overflow button (chevron). This class manages its
+ // own lifetime so that it can stay alive during drag and drop operations.
+ BrowserActionOverflowMenuController* overflow_menu_;
+
+ // The animation that happens when the container snaps to place.
+ scoped_ptr<SlideAnimation> resize_animation_;
+
+ // Don't show the chevron while animating.
+ bool suppress_chevron_;
+
+ // This is used while the user is resizing (and when the animations are in
+ // progress) to know how wide the delta is between the current state and what
+ // we should draw.
+ int resize_amount_;
+
+ // Keeps track of the absolute pixel width the container should have when we
+ // are done animating.
+ int animation_target_size_;
+
+ // The x position for where to draw the drop indicator. -1 if no indicator.
+ int drop_indicator_position_;
+
+ ScopedRunnableMethodFactory<BrowserActionsContainer> task_factory_;
+
+ // Handles delayed showing of the overflow menu when hovering.
+ ScopedRunnableMethodFactory<BrowserActionsContainer> show_menu_task_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_
diff --git a/chrome/browser/views/browser_actions_container_browsertest.cc b/chrome/browser/ui/views/browser_actions_container_browsertest.cc
index ee30ddb..ee30ddb 100644
--- a/chrome/browser/views/browser_actions_container_browsertest.cc
+++ b/chrome/browser/ui/views/browser_actions_container_browsertest.cc
diff --git a/chrome/browser/views/browser_bubble.cc b/chrome/browser/ui/views/browser_bubble.cc
index a118852..a118852 100644
--- a/chrome/browser/views/browser_bubble.cc
+++ b/chrome/browser/ui/views/browser_bubble.cc
diff --git a/chrome/browser/ui/views/browser_bubble.h b/chrome/browser/ui/views/browser_bubble.h
new file mode 100644
index 0000000..8cc63a3
--- /dev/null
+++ b/chrome/browser/ui/views/browser_bubble.h
@@ -0,0 +1,131 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_BROWSER_BUBBLE_H_
+#define CHROME_BROWSER_UI_VIEWS_BROWSER_BUBBLE_H_
+#pragma once
+
+#include "views/view.h"
+#include "views/widget/widget.h"
+
+class BrowserBubbleHost;
+
+// A class for creating a floating window that is "attached" to a particular
+// Browser. If you don't install a delegate, the bubble will hide
+// automatically when the browser moves. The bubble is only shown manually.
+// Users are expected to delete the bubble when finished with it.
+// Class assumes that RTL related mirroring is done by the view.
+class BrowserBubble {
+ public:
+ // Delegate to browser bubble events.
+ class Delegate {
+ public:
+ // Called when the Browser Window that this bubble is attached to moves.
+ virtual void BubbleBrowserWindowMoved(BrowserBubble* bubble) {}
+
+ // Called with the Browser Window that this bubble is attached to is
+ // about to close.
+ virtual void BubbleBrowserWindowClosing(BrowserBubble* bubble) {}
+
+ // Called when the bubble became active / got focus.
+ virtual void BubbleGotFocus(BrowserBubble* bubble) {}
+
+ // Called when the bubble became inactive / lost focus.
+ // |lost_focus_to_child| is true when a child window became active.
+ virtual void BubbleLostFocus(BrowserBubble* bubble,
+ bool lost_focus_to_child) {}
+ };
+
+ // Note that the bubble will size itself to the preferred size of |view|.
+ // |view| is the embedded view, |frame| is widget that the bubble is being
+ // positioned relative to, |origin| is the location that the bubble will
+ // be positioned relative to |frame|. Pass true through |drop_shadow| to
+ // surround the bubble widget with a drop-shadow.
+ BrowserBubble(views::View* view, views::Widget* frame,
+ const gfx::Point& origin, bool drop_shadow);
+ virtual ~BrowserBubble();
+
+ // Call manually if you need to detach the bubble from tracking the browser's
+ // position. Note that you must call this manually before deleting this
+ // object since it can't be safely called from the destructor.
+ void DetachFromBrowser();
+
+ // Normally called automatically during construction, but if DetachFromBrowser
+ // has been called manually, then this call will reattach.
+ void AttachToBrowser();
+ bool attached() const { return attached_; }
+
+ // Get/Set the delegate.
+ Delegate* delegate() const { return delegate_; }
+ void set_delegate(Delegate* del) { delegate_ = del; }
+
+ // Notifications from BrowserBubbleHost.
+ // With no delegate, both of these default to Hiding the bubble.
+ virtual void BrowserWindowMoved();
+ virtual void BrowserWindowClosing();
+
+ // Show or hide the bubble.
+ virtual void Show(bool activate);
+ virtual void Hide();
+ bool visible() const { return visible_; }
+
+ // The contained view.
+ views::View* view() const { return view_; }
+
+ // Set the bounds of the bubble relative to the browser window.
+ void SetBounds(int x, int y, int w, int h);
+ void MoveTo(int x, int y);
+ int width() { return bounds_.width(); }
+ int height() { return bounds_.height(); }
+ const gfx::Rect& bounds() const { return bounds_; }
+
+ // Reposition the bubble - as we are using a WS_POPUP for the bubble,
+ // we have to manually position it when the browser window moves.
+ void Reposition();
+
+ // Resize the bubble to fit the view.
+ void ResizeToView();
+
+ // Returns the NativeView containing that popup.
+ gfx::NativeView native_view() const { return popup_->GetNativeView(); }
+
+ protected:
+ // Create the popup widget.
+ virtual void InitPopup();
+
+ // Move the popup to an absolute position.
+ void MovePopup(int x, int y, int w, int h);
+
+ // The widget that this bubble is in.
+ views::Widget* popup_;
+
+ // The frame that this bubble is attached to.
+ views::Widget* frame_;
+
+ private:
+ // The view that is displayed in this bubble.
+ views::View* view_;
+
+ // The bounds relative to the frame.
+ gfx::Rect bounds_;
+
+ // Current visibility.
+ bool visible_;
+
+ // The delegate isn't owned by the bubble.
+ Delegate* delegate_;
+
+ // Is the bubble attached to a Browser window.
+ bool attached_;
+
+ // Does the bubble have a drop-shadow.
+ bool drop_shadow_enabled_;
+
+ // Non-owning pointer to the host of this bubble.
+ BrowserBubbleHost* bubble_host_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserBubble);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_BROWSER_BUBBLE_H_
diff --git a/chrome/browser/views/browser_bubble_gtk.cc b/chrome/browser/ui/views/browser_bubble_gtk.cc
index 7f18070..7f18070 100644
--- a/chrome/browser/views/browser_bubble_gtk.cc
+++ b/chrome/browser/ui/views/browser_bubble_gtk.cc
diff --git a/chrome/browser/views/browser_bubble_win.cc b/chrome/browser/ui/views/browser_bubble_win.cc
index 84985fd..84985fd 100644
--- a/chrome/browser/views/browser_bubble_win.cc
+++ b/chrome/browser/ui/views/browser_bubble_win.cc
diff --git a/chrome/browser/ui/views/browser_dialogs.h b/chrome/browser/ui/views/browser_dialogs.h
new file mode 100644
index 0000000..66d7d8f
--- /dev/null
+++ b/chrome/browser/ui/views/browser_dialogs.h
@@ -0,0 +1,130 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_BROWSER_DIALOGS_H_
+#define CHROME_BROWSER_UI_VIEWS_BROWSER_DIALOGS_H_
+#pragma once
+
+#include <string>
+
+#include "chrome/common/content_settings_types.h"
+#include "gfx/native_widget_types.h"
+
+// This file contains functions for running a variety of browser dialogs and
+// popups. The dialogs here are the ones that the caller does not need to
+// access the class of the popup. It allows us to break dependencies by
+// allowing the callers to not depend on the classes implementing the dialogs.
+
+class Browser;
+class BrowserView;
+class EditSearchEngineControllerDelegate;
+class FilePath;
+class FindBar;
+class GURL;
+class HtmlDialogUIDelegate;
+class InfoBubbleDelegate;
+class Profile;
+class TabContents;
+class TemplateURL;
+
+namespace gfx {
+class Rect;
+class Size;
+} // namespace gfx
+
+namespace views {
+class Widget;
+class Window;
+} // namespace views
+
+namespace browser {
+
+// Shows the "Report a problem with this page" dialog box. See BugReportView.
+void ShowBugReportView(views::Window* parent,
+ Profile* profile,
+ TabContents* tab);
+
+// Shows the "Report a problem with this page" page in a new tab
+void ShowHtmlBugReportView(views::Window* parent, Browser* browser);
+
+// Shows the "Clear browsing data" dialog box. See ClearBrowsingDataView.
+void ShowClearBrowsingDataView(gfx::NativeWindow parent,
+ Profile* profile);
+
+// Shows the "Importer" dialog. See ImporterView.
+void ShowImporterView(views::Widget* parent,
+ Profile* profile);
+
+// Shows or hides the global bookmark bubble for the star button.
+void ShowBookmarkBubbleView(views::Window* parent,
+ const gfx::Rect& bounds,
+ InfoBubbleDelegate* delegate,
+ Profile* profile,
+ const GURL& url,
+ bool newly_bookmarked);
+void HideBookmarkBubbleView();
+bool IsBookmarkBubbleViewShowing();
+
+// Shows the bookmark manager.
+void ShowBookmarkManagerView(Profile* profile);
+
+// Shows the about dialog. See AboutChromeView.
+views::Window* ShowAboutChromeView(gfx::NativeWindow parent,
+ Profile* profile);
+
+// Shows an HTML dialog. See HtmlDialogView.
+void ShowHtmlDialogView(gfx::NativeWindow parent, Profile* profile,
+ HtmlDialogUIDelegate* delegate);
+
+// Creates and returns a find bar for the given browser window. See FindBarWin.
+FindBar* CreateFindBar(BrowserView* browser_view);
+
+// Shows the "Save passwords and exceptions" dialog.
+// See PasswordsExceptionsWindowView.
+void ShowPasswordsExceptionsWindowView(Profile* profile);
+
+// Shows the keyword editor. See KeywordEditorView.
+void ShowKeywordEditorView(Profile* profile);
+
+// Shows the "new profile" dialog box. See NewProfileDialog.
+void ShowNewProfileDialog();
+
+// Shows the Task Manager.
+void ShowTaskManager();
+
+#if defined(OS_CHROMEOS)
+// Shows the Login Wizard.
+void ShowLoginWizard(const std::string& start_screen, const gfx::Size& size);
+#endif
+
+// Shows a dialog box that allows a search engine to be edited. |template_url|
+// is the search engine being edited. If it is NULL, then the dialog will add a
+// new search engine with the data the user supplies. |delegate| is an object
+// to be notified when the user is done editing, or NULL. If NULL, the dialog
+// will update the model with the user's edits directly.
+void EditSearchEngine(gfx::NativeWindow parent,
+ const TemplateURL* template_url,
+ EditSearchEngineControllerDelegate* delegate,
+ Profile* profile);
+
+// Shows the repost form confirmation dialog box.
+void ShowRepostFormWarningDialog(gfx::NativeWindow parent_window,
+ TabContents* tab_contents);
+
+// Shows the content settings dialog box.
+void ShowContentSettingsWindow(gfx::NativeWindow parent_window,
+ ContentSettingsType content_type,
+ Profile* profile);
+
+// Shows the collected cookies dialog box.
+void ShowCollectedCookiesDialog(gfx::NativeWindow parent_window,
+ TabContents* tab_contents);
+
+// Shows the create web app shortcut dialog box.
+void ShowCreateShortcutsDialog(gfx::NativeWindow parent_window,
+ TabContents* tab_contents);
+
+} // namespace browser
+
+#endif // CHROME_BROWSER_UI_VIEWS_BROWSER_DIALOGS_H_
diff --git a/chrome/browser/views/browser_keyboard_accessibility_test_win.cc b/chrome/browser/ui/views/browser_keyboard_accessibility_test_win.cc
index 1218367..1218367 100644
--- a/chrome/browser/views/browser_keyboard_accessibility_test_win.cc
+++ b/chrome/browser/ui/views/browser_keyboard_accessibility_test_win.cc
diff --git a/chrome/browser/views/bubble_border.cc b/chrome/browser/ui/views/bubble_border.cc
index e37f5fe..e37f5fe 100644
--- a/chrome/browser/views/bubble_border.cc
+++ b/chrome/browser/ui/views/bubble_border.cc
diff --git a/chrome/browser/ui/views/bubble_border.h b/chrome/browser/ui/views/bubble_border.h
new file mode 100644
index 0000000..4082d28
--- /dev/null
+++ b/chrome/browser/ui/views/bubble_border.h
@@ -0,0 +1,172 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_BUBBLE_BORDER_H_
+#define CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_H_
+#pragma once
+
+#include "third_party/skia/include/core/SkColor.h"
+#include "views/background.h"
+#include "views/border.h"
+
+class SkBitmap;
+
+// Renders a border, with optional arrow, and a custom dropshadow.
+// This can be used to produce floating "bubble" objects with rounded corners.
+class BubbleBorder : public views::Border {
+ public:
+ // Possible locations for the (optional) arrow.
+ // 0 bit specifies left or right.
+ // 1 bit specifies top or bottom.
+ // 2 bit specifies horizontal or vertical.
+ enum ArrowLocation {
+ TOP_LEFT = 0,
+ TOP_RIGHT = 1,
+ BOTTOM_LEFT = 2,
+ BOTTOM_RIGHT = 3,
+ LEFT_TOP = 4,
+ RIGHT_TOP = 5,
+ LEFT_BOTTOM = 6,
+ RIGHT_BOTTOM = 7,
+ NONE = 8, // No arrow. Positioned under the supplied rect.
+ FLOAT = 9 // No arrow. Centered over the supplied rect.
+ };
+
+ explicit BubbleBorder(ArrowLocation arrow_location)
+ : override_arrow_offset_(0),
+ arrow_location_(arrow_location),
+ background_color_(SK_ColorWHITE) {
+ InitClass();
+ }
+
+ // Returns the radius of the corner of the border.
+ static int GetCornerRadius() {
+ // We can't safely calculate a border radius by comparing the sizes of the
+ // side and corner images, because either may have been extended in various
+ // directions in order to do more subtle dropshadow fading or other effects.
+ // So we hardcode the most accurate value.
+ return 4;
+ }
+
+ // Sets the location for the arrow.
+ void set_arrow_location(ArrowLocation arrow_location) {
+ arrow_location_ = arrow_location;
+ }
+ ArrowLocation arrow_location() const { return arrow_location_; }
+
+ static ArrowLocation horizontal_mirror(ArrowLocation loc) {
+ return loc >= NONE ? loc : static_cast<ArrowLocation>(loc ^ 1);
+ }
+
+ static ArrowLocation vertical_mirror(ArrowLocation loc) {
+ return loc >= NONE ? loc : static_cast<ArrowLocation>(loc ^ 2);
+ }
+
+ static bool has_arrow(ArrowLocation loc) {
+ return loc >= NONE ? false : true;
+ }
+
+ static bool is_arrow_on_left(ArrowLocation loc) {
+ return loc >= NONE ? false : !(loc & 1);
+ }
+
+ static bool is_arrow_on_top(ArrowLocation loc) {
+ return loc >= NONE ? false : !(loc & 2);
+ }
+
+ static bool is_arrow_on_horizontal(ArrowLocation loc) {
+ return loc >= NONE ? false : !(loc & 4);
+ }
+
+ // Sets the background color for the arrow body. This is irrelevant if you do
+ // not also set the arrow location to something other than NONE.
+ void set_background_color(SkColor background_color) {
+ background_color_ = background_color;
+ }
+ SkColor background_color() const { return background_color_; }
+
+ // For borders with an arrow, gives the desired bounds (in screen coordinates)
+ // given the rect to point to and the size of the contained contents. This
+ // depends on the arrow location, so if you change that, you should call this
+ // again to find out the new coordinates.
+ gfx::Rect GetBounds(const gfx::Rect& position_relative_to,
+ const gfx::Size& contents_size) const;
+
+ // Sets a fixed offset for the arrow from the beginning of corresponding edge.
+ // The arrow will still point to the same location but the bubble will shift
+ // location to make that happen. Returns actuall arrow offset, in case of
+ // overflow it differ from desired.
+ int SetArrowOffset(int offset, const gfx::Size& contents_size);
+
+ // Overridden from views::Border:
+ virtual void GetInsets(gfx::Insets* insets) const;
+
+ private:
+ // Loads images if necessary.
+ static void InitClass();
+
+ virtual ~BubbleBorder() { }
+
+ // Overridden from views::Border:
+ virtual void Paint(const views::View& view, gfx::Canvas* canvas) const;
+
+ void DrawEdgeWithArrow(gfx::Canvas* canvas,
+ bool is_horizontal,
+ SkBitmap* edge,
+ SkBitmap* arrow,
+ int start_x,
+ int start_y,
+ int before_arrow,
+ int after_arrow,
+ int offset) const;
+
+ void DrawArrowInterior(gfx::Canvas* canvas,
+ bool is_horizontal,
+ int tip_x,
+ int tip_y,
+ int shift_x,
+ int shift_y) const;
+
+ // Border graphics.
+ static SkBitmap* left_;
+ static SkBitmap* top_left_;
+ static SkBitmap* top_;
+ static SkBitmap* top_right_;
+ static SkBitmap* right_;
+ static SkBitmap* bottom_right_;
+ static SkBitmap* bottom_;
+ static SkBitmap* bottom_left_;
+ static SkBitmap* left_arrow_;
+ static SkBitmap* top_arrow_;
+ static SkBitmap* right_arrow_;
+ static SkBitmap* bottom_arrow_;
+
+ // Minimal offset of the arrow from the closet edge of bounding rect.
+ static int arrow_offset_;
+
+ // If specified, overrides the pre-calculated |arrow_offset_| of the arrow.
+ int override_arrow_offset_;
+
+ ArrowLocation arrow_location_;
+ SkColor background_color_;
+
+ DISALLOW_COPY_AND_ASSIGN(BubbleBorder);
+};
+
+// A Background that clips itself to the specified BubbleBorder and uses
+// the background color of the BubbleBorder.
+class BubbleBackground : public views::Background {
+ public:
+ explicit BubbleBackground(BubbleBorder* border) : border_(border) {}
+
+ // Background overrides.
+ virtual void Paint(gfx::Canvas* canvas, views::View* view) const;
+
+ private:
+ BubbleBorder* border_;
+
+ DISALLOW_COPY_AND_ASSIGN(BubbleBackground);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_H_
diff --git a/chrome/browser/views/certificate_viewer_win.cc b/chrome/browser/ui/views/certificate_viewer_win.cc
index ba54267..ba54267 100644
--- a/chrome/browser/views/certificate_viewer_win.cc
+++ b/chrome/browser/ui/views/certificate_viewer_win.cc
diff --git a/chrome/browser/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc
index d872ace..d872ace 100644
--- a/chrome/browser/views/chrome_views_delegate.cc
+++ b/chrome/browser/ui/views/chrome_views_delegate.cc
diff --git a/chrome/browser/ui/views/chrome_views_delegate.h b/chrome/browser/ui/views/chrome_views_delegate.h
new file mode 100644
index 0000000..8b3a6a2
--- /dev/null
+++ b/chrome/browser/ui/views/chrome_views_delegate.h
@@ -0,0 +1,39 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_CHROME_VIEWS_DELEGATE_H_
+#define CHROME_BROWSER_UI_VIEWS_CHROME_VIEWS_DELEGATE_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "build/build_config.h"
+#include "views/views_delegate.h"
+
+class ChromeViewsDelegate : public views::ViewsDelegate {
+ public:
+ ChromeViewsDelegate() {}
+ virtual ~ChromeViewsDelegate() {}
+
+ // Overridden from views::ViewsDelegate:
+ virtual Clipboard* GetClipboard() const;
+ virtual void SaveWindowPlacement(const std::wstring& window_name,
+ const gfx::Rect& bounds,
+ bool maximized);
+ virtual bool GetSavedWindowBounds(const std::wstring& window_name,
+ gfx::Rect* bounds) const;
+ virtual bool GetSavedMaximizedState(const std::wstring& window_name,
+ bool* maximized) const;
+ virtual void NotifyAccessibilityEvent(
+ views::View* view, AccessibilityTypes::Event event_type);
+#if defined(OS_WIN)
+ virtual HICON GetDefaultWindowIcon() const;
+#endif
+ virtual void AddRef();
+ virtual void ReleaseRef();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ChromeViewsDelegate);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_CHROME_VIEWS_DELEGATE_H_
diff --git a/chrome/browser/views/clear_browsing_data.cc b/chrome/browser/ui/views/clear_browsing_data.cc
index 3eb4e5c..3eb4e5c 100644
--- a/chrome/browser/views/clear_browsing_data.cc
+++ b/chrome/browser/ui/views/clear_browsing_data.cc
diff --git a/chrome/browser/ui/views/clear_browsing_data.h b/chrome/browser/ui/views/clear_browsing_data.h
new file mode 100644
index 0000000..8b1359e
--- /dev/null
+++ b/chrome/browser/ui/views/clear_browsing_data.h
@@ -0,0 +1,128 @@
+// Copyright (c) 2006-2008 The Chromium 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_VIEWS_CLEAR_BROWSING_DATA_H_
+#define CHROME_BROWSER_UI_VIEWS_CLEAR_BROWSING_DATA_H_
+#pragma once
+
+#include "app/combobox_model.h"
+#include "chrome/browser/browsing_data_remover.h"
+#include "views/controls/button/button.h"
+#include "views/controls/combobox/combobox.h"
+#include "views/controls/label.h"
+#include "views/controls/link.h"
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+
+namespace views {
+class Checkbox;
+class Label;
+class Throbber;
+class Window;
+}
+
+class Profile;
+class MessageLoop;
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// The ClearBrowsingData class is responsible for drawing the UI controls of the
+// dialog that allows the user to select what to delete (history, downloads,
+// etc).
+//
+////////////////////////////////////////////////////////////////////////////////
+class ClearBrowsingDataView : public views::View,
+ public views::DialogDelegate,
+ public views::ButtonListener,
+ public ComboboxModel,
+ public views::Combobox::Listener,
+ public BrowsingDataRemover::Observer,
+ public views::LinkController {
+ public:
+ explicit ClearBrowsingDataView(Profile* profile);
+ virtual ~ClearBrowsingDataView(void);
+
+ // Initialize the controls on the dialog.
+ void Init();
+
+ // Overridden from views::View:
+ virtual gfx::Size GetPreferredSize();
+ virtual void Layout();
+
+ // Overridden from views::DialogDelegate:
+ virtual int GetDefaultDialogButton() const;
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool IsDialogButtonEnabled(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool CanResize() const;
+ virtual bool CanMaximize() const;
+ virtual bool IsAlwaysOnTop() const;
+ virtual bool HasAlwaysOnTopMenu() const;
+ virtual bool IsModal() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual bool Accept();
+ virtual views::View* GetContentsView();
+ views::ClientView* CreateClientView(views::Window* window);
+ virtual views::View* GetExtraView() { return throbber_view_; }
+ virtual bool GetSizeExtraViewHeightToButtons() { return true; }
+ virtual views::View* GetInitiallyFocusedView();
+
+ // Overridden from ComboboxModel:
+ virtual int GetItemCount();
+ virtual string16 GetItemAt(int index);
+
+ // Overridden from views::Combobox::Listener:
+ virtual void ItemChanged(views::Combobox* sender, int prev_index,
+ int new_index);
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Overriden from views::LinkController:
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ private:
+ // Adds a new check-box as a child to the view.
+ views::Checkbox* AddCheckbox(const std::wstring& text, bool checked);
+
+ // Sets the controls on the UI to be enabled/disabled depending on whether we
+ // have a delete operation in progress or not.
+ void UpdateControlEnabledState();
+
+ // Starts the process of deleting the browsing data depending on what the
+ // user selected.
+ void OnDelete();
+
+ // Callback from BrowsingDataRemover. Closes the dialog.
+ virtual void OnBrowsingDataRemoverDone();
+
+ // UI elements we add to the parent view.
+ views::View* throbber_view_;
+ views::Throbber* throbber_;
+ views::Label* status_label_;
+ // Other UI elements.
+ views::Label* delete_all_label_;
+ views::Checkbox* del_history_checkbox_;
+ views::Checkbox* del_downloads_checkbox_;
+ views::Checkbox* del_cache_checkbox_;
+ views::Checkbox* del_cookies_checkbox_;
+ views::Checkbox* del_passwords_checkbox_;
+ views::Checkbox* del_form_data_checkbox_;
+ views::Label* time_period_label_;
+ views::Combobox* time_period_combobox_;
+
+ // Used to signal enabled/disabled state for controls in the UI.
+ bool delete_in_progress_;
+
+ Profile* profile_;
+
+ // If non-null it means removal is in progress. BrowsingDataRemover takes care
+ // of deleting itself when done.
+ BrowsingDataRemover* remover_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClearBrowsingDataView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_CLEAR_BROWSING_DATA_H_
diff --git a/chrome/browser/views/clear_browsing_data_view.cc b/chrome/browser/ui/views/clear_browsing_data_view.cc
index d6f7ab5..d6f7ab5 100644
--- a/chrome/browser/views/clear_browsing_data_view.cc
+++ b/chrome/browser/ui/views/clear_browsing_data_view.cc
diff --git a/chrome/browser/ui/views/clear_browsing_data_view.h b/chrome/browser/ui/views/clear_browsing_data_view.h
new file mode 100644
index 0000000..0659057
--- /dev/null
+++ b/chrome/browser/ui/views/clear_browsing_data_view.h
@@ -0,0 +1,121 @@
+// Copyright (c) 2006-2008 The Chromium 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_VIEWS_CLEAR_BROWSING_DATA_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_CLEAR_BROWSING_DATA_VIEW_H_
+#pragma once
+
+#include "app/combobox_model.h"
+#include "chrome/browser/browsing_data_remover.h"
+#include "chrome/browser/views/clear_data_view.h"
+#include "views/controls/button/button.h"
+#include "views/controls/combobox/combobox.h"
+#include "views/controls/label.h"
+#include "views/controls/link.h"
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+
+namespace views {
+class Checkbox;
+class Label;
+class Throbber;
+class Window;
+}
+
+class ClearDataView;
+class Profile;
+class MessageLoop;
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// The ClearBrowsingData2 class is responsible for drawing the UI controls of
+// the dialog that allows the user to select what to delete (history,
+// downloads, etc).
+//
+// TODO(raz) Remove the 2 suffix when the mac/linux/chromeos versions are there
+//
+////////////////////////////////////////////////////////////////////////////////
+class ClearBrowsingDataView2 : public views::View,
+ public views::ButtonListener,
+ public ComboboxModel,
+ public views::Combobox::Listener,
+ public BrowsingDataRemover::Observer,
+ public views::LinkController {
+ public:
+ ClearBrowsingDataView2(Profile* profile, ClearDataView* clear_data_view);
+
+ virtual ~ClearBrowsingDataView2(void);
+
+ // Initialize the controls on the dialog.
+ void Init();
+
+ // Overridden from ComboboxModel:
+ virtual int GetItemCount();
+ virtual string16 GetItemAt(int index);
+
+ // Overridden from views::Combobox::Listener:
+ virtual void ItemChanged(views::Combobox* sender, int prev_index,
+ int new_index);
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Overriden from views::LinkController:
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ // Enable/disable clearing from this tab
+ void SetAllowClear(bool allow);
+
+ private:
+ // Adds a new check-box as a child to the view.
+ views::Checkbox* AddCheckbox(const std::wstring& text, bool checked);
+
+ // Sets the controls on the UI to be enabled/disabled depending on whether we
+ // have a delete operation in progress or not.
+ void UpdateControlEnabledState();
+
+ // Hand off control layout to layout manger
+ void InitControlLayout();
+
+ // Starts the process of deleting the browsing data depending on what the
+ // user selected.
+ void OnDelete();
+
+ // Callback from BrowsingDataRemover. Closes the dialog.
+ virtual void OnBrowsingDataRemoverDone();
+
+ // Parent window, used for disabling close
+ ClearDataView* clear_data_parent_window_;
+
+ // Allows for disabling the clear button from outside this view
+ bool allow_clear_;
+
+ // UI elements
+ views::View* throbber_view_;
+ views::Throbber* throbber_;
+ views::Label* status_label_;
+ views::Label* delete_all_label_;
+ views::Checkbox* del_history_checkbox_;
+ views::Checkbox* del_downloads_checkbox_;
+ views::Checkbox* del_cache_checkbox_;
+ views::Checkbox* del_cookies_checkbox_;
+ views::Checkbox* del_passwords_checkbox_;
+ views::Checkbox* del_form_data_checkbox_;
+ views::Label* time_period_label_;
+ views::Combobox* time_period_combobox_;
+ views::NativeButton* clear_browsing_data_button_;
+
+ // Used to signal enabled/disabled state for controls in the UI.
+ bool delete_in_progress_;
+
+ Profile* profile_;
+
+ // If non-null it means removal is in progress. BrowsingDataRemover takes care
+ // of deleting itself when done.
+ BrowsingDataRemover* remover_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClearBrowsingDataView2);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_CLEAR_BROWSING_DATA_VIEW_H_
diff --git a/chrome/browser/views/clear_data_view.cc b/chrome/browser/ui/views/clear_data_view.cc
index 8f349bd..8f349bd 100644
--- a/chrome/browser/views/clear_data_view.cc
+++ b/chrome/browser/ui/views/clear_data_view.cc
diff --git a/chrome/browser/ui/views/clear_data_view.h b/chrome/browser/ui/views/clear_data_view.h
new file mode 100644
index 0000000..ffd9338
--- /dev/null
+++ b/chrome/browser/ui/views/clear_data_view.h
@@ -0,0 +1,99 @@
+// Copyright (c) 2006-2010 The Chromium 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_VIEWS_CLEAR_DATA_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_CLEAR_DATA_VIEW_H_
+#pragma once
+
+#include "app/combobox_model.h"
+#include "chrome/browser/browsing_data_remover.h"
+#include "chrome/browser/views/clear_browsing_data_view.h"
+#include "chrome/browser/views/clear_server_data.h"
+#include "views/controls/button/button.h"
+#include "views/controls/combobox/combobox.h"
+#include "views/controls/label.h"
+#include "views/controls/link.h"
+#include "views/controls/tabbed_pane/tabbed_pane.h"
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+
+namespace views {
+class Checkbox;
+class Label;
+class Throbber;
+class Window;
+}
+
+class ClearBrowsingDataView2;
+class ClearServerDataView;
+class Profile;
+class MessageLoop;
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// The ClearDataView class is responsible for drawing the window that allows
+// the user to select what to delete (history, downloads, etc). It has tabs
+// separating "local" data from "other" (e.g. server) data
+//
+////////////////////////////////////////////////////////////////////////////////
+class ClearDataView : public views::View,
+ public views::DialogDelegate {
+ public:
+ explicit ClearDataView(Profile* profile);
+ virtual ~ClearDataView(void) {}
+
+ // Disallow the window closing while clearing either server or browsing
+ // data. After clear completes, close the window.
+ void StartClearingBrowsingData();
+ void StopClearingBrowsingData();
+
+ void StartClearingServerData();
+ void SucceededClearingServerData();
+ void FailedClearingServerData();
+
+ // Initialize the controls on the dialog.
+ void Init();
+
+ // Overridden from views::View:
+ virtual gfx::Size GetPreferredSize();
+ virtual void Layout();
+
+ // Overridden from views::DialogDelegate:
+ virtual int GetDefaultDialogButton() const;
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual int GetDialogButtons() const;
+ virtual bool IsDialogButtonEnabled(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool CanResize() const;
+ virtual bool CanMaximize() const;
+ virtual bool IsAlwaysOnTop() const;
+ virtual bool HasAlwaysOnTopMenu() const;
+ virtual bool IsModal() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual views::View* GetContentsView();
+ virtual bool GetSizeExtraViewHeightToButtons() { return true; }
+ virtual views::View* GetInitiallyFocusedView();
+
+ private:
+ // Sets the controls on the UI to be enabled/disabled depending on whether we
+ // have a delete operation in progress or not.
+ void UpdateControlEnabledState();
+
+ // Currently clearing
+ bool clearing_data_;
+
+ views::TabbedPane* tabs_;
+ ClearServerDataView* clear_server_data_tab_;
+ ClearBrowsingDataView2* clear_browsing_data_tab_;
+
+ Profile* profile_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClearDataView);
+};
+
+static const int kDialogPadding = 7;
+
+#endif // CHROME_BROWSER_UI_VIEWS_CLEAR_DATA_VIEW_H_
+
diff --git a/chrome/browser/views/clear_server_data.cc b/chrome/browser/ui/views/clear_server_data.cc
index 2cd3be7..2cd3be7 100644
--- a/chrome/browser/views/clear_server_data.cc
+++ b/chrome/browser/ui/views/clear_server_data.cc
diff --git a/chrome/browser/ui/views/clear_server_data.h b/chrome/browser/ui/views/clear_server_data.h
new file mode 100644
index 0000000..6d0f09f
--- /dev/null
+++ b/chrome/browser/ui/views/clear_server_data.h
@@ -0,0 +1,118 @@
+// Copyright (c) 2006-2008 The Chromium 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_VIEWS_CLEAR_SERVER_DATA_H_
+#define CHROME_BROWSER_UI_VIEWS_CLEAR_SERVER_DATA_H_
+#pragma once
+
+#include "app/combobox_model.h"
+#include "chrome/browser/browsing_data_remover.h"
+#include "chrome/browser/views/clear_data_view.h"
+#include "chrome/browser/views/confirm_message_box_dialog.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "views/controls/button/button.h"
+#include "views/controls/label.h"
+#include "views/controls/link.h"
+#include "views/grid_layout.h"
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+
+namespace views {
+class Checkbox;
+class ColumnSet;
+class GridLayout;
+class Label;
+class Throbber;
+class Window;
+}
+
+class ClearDataView;
+class Profile;
+class MessageLoop;
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// The ClearServerData class is responsible for drawing the UI controls of the
+// dialog that allows the user to delete non-local data (e.g. Chrome Sync data)
+//
+////////////////////////////////////////////////////////////////////////////////
+class ClearServerDataView : public views::View,
+ public views::ButtonListener,
+ public views::LinkController,
+ public ProfileSyncServiceObserver,
+ public ConfirmMessageBoxObserver {
+ public:
+ ClearServerDataView(Profile* profile, ClearDataView* clear_data_view);
+
+ virtual ~ClearServerDataView();
+
+ // Initialize the controls on the dialog.
+ void Init();
+
+ // Overridden from views::View:
+ virtual gfx::Size GetPreferredSize();
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Overriden from views::LinkController:
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ // Disable clearing from this tab
+ void SetAllowClear(bool allow);
+
+ private:
+ void InitControlLayout();
+ void InitControlVisibility();
+
+ void AddSpacing(views::GridLayout* layout,
+ bool related_follows);
+
+ void AddWrappingLabelRow(views::GridLayout* layout,
+ views::Label* label,
+ int id,
+ bool related_follows);
+
+ // Adds a new check-box as a child to the view.
+ views::Checkbox* AddCheckbox(const std::wstring& text, bool checked);
+
+ // Sets the controls on the UI to be enabled/disabled depending on whether we
+ // have a delete operation in progress or not.
+ void UpdateControlEnabledState();
+
+ // Enables/disables the clear button as appropriate
+ void UpdateClearButtonEnabledState(bool delete_in_progress);
+
+ // Starts the process of deleting the browsing data depending on what the
+ // user selected.
+ void OnDelete();
+
+ // ProfileSyncServiceObserver method.
+ virtual void OnStateChanged();
+
+ // ProfileSyncServiceObserver
+ virtual void OnConfirmMessageAccept();
+ virtual void OnConfirmMessageCancel();
+
+ ClearDataView* clear_data_parent_window_;
+ Profile* profile_;
+ ProfileSyncService* sync_service_;
+ bool allow_clear_;
+
+ views::Label* flash_title_label_;
+ views::Label* flash_description_label_;
+ views::Label* chrome_sync_title_label_;
+ views::Label* chrome_sync_description_label_;
+ views::Label* dashboard_label_;
+ views::Label* status_label_;
+ views::Link* flash_link_;
+ views::Link* dashboard_link_;
+ views::NativeButton* clear_server_data_button_;
+ views::Throbber* throbber_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClearServerDataView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_CLEAR_SERVER_DATA_H_
+
diff --git a/chrome/browser/views/collected_cookies_win.cc b/chrome/browser/ui/views/collected_cookies_win.cc
index 3f25992..3f25992 100644
--- a/chrome/browser/views/collected_cookies_win.cc
+++ b/chrome/browser/ui/views/collected_cookies_win.cc
diff --git a/chrome/browser/ui/views/collected_cookies_win.h b/chrome/browser/ui/views/collected_cookies_win.h
new file mode 100644
index 0000000..cff1b1d
--- /dev/null
+++ b/chrome/browser/ui/views/collected_cookies_win.h
@@ -0,0 +1,96 @@
+// Copyright (c) 2010 The Chromium 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 Views implementation of the collected Cookies dialog.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_COLLECTED_COOKIES_WIN_H_
+#define CHROME_BROWSER_UI_VIEWS_COLLECTED_COOKIES_WIN_H_
+#pragma once
+
+#include "chrome/browser/tab_contents/constrained_window.h"
+#include "chrome/common/content_settings.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "views/controls/tree/tree_view.h"
+#include "views/window/dialog_delegate.h"
+
+class ConstrainedWindow;
+class CookiesTreeModel;
+class InfobarView;
+class TabContents;
+namespace views {
+class Label;
+class NativeButton;
+}
+
+// CollectedCookiesWin 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 CollectedCookiesWin : public ConstrainedDialogDelegate,
+ NotificationObserver,
+ views::ButtonListener,
+ views::TreeViewController,
+ views::View {
+ public:
+ // Use BrowserWindow::ShowCollectedCookiesDialog to show.
+ CollectedCookiesWin(gfx::NativeWindow parent_window,
+ TabContents* tab_contents);
+
+ // ConstrainedDialogDelegate implementation.
+ virtual std::wstring GetWindowTitle() const;
+ virtual int GetDialogButtons() const;
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual void DeleteDelegate();
+ virtual bool Cancel();
+ virtual views::View* GetContentsView();
+
+ // views::ButtonListener implementation.
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // views::TreeViewController implementation.
+ virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view);
+
+ private:
+ virtual ~CollectedCookiesWin();
+
+ void Init();
+
+ void EnableControls();
+
+ void AddContentException(views::TreeView* tree_view, ContentSetting setting);
+
+ // Notification Observer implementation.
+ void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ NotificationRegistrar registrar_;
+
+ ConstrainedWindow* window_;
+
+ // The tab contents.
+ TabContents* tab_contents_;
+
+ // Assorted views.
+ views::Label* allowed_label_;
+ views::Label* blocked_label_;
+
+ views::TreeView* allowed_cookies_tree_;
+ views::TreeView* blocked_cookies_tree_;
+
+ views::NativeButton* block_allowed_button_;
+ views::NativeButton* allow_blocked_button_;
+ views::NativeButton* for_session_blocked_button_;
+
+ scoped_ptr<CookiesTreeModel> allowed_cookies_tree_model_;
+ scoped_ptr<CookiesTreeModel> blocked_cookies_tree_model_;
+
+ InfobarView* infobar_;
+
+ DISALLOW_COPY_AND_ASSIGN(CollectedCookiesWin);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_COLLECTED_COOKIES_WIN_H_
diff --git a/chrome/browser/views/confirm_message_box_dialog.cc b/chrome/browser/ui/views/confirm_message_box_dialog.cc
index 3f3a1a3..3f3a1a3 100644
--- a/chrome/browser/views/confirm_message_box_dialog.cc
+++ b/chrome/browser/ui/views/confirm_message_box_dialog.cc
diff --git a/chrome/browser/ui/views/confirm_message_box_dialog.h b/chrome/browser/ui/views/confirm_message_box_dialog.h
new file mode 100644
index 0000000..f0da06e
--- /dev/null
+++ b/chrome/browser/ui/views/confirm_message_box_dialog.h
@@ -0,0 +1,100 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_
+#define CHROME_BROWSER_UI_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_
+#pragma once
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "gfx/native_widget_types.h"
+#include "views/controls/label.h"
+#include "views/window/dialog_delegate.h"
+
+// An interface the confirm dialog uses to notify its clients (observers) when
+// the user makes a decision to confirm or cancel. Only one method will be
+// invoked per use (i.e per invocation of ConfirmMessageBoxDialog::Run).
+class ConfirmMessageBoxObserver {
+ public:
+ // The user explicitly confirmed by clicking "OK".
+ virtual void OnConfirmMessageAccept() = 0;
+ // The user chose not to confirm either by clicking "Cancel" or by closing
+ // the dialog.
+ virtual void OnConfirmMessageCancel() {}
+};
+
+class ConfirmMessageBoxDialog : public views::DialogDelegate,
+ public views::View {
+ public:
+ // The method presents a modal confirmation dialog to the user with the title
+ // |window_title| and message |message_text|, and 'Yes' 'No' buttons.
+ // |observer| will be notified when the user makes a decision or closes the
+ // dialog. Note that this class guarantees it will call one of the observer's
+ // methods, so it is the caller's responsibility to ensure |observer| lives
+ // until one of the methods is invoked; it can be deleted thereafter from this
+ // class' point of view. |parent| specifies where to insert the view into the
+ // hierarchy and effectively assumes ownership of the dialog.
+ static void Run(gfx::NativeWindow parent,
+ ConfirmMessageBoxObserver* observer,
+ const std::wstring& message_text,
+ const std::wstring& window_title);
+
+ // A variant of the above for when the message text is longer/shorter than
+ // what the default size of this dialog can accommodate.
+ static void RunWithCustomConfiguration(gfx::NativeWindow parent,
+ ConfirmMessageBoxObserver* observer,
+ const std::wstring& message_text,
+ const std::wstring& window_title,
+ const std::wstring& confirm_label,
+ const std::wstring& reject_label,
+ const gfx::Size& preferred_size);
+
+ virtual ~ConfirmMessageBoxDialog() {}
+
+ // views::DialogDelegate implementation.
+ virtual int GetDialogButtons() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual int GetDefaultDialogButton() const {
+ return MessageBoxFlags::DIALOGBUTTON_CANCEL;
+ }
+
+ virtual bool Accept();
+ virtual bool Cancel();
+
+ // views::WindowDelegate implementation.
+ virtual bool IsModal() const { return true; }
+ virtual views::View* GetContentsView() { return this; }
+
+ // views::View implementation.
+ virtual void Layout();
+ virtual gfx::Size GetPreferredSize();
+
+ private:
+ ConfirmMessageBoxDialog(ConfirmMessageBoxObserver* observer,
+ const std::wstring& message_text,
+ const std::wstring& window_title);
+
+ // The message which will be shown to user.
+ views::Label* message_label_;
+
+ // This is the Title bar text.
+ std::wstring window_title_;
+
+ // The text for the 'OK' and 'CANCEL' buttons.
+ std::wstring confirm_label_;
+ std::wstring reject_label_;
+
+ // The preferred size of the dialog.
+ gfx::Size preferred_size_;
+
+ // The observer to notify of acceptance or cancellation.
+ ConfirmMessageBoxObserver* observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(ConfirmMessageBoxDialog);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_
diff --git a/chrome/browser/views/constrained_html_delegate_win.cc b/chrome/browser/ui/views/constrained_html_delegate_win.cc
index 6d53e22..6d53e22 100644
--- a/chrome/browser/views/constrained_html_delegate_win.cc
+++ b/chrome/browser/ui/views/constrained_html_delegate_win.cc
diff --git a/chrome/browser/views/constrained_window_win.cc b/chrome/browser/ui/views/constrained_window_win.cc
index 7fa1dc6..7fa1dc6 100644
--- a/chrome/browser/views/constrained_window_win.cc
+++ b/chrome/browser/ui/views/constrained_window_win.cc
diff --git a/chrome/browser/ui/views/constrained_window_win.h b/chrome/browser/ui/views/constrained_window_win.h
new file mode 100644
index 0000000..b7933aa
--- /dev/null
+++ b/chrome/browser/ui/views/constrained_window_win.h
@@ -0,0 +1,77 @@
+// Copyright (c) 2006-2008 The Chromium 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_VIEWS_CONSTRAINED_WINDOW_WIN_H_
+#define CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_WIN_H_
+#pragma once
+
+#include "chrome/browser/tab_contents/constrained_window.h"
+#include "chrome/browser/tab_contents/tab_contents_delegate.h"
+#include "gfx/rect.h"
+#include "views/window/window_win.h"
+
+class ConstrainedTabContentsWindowDelegate;
+class ConstrainedWindowAnimation;
+class ConstrainedWindowFrameView;
+namespace views {
+class WindowDelegate;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// ConstrainedWindowWin
+//
+// A ConstrainedWindow implementation that implements a Constrained Window as
+// a child HWND with a custom window frame.
+//
+class ConstrainedWindowWin : public ConstrainedWindow,
+ public views::WindowWin {
+ public:
+ virtual ~ConstrainedWindowWin();
+
+ // Returns the TabContents that constrains this Constrained Window.
+ TabContents* owner() const { return owner_; }
+
+ // Overridden from views::Window:
+ virtual views::NonClientFrameView* CreateFrameViewForWindow();
+
+ // Overridden from ConstrainedWindow:
+ virtual void ShowConstrainedWindow();
+ virtual void CloseConstrainedWindow();
+ virtual void FocusConstrainedWindow();
+ virtual std::wstring GetWindowTitle() const;
+ virtual const gfx::Rect& GetCurrentBounds() const;
+
+ protected:
+ // Windows message handlers:
+ virtual void OnDestroy();
+ virtual void OnFinalMessage(HWND window);
+ virtual LRESULT OnMouseActivate(HWND window, UINT hittest_code, UINT message);
+ virtual void OnWindowPosChanged(WINDOWPOS* window_pos);
+
+ private:
+ friend class ConstrainedWindow;
+
+ // Use the static factory methods on ConstrainedWindow to construct a
+ // ConstrainedWindow.
+ ConstrainedWindowWin(TabContents* owner,
+ views::WindowDelegate* window_delegate);
+
+ // Moves this window to the front of the Z-order and registers us with the
+ // focus manager.
+ void ActivateConstrainedWindow();
+
+ // The TabContents that owns and constrains this ConstrainedWindow.
+ TabContents* owner_;
+
+ // Current "anchor point", the lower right point at which we render
+ // the constrained title bar.
+ gfx::Point anchor_point_;
+
+ // Current display rectangle (relative to owner_'s visible area).
+ gfx::Rect current_bounds_;
+
+ DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowWin);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_WIN_H_
diff --git a/chrome/browser/views/content_setting_bubble_contents.cc b/chrome/browser/ui/views/content_setting_bubble_contents.cc
index cea404d..cea404d 100644
--- a/chrome/browser/views/content_setting_bubble_contents.cc
+++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc
diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.h b/chrome/browser/ui/views/content_setting_bubble_contents.h
new file mode 100644
index 0000000..25723a4
--- /dev/null
+++ b/chrome/browser/ui/views/content_setting_bubble_contents.h
@@ -0,0 +1,104 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_
+#define CHROME_BROWSER_UI_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_
+#pragma once
+
+#include <map>
+
+#include "chrome/common/content_settings_types.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "views/controls/button/button.h"
+#include "views/controls/link.h"
+
+// ContentSettingBubbleContents is used when the user turns on different kinds
+// of content blocking (e.g. "block images"). When viewing a page with blocked
+// content, icons appear in the omnibox corresponding to the content types that
+// were blocked, and the user can click one to get a bubble hosting a few
+// controls. This class provides the content of that bubble. In general,
+// these bubbles typically have a title, a pair of radio buttons for toggling
+// the blocking settings for the current site, a close button, and a link to
+// get to a more comprehensive settings management dialog. A few types have
+// more or fewer controls than this.
+
+class ContentSettingBubbleModel;
+class InfoBubble;
+class Profile;
+class TabContents;
+
+namespace views {
+class NativeButton;
+class RadioButton;
+}
+
+class ContentSettingBubbleContents : public views::View,
+ public views::ButtonListener,
+ public views::LinkController,
+ public NotificationObserver {
+ public:
+ ContentSettingBubbleContents(
+ ContentSettingBubbleModel* content_setting_bubble_model,
+ Profile* profile, TabContents* tab_contents);
+ virtual ~ContentSettingBubbleContents();
+
+ // Sets |info_bubble_|, so we can close the bubble if needed. The caller owns
+ // the bubble and must keep it alive.
+ void set_info_bubble(InfoBubble* info_bubble) { info_bubble_ = info_bubble; }
+
+ virtual gfx::Size GetPreferredSize();
+
+ private:
+ class Favicon;
+
+ typedef std::map<views::Link*, int> PopupLinks;
+
+ // Overridden from views::View:
+ virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
+
+ // views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // views::LinkController:
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ // NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Creates the child views.
+ void InitControlLayout();
+
+ // Provides data for this bubble.
+ scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model_;
+
+ // The active profile.
+ Profile* profile_;
+
+ // The active tab contents.
+ TabContents* tab_contents_;
+
+ // A registrar for listening for TAB_CONTENTS_DESTROYED notifications.
+ NotificationRegistrar registrar_;
+
+ // The InfoBubble holding us.
+ InfoBubble* info_bubble_;
+
+ // Some of our controls, so we can tell what's been clicked when we get a
+ // message.
+ PopupLinks popup_links_;
+ typedef std::vector<views::RadioButton*> RadioGroup;
+ RadioGroup radio_group_;
+ views::NativeButton* close_button_;
+ views::Link* manage_link_;
+ views::Link* clear_link_;
+ views::Link* info_link_;
+ views::Link* load_plugins_link_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingBubbleContents);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_
diff --git a/chrome/browser/views/cookie_info_view.cc b/chrome/browser/ui/views/cookie_info_view.cc
index f2a1bb1..f2a1bb1 100644
--- a/chrome/browser/views/cookie_info_view.cc
+++ b/chrome/browser/ui/views/cookie_info_view.cc
diff --git a/chrome/browser/ui/views/cookie_info_view.h b/chrome/browser/ui/views/cookie_info_view.h
new file mode 100644
index 0000000..071201c
--- /dev/null
+++ b/chrome/browser/ui/views/cookie_info_view.h
@@ -0,0 +1,123 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_COOKIE_INFO_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_COOKIE_INFO_VIEW_H_
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include "app/combobox_model.h"
+#include "base/string16.h"
+#include "net/base/cookie_monster.h"
+#include "views/controls/combobox/combobox.h"
+#include "views/view.h"
+
+namespace views {
+class GridLayout;
+class Label;
+class NativeButton;
+class Textfield;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CookieInfoViewDelegate
+//
+class CookieInfoViewDelegate {
+ public:
+ virtual void ModifyExpireDate(bool session_expire) = 0;
+
+ protected:
+ virtual ~CookieInfoViewDelegate() {}
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// CookieInfoView
+//
+// Responsible for displaying a tabular grid of Cookie information.
+class CookieInfoView : public views::View,
+ public views::Combobox::Listener,
+ public ComboboxModel {
+ public:
+ explicit CookieInfoView(bool editable_expiration_date);
+ virtual ~CookieInfoView();
+
+ // Update the display from the specified CookieNode.
+ void SetCookie(const std::string& domain,
+ const net::CookieMonster::CanonicalCookie& cookie_node);
+
+ // Update the display from the specified cookie string.
+ void SetCookieString(const GURL& url, const std::string& cookie_line);
+
+ // Clears the cookie display to indicate that no or multiple cookies are
+ // selected.
+ void ClearCookieDisplay();
+
+ // Enables or disables the cookie property text fields.
+ void EnableCookieDisplay(bool enabled);
+
+ void set_delegate(CookieInfoViewDelegate* delegate) { delegate_ = delegate; }
+
+ protected:
+ // views::View overrides:
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+
+ // views::Combobox::Listener override.
+ virtual void ItemChanged(views::Combobox* combo_box,
+ int prev_index,
+ int new_index);
+
+ // ComboboxModel overrides for expires_value_combobox_.
+ virtual int GetItemCount();
+ virtual string16 GetItemAt(int index);
+
+ private:
+ // Layout helper routines.
+ void AddLabelRow(int layout_id, views::GridLayout* layout,
+ views::View* label, views::View* value);
+ void AddControlRow(int layout_id, views::GridLayout* layout,
+ views::View* label, views::View* control);
+
+ // Sets up the view layout.
+ void Init();
+
+ // Individual property labels
+ views::Label* name_label_;
+ views::Textfield* name_value_field_;
+ views::Label* content_label_;
+ views::Textfield* content_value_field_;
+ views::Label* domain_label_;
+ views::Textfield* domain_value_field_;
+ views::Label* path_label_;
+ views::Textfield* path_value_field_;
+ views::Label* send_for_label_;
+ views::Textfield* send_for_value_field_;
+ views::Label* created_label_;
+ views::Textfield* created_value_field_;
+ views::Label* expires_label_;
+ views::Textfield* expires_value_field_;
+ views::Combobox* expires_value_combobox_;
+ views::View* expire_view_;
+
+ // Option values for expires_value_combobox_.
+ std::vector<std::wstring> expire_combo_values_;
+
+ // True if expiration date can be edited. In this case we will show
+ // expires_value_combobox_ instead of expires_value_field_. The cookie's
+ // expiration date is editable only this class is used in
+ // CookiesPromptView (alert before cookie is set), in all other cases we
+ // don't let user directly change cookie setting.
+ bool editable_expiration_date_;
+
+ CookieInfoViewDelegate* delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(CookieInfoView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_COOKIE_INFO_VIEW_H_
+
diff --git a/chrome/browser/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc
index 77e2ea6..77e2ea6 100644
--- a/chrome/browser/views/create_application_shortcut_view.cc
+++ b/chrome/browser/ui/views/create_application_shortcut_view.cc
diff --git a/chrome/browser/ui/views/create_application_shortcut_view.h b/chrome/browser/ui/views/create_application_shortcut_view.h
new file mode 100644
index 0000000..f1cd707
--- /dev/null
+++ b/chrome/browser/ui/views/create_application_shortcut_view.h
@@ -0,0 +1,93 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_
+#pragma once
+
+#include <string>
+
+#include "chrome/browser/web_applications/web_app.h"
+#include "views/controls/label.h"
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+
+namespace views {
+class Checkbox;
+class Label;
+class Window;
+}; // namespace views
+
+class MessageLoop;
+class Profile;
+class TabContents;
+
+// CreateShortcutView implements a dialog that asks user where to create
+// the shortcut for given web app.
+class CreateApplicationShortcutView : public views::View,
+ public views::DialogDelegate,
+ public views::ButtonListener {
+ public:
+ explicit CreateApplicationShortcutView(TabContents* tab_contents);
+ virtual ~CreateApplicationShortcutView();
+
+ // Initialize the controls on the dialog.
+ void Init();
+
+ // Overridden from views::View:
+ virtual gfx::Size GetPreferredSize();
+
+ // Overridden from views::DialogDelegate:
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool IsDialogButtonEnabled(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool CanResize() const;
+ virtual bool CanMaximize() const;
+ virtual bool IsAlwaysOnTop() const;
+ virtual bool HasAlwaysOnTopMenu() const;
+ virtual bool IsModal() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual bool Accept();
+ virtual views::View* GetContentsView();
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ private:
+ // Adds a new check-box as a child to the view.
+ views::Checkbox* AddCheckbox(const std::wstring& text, bool checked);
+
+ // Fetch the largest unprocessed icon.
+ // The first largest icon downloaded and decoded successfully will be used.
+ void FetchIcon();
+
+ // Callback of icon download.
+ void OnIconDownloaded(bool errored, const SkBitmap& image);
+
+ // TabContents of the page that we want to create shortcut.
+ TabContents* tab_contents_;
+
+ // UI elements on the dialog.
+ views::View* app_info_;
+ views::Label* create_shortcuts_label_;
+ views::Checkbox* desktop_check_box_;
+ views::Checkbox* menu_check_box_;
+ views::Checkbox* quick_launch_check_box_;
+
+ // Target shortcut info.
+ ShellIntegration::ShortcutInfo shortcut_info_;
+
+ // Unprocessed icons from the WebApplicationInfo passed in.
+ web_app::IconInfoList unprocessed_icons_;
+
+ // Pending app icon download tracked by us.
+ class IconDownloadCallbackFunctor;
+ IconDownloadCallbackFunctor* pending_download_;
+
+ DISALLOW_COPY_AND_ASSIGN(CreateApplicationShortcutView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_
diff --git a/chrome/browser/views/database_info_view.cc b/chrome/browser/ui/views/database_info_view.cc
index 70596e3..70596e3 100644
--- a/chrome/browser/views/database_info_view.cc
+++ b/chrome/browser/ui/views/database_info_view.cc
diff --git a/chrome/browser/ui/views/database_info_view.h b/chrome/browser/ui/views/database_info_view.h
new file mode 100644
index 0000000..284e7d4
--- /dev/null
+++ b/chrome/browser/ui/views/database_info_view.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_DATABASE_INFO_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_DATABASE_INFO_VIEW_H_
+#pragma once
+
+#include "views/view.h"
+#include "chrome/browser/browsing_data_database_helper.h"
+
+namespace views {
+class Label;
+class Textfield;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// DatabaseInfoView
+//
+// Responsible for displaying a tabular grid of Database information.
+class DatabaseInfoView : public views::View {
+ public:
+ DatabaseInfoView();
+ virtual ~DatabaseInfoView();
+
+ // Update the display from the specified Database info.
+ void SetDatabaseInfo(
+ const BrowsingDataDatabaseHelper::DatabaseInfo& database_info);
+
+ // Clears the cookie display to indicate that no or multiple databases are
+ // selected.
+ void ClearDatabaseDisplay();
+
+ // Enables or disables the database property text fields.
+ void EnableDatabaseDisplay(bool enabled);
+
+ protected:
+ // views::View overrides:
+ virtual void ViewHierarchyChanged(
+ bool is_add, views::View* parent, views::View* child);
+
+ private:
+ // Set up the view layout.
+ void Init();
+
+ // Individual property labels.
+ views::Textfield* name_value_field_;
+ views::Textfield* description_value_field_;
+ views::Textfield* size_value_field_;
+ views::Textfield* last_modified_value_field_;
+
+ DISALLOW_COPY_AND_ASSIGN(DatabaseInfoView);
+};
+
+
+#endif // CHROME_BROWSER_UI_VIEWS_DATABASE_INFO_VIEW_H_
diff --git a/chrome/browser/views/database_open_info_view.cc b/chrome/browser/ui/views/database_open_info_view.cc
index 02e7fae..02e7fae 100644
--- a/chrome/browser/views/database_open_info_view.cc
+++ b/chrome/browser/ui/views/database_open_info_view.cc
diff --git a/chrome/browser/ui/views/database_open_info_view.h b/chrome/browser/ui/views/database_open_info_view.h
new file mode 100644
index 0000000..c8df3cd
--- /dev/null
+++ b/chrome/browser/ui/views/database_open_info_view.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_DATABASE_OPEN_INFO_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_DATABASE_OPEN_INFO_VIEW_H_
+#pragma once
+
+#include "base/string16.h"
+#include "chrome/browser/views/generic_info_view.h"
+
+///////////////////////////////////////////////////////////////////////////////
+// DatabaseOpenInfoView
+//
+// Responsible for displaying a tabular grid of Database information when
+// prompting for permission to open a new database.
+class DatabaseOpenInfoView : public GenericInfoView {
+ public:
+ DatabaseOpenInfoView();
+
+ // Update the display from the specified Database data.
+ void SetFields(const std::string& host,
+ const string16& database_name,
+ const string16& display_name,
+ unsigned long estimated_size);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DatabaseOpenInfoView);
+};
+
+
+#endif // CHROME_BROWSER_UI_VIEWS_DATABASE_OPEN_INFO_VIEW_H_
+
diff --git a/chrome/browser/views/default_search_view.cc b/chrome/browser/ui/views/default_search_view.cc
index a90461f..a90461f 100644
--- a/chrome/browser/views/default_search_view.cc
+++ b/chrome/browser/ui/views/default_search_view.cc
diff --git a/chrome/browser/ui/views/default_search_view.h b/chrome/browser/ui/views/default_search_view.h
new file mode 100644
index 0000000..c4ad70f
--- /dev/null
+++ b/chrome/browser/ui/views/default_search_view.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_DEFAULT_SEARCH_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_DEFAULT_SEARCH_VIEW_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "base/string16.h"
+#include "chrome/browser/tab_contents/constrained_window.h"
+#include "views/window/dialog_delegate.h"
+
+#if defined(TOOLKIT_USES_GTK)
+#include "chrome/browser/gtk/constrained_window_gtk.h"
+#endif
+
+class MessageBoxView;
+class TabContents;
+class TemplateURL;
+class TemplateURLModel;
+
+namespace views {
+class View;
+}
+
+// This class is responsible for displaying the contents of the default search
+// prompt for when InstallSearchProvider(url, true) is called.
+class DefaultSearchView : public ConstrainedDialogDelegate {
+ public:
+ static void Show(TabContents* tab_contents,
+ TemplateURL* default_url,
+ TemplateURLModel* template_url_model);
+
+ protected:
+ // ConstrainedDialogDelegate:
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual void DeleteDelegate();
+ virtual views::View* GetContentsView();
+ virtual int GetDefaultDialogButton() const;
+ virtual bool Accept();
+
+ private:
+ DefaultSearchView(TabContents* tab_contents,
+ TemplateURL* default_url,
+ TemplateURLModel* template_url_model);
+ ~DefaultSearchView();
+
+ // The host name for the possible default search provider.
+ string16 DefaultHostName() const;
+
+ // The possible new default url.
+ scoped_ptr<TemplateURL> default_url_;
+ TemplateURLModel* template_url_model_;
+
+ // The message box view whose commands we handle.
+ MessageBoxView* message_box_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(DefaultSearchView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_DEFAULT_SEARCH_VIEW_H_
diff --git a/chrome/browser/views/detachable_toolbar_view.cc b/chrome/browser/ui/views/detachable_toolbar_view.cc
index e2aaa3a..e2aaa3a 100644
--- a/chrome/browser/views/detachable_toolbar_view.cc
+++ b/chrome/browser/ui/views/detachable_toolbar_view.cc
diff --git a/chrome/browser/ui/views/detachable_toolbar_view.h b/chrome/browser/ui/views/detachable_toolbar_view.h
new file mode 100644
index 0000000..65008e0
--- /dev/null
+++ b/chrome/browser/ui/views/detachable_toolbar_view.h
@@ -0,0 +1,91 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_DETACHABLE_TOOLBAR_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_DETACHABLE_TOOLBAR_VIEW_H_
+#pragma once
+
+#include "chrome/browser/views/accessible_pane_view.h"
+
+class SkBitmap;
+struct SkRect;
+
+// DetachableToolbarView contains functionality common to views that can detach
+// from the Chrome frame, such as the BookmarkBarView and the Extension shelf.
+class DetachableToolbarView : public AccessiblePaneView {
+ public:
+ // The color gradient start value close to the edge of the divider.
+ static const SkColor kEdgeDividerColor;
+ // The color gradient value for the middle of the divider.
+ static const SkColor kMiddleDividerColor;
+
+ DetachableToolbarView() {}
+ virtual ~DetachableToolbarView() {}
+
+ // Whether the view is currently detached from the Chrome frame.
+ virtual bool IsDetached() const = 0;
+
+ // Gets the current state of the resize animation (show/hide).
+ virtual double GetAnimationValue() const = 0;
+
+ // Gets the current amount of overlap atop the browser toolbar.
+ virtual int GetToolbarOverlap() const = 0;
+
+ // Paints the background (including the theme image behind content area) when
+ // the bar/shelf is attached to the top toolbar. |background_origin| is the
+ // origin to use for painting the theme image.
+ static void PaintBackgroundAttachedMode(gfx::Canvas* canvas,
+ views::View* view,
+ const gfx::Point& background_origin);
+
+ // Calculate the rect for the content area of the bar/shelf. This is only
+ // needed when the bar/shelf is detached from the Chrome frame (otherwise the
+ // content area is the whole area of the bar/shelf. When detached, however,
+ // only a small round rectangle is for drawing our content on. This calculates
+ // how big this area is, where it is located within the shelf and how round
+ // the edges should be.
+ static void CalculateContentArea(double animation_state,
+ double horizontal_padding,
+ double vertical_padding,
+ SkRect* rect,
+ double* roundness,
+ views::View* view);
+
+ // Paint the horizontal border separating the shelf/bar from the page content.
+ static void PaintHorizontalBorder(gfx::Canvas* canvas,
+ DetachableToolbarView* view);
+
+ // Paint the background of the content area (the surface behind the
+ // bookmarks or extension toolstrips). |rect| is the rectangle to paint
+ // the background within. |roundness| describes the roundness of the corners.
+ static void PaintContentAreaBackground(gfx::Canvas* canvas,
+ ThemeProvider* theme_provider,
+ const SkRect& rect,
+ double roundness);
+ // Paint the border around the content area (when in detached mode).
+ static void PaintContentAreaBorder(gfx::Canvas* canvas,
+ ThemeProvider* theme_provider,
+ const SkRect& rect,
+ double roundness);
+
+ // Paint a themed gradient divider at location |x|. |height| is the full
+ // height of the view you want to paint the divider into, not the height of
+ // the divider. The height of the divider will become:
+ // |height| - 2 * |vertical_padding|.
+ // The color of the divider is a gradient starting with |top_color| at the
+ // top, and changing into |middle_color| and then over to |bottom_color| as
+ // you go further down.
+ static void PaintVerticalDivider(gfx::Canvas* canvas,
+ int x,
+ int height,
+ int vertical_padding,
+ const SkColor& top_color,
+ const SkColor& middle_color,
+ const SkColor& bottom_color);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DetachableToolbarView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_DETACHABLE_TOOLBAR_VIEW_H_
diff --git a/chrome/browser/views/dialog_stubs_gtk.cc b/chrome/browser/ui/views/dialog_stubs_gtk.cc
index a8e4535..a8e4535 100644
--- a/chrome/browser/views/dialog_stubs_gtk.cc
+++ b/chrome/browser/ui/views/dialog_stubs_gtk.cc
diff --git a/chrome/browser/views/dom_view.cc b/chrome/browser/ui/views/dom_view.cc
index a4cc19a..a4cc19a 100644
--- a/chrome/browser/views/dom_view.cc
+++ b/chrome/browser/ui/views/dom_view.cc
diff --git a/chrome/browser/ui/views/dom_view.h b/chrome/browser/ui/views/dom_view.h
new file mode 100644
index 0000000..27d9434
--- /dev/null
+++ b/chrome/browser/ui/views/dom_view.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// DOMView is a ChromeView that displays the content of a web DOM.
+// It should be used with data: URLs.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_DOM_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_DOM_VIEW_H_
+#pragma once
+
+#include "base/scoped_ptr.h"
+#include "googleurl/src/gurl.h"
+#include "views/controls/native/native_view_host.h"
+#include "views/event.h"
+
+class Profile;
+class SiteInstance;
+class TabContents;
+
+class DOMView : public views::NativeViewHost {
+ public:
+ DOMView();
+ virtual ~DOMView();
+
+ // Initialize the view, creating the contents. This should be
+ // called once the view has been added to a container.
+ //
+ // If |instance| is not null, then the view will be loaded in the same
+ // process as the given instance.
+ bool Init(Profile* profile, SiteInstance* instance);
+
+ // Loads the given URL into the page. You must have previously called Init().
+ void LoadURL(const GURL& url);
+
+ // The tab contents displaying the actual contents.
+ TabContents* tab_contents() const { return tab_contents_.get(); }
+
+ protected:
+ // Overridden from View.
+ virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e);
+ virtual void Focus();
+ virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
+ views::View* child);
+
+ // Returns new allocated TabContents instance, caller is responsible deleting.
+ // Override in derived classes to replace TabContents with derivative.
+ virtual TabContents* CreateTabContents(Profile* profile,
+ SiteInstance* instance);
+
+ scoped_ptr<TabContents> tab_contents_;
+
+ private:
+ bool initialized_;
+
+ DISALLOW_COPY_AND_ASSIGN(DOMView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_DOM_VIEW_H_
diff --git a/chrome/browser/views/dom_view_browsertest.cc b/chrome/browser/ui/views/dom_view_browsertest.cc
index 8aa51b6..8aa51b6 100644
--- a/chrome/browser/views/dom_view_browsertest.cc
+++ b/chrome/browser/ui/views/dom_view_browsertest.cc
diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/ui/views/download_item_view.cc
index 3ceaf52..3ceaf52 100644
--- a/chrome/browser/views/download_item_view.cc
+++ b/chrome/browser/ui/views/download_item_view.cc
diff --git a/chrome/browser/ui/views/download_item_view.h b/chrome/browser/ui/views/download_item_view.h
new file mode 100644
index 0000000..a6c138b
--- /dev/null
+++ b/chrome/browser/ui/views/download_item_view.h
@@ -0,0 +1,276 @@
+// Copyright (c) 2010 The Chromium 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 ChromeView that implements one download on the Download shelf.
+// Each DownloadItemView contains an application icon, a text label
+// indicating the download's file name, a text label indicating the
+// download's status (such as the number of bytes downloaded so far)
+// and a button for canceling an in progress download, or opening
+// the completed download.
+//
+// The DownloadItemView lives in the Browser, and has a corresponding
+// DownloadController that receives / writes data which lives in the
+// Renderer.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_ITEM_VIEW_H__
+#define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_ITEM_VIEW_H__
+#pragma once
+
+#include <string>
+
+#include "app/slide_animation.h"
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "base/time.h"
+#include "base/timer.h"
+#include "chrome/browser/cancelable_request.h"
+#include "chrome/browser/download/download_item.h"
+#include "chrome/browser/download/download_manager.h"
+#include "chrome/browser/icon_manager.h"
+#include "gfx/font.h"
+#include "views/event.h"
+#include "views/controls/button/button.h"
+#include "views/view.h"
+
+namespace views {
+class Label;
+class NativeButton;
+}
+class BaseDownloadItemModel;
+class DownloadShelfView;
+class SkBitmap;
+class DownloadShelfContextMenuWin;
+
+class DownloadItemView : public views::ButtonListener,
+ public views::View,
+ public DownloadItem::Observer,
+ public AnimationDelegate {
+ public:
+ DownloadItemView(DownloadItem* download,
+ DownloadShelfView* parent,
+ BaseDownloadItemModel* model);
+ virtual ~DownloadItemView();
+
+ // DownloadObserver method
+ virtual void OnDownloadUpdated(DownloadItem* download);
+ virtual void OnDownloadFileCompleted(DownloadItem* download) { }
+ virtual void OnDownloadOpened(DownloadItem* download);
+
+ // View overrides
+ virtual void Layout();
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual gfx::Size GetPreferredSize();
+ virtual void OnMouseExited(const views::MouseEvent& event);
+ virtual void OnMouseMoved(const views::MouseEvent& event);
+ virtual bool OnMousePressed(const views::MouseEvent& event);
+ virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
+ virtual bool OnMouseDragged(const views::MouseEvent& event);
+ virtual bool OnKeyPressed(const views::KeyEvent& e);
+ virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture);
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+ virtual AccessibilityTypes::State GetAccessibleState();
+
+ // ButtonListener implementation.
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // AnimationDelegate implementation.
+ virtual void AnimationProgressed(const Animation* animation);
+
+ // Timer callback for handling animations
+ void UpdateDownloadProgress();
+ void StartDownloadProgress();
+ void StopDownloadProgress();
+
+ // IconManager::Client interface.
+ void OnExtractIconComplete(IconManager::Handle handle, SkBitmap* icon_bitmap);
+
+ // Returns the DownloadItem model object belonging to this item.
+ DownloadItem* download() const { return download_; }
+
+ private:
+ enum State {
+ NORMAL = 0,
+ HOT,
+ PUSHED,
+ DANGEROUS
+ };
+
+ // The image set associated with the part containing the icon and text.
+ struct BodyImageSet {
+ SkBitmap* top_left;
+ SkBitmap* left;
+ SkBitmap* bottom_left;
+ SkBitmap* top;
+ SkBitmap* center;
+ SkBitmap* bottom;
+ SkBitmap* top_right;
+ SkBitmap* right;
+ SkBitmap* bottom_right;
+ };
+
+ // The image set associated with the drop-down button on the right.
+ struct DropDownImageSet {
+ SkBitmap* top;
+ SkBitmap* center;
+ SkBitmap* bottom;
+ };
+
+ void OpenDownload();
+
+ void LoadIcon();
+
+ virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip);
+
+ // Convenience method to paint the 3 vertical bitmaps (bottom, middle, top)
+ // that form the background.
+ void PaintBitmaps(gfx::Canvas* canvas,
+ const SkBitmap* top_bitmap,
+ const SkBitmap* center_bitmap,
+ const SkBitmap* bottom_bitmap,
+ int x,
+ int y,
+ int height,
+ int width);
+
+ // Sets the state and triggers a repaint.
+ void SetState(State body_state, State drop_down_state);
+
+ // Whether we are in the dangerous mode.
+ bool IsDangerousMode() { return body_state_ == DANGEROUS; }
+
+ // Reverts from dangerous mode to normal download mode.
+ void ClearDangerousMode();
+
+ // Sets |size| with the size of the Save and Discard buttons (they have the
+ // same size).
+ gfx::Size GetButtonSize();
+
+ // Sizes the dangerous download label to a minimum width available using 2
+ // lines. The size is computed only the first time this method is invoked
+ // and simply returned on subsequent calls.
+ void SizeLabelToMinWidth();
+
+ // Reenables the item after it has been disabled when a user clicked it to
+ // open the downloaded file.
+ void Reenable();
+
+ // Given |x|, returns whether |x| is within the x coordinate range of
+ // the drop-down button or not.
+ bool InDropDownButtonXCoordinateRange(int x);
+
+ // Update the accessible name to reflect the current state of the control,
+ // so that screenreaders can access the filename, status text, and
+ // dangerous download warning message (if any).
+ void UpdateAccessibleName();
+
+ // The different images used for the background.
+ BodyImageSet normal_body_image_set_;
+ BodyImageSet hot_body_image_set_;
+ BodyImageSet pushed_body_image_set_;
+ BodyImageSet dangerous_mode_body_image_set_;
+ DropDownImageSet normal_drop_down_image_set_;
+ DropDownImageSet hot_drop_down_image_set_;
+ DropDownImageSet pushed_drop_down_image_set_;
+
+ // The warning icon showns for dangerous downloads.
+ SkBitmap* warning_icon_;
+
+ // The model we query for display information
+ DownloadItem* download_;
+
+ // Our parent view that owns us.
+ DownloadShelfView* parent_;
+
+ // Elements of our particular download
+ std::wstring status_text_;
+ bool show_status_text_;
+
+ // The font used to print the file name and status.
+ gfx::Font font_;
+
+ // The tooltip.
+ std::wstring tooltip_text_;
+
+ // The current state (normal, hot or pushed) of the body and drop-down.
+ State body_state_;
+ State drop_down_state_;
+
+ // In degrees, for downloads with no known total size.
+ int progress_angle_;
+
+ // The left and right x coordinates of the drop-down button.
+ int drop_down_x_left_;
+ int drop_down_x_right_;
+
+ // Used when we are showing the menu to show the drop-down as pressed.
+ bool drop_down_pressed_;
+
+ // The height of the box formed by the background images and its labels.
+ int box_height_;
+
+ // The y coordinate of the box formed by the background images and its labels.
+ int box_y_;
+
+ // Whether we are dragging the download button.
+ bool dragging_;
+
+ // Whether we are tracking a possible drag.
+ bool starting_drag_;
+
+ // Position that a possible drag started at.
+ gfx::Point drag_start_point_;
+
+ // For canceling an in progress icon request.
+ CancelableRequestConsumerT<int, 0> icon_consumer_;
+
+ // A model class to control the status text we display and the cancel
+ // behavior.
+ // This class owns the pointer.
+ scoped_ptr<BaseDownloadItemModel> model_;
+
+ // Hover animations for our body and drop buttons.
+ scoped_ptr<SlideAnimation> body_hover_animation_;
+ scoped_ptr<SlideAnimation> drop_hover_animation_;
+
+ // Animation for download complete.
+ scoped_ptr<SlideAnimation> complete_animation_;
+
+ // Progress animation
+ base::RepeatingTimer<DownloadItemView> progress_timer_;
+
+ // Dangerous mode buttons.
+ views::NativeButton* save_button_;
+ views::NativeButton* discard_button_;
+
+ // Dangerous mode label.
+ views::Label* dangerous_download_label_;
+
+ // Whether the dangerous mode label has been sized yet.
+ bool dangerous_download_label_sized_;
+
+ // The size of the buttons. Cached so animation works when hidden.
+ gfx::Size cached_button_size_;
+
+ // Whether we are currently disabled as part of opening the downloaded file.
+ bool disabled_while_opening_;
+
+ // The time at which this view was created.
+ base::Time creation_time_;
+
+ // Method factory used to delay reenabling of the item when opening the
+ // downloaded file.
+ ScopedRunnableMethodFactory<DownloadItemView> reenable_method_factory_;
+
+ // The currently running download context menu.
+ scoped_ptr<DownloadShelfContextMenuWin> context_menu_;
+
+ // If non-NULL, set to true when this object is deleted.
+ // (Used when showing the context menu as it runs an inner message loop that
+ // might delete us).
+ bool* deleted_;
+
+ DISALLOW_COPY_AND_ASSIGN(DownloadItemView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_ITEM_VIEW_H__
diff --git a/chrome/browser/views/download_shelf_view.cc b/chrome/browser/ui/views/download_shelf_view.cc
index 43df5c7..43df5c7 100644
--- a/chrome/browser/views/download_shelf_view.cc
+++ b/chrome/browser/ui/views/download_shelf_view.cc
diff --git a/chrome/browser/ui/views/download_shelf_view.h b/chrome/browser/ui/views/download_shelf_view.h
new file mode 100644
index 0000000..126eff0
--- /dev/null
+++ b/chrome/browser/ui/views/download_shelf_view.h
@@ -0,0 +1,155 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_DOWNLOAD_SHELF_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_SHELF_VIEW_H_
+#pragma once
+
+#include "app/slide_animation.h"
+#include "chrome/browser/download/download_shelf.h"
+#include "chrome/browser/views/accessible_pane_view.h"
+#include "views/controls/button/button.h"
+#include "views/controls/link.h"
+#include "views/mouse_watcher.h"
+
+namespace views {
+class ImageButton;
+class ImageView;
+}
+
+class BaseDownloadItemModel;
+class Browser;
+class BrowserView;
+
+class DownloadAnimation;
+class DownloadItemView;
+
+// DownloadShelfView is a view that contains individual views for each download,
+// as well as a close button and a link to show all downloads.
+//
+// DownloadShelfView does not hold an infinite number of download views, rather
+// it'll automatically remove views once a certain point is reached.
+class DownloadShelfView : public AccessiblePaneView,
+ public AnimationDelegate,
+ public DownloadShelf,
+ public views::ButtonListener,
+ public views::LinkController,
+ public views::MouseWatcherListener {
+ public:
+ DownloadShelfView(Browser* browser, BrowserView* parent);
+ virtual ~DownloadShelfView();
+
+ // Sent from the DownloadItemView when the user opens an item.
+ void OpenedDownload(DownloadItemView* view);
+
+ // Implementation of View.
+ virtual gfx::Size GetPreferredSize();
+ virtual void Layout();
+ virtual void Paint(gfx::Canvas* canvas);
+
+ // Implementation of AnimationDelegate.
+ virtual void AnimationProgressed(const Animation* animation);
+ virtual void AnimationEnded(const Animation* animation);
+
+ // Implementation of LinkController.
+ // Invoked when the user clicks the 'show all downloads' link button.
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ // Implementation of ButtonListener.
+ // Invoked when the user clicks the close button. Asks the browser to
+ // hide the download shelf.
+ virtual void ButtonPressed(views::Button* button, const views::Event& event);
+
+ // Implementation of DownloadShelf.
+ virtual void AddDownload(BaseDownloadItemModel* download_model);
+ virtual bool IsShowing() const;
+ virtual bool IsClosing() const;
+ virtual void Show();
+ virtual void Close();
+ virtual Browser* browser() const { return browser_; }
+
+ // Implementation of MouseWatcherDelegate.
+ virtual void MouseMovedOutOfView();
+
+ // Override views::FocusChangeListener method from AccessiblePaneView.
+ virtual void FocusWillChange(View* focused_before,
+ View* focused_now);
+
+ // Removes a specified download view. The supplied view is deleted after
+ // it's removed.
+ void RemoveDownloadView(views::View* view);
+
+ protected:
+ // From AccessiblePaneView
+ virtual views::View* GetDefaultFocusableChild();
+
+ private:
+ void Init();
+
+ // Adds a View representing a download to this DownloadShelfView.
+ // DownloadShelfView takes ownership of the View, and will delete it as
+ // necessary.
+ void AddDownloadView(DownloadItemView* view);
+
+ // Paints the border.
+ void PaintBorder(gfx::Canvas* canvas);
+
+ // Returns true if the shelf is wide enough to show the first download item.
+ bool CanFitFirstDownloadItem();
+
+ // Called on theme change.
+ void UpdateButtonColors();
+
+ // Overridden from views::View.
+ virtual void OnThemeChanged();
+
+ // Called when the "close shelf" animation ended.
+ void Closed();
+
+ // Returns true if we can auto close. We can auto-close if all the items on
+ // the shelf have been opened.
+ bool CanAutoClose();
+
+ // Called when any view |view| gains or loses focus. If it's one of our
+ // DownloadItemView children, call SchedulePaint on its bounds
+ // so that its focus rect is repainted.
+ void SchedulePaintForDownloadItem(views::View* view);
+
+ // Get the rect that perfectly surrounds a DownloadItemView so we can
+ // draw a focus rect around it.
+ gfx::Rect GetFocusRectBounds(const DownloadItemView* download_item_view);
+
+ // The browser for this shelf.
+ Browser* browser_;
+
+ // The animation for adding new items to the shelf.
+ scoped_ptr<SlideAnimation> new_item_animation_;
+
+ // The show/hide animation for the shelf itself.
+ scoped_ptr<SlideAnimation> shelf_animation_;
+
+ // The download views. These are also child Views, and deleted when
+ // the DownloadShelfView is deleted.
+ std::vector<DownloadItemView*> download_views_;
+
+ // An image displayed on the right of the "Show all downloads..." link.
+ views::ImageView* arrow_image_;
+
+ // Link for showing all downloads. This is contained as a child, and deleted
+ // by View.
+ views::Link* show_all_view_;
+
+ // Button for closing the downloads. This is contained as a child, and
+ // deleted by View.
+ views::ImageButton* close_button_;
+
+ // The window this shelf belongs to.
+ BrowserView* parent_;
+
+ views::MouseWatcher mouse_watcher_;
+
+ DISALLOW_COPY_AND_ASSIGN(DownloadShelfView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_SHELF_VIEW_H_
diff --git a/chrome/browser/views/download_started_animation_win.cc b/chrome/browser/ui/views/download_started_animation_win.cc
index e142b14..e142b14 100644
--- a/chrome/browser/views/download_started_animation_win.cc
+++ b/chrome/browser/ui/views/download_started_animation_win.cc
diff --git a/chrome/browser/views/dropdown_bar_host.cc b/chrome/browser/ui/views/dropdown_bar_host.cc
index e55365b..e55365b 100644
--- a/chrome/browser/views/dropdown_bar_host.cc
+++ b/chrome/browser/ui/views/dropdown_bar_host.cc
diff --git a/chrome/browser/ui/views/dropdown_bar_host.h b/chrome/browser/ui/views/dropdown_bar_host.h
new file mode 100644
index 0000000..a2a0acd
--- /dev/null
+++ b/chrome/browser/ui/views/dropdown_bar_host.h
@@ -0,0 +1,188 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_DROPDOWN_BAR_HOST_H_
+#define CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_
+#pragma once
+
+#include "app/animation.h"
+#include "base/scoped_ptr.h"
+#include "chrome/common/native_web_keyboard_event.h"
+#include "gfx/native_widget_types.h"
+#include "gfx/rect.h"
+#include "views/controls/textfield/textfield.h"
+#include "views/focus/focus_manager.h"
+
+class BrowserView;
+class DropdownBarView;
+class SlideAnimation;
+class TabContents;
+
+namespace views {
+class ExternalFocusTracker;
+class View;
+class Widget;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// The DropdownBarHost implements the container widget for the UI that
+// is shown at the top of browser contents. It uses the appropriate
+// implementation from dropdown_bar_host_win.cc or dropdown_bar_host_gtk.cc to
+// draw its content and is responsible for showing, hiding, animating, closing,
+// and moving the bar if needed, for example if the widget is
+// obscuring the selection results in FindBar.
+//
+////////////////////////////////////////////////////////////////////////////////
+class DropdownBarHost : public views::AcceleratorTarget,
+ public views::FocusChangeListener,
+ public AnimationDelegate {
+ public:
+ explicit DropdownBarHost(BrowserView* browser_view);
+ virtual ~DropdownBarHost();
+
+ // Initializes the dropdown bar host with the give view.
+ void Init(DropdownBarView* view);
+
+ // Whether we are animating the position of the dropdown widget.
+ bool IsAnimating() const;
+ // Returns true if the dropdown bar view is visible, or false otherwise.
+ bool IsVisible() const;
+ // Selects text in the entry field and set focus.
+ void SetFocusAndSelection();
+ // Stops the animation.
+ void StopAnimation();
+
+ // Shows the dropdown bar.
+ virtual void Show(bool animate);
+ // Hides the dropdown bar.
+ virtual void Hide(bool animate);
+
+ // Returns the rectangle representing where to position the dropdown widget.
+ virtual gfx::Rect GetDialogPosition(gfx::Rect avoid_overlapping_rect) = 0;
+
+ // Moves the widget to the provided location, moves it to top
+ // in the z-order (HWND_TOP, not HWND_TOPMOST for windows) and shows
+ // the widget (if hidden).
+ virtual void SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw) = 0;
+
+ // Overridden from views::FocusChangeListener:
+ virtual void FocusWillChange(views::View* focused_before,
+ views::View* focused_now);
+
+ // Overridden from views::AcceleratorTarget:
+ virtual bool AcceleratorPressed(const views::Accelerator& accelerator) = 0;
+
+ // AnimationDelegate implementation:
+ virtual void AnimationProgressed(const Animation* animation);
+ virtual void AnimationEnded(const Animation* animation);
+
+ // During testing we can disable animations by setting this flag to true,
+ // so that opening and closing the dropdown bar is shown instantly, instead of
+ // having to poll it while it animates to open/closed status.
+ static bool disable_animations_during_testing_;
+
+ // Returns the browser view that the dropdown belongs to.
+ BrowserView* browser_view() const { return browser_view_; }
+
+ // Registers this class as the handler for when Escape is pressed. Once we
+ // loose focus we will unregister Escape and (any accelerators the derived
+ // classes registers by using overrides of RegisterAccelerators). See also:
+ // SetFocusChangeListener().
+ virtual void RegisterAccelerators();
+
+ // When we loose focus, we unregister all accelerator handlers. See also:
+ // SetFocusChangeListener().
+ virtual void UnregisterAccelerators();
+
+ protected:
+ // Returns the dropdown bar view.
+ DropdownBarView* view() const { return view_; }
+
+ // Returns the focus tracker.
+ views::ExternalFocusTracker* focus_tracker() const {
+ return focus_tracker_.get();
+ }
+
+ // Resets the focus tracker.
+ void ResetFocusTracker();
+
+ // The focus manager we register with to keep track of focus changes.
+ views::FocusManager* focus_manager() const { return focus_manager_; }
+
+ // Returns the host widget.
+ views::Widget* host() const { return host_.get(); }
+
+ // Returns the animation offset.
+ int animation_offset() const { return animation_offset_; }
+
+ // Retrieves the boundary that the dropdown widget has to work with
+ // within the Chrome frame window. The boundary differs depending on
+ // the dropdown bar implementation. The default implementation
+ // returns the boundary of browser_view and the drop down
+ // can be shown in any client area.
+ virtual void GetWidgetBounds(gfx::Rect* bounds);
+
+ // The find bar widget needs rounded edges, so we create a polygon
+ // that corresponds to the background images for this window (and
+ // make the polygon only contain the pixels that we want to
+ // draw). The polygon is then given to SetWindowRgn which changes
+ // the window from being a rectangle in shape, to being a rect with
+ // curved edges. We also check to see if the region should be
+ // truncated to prevent from drawing onto Chrome's window border.
+ void UpdateWindowEdges(const gfx::Rect& new_pos);
+
+ // Creates and returns the native Widget.
+ views::Widget* CreateHost();
+
+ // Allows implementation to tweak widget position.
+ void SetWidgetPositionNative(const gfx::Rect& new_pos, bool no_redraw);
+
+ // Returns a keyboard event suitable for fowarding.
+ NativeWebKeyboardEvent GetKeyboardEvent(
+ const TabContents* contents,
+ const views::Textfield::Keystroke& key_stroke);
+
+ // Returns the animation for the dropdown.
+ SlideAnimation* animation() {
+ return animation_.get();
+ }
+
+ private:
+ // The BrowserView that created us.
+ BrowserView* browser_view_;
+
+ // Our view, which is responsible for drawing the UI.
+ DropdownBarView* view_;
+
+ // The y position pixel offset of the widget while animating the
+ // dropdown widget.
+ int animation_offset_;
+
+ // The animation class to use when opening the Dropdown widget.
+ scoped_ptr<SlideAnimation> animation_;
+
+ // The focus manager we register with to keep track of focus changes.
+ views::FocusManager* focus_manager_;
+
+ // True if the accelerator target for Esc key is registered.
+ bool esc_accel_target_registered_;
+
+ // Tracks and stores the last focused view which is not the DropdownBarView
+ // or any of its children. Used to restore focus once the DropdownBarView is
+ // closed.
+ scoped_ptr<views::ExternalFocusTracker> focus_tracker_;
+
+ // Host is the Widget implementation that is created and maintained by the
+ // dropdown bar. It contains the DropdownBarView.
+ scoped_ptr<views::Widget> host_;
+
+ // A flag to manually manage visibility. GTK/X11 is asynchrnous and
+ // the state of the widget can be out of sync.
+ bool is_visible_;
+
+ DISALLOW_COPY_AND_ASSIGN(DropdownBarHost);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_
diff --git a/chrome/browser/views/dropdown_bar_host_gtk.cc b/chrome/browser/ui/views/dropdown_bar_host_gtk.cc
index 2a4e4be..2a4e4be 100644
--- a/chrome/browser/views/dropdown_bar_host_gtk.cc
+++ b/chrome/browser/ui/views/dropdown_bar_host_gtk.cc
diff --git a/chrome/browser/views/dropdown_bar_host_win.cc b/chrome/browser/ui/views/dropdown_bar_host_win.cc
index c14fb21..c14fb21 100644
--- a/chrome/browser/views/dropdown_bar_host_win.cc
+++ b/chrome/browser/ui/views/dropdown_bar_host_win.cc
diff --git a/chrome/browser/ui/views/dropdown_bar_view.h b/chrome/browser/ui/views/dropdown_bar_view.h
new file mode 100644
index 0000000..cfd3377
--- /dev/null
+++ b/chrome/browser/ui/views/dropdown_bar_view.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_DROPDOWN_BAR_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_VIEW_H_
+#pragma once
+
+#include "views/view.h"
+
+class DropdownBarHost;
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// The DropdownBarView is an abstract view to draw the UI controls of the
+// DropdownBarHost.
+//
+////////////////////////////////////////////////////////////////////////////////
+class DropdownBarView : public views::View {
+ public:
+ explicit DropdownBarView(DropdownBarHost* host)
+ : host_(host),
+ animation_offset_(0) {
+ }
+ virtual ~DropdownBarView() {}
+
+ // Claims focus for the text field and selects its contents.
+ virtual void SetFocusAndSelection(bool select_all) = 0;
+
+ // Updates the view to let it know where the host is clipping the
+ // dropdown widget (while animating the opening or closing of the widget).
+ void set_animation_offset(int offset) { animation_offset_ = offset; }
+
+ // Returns the offset used while animating.
+ int animation_offset() const { return animation_offset_; }
+
+ protected:
+ // Returns the DropdownBarHost that manages this view.
+ DropdownBarHost* host() const { return host_; }
+
+ private:
+ // The dropdown bar host that controls this view.
+ DropdownBarHost* host_;
+
+ // While animating, the host clips the widget and draws only the bottom
+ // part of it. The view needs to know the pixel offset at which we are drawing
+ // the widget so that we can draw the curved edges that attach to the toolbar
+ // in the right location.
+ int animation_offset_;
+
+ DISALLOW_COPY_AND_ASSIGN(DropdownBarView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_VIEW_H_
diff --git a/chrome/browser/views/edit_search_engine_dialog.cc b/chrome/browser/ui/views/edit_search_engine_dialog.cc
index 8919d9d..8919d9d 100644
--- a/chrome/browser/views/edit_search_engine_dialog.cc
+++ b/chrome/browser/ui/views/edit_search_engine_dialog.cc
diff --git a/chrome/browser/ui/views/edit_search_engine_dialog.h b/chrome/browser/ui/views/edit_search_engine_dialog.h
new file mode 100644
index 0000000..f68e803
--- /dev/null
+++ b/chrome/browser/ui/views/edit_search_engine_dialog.h
@@ -0,0 +1,105 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// EditSearchEngineDialog provides text fields for editing a keyword: the title,
+// url and actual keyword. It is used by the KeywordEditorView of the Options
+// dialog, and also on its own to confirm the addition of a keyword added by
+// the ExternalJSObject via the RenderView.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_EDIT_SEARCH_ENGINE_DIALOG_H_
+#define CHROME_BROWSER_UI_VIEWS_EDIT_SEARCH_ENGINE_DIALOG_H_
+#pragma once
+
+#include <windows.h>
+
+#include "views/controls/textfield/textfield.h"
+#include "views/window/dialog_delegate.h"
+
+namespace views {
+class Label;
+class ImageView;
+class Window;
+}
+
+class EditSearchEngineController;
+class EditSearchEngineControllerDelegate;
+class Profile;
+class TemplateURL;
+class TemplateURLModel;
+
+class EditSearchEngineDialog : public views::View,
+ public views::Textfield::Controller,
+ public views::DialogDelegate {
+ public:
+ // The |template_url| and/or |delegate| may be NULL.
+ EditSearchEngineDialog(const TemplateURL* template_url,
+ EditSearchEngineControllerDelegate* delegate,
+ Profile* profile);
+ virtual ~EditSearchEngineDialog() {}
+
+ // Shows the dialog to the user.
+ static void Show(gfx::NativeWindow parent,
+ const TemplateURL* template_url,
+ EditSearchEngineControllerDelegate* delegate,
+ Profile* profile);
+
+ // views::DialogDelegate overrides.
+ virtual bool IsModal() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual bool IsDialogButtonEnabled(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool Cancel();
+ virtual bool Accept();
+ virtual views::View* GetContentsView();
+
+ // views::Textfield::Controller overrides. Updates whether the user can
+ // accept the dialog as well as updating image views showing whether value is
+ // valid.
+ virtual void ContentsChanged(views::Textfield* sender,
+ const std::wstring& new_contents);
+ virtual bool HandleKeystroke(views::Textfield* sender,
+ const views::Textfield::Keystroke& key);
+
+ private:
+ void Init();
+
+ // Create a Label containing the text with the specified message id.
+ views::Label* CreateLabel(int message_id);
+
+ // Creates a text field with the specified text. If |lowercase| is true, the
+ // Textfield is configured to map all input to lower case.
+ views::Textfield* CreateTextfield(const std::wstring& text, bool lowercase);
+
+ // Invokes UpdateImageView for each of the images views.
+ void UpdateImageViews();
+
+ // 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 UpdateImageView(views::ImageView* image_view,
+ bool is_valid,
+ int invalid_message_id);
+
+ // Used to parent window to. May be NULL or an invalid window.
+ HWND parent_;
+
+ // View containing the buttons, text fields ...
+ views::View* view_;
+
+ // Text fields.
+ views::Textfield* title_tf_;
+ views::Textfield* keyword_tf_;
+ views::Textfield* url_tf_;
+
+ // Shows error images.
+ views::ImageView* title_iv_;
+ views::ImageView* keyword_iv_;
+ views::ImageView* url_iv_;
+
+ scoped_ptr<EditSearchEngineController> controller_;
+
+ DISALLOW_COPY_AND_ASSIGN(EditSearchEngineDialog);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_EDIT_SEARCH_ENGINE_DIALOG_H_
diff --git a/chrome/browser/views/event_utils.cc b/chrome/browser/ui/views/event_utils.cc
index 06b9f0d..06b9f0d 100644
--- a/chrome/browser/views/event_utils.cc
+++ b/chrome/browser/ui/views/event_utils.cc
diff --git a/chrome/browser/ui/views/event_utils.h b/chrome/browser/ui/views/event_utils.h
new file mode 100644
index 0000000..9d37c53
--- /dev/null
+++ b/chrome/browser/ui/views/event_utils.h
@@ -0,0 +1,28 @@
+// Copyright (c) 2006-2008 The Chromium 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_VIEWS_EVENT_UTILS_H__
+#define CHROME_BROWSER_UI_VIEWS_EVENT_UTILS_H__
+#pragma once
+
+#include "webkit/glue/window_open_disposition.h"
+
+namespace views {
+class MouseEvent;
+}
+
+namespace event_utils {
+
+// Translates event flags into what kind of disposition they represents.
+// For example, a middle click would mean to open a background tab.
+// event_flags are the flags as understood by views::MouseEvent.
+WindowOpenDisposition DispositionFromEventFlags(int event_flags);
+
+// Returns true if the specified mouse event may have a
+// WindowOptionDisposition.
+bool IsPossibleDispositionEvent(const views::MouseEvent& event);
+
+}
+
+#endif // CHROME_BROWSER_UI_VIEWS_EVENT_UTILS_H__
diff --git a/chrome/browser/views/extensions/browser_action_drag_data.cc b/chrome/browser/ui/views/extensions/browser_action_drag_data.cc
index 6ab54ce..6ab54ce 100644
--- a/chrome/browser/views/extensions/browser_action_drag_data.cc
+++ b/chrome/browser/ui/views/extensions/browser_action_drag_data.cc
diff --git a/chrome/browser/ui/views/extensions/browser_action_drag_data.h b/chrome/browser/ui/views/extensions/browser_action_drag_data.h
new file mode 100644
index 0000000..ae26cca
--- /dev/null
+++ b/chrome/browser/ui/views/extensions/browser_action_drag_data.h
@@ -0,0 +1,64 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_EXTENSIONS_BROWSER_ACTION_DRAG_DATA_H_
+#define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BROWSER_ACTION_DRAG_DATA_H_
+#pragma once
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "chrome/browser/profile.h"
+
+#if defined(TOOLKIT_VIEWS)
+#include "app/os_exchange_data.h"
+#endif
+
+class BrowserActionButton;
+class FilePath;
+class Pickle;
+class Profile;
+
+class BrowserActionDragData {
+ public:
+ BrowserActionDragData();
+ BrowserActionDragData(const std::string& id, int index);
+
+ const std::string& id() const { return id_; }
+
+ size_t index() const { return index_; }
+
+ // Returns true if this data is from the specified profile.
+ bool IsFromProfile(Profile* profile) const;
+
+#if defined(TOOLKIT_VIEWS)
+ void Write(Profile* profile, OSExchangeData* data) const;
+
+ // Restores this data from the clipboard, returning true on success.
+ bool Read(const OSExchangeData& data);
+
+ // Returns the Custom Format this class supports (for Browser Actions).
+ static OSExchangeData::CustomFormat GetBrowserActionCustomFormat();
+#endif
+
+ private:
+ void WriteToPickle(Profile* profile, Pickle* pickle) const;
+ bool ReadFromPickle(Pickle* pickle);
+
+ // ID of the profile we originated from.
+ ProfileId profile_id_;
+
+ // The id of the view being dragged.
+ std::string id_;
+
+ // The index of the view being dragged.
+ size_t index_;
+
+ // The MIME type for the clipboard format for BrowserActionDragData.
+ static const char* kClipboardFormatString;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserActionDragData);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BROWSER_ACTION_DRAG_DATA_H_
diff --git a/chrome/browser/views/extensions/browser_action_drag_data_unittest.cc b/chrome/browser/ui/views/extensions/browser_action_drag_data_unittest.cc
index 226591f..226591f 100644
--- a/chrome/browser/views/extensions/browser_action_drag_data_unittest.cc
+++ b/chrome/browser/ui/views/extensions/browser_action_drag_data_unittest.cc
diff --git a/chrome/browser/views/extensions/browser_action_overflow_menu_controller.cc b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc
index aa072f6..aa072f6 100644
--- a/chrome/browser/views/extensions/browser_action_overflow_menu_controller.cc
+++ b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc
diff --git a/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h
new file mode 100644
index 0000000..06f8823
--- /dev/null
+++ b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h
@@ -0,0 +1,117 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_EXTENSIONS_BROWSER_ACTION_OVERFLOW_MENU_CONTROLLER_H_
+#define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BROWSER_ACTION_OVERFLOW_MENU_CONTROLLER_H_
+#pragma once
+
+#include <set>
+#include <vector>
+
+#include "base/scoped_ptr.h"
+#include "base/task.h"
+#include "views/controls/menu/menu_delegate.h"
+
+class BrowserActionsContainer;
+class BrowserActionView;
+class ExtensionContextMenuModel;
+
+namespace views {
+class Menu2;
+}
+
+// This class handles the overflow menu for browser actions (showing the menu,
+// drag and drop, etc). This class manages its own lifetime.
+class BrowserActionOverflowMenuController : public views::MenuDelegate {
+ public:
+ // The observer is notified prior to the menu being deleted.
+ class Observer {
+ public:
+ virtual void NotifyMenuDeleted(
+ BrowserActionOverflowMenuController* controller) = 0;
+ };
+
+ BrowserActionOverflowMenuController(
+ BrowserActionsContainer* owner,
+ views::MenuButton* menu_button,
+ const std::vector<BrowserActionView*>& views,
+ int start_index);
+
+ void set_observer(Observer* observer) { observer_ = observer; }
+
+ // Shows the overflow menu.
+ bool RunMenu(gfx::NativeWindow window, bool for_drop);
+
+ // Closes the overflow menu (and its context menu if open as well).
+ void CancelMenu();
+
+ // Overridden from views::MenuDelegate:
+ virtual void ExecuteCommand(int id);
+ virtual bool ShowContextMenu(views::MenuItemView* source,
+ int id,
+ const gfx::Point& p,
+ bool is_mouse_gesture);
+ virtual void DropMenuClosed(views::MenuItemView* menu);
+ // These drag functions offer support for dragging icons into the overflow
+ // menu.
+ virtual bool GetDropFormats(
+ views::MenuItemView* menu,
+ int* formats,
+ std::set<OSExchangeData::CustomFormat>* custom_formats);
+ virtual bool AreDropTypesRequired(views::MenuItemView* menu);
+ virtual bool CanDrop(views::MenuItemView* menu, const OSExchangeData& data);
+ virtual int GetDropOperation(views::MenuItemView* item,
+ const views::DropTargetEvent& event,
+ DropPosition* position);
+ virtual int OnPerformDrop(views::MenuItemView* menu,
+ DropPosition position,
+ const views::DropTargetEvent& event);
+ // These three drag functions offer support for dragging icons out of the
+ // overflow menu.
+ virtual bool CanDrag(views::MenuItemView* menu);
+ virtual void WriteDragData(views::MenuItemView* sender, OSExchangeData* data);
+ virtual int GetDragOperations(views::MenuItemView* sender);
+
+ private:
+ // This class manages its own lifetime.
+ virtual ~BrowserActionOverflowMenuController();
+
+ // Converts a menu item |id| into a BrowserActionView by adding the |id| value
+ // to the number of visible views (according to the container owner). If
+ // |index| is specified, it will point to the absolute index of the view.
+ BrowserActionView* ViewForId(int id, size_t* index);
+
+ // A pointer to the browser action container that owns the overflow menu.
+ BrowserActionsContainer* owner_;
+
+ // The observer, may be null.
+ Observer* observer_;
+
+ // A pointer to the overflow menu button that we are showing the menu for.
+ views::MenuButton* menu_button_;
+
+ // The overflow menu for the menu button.
+ scoped_ptr<views::MenuItemView> menu_;
+
+ // The views vector of all the browser actions the container knows about. We
+ // won't show all items, just the one starting at |start_index| and above.
+ const std::vector<BrowserActionView*>* views_;
+
+ // The index into the BrowserActionView vector, indicating where to start
+ // picking browser actions to draw.
+ int start_index_;
+
+ // Whether this controller is being used for drop.
+ bool for_drop_;
+
+ // The browser action context menu and model.
+ scoped_refptr<ExtensionContextMenuModel> context_menu_contents_;
+ scoped_ptr<views::Menu2> context_menu_menu_;
+
+ friend class DeleteTask<BrowserActionOverflowMenuController>;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserActionOverflowMenuController);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BROWSER_ACTION_OVERFLOW_MENU_CONTROLLER_H_
diff --git a/chrome/browser/views/extensions/extension_install_prompt.cc b/chrome/browser/ui/views/extensions/extension_install_prompt.cc
index 5cf1e7b..5cf1e7b 100644
--- a/chrome/browser/views/extensions/extension_install_prompt.cc
+++ b/chrome/browser/ui/views/extensions/extension_install_prompt.cc
diff --git a/chrome/browser/views/extensions/extension_install_prompt2.cc b/chrome/browser/ui/views/extensions/extension_install_prompt2.cc
index ba9631e..ba9631e 100644
--- a/chrome/browser/views/extensions/extension_install_prompt2.cc
+++ b/chrome/browser/ui/views/extensions/extension_install_prompt2.cc
diff --git a/chrome/browser/views/extensions/extension_installed_bubble.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc
index 8cb9397..8cb9397 100644
--- a/chrome/browser/views/extensions/extension_installed_bubble.cc
+++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc
diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.h b/chrome/browser/ui/views/extensions/extension_installed_bubble.h
new file mode 100644
index 0000000..7ff6d82
--- /dev/null
+++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.h
@@ -0,0 +1,85 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_
+#define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_
+#pragma once
+
+#include "base/ref_counted.h"
+#include "chrome/browser/views/info_bubble.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+
+class Browser;
+class Extension;
+class InstalledBubbleContent;
+class SkBitmap;
+
+// Provides feedback to the user upon successful installation of an
+// extension. Depending on the type of extension, the InfoBubble will
+// point to:
+// BROWSER_ACTION -> The browserAction icon in the toolbar.
+// PAGE_ACTION -> A preview of the pageAction icon in the location
+// bar which is shown while the InfoBubble is shown.
+// GENERIC -> The wrench menu. This case includes pageActions that
+// don't specify a default icon.
+//
+// ExtensionInstallBubble manages its own lifetime.
+class ExtensionInstalledBubble
+ : public InfoBubbleDelegate,
+ public NotificationObserver,
+ public base::RefCountedThreadSafe<ExtensionInstalledBubble> {
+ public:
+ // The behavior and content of this InfoBubble comes in these varieties:
+ enum BubbleType {
+ BROWSER_ACTION,
+ PAGE_ACTION,
+ EXTENSION_APP,
+ 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<ExtensionInstalledBubble>;
+
+ // Private ctor. Registers a listener for EXTENSION_LOADED.
+ ExtensionInstalledBubble(const Extension* extension, Browser *browser,
+ SkBitmap icon);
+
+ ~ExtensionInstalledBubble() {}
+
+ // 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(InfoBubble* info_bubble,
+ bool closed_by_escape);
+ virtual bool CloseOnEscape() { return true; }
+ virtual bool FadeInOnShow() { return true; }
+
+ const Extension* extension_;
+ Browser* browser_;
+ SkBitmap icon_;
+ NotificationRegistrar registrar_;
+ InstalledBubbleContent* bubble_content_;
+ BubbleType type_;
+
+ // How many times we've deferred due to animations being in progress.
+ int animation_wait_retries_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubble);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_
diff --git a/chrome/browser/views/extensions/extension_popup.cc b/chrome/browser/ui/views/extensions/extension_popup.cc
index 0db98f6..0db98f6 100644
--- a/chrome/browser/views/extensions/extension_popup.cc
+++ b/chrome/browser/ui/views/extensions/extension_popup.cc
diff --git a/chrome/browser/ui/views/extensions/extension_popup.h b/chrome/browser/ui/views/extensions/extension_popup.h
new file mode 100644
index 0000000..ab98523
--- /dev/null
+++ b/chrome/browser/ui/views/extensions/extension_popup.h
@@ -0,0 +1,224 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_
+#define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_
+#pragma once
+
+#include "chrome/browser/extensions/extension_host.h"
+#include "chrome/browser/views/browser_bubble.h"
+#include "chrome/browser/views/extensions/extension_view.h"
+#include "chrome/browser/views/bubble_border.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "gfx/native_widget_types.h"
+#include "googleurl/src/gurl.h"
+
+
+class Browser;
+class ExtensionHost;
+class Profile;
+
+namespace views {
+class Widget;
+}
+
+class ExtensionPopup : public BrowserBubble,
+ public BrowserBubble::Delegate,
+ public NotificationObserver,
+ public ExtensionView::Container {
+ public:
+ // Observer to ExtensionPopup events.
+ class Observer {
+ public:
+ // Called when the ExtensionPopup is closing. Note that it
+ // is ref-counted, and thus will be released shortly after
+ // making this delegate call.
+ virtual void ExtensionPopupIsClosing(ExtensionPopup* popup) {}
+
+ // Called after the ExtensionPopup has been closed and deleted.
+ // |popup_token| is the address of the deleted ExtensionPopup.
+ virtual void ExtensionPopupClosed(void* popup_token) {}
+
+ // Called when the ExtensionHost is first created for the pop-up view.
+ // Note that this is invoked BEFORE the ExtensionPopup is created, and can
+ // be used to provide extra configuration of the host before it is pushed
+ // into the popup. An example use is for automation resource routing in
+ // Chrome-Frame. See extension_popup_api.cc.
+ virtual void ExtensionHostCreated(ExtensionHost* host) {}
+
+ // Called when the ExtensionPopup is resized. Note that the popup may have
+ // an empty bounds, if a popup is repositioned before the hosted content
+ // has loaded.
+ virtual void ExtensionPopupResized(ExtensionPopup* popup) {}
+ };
+
+ enum PopupChrome {
+ BUBBLE_CHROME,
+ RECTANGLE_CHROME
+ };
+
+ virtual ~ExtensionPopup();
+
+ // Create and show a popup with |url| positioned adjacent to |relative_to| in
+ // screen coordinates.
+ // |browser| is the browser to which the pop-up will be attached. NULL is a
+ // valid parameter for pop-ups not associated with a browser.
+ // |profile| is the user profile instance associated with the popup. A
+ // non NULL value must be given.
+ // |frame_window| is the native window that hosts the view inside which the
+ // popup will be anchored.
+ // The positioning of the pop-up is determined by |arrow_location| according
+ // to the following logic: The popup is anchored so that the corner indicated
+ // by value of |arrow_location| remains fixed during popup resizes.
+ // If |arrow_location| is BOTTOM_*, then the popup 'pops up', otherwise
+ // the popup 'drops down'.
+ // Pass |activate_on_show| as true to activate the popup window.
+ // Pass |inspect_with_devtools| as true to pin the popup open and show the
+ // devtools window for it.
+ // The |chrome| argument controls the chrome that surrounds the pop-up.
+ // Passing BUBBLE_CHROME will give the pop-up a bubble-like appearance,
+ // including the arrow mentioned above. Passing RECTANGLE_CHROME will give
+ // the popup a rectangular, black border with a drop-shadow with no arrow.
+ // The positioning of the popup is still governed by the arrow-location
+ // parameter.
+ //
+ // The actual display of the popup is delayed until the page contents
+ // finish loading in order to minimize UI flashing and resizing.
+ static ExtensionPopup* Show(const GURL& url, Browser* browser,
+ Profile* profile,
+ gfx::NativeWindow frame_window,
+ const gfx::Rect& relative_to,
+ BubbleBorder::ArrowLocation arrow_location,
+ bool activate_on_show,
+ bool inspect_with_devtools,
+ PopupChrome chrome,
+ Observer* observer);
+
+ // Closes the ExtensionPopup (this will cause the delegate
+ // ExtensionPopupIsClosing and ExtensionPopupClosed to fire.
+ void Close();
+
+ // Some clients wish to do their own custom focus change management. If this
+ // is set to false, then the ExtensionPopup will not do anything in response
+ // to the BubbleLostFocus() calls it gets from the BrowserBubble.
+ void set_close_on_lost_focus(bool close_on_lost_focus) {
+ close_on_lost_focus_ = close_on_lost_focus;
+ }
+
+ ExtensionHost* host() const { return extension_host_.get(); }
+
+ // Assigns the arrow location of the popup view, and updates the popup
+ // border widget, if necessary.
+ void SetArrowPosition(BubbleBorder::ArrowLocation arrow_location);
+ BubbleBorder::ArrowLocation arrow_position() const {
+ return anchor_position_;
+ }
+
+ // Gives the desired bounds (in screen coordinates) given the rect to point
+ // to and the size of the contained contents. Includes all of the
+ // border-chrome surrounding the pop-up as well.
+ gfx::Rect GetOuterBounds() const;
+
+ // BrowserBubble overrides.
+ virtual void Hide();
+ virtual void Show(bool activate);
+ virtual void ResizeToView();
+
+ // BrowserBubble::Delegate methods.
+ virtual void BubbleBrowserWindowMoved(BrowserBubble* bubble);
+ virtual void BubbleBrowserWindowClosing(BrowserBubble* bubble);
+ virtual void BubbleGotFocus(BrowserBubble* bubble);
+ virtual void BubbleLostFocus(BrowserBubble* bubble,
+ bool lost_focus_to_child);
+
+ // NotificationObserver overrides.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // ExtensionView::Container overrides.
+ virtual void OnExtensionMouseMove(ExtensionView* view) { }
+ virtual void OnExtensionMouseLeave(ExtensionView* view) { }
+ virtual void OnExtensionPreferredSizeChanged(ExtensionView* view);
+
+ // Export the refrence-counted interface required for use as template
+ // arguments for RefCounted. ExtensionPopup does not inherit from RefCounted
+ // because it must override the behaviour of Release.
+ void AddRef() { instance_lifetime_->AddRef(); }
+ static bool ImplementsThreadSafeReferenceCounting() {
+ return InternalRefCounter::ImplementsThreadSafeReferenceCounting();
+ }
+
+ // Implements the standard RefCounted<T>::Release behaviour, except
+ // signals Observer::ExtensionPopupClosed after final release.
+ void Release();
+
+ // The min/max height of popups.
+ static const int kMinWidth;
+ static const int kMinHeight;
+ static const int kMaxWidth;
+ static const int kMaxHeight;
+
+ private:
+ ExtensionPopup(ExtensionHost* host,
+ views::Widget* frame,
+ const gfx::Rect& relative_to,
+ BubbleBorder::ArrowLocation arrow_location,
+ bool activate_on_show,
+ bool inspect_with_devtools,
+ PopupChrome chrome,
+ Observer* observer);
+
+ // The area on the screen that the popup should be positioned relative to.
+ gfx::Rect relative_to_;
+
+ // The contained host for the view.
+ scoped_ptr<ExtensionHost> extension_host_;
+
+ // Flag used to indicate if the pop-up should be activated upon first display.
+ bool activate_on_show_;
+
+ // Flag used to indicate if the pop-up should open a devtools window once
+ // it is shown inspecting it.
+ bool inspect_with_devtools_;
+
+ // If false, ignore BrowserBubble::Delegate::BubbleLostFocus() calls.
+ bool close_on_lost_focus_;
+
+ // Whether the ExtensionPopup is current going about closing itself.
+ bool closing_;
+
+ NotificationRegistrar registrar_;
+
+ // A separate widget and associated pieces to draw a border behind the
+ // popup. This has to be a separate window in order to support transparency.
+ // Layered windows can't contain native child windows, so we wouldn't be
+ // able to have the ExtensionView child.
+ views::Widget* border_widget_;
+ BubbleBorder* border_;
+ views::View* border_view_;
+
+ // The type of chrome associated with the popup window.
+ PopupChrome popup_chrome_;
+
+ // The observer of this popup.
+ Observer* observer_;
+
+ // A cached copy of the arrow-position for the bubble chrome.
+ // If a black-border was requested, we still need this value to determine
+ // the position of the pop-up in relation to |relative_to_|.
+ BubbleBorder::ArrowLocation anchor_position_;
+
+ // ExtensionPopup's lifetime is managed via reference counting, but it does
+ // not expose the RefCounted interface. Instead, the lifetime is tied to
+ // this member variable.
+ class InternalRefCounter : public base::RefCounted<InternalRefCounter> {
+ };
+ InternalRefCounter* instance_lifetime_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionPopup);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_
diff --git a/chrome/browser/views/extensions/extension_view.cc b/chrome/browser/ui/views/extensions/extension_view.cc
index fcace1a..fcace1a 100644
--- a/chrome/browser/views/extensions/extension_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_view.cc
diff --git a/chrome/browser/ui/views/extensions/extension_view.h b/chrome/browser/ui/views/extensions/extension_view.h
new file mode 100644
index 0000000..b8cfecd
--- /dev/null
+++ b/chrome/browser/ui/views/extensions/extension_view.h
@@ -0,0 +1,112 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_EXTENSIONS_EXTENSION_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_VIEW_H_
+#pragma once
+
+#include "build/build_config.h"
+
+#include "third_party/skia/include/core/SkBitmap.h"
+#include "views/controls/native/native_view_host.h"
+
+class Browser;
+class Extension;
+class ExtensionHost;
+class ExtensionView;
+class RenderViewHost;
+
+// This handles the display portion of an ExtensionHost.
+class ExtensionView : public views::NativeViewHost {
+ public:
+ ExtensionView(ExtensionHost* host, Browser* browser);
+ ~ExtensionView();
+
+ // A class that represents the container that this view is in.
+ // (bottom shelf, side bar, etc.)
+ class Container {
+ public:
+ virtual ~Container() {}
+ // Mouse event notifications from the view. (useful for hover UI).
+ virtual void OnExtensionMouseMove(ExtensionView* view) = 0;
+ virtual void OnExtensionMouseLeave(ExtensionView* view) = 0;
+ virtual void OnExtensionPreferredSizeChanged(ExtensionView* view) {}
+ };
+
+ ExtensionHost* host() const { return host_; }
+ Browser* browser() const { return browser_; }
+ const Extension* extension() const;
+ RenderViewHost* render_view_host() const;
+ void DidStopLoading();
+ void SetIsClipped(bool is_clipped);
+
+ // Notification from ExtensionHost.
+ void UpdatePreferredSize(const gfx::Size& new_size);
+ void HandleMouseMove();
+ void HandleMouseLeave();
+
+ // Method for the ExtensionHost to notify us when the RenderViewHost has a
+ // connection.
+ void RenderViewCreated();
+
+ // Set a custom background for the view. The background will be tiled.
+ void SetBackground(const SkBitmap& background);
+
+ // Sets the container for this view.
+ void SetContainer(Container* container) { container_ = container; }
+
+ // Overridden from views::NativeViewHost:
+ virtual void SetVisible(bool is_visible);
+ virtual void DidChangeBounds(const gfx::Rect& previous,
+ const gfx::Rect& current);
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View *parent, views::View *child);
+
+ protected:
+ // Overridden from views::View.
+ virtual void PreferredSizeChanged();
+ virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e);
+
+ private:
+ friend class ExtensionHost;
+
+ // Initializes the RenderWidgetHostView for this object.
+ void CreateWidgetHostView();
+
+ // We wait to show the ExtensionView until several things have loaded.
+ void ShowIfCompletelyLoaded();
+
+ // Restore object to initial state. Called on shutdown or after a renderer
+ // crash.
+ void CleanUp();
+
+ // The running extension instance that we're displaying.
+ // Note that host_ owns view
+ ExtensionHost* host_;
+
+ // The browser window that this view is in.
+ Browser* browser_;
+
+ // True if we've been initialized.
+ bool initialized_;
+
+ // 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_;
+
+ // What we should set the preferred width to once the ExtensionView has
+ // loaded.
+ gfx::Size pending_preferred_size_;
+
+ // The container this view is in (not necessarily its direct superview).
+ // Note: the view does not own its container.
+ Container* container_;
+
+ // Whether this extension view is clipped.
+ bool is_clipped_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_VIEW_H_
diff --git a/chrome/browser/views/external_protocol_dialog.cc b/chrome/browser/ui/views/external_protocol_dialog.cc
index 5b6d975..5b6d975 100644
--- a/chrome/browser/views/external_protocol_dialog.cc
+++ b/chrome/browser/ui/views/external_protocol_dialog.cc
diff --git a/chrome/browser/ui/views/external_protocol_dialog.h b/chrome/browser/ui/views/external_protocol_dialog.h
new file mode 100644
index 0000000..da90fe5
--- /dev/null
+++ b/chrome/browser/ui/views/external_protocol_dialog.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_EXTERNAL_PROTOCOL_DIALOG_H_
+#define CHROME_BROWSER_UI_VIEWS_EXTERNAL_PROTOCOL_DIALOG_H_
+#pragma once
+
+#include "base/time.h"
+#include "googleurl/src/gurl.h"
+#include "views/window/dialog_delegate.h"
+
+class MessageBoxView;
+class TabContents;
+
+class ExternalProtocolDialog : public views::DialogDelegate {
+ public:
+ // RunExternalProtocolDialog calls this private constructor.
+ ExternalProtocolDialog(TabContents* tab_contents,
+ const GURL& url,
+ const std::wstring& command);
+
+ // Returns the path of the application to be launched given the protocol
+ // of the requested url. Returns an empty string on failure.
+ static std::wstring GetApplicationForProtocol(const GURL& url);
+
+ virtual ~ExternalProtocolDialog();
+
+ // views::DialogDelegate Methods:
+ virtual int GetDefaultDialogButton() const;
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual void DeleteDelegate();
+ virtual bool Cancel();
+ virtual bool Accept();
+ virtual views::View* GetContentsView();
+
+ // views::WindowDelegate Methods:
+ virtual bool IsAlwaysOnTop() const { return false; }
+ virtual bool IsModal() const { return false; }
+
+ private:
+ // The message box view whose commands we handle.
+ MessageBoxView* message_box_view_;
+
+ // The associated TabContents.
+ TabContents* tab_contents_;
+
+ // URL of the external protocol request.
+ GURL url_;
+
+ // The time at which this dialog was created.
+ base::TimeTicks creation_time_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExternalProtocolDialog);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_EXTERNAL_PROTOCOL_DIALOG_H_
diff --git a/chrome/browser/views/find_bar_host.cc b/chrome/browser/ui/views/find_bar_host.cc
index 3926e70..3926e70 100644
--- a/chrome/browser/views/find_bar_host.cc
+++ b/chrome/browser/ui/views/find_bar_host.cc
diff --git a/chrome/browser/ui/views/find_bar_host.h b/chrome/browser/ui/views/find_bar_host.h
new file mode 100644
index 0000000..cc52c87
--- /dev/null
+++ b/chrome/browser/ui/views/find_bar_host.h
@@ -0,0 +1,130 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_FIND_BAR_HOST_H_
+#define CHROME_BROWSER_UI_VIEWS_FIND_BAR_HOST_H_
+#pragma once
+
+#include "chrome/browser/find_bar.h"
+#include "chrome/browser/renderer_host/render_view_host_delegate.h"
+#include "chrome/browser/views/dropdown_bar_host.h"
+#include "gfx/native_widget_types.h"
+#include "gfx/rect.h"
+#include "views/controls/textfield/textfield.h"
+
+class BrowserView;
+class FindBarController;
+class FindBarView;
+class FindNotificationDetails;
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// The FindBarHost implements the container widget for the
+// find-in-page functionality. It uses the appropriate implementation from
+// find_bar_host_win.cc or find_bar_host_gtk.cc to draw its content and is
+// responsible for showing, hiding, closing, and moving the widget if needed,
+// for example if the widget is obscuring the selection results. It also
+// receives notifications about the search results and communicates that to
+// the view.
+//
+// There is one FindBarHost per BrowserView, and its state is updated
+// whenever the selected Tab is changed. The FindBarHost is created when
+// the BrowserView is attached to the frame's Widget for the first time.
+//
+////////////////////////////////////////////////////////////////////////////////
+class FindBarHost : public DropdownBarHost,
+ public FindBar,
+ public FindBarTesting {
+ public:
+ explicit FindBarHost(BrowserView* browser_view);
+ virtual ~FindBarHost();
+
+ // Forwards selected keystrokes to the renderer. This is useful to make sure
+ // that arrow keys and PageUp and PageDown result in scrolling, instead of
+ // being eaten because the FindBar has focus. Returns true if the keystroke
+ // was forwarded, false if not.
+ bool MaybeForwardKeystrokeToWebpage(
+ const views::Textfield::Keystroke& key_stroke);
+
+ // FindBar implementation:
+ 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();
+
+ // Overridden from views::AcceleratorTarget in DropdownBarHost class:
+ virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
+
+ // FindBarTesting implementation:
+ virtual bool GetFindBarWindowInfo(gfx::Point* position,
+ bool* fully_visible);
+ virtual string16 GetFindText();
+
+ // Overridden from DropdownBarHost:
+ // Returns the rectangle representing where to position the find bar. It uses
+ // GetDialogBounds and positions itself within that, either to the left (if an
+ // InfoBar is present) or to the right (no InfoBar). 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.
+ virtual gfx::Rect GetDialogPosition(gfx::Rect avoid_overlapping_rect);
+ // Moves the dialog window to the provided location, moves it to top in the
+ // z-order (HWND_TOP, not HWND_TOPMOST) and shows the window (if hidden).
+ // It then calls UpdateWindowEdges to make sure we don't overwrite the Chrome
+ // window border. If |no_redraw| is set, the window is getting moved but not
+ // sized, and should not be redrawn to reduce update flicker.
+ virtual void SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw);
+
+ // Retrieves the boundaries that the find bar widget has to work with
+ // within the Chrome frame window. The resulting rectangle will be a
+ // rectangle that overlaps the bottom of the Chrome toolbar by one
+ // pixel (so we can create the illusion that the dropdown widget is
+ // part of the toolbar) and covers the page area, except that we
+ // deflate the rect width by subtracting (from both sides) the width
+ // of the toolbar and some extra pixels to account for the width of
+ // the Chrome window borders. |bounds| is relative to the browser
+ // window. If the function fails to determine the browser
+ // window/client area rectangle or the rectangle for the page area
+ // then |bounds| will be an empty rectangle.
+ virtual void GetWidgetBounds(gfx::Rect* bounds);
+
+ // Additional accelerator handling (on top of what DropDownBarHost does).
+ virtual void RegisterAccelerators();
+ virtual void UnregisterAccelerators();
+
+ private:
+ // Allows implementation to tweak widget position.
+ void GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect);
+
+ // Allows native implementation to prevent keystrokes from being forwarded.
+ bool ShouldForwardKeystrokeToWebpageNative(
+ const views::Textfield::Keystroke& key_stroke);
+
+ // Returns the FindBarView.
+ FindBarView* find_bar_view();
+
+ // A pointer back to the owning controller.
+ FindBarController* find_bar_controller_;
+
+ DISALLOW_COPY_AND_ASSIGN(FindBarHost);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_HOST_H_
diff --git a/chrome/browser/views/find_bar_host_gtk.cc b/chrome/browser/ui/views/find_bar_host_gtk.cc
index d9f8986..d9f8986 100644
--- a/chrome/browser/views/find_bar_host_gtk.cc
+++ b/chrome/browser/ui/views/find_bar_host_gtk.cc
diff --git a/chrome/browser/views/find_bar_host_interactive_uitest.cc b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc
index 12537fb..12537fb 100644
--- a/chrome/browser/views/find_bar_host_interactive_uitest.cc
+++ b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc
diff --git a/chrome/browser/views/find_bar_host_uitest.cc b/chrome/browser/ui/views/find_bar_host_uitest.cc
index 8dd6dbb..8dd6dbb 100644
--- a/chrome/browser/views/find_bar_host_uitest.cc
+++ b/chrome/browser/ui/views/find_bar_host_uitest.cc
diff --git a/chrome/browser/views/find_bar_host_win.cc b/chrome/browser/ui/views/find_bar_host_win.cc
index e1e5a50..e1e5a50 100644
--- a/chrome/browser/views/find_bar_host_win.cc
+++ b/chrome/browser/ui/views/find_bar_host_win.cc
diff --git a/chrome/browser/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc
index 7132553..7132553 100644
--- a/chrome/browser/views/find_bar_view.cc
+++ b/chrome/browser/ui/views/find_bar_view.cc
diff --git a/chrome/browser/ui/views/find_bar_view.h b/chrome/browser/ui/views/find_bar_view.h
new file mode 100644
index 0000000..a7a5e7f
--- /dev/null
+++ b/chrome/browser/ui/views/find_bar_view.h
@@ -0,0 +1,126 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_FIND_BAR_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_
+#pragma once
+
+#include "base/string16.h"
+#include "chrome/browser/find_notification_details.h"
+#include "chrome/browser/views/dropdown_bar_view.h"
+#include "gfx/size.h"
+#include "views/controls/button/button.h"
+#include "views/controls/textfield/textfield.h"
+
+class FindBarHost;
+
+namespace views {
+class ImageButton;
+class Label;
+class MouseEvent;
+class View;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// The FindBarView is responsible for drawing the UI controls of the
+// FindBar, the find text box, the 'Find' button and the 'Close'
+// button. It communicates the user search words to the FindBarHost.
+//
+////////////////////////////////////////////////////////////////////////////////
+class FindBarView : public DropdownBarView,
+ public views::ButtonListener,
+ public views::Textfield::Controller {
+ public:
+ // A tag denoting which button the user pressed.
+ enum ButtonTag {
+ FIND_PREVIOUS_TAG = 0, // The Find Previous button.
+ FIND_NEXT_TAG, // The Find Next button.
+ CLOSE_TAG, // The Close button (the 'X').
+ };
+
+ explicit FindBarView(FindBarHost* host);
+ virtual ~FindBarView();
+
+ // Gets/sets the text displayed in the text box.
+ string16 GetFindText() const;
+ void SetFindText(const string16& find_text);
+
+ // Updates the label inside the Find text box that shows the ordinal of the
+ // active item and how many matches were found.
+ void UpdateForResult(const FindNotificationDetails& result,
+ const string16& find_text);
+
+ // Claims focus for the text field and selects its contents.
+ virtual void SetFocusAndSelection(bool select_all);
+
+ // Overridden from views::View:
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual void Layout();
+ virtual gfx::Size GetPreferredSize();
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Overridden from views::Textfield::Controller:
+ virtual void ContentsChanged(views::Textfield* sender,
+ const string16& new_contents);
+ virtual bool HandleKeystroke(views::Textfield* sender,
+ const views::Textfield::Keystroke& key);
+
+ private:
+ // Update the appearance for the match count label.
+ void UpdateMatchCountAppearance(bool no_match);
+
+ // Overridden from views::View.
+ virtual void OnThemeChanged();
+
+ // We use a hidden view to grab mouse clicks and bring focus to the find
+ // text box. This is because although the find text box may look like it
+ // extends all the way to the find button, it only goes as far as to the
+ // match_count label. The user, however, expects being able to click anywhere
+ // inside what looks like the find text box (including on or around the
+ // match_count label) and have focus brought to the find box.
+ class FocusForwarderView : public views::View {
+ public:
+ explicit FocusForwarderView(
+ views::Textfield* view_to_focus_on_mousedown)
+ : view_to_focus_on_mousedown_(view_to_focus_on_mousedown) {}
+
+ private:
+ virtual bool OnMousePressed(const views::MouseEvent& event);
+
+ views::Textfield* view_to_focus_on_mousedown_;
+
+ DISALLOW_COPY_AND_ASSIGN(FocusForwarderView);
+ };
+
+ // Returns the OS-specific view for the find bar that acts as an intermediary
+ // between us and the TabContentsView.
+ FindBarHost* find_bar_host() const;
+
+#if defined(OS_LINUX)
+ // In gtk we get changed signals if we programatically set the text. If we
+ // don't ignore them we run into problems. For example, switching tabs back
+ // to one with the find bar visible will cause a search to the next found
+ // text. Also if the find bar had been visible and then hidden and the user
+ // switches back, found text will be highlighted again.
+ bool ignore_contents_changed_;
+#endif
+
+ // The controls in the window.
+ views::Textfield* find_text_;
+ views::Label* match_count_text_;
+ FocusForwarderView* focus_forwarder_view_;
+ views::ImageButton* find_previous_button_;
+ views::ImageButton* find_next_button_;
+ views::ImageButton* close_button_;
+
+ DISALLOW_COPY_AND_ASSIGN(FindBarView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_
diff --git a/chrome/browser/views/first_run_bubble.cc b/chrome/browser/ui/views/first_run_bubble.cc
index fae2cfa..fae2cfa 100644
--- a/chrome/browser/views/first_run_bubble.cc
+++ b/chrome/browser/ui/views/first_run_bubble.cc
diff --git a/chrome/browser/ui/views/first_run_bubble.h b/chrome/browser/ui/views/first_run_bubble.h
new file mode 100644
index 0000000..2829218
--- /dev/null
+++ b/chrome/browser/ui/views/first_run_bubble.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_FIRST_RUN_BUBBLE_H_
+#define CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_H_
+#pragma once
+
+#include "base/compiler_specific.h"
+#include "base/task.h"
+#include "chrome/browser/first_run/first_run.h"
+#include "chrome/browser/views/info_bubble.h"
+
+class FirstRunBubbleViewBase;
+class Profile;
+
+class FirstRunBubble : public InfoBubble,
+ public InfoBubbleDelegate {
+ public:
+ static FirstRunBubble* Show(Profile* profile, views::Widget* parent,
+ const gfx::Rect& position_relative_to,
+ BubbleBorder::ArrowLocation arrow_location,
+ FirstRun::BubbleType bubble_type);
+
+ private:
+ FirstRunBubble();
+ virtual ~FirstRunBubble();
+
+ void set_view(FirstRunBubbleViewBase* view) { view_ = view; }
+
+ // Re-enable the parent window.
+ void EnableParent();
+
+#if defined(OS_WIN)
+ // Overridden from InfoBubble:
+ virtual void OnActivate(UINT action, BOOL minimized, HWND window);
+#endif
+
+ // InfoBubbleDelegate.
+ virtual void InfoBubbleClosing(InfoBubble* info_bubble,
+ bool closed_by_escape);
+ virtual bool CloseOnEscape() { return true; }
+ virtual bool FadeInOnShow() { return true; }
+
+ // Whether we have already been activated.
+ bool has_been_activated_;
+
+ ScopedRunnableMethodFactory<FirstRunBubble> enable_window_method_factory_;
+
+ // The view inside the FirstRunBubble.
+ FirstRunBubbleViewBase* view_;
+
+ DISALLOW_COPY_AND_ASSIGN(FirstRunBubble);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_H_
diff --git a/chrome/browser/views/first_run_search_engine_view.cc b/chrome/browser/ui/views/first_run_search_engine_view.cc
index 6688d9e..6688d9e 100644
--- a/chrome/browser/views/first_run_search_engine_view.cc
+++ b/chrome/browser/ui/views/first_run_search_engine_view.cc
diff --git a/chrome/browser/ui/views/first_run_search_engine_view.h b/chrome/browser/ui/views/first_run_search_engine_view.h
new file mode 100644
index 0000000..e901f1e
--- /dev/null
+++ b/chrome/browser/ui/views/first_run_search_engine_view.h
@@ -0,0 +1,144 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_
+#pragma once
+
+#include <vector>
+
+#include "chrome/browser/search_engines/template_url_model_observer.h"
+#include "gfx/size.h"
+#include "views/controls/button/native_button.h"
+#include "views/view.h"
+#include "views/window/window_delegate.h"
+
+namespace views {
+class ButtonListener;
+class ImageView;
+class Label;
+class Separator;
+class Window;
+}
+
+class Profile;
+class TemplateURL;
+class TemplateURLModel;
+
+// This class holds the logo and TemplateURL for a search engine and serves
+// as its button in the search engine selection view.
+class SearchEngineChoice : public views::NativeButton {
+ public:
+ // |listener| is the FirstRunView that waits for the search engine selection
+ // to complete; |search_engine| holds the data for the particular search
+ // engine this button represents; |use_small_logos| is true if we're
+ // displaying more than three choices.
+ SearchEngineChoice(views::ButtonListener* listener,
+ const TemplateURL* search_engine,
+ bool use_small_logos);
+
+ virtual ~SearchEngineChoice() {}
+
+ // These methods return data about the logo or text view associated
+ // with this search engine choice.
+ views::View* GetView() { return choice_view_; }
+ int GetChoiceViewWidth();
+ int GetChoiceViewHeight();
+
+ // Set the bounds for the search engine choice view; called in the
+ // Layout method, when we know what the new bounds should be.
+ void SetChoiceViewBounds(int x, int y, int width, int height);
+
+ // Accessor for the search engine data this button represents.
+ const TemplateURL* GetSearchEngine() { return search_engine_; }
+
+ // Used for UX testing.
+ void set_slot(int slot) { slot_ = slot; }
+ int slot() const { return slot_; }
+
+ private:
+ // Either an ImageView of a logo, or a Label with text. Owned by
+ // FirstRunSearchEngineView.
+ views::View* choice_view_;
+
+ // True if choice_view_ is holding an ImageView.
+ bool is_image_label_;
+
+ // Data for the search engine held here.
+ const TemplateURL* search_engine_;
+
+ // Used for UX testing. Gives slot in which search engine was shown.
+ int slot_;
+
+ DISALLOW_COPY_AND_ASSIGN(SearchEngineChoice);
+};
+
+// This class displays a large search engine choice dialog view during
+// initial first run import.
+class FirstRunSearchEngineView
+ : public views::View,
+ public views::ButtonListener,
+ public views::WindowDelegate,
+ public TemplateURLModelObserver {
+ public:
+ // |profile| allows us to get the set of imported search engines.
+ // |randomize| is true if logos are to be displayed in random order.
+ FirstRunSearchEngineView(Profile* profile, bool randomize);
+
+ virtual ~FirstRunSearchEngineView();
+
+ // Overridden from views::View:
+ virtual gfx::Size GetPreferredSize();
+ virtual void Layout();
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+
+ // Overridden from views::WindowDelegate:
+ virtual std::wstring GetWindowTitle() const;
+ views::View* GetContentsView() { return this; }
+ bool CanResize() const { return false; }
+ bool CanMaximize() const { return false; }
+ bool IsAlwaysOnTop() const { return true; }
+ bool HasAlwaysOnTopMenu() const { return false; }
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Override from View so we can draw the gray background at dialog top.
+ virtual void Paint(gfx::Canvas* canvas);
+
+ // Overridden from TemplateURLModelObserver. When the search engines have
+ // loaded from the profile, we can populate the logos in the dialog box
+ // to present to the user.
+ virtual void OnTemplateURLModelChanged();
+
+ private:
+ // Initializes the labels and controls in the view.
+ void SetupControls();
+
+ // Owned by the profile_.
+ TemplateURLModel* search_engines_model_;
+
+ // One for each search engine choice offered, either three or four.
+ std::vector<SearchEngineChoice*> search_engine_choices_;
+
+ // If logos are to be displayed in random order. Used for UX testing.
+ bool randomize_;
+
+ // The profile associated with this import process.
+ Profile* profile_;
+
+ bool text_direction_is_rtl_;
+
+ // Image of browser search box with grey background and bubble arrow.
+ views::ImageView* background_image_;
+
+ // UI elements:
+ views::Label* title_label_;
+ views::Label* text_label_;
+
+ DISALLOW_COPY_AND_ASSIGN(FirstRunSearchEngineView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_
+
diff --git a/chrome/browser/views/frame/app_panel_browser_frame_view.cc b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc
index d7efbe9..d7efbe9 100644
--- a/chrome/browser/views/frame/app_panel_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc
diff --git a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.h b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.h
new file mode 100644
index 0000000..1f6deec
--- /dev/null
+++ b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.h
@@ -0,0 +1,130 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_FRAME_APP_PANEL_BROWSER_FRAME_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_FRAME_APP_PANEL_BROWSER_FRAME_VIEW_H_
+#pragma once
+
+#include "chrome/browser/views/frame/browser_frame.h"
+#include "chrome/browser/views/frame/browser_non_client_frame_view.h"
+#include "chrome/browser/views/tab_icon_view.h"
+#include "views/controls/button/button.h"
+#include "views/window/non_client_view.h"
+
+class BaseTabStrip;
+class BrowserView;
+class TabContents;
+namespace gfx {
+class Font;
+}
+namespace views {
+class ImageButton;
+class ImageView;
+}
+// The frame view which is used for Application Panels.
+// TODO(rafaelw): Refactor. This shares much duplicated code with
+// OpaqueBrowserFrameView.
+class AppPanelBrowserFrameView : public BrowserNonClientFrameView,
+ public views::ButtonListener,
+ public TabIconView::TabIconViewModel {
+ public:
+ // Constructs a non-client view for an BrowserFrame.
+ AppPanelBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view);
+ virtual ~AppPanelBrowserFrameView();
+
+ // Overridden from BrowserNonClientFrameView:
+ virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const;
+ virtual int GetHorizontalTabStripVerticalOffset(bool restored) const;
+ virtual void UpdateThrobber(bool running);
+ virtual gfx::Size GetMinimumSize();
+
+ protected:
+ // Overridden from views::NonClientFrameView:
+ virtual gfx::Rect GetBoundsForClientView() const;
+ virtual bool AlwaysUseCustomFrame() const;
+ virtual bool AlwaysUseNativeFrame() const;
+ virtual gfx::Rect GetWindowBoundsForClientBounds(
+ const gfx::Rect& client_bounds) const;
+ virtual int NonClientHitTest(const gfx::Point& point);
+ virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask);
+ virtual void EnableClose(bool enable);
+ virtual void ResetWindowControls();
+
+ // Overridden from views::View:
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual void Layout();
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Overridden from TabIconView::TabIconViewModel:
+ virtual bool ShouldTabIconViewAnimate() const;
+ virtual SkBitmap GetFavIconForTabIconView();
+
+ private:
+ // Returns the thickness of the border that makes up the window frame edges.
+ // This does not include any client edge.
+ int FrameBorderThickness() const;
+
+ // Returns the thickness of the entire nonclient left, right, and bottom
+ // borders, including both the window frame and any client edge.
+ int NonClientBorderThickness() const;
+
+ // Returns the height of the entire nonclient top border, including the window
+ // frame, any title area, and any connected client edge.
+ int NonClientTopBorderHeight() const;
+
+ // Returns the thickness of the nonclient portion of the 3D edge along the
+ // bottom of the titlebar.
+ int TitlebarBottomThickness() const;
+
+ // Returns the size of the titlebar icon.
+ int IconSize() const;
+
+ // Returns the bounds of the titlebar icon.
+ gfx::Rect IconBounds() const;
+
+ // Paint various sub-components of this view. The *FrameBorder() function
+ // also paints the background of the titlebar area, since the top frame border
+ // and titlebar background are a contiguous component.
+ void PaintRestoredFrameBorder(gfx::Canvas* canvas);
+ void PaintMaximizedFrameBorder(gfx::Canvas* canvas);
+ void PaintTitleBar(gfx::Canvas* canvas);
+ void PaintRestoredClientEdge(gfx::Canvas* canvas);
+
+ // Layout various sub-components of this view.
+ void LayoutWindowControls();
+ void LayoutTitleBar();
+
+ // Returns the bounds of the client area for the specified view size.
+ gfx::Rect CalculateClientAreaBounds(int width, int height) const;
+
+ // The layout rect of the title, if visible.
+ gfx::Rect title_bounds_;
+
+ // Window controls.
+ views::ImageButton* close_button_;
+
+ // The Window icon.
+ TabIconView* window_icon_;
+
+ // The frame that hosts this view.
+ BrowserFrame* frame_;
+
+ // The BrowserView hosted within this View.
+ BrowserView* browser_view_;
+
+ // The bounds of the ClientView.
+ gfx::Rect client_view_bounds_;
+
+ // The accessible name of this view.
+ std::wstring accessible_name_;
+
+ static void InitAppWindowResources();
+ static gfx::Font* title_font_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppPanelBrowserFrameView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FRAME_APP_PANEL_BROWSER_FRAME_VIEW_H_
diff --git a/chrome/browser/views/frame/browser_bubble_host.cc b/chrome/browser/ui/views/frame/browser_bubble_host.cc
index 60809bf..60809bf 100644
--- a/chrome/browser/views/frame/browser_bubble_host.cc
+++ b/chrome/browser/ui/views/frame/browser_bubble_host.cc
diff --git a/chrome/browser/ui/views/frame/browser_bubble_host.h b/chrome/browser/ui/views/frame/browser_bubble_host.h
new file mode 100644
index 0000000..990f39e
--- /dev/null
+++ b/chrome/browser/ui/views/frame/browser_bubble_host.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_FRAME_BROWSER_BUBBLE_HOST_H_
+#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_BUBBLE_HOST_H_
+#pragma once
+
+#include <set>
+
+#include "base/basictypes.h"
+
+class BrowserBubble;
+
+// A class providing a hosting environment for BrowserBubble instances.
+// Allows for notification to attached BrowserBubbles of browser move, and
+// close events.
+class BrowserBubbleHost {
+ public:
+ BrowserBubbleHost() {}
+
+ // Invoked when the window containing the attached browser-bubbles is moved.
+ // Calls BrowserBubble::BrowserWindowMoved on all attached bubbles.
+ void WindowMoved();
+
+ // To be called when the frame containing the BrowserBubbleHost is closing.
+ // Calls BrowserBubble::BrowserWindowClosing on all attached bubbles.
+ void Close();
+
+ // Registers/Unregisters |bubble| to receive notifications when the host moves
+ // or is closed.
+ void AttachBrowserBubble(BrowserBubble* bubble);
+ void DetachBrowserBubble(BrowserBubble* bubble);
+
+ private:
+ // The set of bubbles associated with this host.
+ typedef std::set<BrowserBubble*> BubbleSet;
+ BubbleSet browser_bubbles_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserBubbleHost);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_BUBBLE_HOST_H_
diff --git a/chrome/browser/ui/views/frame/browser_frame.h b/chrome/browser/ui/views/frame/browser_frame.h
new file mode 100644
index 0000000..9a1a523
--- /dev/null
+++ b/chrome/browser/ui/views/frame/browser_frame.h
@@ -0,0 +1,80 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_FRAME_BROWSER_FRAME_H_
+#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_H_
+#pragma once
+
+#include "build/build_config.h"
+#include "views/window/non_client_view.h"
+
+class BaseTabStrip;
+class BrowserView;
+class Profile;
+class ThemeProvider;
+
+namespace gfx {
+class Font;
+class Rect;
+} // namespace gfx
+
+namespace views {
+class Window;
+
+#if defined(OS_WIN)
+class WindowWin;
+#endif
+} // namespace views
+
+// This is a virtual interface that allows system specific browser frames.
+class BrowserFrame {
+ public:
+ virtual ~BrowserFrame() {}
+
+ // Creates the appropriate BrowserFrame for this platform. The returned
+ // object is owned by the caller.
+ static BrowserFrame* Create(BrowserView* browser_view, Profile* profile);
+
+ static const gfx::Font& GetTitleFont();
+
+ // Returns the Window associated with this frame. Guraranteed non-NULL after
+ // construction.
+ virtual views::Window* GetWindow() = 0;
+
+ // Determine the distance of the left edge of the minimize button from the
+ // left edge of the window. Used in our Non-Client View's Layout.
+ virtual int GetMinimizeButtonOffset() const = 0;
+
+ // Retrieves the bounds, in non-client view coordinates for the specified
+ // TabStrip.
+ virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const = 0;
+
+ // Returns the y coordinate within the window at which the horizontal TabStrip
+ // begins (or would begin). If |restored| is true, this is calculated as if
+ // we were in restored mode regardless of the current mode.
+ virtual int GetHorizontalTabStripVerticalOffset(bool restored) const = 0;
+
+ // Tells the frame to update the throbber.
+ virtual void UpdateThrobber(bool running) = 0;
+
+ // Tells the frame to continue a drag detached tab operation.
+ virtual void ContinueDraggingDetachedTab() = 0;
+
+ // Returns the theme provider for this frame.
+ virtual ThemeProvider* GetThemeProviderForFrame() const = 0;
+
+ // Returns true if the window should use the native frame view. This is true
+ // if there are no themes applied on Vista, or if there are themes applied and
+ // this browser window is an app or popup.
+ virtual bool AlwaysUseNativeFrame() const = 0;
+
+ // Returns the NonClientFrameView of this frame.
+ virtual views::View* GetFrameView() const = 0;
+
+ // Notifies the frame that the tab strip display mode changed so it can update
+ // its frame treatment if necessary.
+ virtual void TabStripDisplayModeChanged() = 0;
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_H_
diff --git a/chrome/browser/views/frame/browser_frame_gtk.cc b/chrome/browser/ui/views/frame/browser_frame_gtk.cc
index 83a6acb..83a6acb 100644
--- a/chrome/browser/views/frame/browser_frame_gtk.cc
+++ b/chrome/browser/ui/views/frame/browser_frame_gtk.cc
diff --git a/chrome/browser/ui/views/frame/browser_frame_gtk.h b/chrome/browser/ui/views/frame/browser_frame_gtk.h
new file mode 100644
index 0000000..77d346c8
--- /dev/null
+++ b/chrome/browser/ui/views/frame/browser_frame_gtk.h
@@ -0,0 +1,85 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_FRAME_BROWSER_FRAME_GTK_H_
+#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_GTK_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "chrome/browser/views/frame/browser_frame.h"
+#include "views/window/window_gtk.h"
+
+class BrowserNonClientFrameView;
+class BrowserRootView;
+
+class BrowserFrameGtk : public BrowserFrame,
+ public views::WindowGtk {
+ public:
+ // Normally you will create this class by calling BrowserFrame::Create.
+ // Init must be called before using this class, which Create will do for you.
+ BrowserFrameGtk(BrowserView* browser_view, Profile* profile);
+ virtual ~BrowserFrameGtk();
+
+ // Creates a frame view and initializes the window. This
+ // initialization function must be called after construction, it is
+ // separate to avoid recursive calling of the frame from its
+ // constructor.
+ virtual void Init();
+
+ // Overridden from BrowserFrame:
+ virtual views::Window* GetWindow();
+ virtual int GetMinimizeButtonOffset() const;
+ virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const;
+ virtual int GetHorizontalTabStripVerticalOffset(bool restored) const;
+ virtual void UpdateThrobber(bool running);
+ virtual void ContinueDraggingDetachedTab();
+ virtual ThemeProvider* GetThemeProviderForFrame() const;
+ virtual bool AlwaysUseNativeFrame() const;
+ virtual views::View* GetFrameView() const;
+ virtual void TabStripDisplayModeChanged();
+
+ // Overridden from views::Widget:
+ virtual ThemeProvider* GetThemeProvider() const;
+ virtual ThemeProvider* GetDefaultThemeProvider() const;
+ virtual void IsActiveChanged();
+ virtual void SetInitialFocus();
+
+ protected:
+ void set_browser_frame_view(BrowserNonClientFrameView* browser_frame_view) {
+ browser_frame_view_ = browser_frame_view;
+ }
+
+ // Overridden from views::WidgetGtk:
+ virtual views::RootView* CreateRootView();
+ virtual bool GetAccelerator(int cmd_id, menus::Accelerator* accelerator);
+
+ // Overriden from views::WindowGtk:
+ virtual gboolean OnWindowStateEvent(GtkWidget* widget,
+ GdkEventWindowState* event);
+ virtual gboolean OnConfigureEvent(GtkWidget* widget,
+ GdkEventConfigure* event);
+
+ protected:
+ BrowserView* browser_view() const {
+ return browser_view_;
+ }
+
+ private:
+ // The BrowserView is our ClientView. This is a pointer to it.
+ BrowserView* browser_view_;
+
+ // A pointer to our NonClientFrameView as a BrowserNonClientFrameView.
+ BrowserNonClientFrameView* browser_frame_view_;
+
+ // An unowning reference to the root view associated with the window. We save
+ // a copy as a BrowserRootView to avoid evil casting later, when we need to
+ // call functions that only exist on BrowserRootView (versus RootView).
+ BrowserRootView* root_view_;
+
+ Profile* profile_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserFrameGtk);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_GTK_H_
diff --git a/chrome/browser/views/frame/browser_frame_win.cc b/chrome/browser/ui/views/frame/browser_frame_win.cc
index bd5ddca..bd5ddca 100644
--- a/chrome/browser/views/frame/browser_frame_win.cc
+++ b/chrome/browser/ui/views/frame/browser_frame_win.cc
diff --git a/chrome/browser/ui/views/frame/browser_frame_win.h b/chrome/browser/ui/views/frame/browser_frame_win.h
new file mode 100644
index 0000000..2c1d7b79
--- /dev/null
+++ b/chrome/browser/ui/views/frame/browser_frame_win.h
@@ -0,0 +1,101 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_FRAME_BROWSER_FRAME_WIN_H_
+#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_WIN_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "chrome/browser/views/frame/browser_frame.h"
+#include "views/window/window_win.h"
+
+class AeroGlassNonClientView;
+class BrowserNonClientFrameView;
+class BrowserRootView;
+class BrowserView;
+class NonClientFrameView;
+class Profile;
+
+///////////////////////////////////////////////////////////////////////////////
+// BrowserFrameWin
+//
+// BrowserFrame is a WindowWin subclass that provides the window frame for the
+// Chrome browser window.
+//
+class BrowserFrameWin : public BrowserFrame, public views::WindowWin {
+ public:
+ // Normally you will create this class by calling BrowserFrame::Create.
+ // Init must be called before using this class, which Create will do for you.
+ BrowserFrameWin(BrowserView* browser_view, Profile* profile);
+ virtual ~BrowserFrameWin();
+
+ // This initialization function must be called after construction, it is
+ // separate to avoid recursive calling of the frame from its constructor.
+ void Init();
+
+ BrowserView* browser_view() const { return browser_view_; }
+
+ // BrowserFrame implementation.
+ virtual views::Window* GetWindow();
+ virtual int GetMinimizeButtonOffset() const;
+ virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const;
+ virtual int GetHorizontalTabStripVerticalOffset(bool restored) const;
+ virtual void UpdateThrobber(bool running);
+ virtual void ContinueDraggingDetachedTab();
+ virtual ThemeProvider* GetThemeProviderForFrame() const;
+ virtual bool AlwaysUseNativeFrame() const;
+ virtual views::View* GetFrameView() const;
+ virtual void TabStripDisplayModeChanged();
+
+ protected:
+ // Overridden from views::WindowWin:
+ virtual gfx::Insets GetClientAreaInsets() const;
+ virtual bool GetAccelerator(int cmd_id, menus::Accelerator* accelerator);
+ virtual void OnEndSession(BOOL ending, UINT logoff);
+ virtual void OnEnterSizeMove();
+ virtual void OnExitSizeMove();
+ virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu);
+ virtual LRESULT OnMouseActivate(HWND window,
+ UINT hittest_code,
+ UINT message);
+ virtual void OnMove(const CPoint& point);
+ virtual void OnMoving(UINT param, LPRECT new_bounds);
+ virtual LRESULT OnNCActivate(BOOL active);
+ virtual LRESULT OnNCHitTest(const CPoint& pt);
+ virtual void OnWindowPosChanged(WINDOWPOS* window_pos);
+ virtual ThemeProvider* GetThemeProvider() const;
+ virtual ThemeProvider* GetDefaultThemeProvider() const;
+ virtual void OnScreenReaderDetected();
+
+ // Overridden from views::Window:
+ virtual int GetShowState() const;
+ virtual void Activate();
+ virtual bool IsAppWindow() const { return true; }
+ virtual views::NonClientFrameView* CreateFrameViewForWindow();
+ virtual void UpdateFrameAfterFrameChange();
+ virtual views::RootView* CreateRootView();
+
+ private:
+ // Updates the DWM with the frame bounds.
+ void UpdateDWMFrame();
+
+ // The BrowserView is our ClientView. This is a pointer to it.
+ BrowserView* browser_view_;
+
+ // A pointer to our NonClientFrameView as a BrowserNonClientFrameView.
+ BrowserNonClientFrameView* browser_frame_view_;
+
+ // An unowning reference to the root view associated with the window. We save
+ // a copy as a BrowserRootView to avoid evil casting later, when we need to
+ // call functions that only exist on BrowserRootView (versus RootView).
+ BrowserRootView* root_view_;
+
+ bool frame_initialized_;
+
+ Profile* profile_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserFrameWin);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_WIN_H_
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view.h b/chrome/browser/ui/views/frame/browser_non_client_frame_view.h
new file mode 100644
index 0000000..2fec304
--- /dev/null
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_
+#pragma once
+
+#include "views/window/non_client_view.h"
+
+class BaseTabStrip;
+
+// A specialization of the NonClientFrameView object that provides additional
+// Browser-specific methods.
+class BrowserNonClientFrameView : public views::NonClientFrameView {
+ public:
+ BrowserNonClientFrameView() : NonClientFrameView() {}
+ virtual ~BrowserNonClientFrameView() {}
+
+ // Returns the bounds within which the TabStrip should be laid out.
+ virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const = 0;
+
+ // Returns the y coordinate within the window at which the horizontal TabStrip
+ // begins, or (in vertical tabs mode) would begin. If |restored| is true,
+ // this is calculated as if we were in restored mode regardless of the current
+ // mode. This is used to correctly align theme images.
+ virtual int GetHorizontalTabStripVerticalOffset(bool restored) const = 0;
+
+ // Updates the throbber.
+ virtual void UpdateThrobber(bool running) = 0;
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_
diff --git a/chrome/browser/views/frame/browser_root_view.cc b/chrome/browser/ui/views/frame/browser_root_view.cc
index e423603..e423603 100644
--- a/chrome/browser/views/frame/browser_root_view.cc
+++ b/chrome/browser/ui/views/frame/browser_root_view.cc
diff --git a/chrome/browser/ui/views/frame/browser_root_view.h b/chrome/browser/ui/views/frame/browser_root_view.h
new file mode 100644
index 0000000..f821619
--- /dev/null
+++ b/chrome/browser/ui/views/frame/browser_root_view.h
@@ -0,0 +1,63 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_FRAME_BROWSER_ROOT_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_ROOT_VIEW_H_
+#pragma once
+
+#include "views/widget/root_view.h"
+
+class BrowserView;
+class OSExchangeData;
+class BaseTabStrip;
+
+// RootView implementation used by BrowserFrame. This forwards drop events to
+// the TabStrip. Visually the tabstrip extends to the top of the frame, but in
+// actually it doesn't. The tabstrip is only as high as a tab. To enable
+// dropping above the tabstrip BrowserRootView forwards drop events to the
+// TabStrip.
+class BrowserRootView : public views::RootView {
+ public:
+ // You must call set_tabstrip before this class will accept drops.
+ BrowserRootView(BrowserView* browser_view, views::Widget* widget);
+
+ virtual bool GetDropFormats(
+ int* formats,
+ std::set<OSExchangeData::CustomFormat>* custom_formats);
+ virtual bool AreDropTypesRequired();
+ virtual bool CanDrop(const OSExchangeData& data);
+ virtual void OnDragEntered(const views::DropTargetEvent& event);
+ virtual int OnDragUpdated(const views::DropTargetEvent& event);
+ virtual void OnDragExited();
+ virtual int OnPerformDrop(const views::DropTargetEvent& event);
+
+ private:
+ // Returns true if the event should be forwarded to the tabstrip.
+ bool ShouldForwardToTabStrip(const views::DropTargetEvent& event);
+
+ // Converts the event from the hosts coordinate system to the tabstrips
+ // coordinate system.
+ views::DropTargetEvent* MapEventToTabStrip(
+ const views::DropTargetEvent& event,
+ const OSExchangeData& data);
+
+ inline BaseTabStrip* tabstrip() const;
+
+ // Returns true if |data| has string contents and the user can "paste and go".
+ // If |url| is non-NULL and the user can "paste and go", |url| is set to the
+ // desired destination.
+ bool GetPasteAndGoURL(const OSExchangeData& data, GURL* url);
+
+ // The BrowserView.
+ BrowserView* browser_view_;
+
+ // If true, drag and drop events are being forwarded to the tab strip.
+ // This is used to determine when to send OnDragEntered and OnDragExited
+ // to the tab strip.
+ bool forwarding_to_tab_strip_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserRootView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_ROOT_VIEW_H_
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 949b73b..949b73b 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h
new file mode 100644
index 0000000..8a443bb
--- /dev/null
+++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -0,0 +1,654 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_FRAME_BROWSER_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
+#pragma once
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include "app/menus/simple_menu_model.h"
+#include "base/scoped_ptr.h"
+#include "base/timer.h"
+#include "build/build_config.h"
+#include "chrome/browser/browser.h"
+#include "chrome/browser/browser_window.h"
+#include "chrome/browser/tabs/tab_strip_model_observer.h"
+#include "chrome/browser/views/frame/browser_bubble_host.h"
+#include "chrome/browser/views/frame/browser_frame.h"
+#include "chrome/browser/views/infobars/infobar_container.h"
+#include "chrome/browser/views/tabs/tab_strip.h"
+#include "chrome/browser/views/tabs/base_tab_strip.h"
+#include "chrome/browser/views/unhandled_keyboard_event_handler.h"
+#include "chrome/common/notification_registrar.h"
+#include "gfx/native_widget_types.h"
+#include "views/window/client_view.h"
+#include "views/window/window_delegate.h"
+
+#if defined(OS_WIN)
+#include "chrome/browser/hang_monitor/hung_plugin_action.h"
+#include "chrome/browser/hang_monitor/hung_window_detector.h"
+#include "views/controls/menu/native_menu_win.h"
+#endif
+
+// NOTE: For more information about the objects and files in this directory,
+// view: http://dev.chromium.org/developers/design-documents/browser-window
+
+class AccessiblePaneView;
+class AccessibleViewHelper;
+class BookmarkBarView;
+class Browser;
+class BrowserBubble;
+class BrowserViewLayout;
+class ContentsContainer;
+class DownloadShelfView;
+class EncodingMenuModel;
+class FullscreenExitBubble;
+class HtmlDialogUIDelegate;
+class InfoBarContainer;
+class LocationBarView;
+class SideTabStrip;
+class StatusBubbleViews;
+class TabContentsContainer;
+class TabStripModel;
+class ToolbarView;
+class ZoomMenuModel;
+
+#if defined(OS_WIN)
+class AeroPeekManager;
+class JumpList;
+#endif
+
+namespace views {
+class ExternalFocusTracker;
+class Menu;
+class SingleSplitView;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// BrowserView
+//
+// A ClientView subclass that provides the contents of a browser window,
+// including the TabStrip, toolbars, download shelves, the content area etc.
+//
+class BrowserView : public BrowserBubbleHost,
+ public BrowserWindow,
+ public BrowserWindowTesting,
+ public NotificationObserver,
+ public TabStripModelObserver,
+ public menus::SimpleMenuModel::Delegate,
+ public views::WindowDelegate,
+ public views::ClientView,
+ public InfoBarContainer::Delegate {
+ public:
+ // The browser view's class name.
+ static const char kViewClassName[];
+
+ // Explicitly sets how windows are shown. Use a value of -1 to give the
+ // default behavior. This is used during testing and not generally useful
+ // otherwise.
+ static void SetShowState(int state);
+
+ explicit BrowserView(Browser* browser);
+ virtual ~BrowserView();
+
+ void set_frame(BrowserFrame* frame) { frame_ = frame; }
+ BrowserFrame* frame() const { return frame_; }
+
+ // Returns a pointer to the BrowserView* interface implementation (an
+ // instance of this object, typically) for a given native window, or NULL if
+ // there is no such association.
+ static BrowserView* GetBrowserViewForNativeWindow(gfx::NativeWindow window);
+
+ // Returns a Browser instance of this view.
+ Browser* browser() const { return browser_.get(); }
+
+ // Returns the show flag that should be used to show the frame containing
+ // this view.
+ int GetShowState() const;
+
+ // Called by the frame to notify the BrowserView that it was moved, and that
+ // any dependent popup windows should be repositioned.
+ void WindowMoved();
+
+ // Called by the frame to notify the BrowserView that a move or resize was
+ // initiated.
+ void WindowMoveOrResizeStarted();
+
+ // Returns the apparent bounds of the toolbar, in BrowserView coordinates.
+ // These differ from |toolbar_.bounds()| in that they match where the toolbar
+ // background image is drawn -- slightly outside the "true" bounds
+ // horizontally, and, when using vertical tabs, behind the tab column.
+ gfx::Rect GetToolbarBounds() const;
+
+ // Returns the bounds of the content area, in the coordinates of the
+ // BrowserView's parent.
+ gfx::Rect GetClientAreaBounds() const;
+
+ // Returns the constraining bounding box that should be used to lay out the
+ // FindBar within. This is _not_ the size of the find bar, just the bounding
+ // box it should be laid out within. The coordinate system of the returned
+ // rect is in the coordinate system of the frame, since the FindBar is a child
+ // window.
+ gfx::Rect GetFindBarBoundingBox() const;
+
+ // Returns the preferred height of the TabStrip. Used to position the OTR
+ // avatar icon.
+ int GetTabStripHeight() const;
+
+ // Takes some view's origin (relative to this BrowserView) and offsets it such
+ // that it can be used as the source origin for seamlessly tiling the toolbar
+ // background image over that view.
+ gfx::Point OffsetPointForToolbarBackgroundImage(
+ const gfx::Point& point) const;
+
+ // Returns the width of the currently displayed sidebar or 0.
+ int GetSidebarWidth() const;
+
+ // Accessor for the TabStrip.
+ BaseTabStrip* tabstrip() const { return tabstrip_; }
+
+ // Accessor for the Toolbar.
+ ToolbarView* toolbar() const { return toolbar_; }
+
+ // Returns true if various window components are visible.
+ bool IsTabStripVisible() const;
+
+ // Returns true if the vertical tabstrip is in use.
+ bool UseVerticalTabs() const;
+
+ // Returns true if the profile associated with this Browser window is
+ // off the record.
+ bool IsOffTheRecord() const;
+
+ // Returns true if the non-client view should render the Off-The-Record
+ // avatar icon if the window is off the record.
+ bool ShouldShowOffTheRecordAvatar() const;
+
+ // Handle the specified |accelerator| being pressed.
+ bool AcceleratorPressed(const views::Accelerator& accelerator);
+
+ // Provides the containing frame with the accelerator for the specified
+ // command id. This can be used to provide menu item shortcut hints etc.
+ // Returns true if an accelerator was found for the specified |cmd_id|, false
+ // otherwise.
+ bool GetAccelerator(int cmd_id, menus::Accelerator* accelerator);
+
+ // Shows the next app-modal dialog box, if there is one to be shown, or moves
+ // an existing showing one to the front. Returns true if one was shown or
+ // activated, false if none was shown.
+ bool ActivateAppModalDialog() const;
+
+ // Returns the selected TabContents. Used by our NonClientView's
+ // TabIconView::TabContentsProvider implementations.
+ // TODO(beng): exposing this here is a bit bogus, since it's only used to
+ // determine loading state. It'd be nicer if we could change this to be
+ // bool IsSelectedTabLoading() const; or something like that. We could even
+ // move it to a WindowDelegate subclass.
+ TabContents* GetSelectedTabContents() const;
+
+ // Retrieves the icon to use in the frame to indicate an OTR window.
+ SkBitmap GetOTRAvatarIcon();
+
+#if defined(OS_WIN)
+ // Called right before displaying the system menu to allow the BrowserView
+ // to add or delete entries.
+ void PrepareToRunSystemMenu(HMENU menu);
+#endif
+
+ // Returns true if the Browser object associated with this BrowserView is a
+ // normal-type window (i.e. a browser window, not an app or popup).
+ bool IsBrowserTypeNormal() const {
+ return browser_->type() == Browser::TYPE_NORMAL;
+ }
+
+ // Returns true if the Browser object associated with this BrowserView is a
+ // app panel window.
+ bool IsBrowserTypePanel() const {
+ return browser_->type() == Browser::TYPE_APP_PANEL;
+ }
+
+ // Returns true if the Browser object associated with this BrowserView is a
+ // popup window.
+ bool IsBrowserTypePopup() const {
+ return (browser_->type() & Browser::TYPE_POPUP) != 0;
+ }
+
+ // Register preferences specific to this view.
+ static void RegisterBrowserViewPrefs(PrefService* prefs);
+
+ // Returns true if the specified point(BrowserView coordinates) is in
+ // in the window caption area of the browser window.
+ bool IsPositionInWindowCaption(const gfx::Point& point);
+
+ // Returns whether the fullscreen bubble is visible or not.
+ bool IsFullscreenBubbleVisible() const;
+
+ // Invoked from the frame when the full screen state changes. This is only
+ // used on Linux.
+ void FullScreenStateChanged();
+
+ // Restores the focused view. This is also used to set the initial focus
+ // when a new browser window is created.
+ void RestoreFocus();
+
+ // Called when the activation of the frame changes.
+ virtual void ActivationChanged(bool activated);
+
+ // 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 LocationBar* GetLocationBar() const;
+ virtual void SetFocusToLocationBar(bool select_all);
+ virtual void UpdateReloadStopState(bool is_loading, bool force);
+ virtual void UpdateToolbar(TabContents* contents, bool should_restore_state);
+ virtual void FocusToolbar();
+ virtual void FocusAppMenu();
+ virtual void FocusBookmarksToolbar();
+ virtual void FocusChromeOSStatus() {}
+ virtual void RotatePaneFocus(bool forwards);
+ virtual void DestroyBrowser();
+ virtual bool IsBookmarkBarVisible() const;
+ virtual bool IsBookmarkBarAnimating() const;
+ virtual bool IsToolbarVisible() const;
+ virtual gfx::Rect GetRootWindowResizerRect() const;
+ virtual void DisableInactiveFrame();
+ virtual void ConfirmSetDefaultSearchProvider(
+ TabContents* tab_contents,
+ TemplateURL* template_url,
+ TemplateURLModel* template_url_model);
+ 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 void SetDownloadShelfVisible(bool visible);
+ virtual bool IsDownloadShelfVisible() const;
+ virtual DownloadShelf* GetDownloadShelf();
+ virtual void ShowReportBugDialog();
+ 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 ContinueDraggingDetachedTab(const gfx::Rect& tab_bounds);
+ virtual void UserChangedTheme();
+ virtual int GetExtraRenderViewHeight() const;
+ virtual void TabContentsFocused(TabContents* source);
+ 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 ShowCreateShortcutsDialog(TabContents* tab_contents);
+ virtual void Cut();
+ virtual void Copy();
+ virtual void Paste();
+ virtual void ToggleTabStripMode();
+ virtual void ShowInstant(TabContents* preview_contents);
+ virtual void HideInstant();
+ virtual gfx::Rect GetInstantBounds();
+
+ // Overridden from BrowserWindowTesting:
+ virtual BookmarkBarView* GetBookmarkBarView() const;
+ virtual LocationBarView* GetLocationBarView() const;
+ virtual views::View* GetTabContentsContainerView() const;
+ virtual views::View* GetSidebarContainerView() const;
+ virtual ToolbarView* GetToolbarView() const;
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Overridden from TabStripModelObserver:
+ virtual void TabDetachedAt(TabContents* contents, int index);
+ virtual void TabDeselectedAt(TabContents* contents, int index);
+ virtual void TabSelectedAt(TabContents* old_contents,
+ TabContents* new_contents,
+ int index,
+ bool user_gesture);
+ virtual void TabReplacedAt(TabContents* old_contents,
+ TabContents* new_contents,
+ int index);
+ virtual void TabStripEmpty();
+
+ // Overridden from menus::SimpleMenuModel::Delegate:
+ virtual bool IsCommandIdChecked(int command_id) const;
+ virtual bool IsCommandIdEnabled(int command_id) const;
+ virtual bool GetAcceleratorForCommandId(int command_id,
+ menus::Accelerator* accelerator);
+ virtual bool IsLabelForCommandIdDynamic(int command_id) const;
+ virtual string16 GetLabelForCommandId(int command_id) const;
+ virtual void ExecuteCommand(int command_id);
+
+ // Overridden from views::WindowDelegate:
+ virtual bool CanResize() const;
+ virtual bool CanMaximize() const;
+ virtual bool IsModal() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual std::wstring GetAccessibleWindowTitle() const;
+ virtual views::View* GetInitiallyFocusedView();
+ virtual bool ShouldShowWindowTitle() const;
+ virtual SkBitmap GetWindowAppIcon();
+ virtual SkBitmap GetWindowIcon();
+ virtual bool ShouldShowWindowIcon() const;
+ virtual bool ExecuteWindowsCommand(int command_id);
+ virtual std::wstring GetWindowName() const;
+ virtual void SaveWindowPlacement(const gfx::Rect& bounds,
+ bool maximized);
+ virtual bool GetSavedWindowBounds(gfx::Rect* bounds) const;
+ virtual bool GetSavedMaximizedState(bool* maximized) const;
+ virtual views::View* GetContentsView();
+ virtual views::ClientView* CreateClientView(views::Window* window);
+
+ // Overridden from views::ClientView:
+ virtual bool CanClose() const;
+ virtual int NonClientHitTest(const gfx::Point& point);
+ virtual gfx::Size GetMinimumSize();
+
+ // InfoBarContainer::Delegate overrides
+ virtual void InfoBarSizeChanged(bool is_animating);
+
+ protected:
+ // Appends to |toolbars| a pointer to each AccessiblePaneView that
+ // can be traversed using F6, in the order they should be traversed.
+ // Abstracted here so that it can be extended for Chrome OS.
+ virtual void GetAccessiblePanes(
+ std::vector<AccessiblePaneView*>* panes);
+
+ // Save the current focused view to view storage
+ void SaveFocusedView();
+
+ int last_focused_view_storage_id() const {
+ return last_focused_view_storage_id_;
+ }
+
+ // Overridden from views::View:
+ virtual std::string GetClassName() const;
+ virtual void Layout();
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+ virtual void ChildPreferredSizeChanged(View* child);
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+
+ // Factory Methods.
+ // Returns a new LayoutManager for this browser view. A subclass may
+ // override to implemnet different layout pocily.
+ virtual views::LayoutManager* CreateLayoutManager() const;
+
+ // Initializes a new TabStrip for the browser view. This can be performed
+ // multiple times over the life of the browser, and is run when the display
+ // mode for the tabstrip changes from horizontal to vertical.
+ virtual void InitTabStrip(TabStripModel* tab_strip_model);
+
+ // Browser window related initializations.
+ virtual void Init();
+
+ private:
+ friend class BrowserViewLayout;
+
+#if defined(OS_WIN)
+ // Creates the system menu.
+ void InitSystemMenu();
+#endif
+
+ // Returns the BrowserViewLayout.
+ BrowserViewLayout* GetBrowserViewLayout() const;
+
+ // Layout the Status Bubble.
+ void LayoutStatusBubble();
+
+ // Prepare to show the Bookmark Bar for the specified TabContents. Returns
+ // true if the Bookmark Bar can be shown (i.e. it's supported for this
+ // Browser type) and there should be a subsequent re-layout to show it.
+ // |contents| can be NULL.
+ bool MaybeShowBookmarkBar(TabContents* contents);
+
+ // Prepare to show an Info Bar for the specified TabContents. Returns true
+ // if there is an Info Bar to show and one is supported for this Browser
+ // type, and there should be a subsequent re-layout to show it.
+ // |contents| can be NULL.
+ bool MaybeShowInfoBar(TabContents* contents);
+
+ // Updates sidebar UI according to the current tab and sidebar state.
+ void UpdateSidebar();
+ // Displays active sidebar linked to the |tab_contents| or hides sidebar UI,
+ // if there's no such sidebar.
+ void UpdateSidebarForContents(TabContents* tab_contents);
+
+ // Updated devtools window for given contents.
+ void UpdateDevToolsForContents(TabContents* tab_contents);
+
+ // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the
+ // Download Shelf in response to a change notification from the specified
+ // |contents|. |contents| can be NULL. In this case, all optional UI will be
+ // removed.
+ void UpdateUIForContents(TabContents* contents);
+
+ // Updates an optional child View, e.g. Bookmarks Bar, Info Bar, Download
+ // Shelf. If |*old_view| differs from new_view, the old_view is removed and
+ // the new_view is added. This is intended to be used when swapping in/out
+ // child views that are referenced via a field.
+ // Returns true if anything was changed, and a re-Layout is now required.
+ bool UpdateChildViewAndLayout(views::View* new_view, views::View** old_view);
+
+ // Invoked to update the necessary things when our fullscreen state changes
+ // to |fullscreen|. On Windows this is invoked immediately when we toggle the
+ // full screen state. On Linux changing the fullscreen state is async, so we
+ // ask the window to change it's fullscreen state, then when we get
+ // notification that it succeeded this method is invoked.
+ void ProcessFullscreen(bool fullscreen);
+
+ // Copy the accelerator table from the app resources into something we can
+ // use.
+ void LoadAccelerators();
+
+#if defined(OS_WIN)
+ // Builds the correct menu for when we have minimal chrome.
+ void BuildSystemMenuForBrowserWindow();
+ void BuildSystemMenuForAppOrPopupWindow(bool is_app);
+#endif
+
+ // Retrieves the command id for the specified Windows app command.
+ int GetCommandIDForAppCommandID(int app_command_id) const;
+
+ // Callback for the loading animation(s) associated with this view.
+ void LoadingAnimationCallback();
+
+ // Initialize the hung plugin detector.
+ void InitHangMonitor();
+
+ // Invoked from TabSelectedAt or when instant is made active. Is
+ // |change_tab_contents| is true, |new_contents| is added to the view
+ // hierarchy, if |change_tab_contents| is false, it's assumed |new_contents|
+ // has already been added to the view hierarchy.
+ void ProcessTabSelected(TabContents* new_contents, bool change_tab_contents);
+
+ // Last focused view that issued a tab traversal.
+ int last_focused_view_storage_id_;
+
+ // The BrowserFrame that hosts this view.
+ BrowserFrame* frame_;
+
+ // The Browser object we are associated with.
+ scoped_ptr<Browser> browser_;
+
+ // BrowserView layout (LTR one is pictured here).
+ //
+ // --------------------------------------------------------------------------
+ // | | Tabs (1) |
+ // | |--------------------------------------------------------------|
+ // | | Navigation buttons, menus and the address bar (toolbar_) |
+ // | |--------------------------------------------------------------|
+ // | | All infobars (infobar_container_) * |
+ // | |--------------------------------------------------------------|
+ // | | Bookmarks (bookmark_bar_view_) * |
+ // | |--------------------------------------------------------------|
+ // | |Page content (contents_) || |
+ // | |--------------------------------------|| Sidebar content |
+ // | || contents_container_ and/or ||| (sidebar_container_) |
+ // | || preview_container_ ||| |
+ // | || |(3) |
+ // | Tabs (2)|| ||| |
+ // | || ||| |
+ // | || ||| |
+ // | || ||| |
+ // | |--------------------------------------|| |
+ // | |==(4)=========================================================|
+ // | | |
+ // | | |
+ // | | Debugger (devtools_container_) |
+ // | | |
+ // | | |
+ // | |--------------------------------------------------------------|
+ // | | Active downloads (download_shelf_) |
+ // --------------------------------------------------------------------------
+ //
+ // (1) - tabstrip_, default position
+ // (2) - tabstrip_, position when side tabs are enabled
+ // (3) - sidebar_split_
+ // (4) - contents_split_
+ //
+ // * - The bookmark bar and info bar are swapped when on the new tab page.
+ // Additionally contents_ is positioned on top of the bookmark bar when
+ // the bookmark bar is detached. This is done to allow the
+ // preview_container_ to appear over the bookmark bar.
+
+ // Tool/Info bars that we are currently showing. Used for layout.
+ // active_bookmark_bar_ is either NULL, if the bookmark bar isn't showing,
+ // or is bookmark_bar_view_ if the bookmark bar is showing.
+ views::View* active_bookmark_bar_;
+
+ // The TabStrip.
+ BaseTabStrip* tabstrip_;
+
+ // The Toolbar containing the navigation buttons, menus and the address bar.
+ ToolbarView* toolbar_;
+
+ // The Bookmark Bar View for this window. Lazily created.
+ scoped_ptr<BookmarkBarView> bookmark_bar_view_;
+
+ // The download shelf view (view at the bottom of the page).
+ scoped_ptr<DownloadShelfView> download_shelf_;
+
+ // The InfoBarContainer that contains InfoBars for the current tab.
+ InfoBarContainer* infobar_container_;
+
+ // The view that contains sidebar for the current tab.
+ TabContentsContainer* sidebar_container_;
+
+ // Split view containing the contents container and sidebar container.
+ views::SingleSplitView* sidebar_split_;
+
+ // The view that contains the selected TabContents.
+ TabContentsContainer* contents_container_;
+
+ // The view that contains devtools window for the selected TabContents.
+ TabContentsContainer* devtools_container_;
+
+ // The view that contains instant's TabContents.
+ TabContentsContainer* preview_container_;
+
+ // The view managing both the contents_container_ and preview_container_.
+ ContentsContainer* contents_;
+
+ // Split view containing the contents container and devtools container.
+ views::SingleSplitView* contents_split_;
+
+ // Tracks and stores the last focused view which is not the
+ // devtools_container_ or any of its children. Used to restore focus once
+ // the devtools_container_ is hidden.
+ scoped_ptr<views::ExternalFocusTracker> devtools_focus_tracker_;
+
+ // The Status information bubble that appears at the bottom of the window.
+ scoped_ptr<StatusBubbleViews> status_bubble_;
+
+ // A mapping between accelerators and commands.
+ std::map<views::Accelerator, int> accelerator_table_;
+
+ // True if we have already been initialized.
+ bool initialized_;
+
+ // True if we should ignore requests to layout. This is set while toggling
+ // fullscreen mode on and off to reduce jankiness.
+ bool ignore_layout_;
+
+ scoped_ptr<FullscreenExitBubble> fullscreen_bubble_;
+
+#if defined(OS_WIN)
+ // The additional items we insert into the system menu.
+ scoped_ptr<views::SystemMenuModel> system_menu_contents_;
+ scoped_ptr<ZoomMenuModel> zoom_menu_contents_;
+ scoped_ptr<EncodingMenuModel> encoding_menu_contents_;
+ // The wrapped system menu itself.
+ scoped_ptr<views::NativeMenuWin> system_menu_;
+
+ // This object is used to perform periodic actions in a worker
+ // thread. It is currently used to monitor hung plugin windows.
+ WorkerThreadTicker ticker_;
+
+ // This object is initialized with the frame window HWND. This
+ // object is also passed as a tick handler with the ticker_ object.
+ // It is used to periodically monitor for hung plugin windows
+ HungWindowDetector hung_window_detector_;
+
+ // This object is invoked by hung_window_detector_ when it detects a hung
+ // plugin window.
+ HungPluginAction hung_plugin_action_;
+
+ // The custom JumpList for Windows 7.
+ scoped_ptr<JumpList> jumplist_;
+
+ // The custom AeroPeek manager for Windows 7.
+ scoped_ptr<AeroPeekManager> aeropeek_manager_;
+#endif
+
+ // The timer used to update frames for the Loading Animation.
+ base::RepeatingTimer<BrowserView> loading_animation_timer_;
+
+ UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
+
+ scoped_ptr<AccessibleViewHelper> accessible_view_helper_;
+
+ NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
diff --git a/chrome/browser/views/frame/browser_view_layout.cc b/chrome/browser/ui/views/frame/browser_view_layout.cc
index 5b7dc66..5b7dc66 100644
--- a/chrome/browser/views/frame/browser_view_layout.cc
+++ b/chrome/browser/ui/views/frame/browser_view_layout.cc
diff --git a/chrome/browser/ui/views/frame/browser_view_layout.h b/chrome/browser/ui/views/frame/browser_view_layout.h
new file mode 100644
index 0000000..279803c
--- /dev/null
+++ b/chrome/browser/ui/views/frame/browser_view_layout.h
@@ -0,0 +1,112 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_
+#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_
+#pragma once
+
+#include "views/layout_manager.h"
+
+class BaseTabStrip;
+class BookmarkBarView;
+class Browser;
+class BrowserView;
+class ContentsContainer;
+class DownloadShelfView;
+class ToolbarView;
+
+// The layout manager used in chrome browser.
+class BrowserViewLayout : public views::LayoutManager {
+ public:
+ BrowserViewLayout();
+ virtual ~BrowserViewLayout() {}
+
+ // Returns the minimum size of the browser view.
+ virtual gfx::Size GetMinimumSize();
+
+ // Returns the bounding box for the find bar.
+ virtual gfx::Rect GetFindBarBoundingBox() const;
+
+ // Returns true if the specified point(BrowserView coordinates) is in
+ // in the window caption area of the browser window.
+ virtual bool IsPositionInWindowCaption(const gfx::Point& point);
+
+ // Tests to see if the specified |point| (in nonclient view's coordinates)
+ // is within the views managed by the laymanager. Returns one of
+ // HitTestCompat enum defined in views/window/hit_test.h.
+ // See also ClientView::NonClientHitTest.
+ virtual int NonClientHitTest(const gfx::Point& point);
+
+ // views::LayoutManager overrides:
+ virtual void Installed(views::View* host);
+ virtual void Uninstalled(views::View* host);
+ virtual void ViewAdded(views::View* host, views::View* view);
+ virtual void ViewRemoved(views::View* host, views::View* view);
+ virtual void Layout(views::View* host);
+ virtual gfx::Size GetPreferredSize(views::View* host);
+
+ protected:
+ Browser* browser();
+ const Browser* browser() const;
+
+ // Layout the TabStrip, returns the coordinate of the bottom of the TabStrip,
+ // for laying out subsequent controls.
+ virtual int LayoutTabStrip();
+
+ // Layout the following controls, starting at |top|, returns the coordinate
+ // of the bottom of the control, for laying out the next control.
+ virtual int LayoutToolbar(int top);
+ int LayoutBookmarkAndInfoBars(int top);
+ int LayoutBookmarkBar(int top);
+ int LayoutInfoBar(int top);
+
+ // Layout the TabContents container, between the coordinates |top| and
+ // |bottom|.
+ void LayoutTabContents(int top, int bottom);
+
+ // Returns the top margin to adjust the contents_container_ by. This is used
+ // to make the bookmark bar and contents_container_ overlap so that the
+ // preview contents hides the bookmark bar.
+ int GetTopMarginForActiveContent();
+
+ // Layout the Download Shelf, returns the coordinate of the top of the
+ // control, for laying out the previous control.
+ int LayoutDownloadShelf(int bottom);
+
+ // Returns true if an infobar is showing.
+ bool InfobarVisible() const;
+
+ // See description above vertical_layout_rect_ for details.
+ void set_vertical_layout_rect(const gfx::Rect& bounds) {
+ vertical_layout_rect_ = bounds;
+ }
+ const gfx::Rect& vertical_layout_rect() const {
+ return vertical_layout_rect_;
+ }
+
+ // Child views that the layout manager manages.
+ BaseTabStrip* tabstrip_;
+ ToolbarView* toolbar_;
+ views::View* contents_split_;
+ ContentsContainer* contents_container_;
+ views::View* infobar_container_;
+ DownloadShelfView* download_shelf_;
+ BookmarkBarView* active_bookmark_bar_;
+
+ BrowserView* browser_view_;
+
+ // The bounds within which the vertically-stacked contents of the BrowserView
+ // should be laid out within. When the SideTabstrip is not visible, this is
+ // just the local bounds of the BrowserView, otherwise it's the local bounds
+ // of the BrowserView less the width of the SideTabstrip.
+ gfx::Rect vertical_layout_rect_;
+
+ // The distance the FindBar is from the top of the window, in pixels.
+ int find_bar_y_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_
+
diff --git a/chrome/browser/views/frame/contents_container.cc b/chrome/browser/ui/views/frame/contents_container.cc
index fd80e3b..fd80e3b 100644
--- a/chrome/browser/views/frame/contents_container.cc
+++ b/chrome/browser/ui/views/frame/contents_container.cc
diff --git a/chrome/browser/ui/views/frame/contents_container.h b/chrome/browser/ui/views/frame/contents_container.h
new file mode 100644
index 0000000..2e00fa7
--- /dev/null
+++ b/chrome/browser/ui/views/frame/contents_container.h
@@ -0,0 +1,86 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_FRAME_CONTENTS_CONTAINER_H_
+#define CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_
+#pragma once
+
+#include "views/view.h"
+
+class BrowserView;
+class TabContents;
+
+namespace views {
+class Widget;
+}
+
+// ContentsContainer is responsible for managing the TabContents views.
+// ContentsContainer has up to two children: one for the currently active
+// TabContents and one for instant's TabContents.
+class ContentsContainer : public views::View {
+ public:
+ ContentsContainer(BrowserView* browser_view, views::View* active);
+ virtual ~ContentsContainer();
+
+ // Makes the preview view the active view and nulls out the old active view.
+ // It's assumed the caller will delete or remove the old active view
+ // separately.
+ void MakePreviewContentsActiveContents();
+
+ // Sets the preview view. This does not delete the old.
+ void SetPreview(views::View* preview, TabContents* preview_tab_contents);
+
+ TabContents* preview_tab_contents() const { return preview_tab_contents_; }
+
+ // Sets the active top margin.
+ void SetActiveTopMargin(int margin);
+
+ // Returns the bounds of the preview. If the preview isn't active this
+ // retuns the bounds the preview would be shown at.
+ gfx::Rect GetPreviewBounds();
+
+ // View overrides:
+ virtual void Layout();
+
+ private:
+#if defined(OS_WIN)
+ class TearWindow;
+#else
+ typedef views::Widget TearWindow;
+#endif
+
+ // Creates and configures the tear window.
+ void CreateTearWindow();
+
+ // Creates and returns a new TearWindow.
+ TearWindow* CreateTearWindowImpl();
+
+ // Resets the bounds of the tear window.
+ void PositionTearWindow();
+
+ // Closes and deletes the tear window.
+ void DeleteTearWindow();
+
+ // Invoked when the tear window is destroyed.
+ void TearWindowDestroyed();
+
+ BrowserView* browser_view_;
+
+ views::View* active_;
+
+ views::View* preview_;
+
+ TabContents* preview_tab_contents_;
+
+ // Window used to show the page tear.
+ TearWindow* tear_window_;
+
+ // The margin between the top and the active view. This is used to make the
+ // preview overlap the bookmark bar on the new tab page.
+ int active_top_margin_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContentsContainer);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_
diff --git a/chrome/browser/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
index fdc1956..fdc1956 100644
--- a/chrome/browser/views/frame/glass_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.h b/chrome/browser/ui/views/frame/glass_browser_frame_view.h
new file mode 100644
index 0000000..c191568
--- /dev/null
+++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.h
@@ -0,0 +1,103 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_
+#pragma once
+
+#include "chrome/browser/views/frame/browser_frame_win.h"
+#include "chrome/browser/views/frame/browser_non_client_frame_view.h"
+#include "views/controls/button/button.h"
+#include "views/window/non_client_view.h"
+
+class BrowserView;
+class SkBitmap;
+
+class GlassBrowserFrameView : public BrowserNonClientFrameView {
+ public:
+ // Constructs a non-client view for an BrowserFrame.
+ GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view);
+ virtual ~GlassBrowserFrameView();
+
+ // Overridden from BrowserNonClientFrameView:
+ virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const;
+ virtual int GetHorizontalTabStripVerticalOffset(bool restored) const;
+ virtual void UpdateThrobber(bool running);
+
+ // Overridden from views::NonClientFrameView:
+ virtual gfx::Rect GetBoundsForClientView() const;
+ virtual bool AlwaysUseNativeFrame() const;
+ virtual gfx::Rect GetWindowBoundsForClientBounds(
+ const gfx::Rect& client_bounds) const;
+ virtual int NonClientHitTest(const gfx::Point& point);
+ virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) { }
+ virtual void EnableClose(bool enable) { }
+ virtual void ResetWindowControls() { }
+
+ protected:
+ // Overridden from views::View:
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual void Layout();
+
+ private:
+ // Returns the thickness of the border that makes up the window frame edges.
+ // This does not include any client edge.
+ int FrameBorderThickness() const;
+
+ // Returns the thickness of the entire nonclient left, right, and bottom
+ // borders, including both the window frame and any client edge.
+ int NonClientBorderThickness() const;
+
+ // Returns the height of the entire nonclient top border, including the window
+ // frame, any title area, and any connected client edge. If |restored| is
+ // true, acts as if the window is restored regardless of the real mode. If
+ // |ignore_vertical_tabs| is true, acts as if vertical tabs are off regardless
+ // of the real state.
+ int NonClientTopBorderHeight(bool restored, bool ignore_vertical_tabs) const;
+
+ // Paint various sub-components of this view.
+ void PaintToolbarBackground(gfx::Canvas* canvas);
+ void PaintOTRAvatar(gfx::Canvas* canvas);
+ void PaintRestoredClientEdge(gfx::Canvas* canvas);
+
+ // Layout various sub-components of this view.
+ void LayoutOTRAvatar();
+ void LayoutClientView();
+
+ // Returns the bounds of the client area for the specified view size.
+ gfx::Rect CalculateClientAreaBounds(int width, int height) const;
+
+ // Starts/Stops the window throbber running.
+ void StartThrobber();
+ void StopThrobber();
+
+ // Displays the next throbber frame.
+ void DisplayNextThrobberFrame();
+
+ // The layout rect of the OTR avatar icon, if visible.
+ gfx::Rect otr_avatar_bounds_;
+
+ // The frame that hosts this view.
+ BrowserFrame* frame_;
+
+ // The BrowserView hosted within this View.
+ BrowserView* browser_view_;
+
+ // The bounds of the ClientView.
+ gfx::Rect client_view_bounds_;
+
+ // Whether or not the window throbber is currently animating.
+ bool throbber_running_;
+
+ // The index of the current frame of the throbber animation.
+ int throbber_frame_;
+
+ static const int kThrobberIconCount = 24;
+ static HICON throbber_icons_[kThrobberIconCount];
+ static void InitThrobberIcons();
+
+ DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_
diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
index 94d0ffa..94d0ffa 100644
--- a/chrome/browser/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h
new file mode 100644
index 0000000..05830d59
--- /dev/null
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h
@@ -0,0 +1,148 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_
+#pragma once
+
+#include "chrome/browser/views/frame/browser_frame.h"
+#include "chrome/browser/views/frame/browser_non_client_frame_view.h"
+#include "chrome/browser/views/tab_icon_view.h"
+#include "views/controls/button/button.h"
+#include "views/window/non_client_view.h"
+
+class BaseTabStrip;
+class BrowserView;
+namespace gfx {
+class Font;
+}
+class TabContents;
+namespace views {
+class ImageButton;
+class ImageView;
+}
+
+class OpaqueBrowserFrameView : public BrowserNonClientFrameView,
+ public views::ButtonListener,
+ public TabIconView::TabIconViewModel {
+ public:
+ // Constructs a non-client view for an BrowserFrame.
+ OpaqueBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view);
+ virtual ~OpaqueBrowserFrameView();
+
+ // Overridden from BrowserNonClientFrameView:
+ virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const;
+ virtual int GetHorizontalTabStripVerticalOffset(bool restored) const;
+ virtual void UpdateThrobber(bool running);
+ virtual gfx::Size GetMinimumSize();
+
+ protected:
+ // Overridden from views::NonClientFrameView:
+ virtual gfx::Rect GetBoundsForClientView() const;
+ virtual bool AlwaysUseNativeFrame() const;
+ virtual bool AlwaysUseCustomFrame() const;
+ virtual gfx::Rect GetWindowBoundsForClientBounds(
+ const gfx::Rect& client_bounds) const;
+ virtual int NonClientHitTest(const gfx::Point& point);
+ virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask);
+ virtual void EnableClose(bool enable);
+ virtual void ResetWindowControls();
+
+ // Overridden from views::View:
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual void Layout();
+ virtual bool HitTest(const gfx::Point& l) const;
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Overridden from TabIconView::TabIconViewModel:
+ virtual bool ShouldTabIconViewAnimate() const;
+ virtual SkBitmap GetFavIconForTabIconView();
+
+ private:
+ // Returns the thickness of the border that makes up the window frame edges.
+ // This does not include any client edge. If |restored| is true, acts as if
+ // the window is restored regardless of the real mode.
+ int FrameBorderThickness(bool restored) const;
+
+ // Returns the height of the top resize area. This is smaller than the frame
+ // border height in order to increase the window draggable area.
+ int TopResizeHeight() const;
+
+ // Returns the thickness of the entire nonclient left, right, and bottom
+ // borders, including both the window frame and any client edge.
+ int NonClientBorderThickness() const;
+
+ // Returns the height of the entire nonclient top border, including the window
+ // frame, any title area, and any connected client edge. If |restored| is
+ // true, acts as if the window is restored regardless of the real mode. If
+ // |ignore_vertical_tabs| is true, acts as if vertical tabs are off regardless
+ // of the real state.
+ int NonClientTopBorderHeight(bool restored, bool ignore_vertical_tabs) const;
+
+ // Returns the y-coordinate of the caption buttons. If |restored| is true,
+ // acts as if the window is restored regardless of the real mode.
+ int CaptionButtonY(bool restored) const;
+
+ // Returns the thickness of the 3D edge along the bottom of the titlebar. If
+ // |restored| is true, acts as if the window is restored regardless of the
+ // real mode.
+ int TitlebarBottomThickness(bool restored) const;
+
+ // Returns the size of the titlebar icon. This is used even when the icon is
+ // not shown, e.g. to set the titlebar height.
+ int IconSize() const;
+
+ // Returns the bounds of the titlebar icon (or where the icon would be if
+ // there was one).
+ gfx::Rect IconBounds() const;
+
+ // Paint various sub-components of this view. The *FrameBorder() functions
+ // also paint the background of the titlebar area, since the top frame border
+ // and titlebar background are a contiguous component.
+ void PaintRestoredFrameBorder(gfx::Canvas* canvas);
+ void PaintMaximizedFrameBorder(gfx::Canvas* canvas);
+ void PaintTitleBar(gfx::Canvas* canvas);
+ void PaintToolbarBackground(gfx::Canvas* canvas);
+ void PaintOTRAvatar(gfx::Canvas* canvas);
+ void PaintRestoredClientEdge(gfx::Canvas* canvas);
+
+ // Layout various sub-components of this view.
+ void LayoutWindowControls();
+ void LayoutTitleBar();
+ void LayoutOTRAvatar();
+
+ // Returns the bounds of the client area for the specified view size.
+ gfx::Rect CalculateClientAreaBounds(int width, int height) const;
+
+ // The layout rect of the title, if visible.
+ gfx::Rect title_bounds_;
+
+ // The layout rect of the OTR avatar icon, if visible.
+ gfx::Rect otr_avatar_bounds_;
+
+ // Window controls.
+ views::ImageButton* minimize_button_;
+ views::ImageButton* maximize_button_;
+ views::ImageButton* restore_button_;
+ views::ImageButton* close_button_;
+
+ // The Window icon.
+ TabIconView* window_icon_;
+
+ // The frame that hosts this view.
+ BrowserFrame* frame_;
+
+ // The BrowserView hosted within this View.
+ BrowserView* browser_view_;
+
+ // The bounds of the ClientView.
+ gfx::Rect client_view_bounds_;
+
+ DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_
diff --git a/chrome/browser/views/frame/popup_non_client_frame_view.cc b/chrome/browser/ui/views/frame/popup_non_client_frame_view.cc
index dd76c86..dd76c86 100644
--- a/chrome/browser/views/frame/popup_non_client_frame_view.cc
+++ b/chrome/browser/ui/views/frame/popup_non_client_frame_view.cc
diff --git a/chrome/browser/ui/views/frame/popup_non_client_frame_view.h b/chrome/browser/ui/views/frame/popup_non_client_frame_view.h
new file mode 100644
index 0000000..95e13fc
--- /dev/null
+++ b/chrome/browser/ui/views/frame/popup_non_client_frame_view.h
@@ -0,0 +1,40 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_FRAME_POPUP_NON_CLIENT_FRAME_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_FRAME_POPUP_NON_CLIENT_FRAME_VIEW_H_
+#pragma once
+
+#include "chrome/browser/views/frame/browser_non_client_frame_view.h"
+
+class BaseTabStrip;
+
+// BrowserNonClientFrameView implementation for popups. We let the window
+// manager implementation render the decorations for popups, so this draws
+// nothing.
+class PopupNonClientFrameView : public BrowserNonClientFrameView {
+ public:
+ PopupNonClientFrameView() {}
+
+ // NonClientFrameView:
+ virtual gfx::Rect GetBoundsForClientView() const;
+ virtual bool AlwaysUseCustomFrame() const;
+ virtual bool AlwaysUseNativeFrame() const;
+ virtual gfx::Rect GetWindowBoundsForClientBounds(
+ const gfx::Rect& client_bounds) const;
+ virtual int NonClientHitTest(const gfx::Point& point);
+ virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask);
+ virtual void EnableClose(bool enable);
+ virtual void ResetWindowControls();
+
+ // BrowserNonClientFrameView:
+ virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const;
+ virtual int GetHorizontalTabStripVerticalOffset(bool restored) const;
+ virtual void UpdateThrobber(bool running);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PopupNonClientFrameView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FRAME_POPUP_NON_CLIENT_FRAME_VIEW_H_
diff --git a/chrome/browser/views/fullscreen_exit_bubble.cc b/chrome/browser/ui/views/fullscreen_exit_bubble.cc
index 635e9d2..635e9d2 100644
--- a/chrome/browser/views/fullscreen_exit_bubble.cc
+++ b/chrome/browser/ui/views/fullscreen_exit_bubble.cc
diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble.h b/chrome/browser/ui/views/fullscreen_exit_bubble.h
new file mode 100644
index 0000000..167f885
--- /dev/null
+++ b/chrome/browser/ui/views/fullscreen_exit_bubble.h
@@ -0,0 +1,107 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__
+#define CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__
+#pragma once
+
+#include "app/slide_animation.h"
+#include "base/scoped_ptr.h"
+#include "base/timer.h"
+#include "chrome/browser/command_updater.h"
+#include "views/controls/link.h"
+
+#if defined(OS_LINUX)
+namespace views {
+class WidgetGtk;
+}
+#endif
+
+// FullscreenExitBubble is responsible for showing a bubble atop the screen in
+// fullscreen mode, telling users how to exit and providing a click target.
+// The bubble auto-hides, and re-shows when the user moves to the screen top.
+
+class FullscreenExitBubble : public views::LinkController,
+ public AnimationDelegate {
+ public:
+ explicit FullscreenExitBubble(
+ views::Widget* frame,
+ CommandUpdater::CommandUpdaterDelegate* delegate);
+ virtual ~FullscreenExitBubble();
+
+ private:
+ class FullscreenExitView;
+ class FullscreenExitPopup;
+
+ static const double kOpacity; // Opacity of the bubble, 0.0 - 1.0
+ static const int kInitialDelayMs; // Initial time bubble remains onscreen
+ static const int kIdleTimeMs; // Time before mouse idle triggers hide
+ static const int kPositionCheckHz; // How fast to check the mouse position
+ static const int kSlideInRegionHeightPx;
+ // Height of region triggering slide-in
+ static const int kSlideInDurationMs; // Duration of slide-in animation
+ static const int kSlideOutDurationMs; // Duration of slide-out animation
+
+ // views::LinkController
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ // AnimationDelegate
+ virtual void AnimationProgressed(const Animation* animation);
+ virtual void AnimationEnded(const Animation* animation);
+
+ // Called repeatedly to get the current mouse position and animate the bubble
+ // on or off the screen as appropriate.
+ void CheckMousePosition();
+
+ // Hides the bubble. This is a separate function so it can be called by a
+ // timer.
+ void Hide();
+
+ // Returns the current desirable rect for the popup window. If
+ // |ignore_animation_state| is true this returns the rect assuming the popup
+ // is fully onscreen.
+ gfx::Rect GetPopupRect(bool ignore_animation_state) const;
+
+ // The root view containing us.
+ views::View* root_view_;
+
+ // Someone who can toggle fullscreen mode on and off when the user requests
+ // it.
+ CommandUpdater::CommandUpdaterDelegate* delegate_;
+
+#if defined(OS_WIN)
+ // The popup itself, which is a slightly modified WidgetWin. We need to use
+ // a WidgetWin (and thus an HWND) to make the popup float over other HWNDs.
+ FullscreenExitPopup* popup_;
+#elif defined(OS_LINUX)
+ views::WidgetGtk* popup_;
+#endif
+
+ // The contents of the popup.
+ FullscreenExitView* view_;
+
+ // Animation controlling sliding into/out of the top of the screen.
+ scoped_ptr<SlideAnimation> size_animation_;
+
+ // Timer to delay before allowing the bubble to hide after it's initially
+ // shown.
+ base::OneShotTimer<FullscreenExitBubble> initial_delay_;
+
+ // Timer to see how long the mouse has been idle.
+ base::OneShotTimer<FullscreenExitBubble> idle_timeout_;
+
+ // Timer to poll the current mouse position. We can't just listen for mouse
+ // events without putting a non-empty HWND onscreen (or hooking Windows, which
+ // has other problems), so instead we run a low-frequency poller to see if the
+ // user has moved in or out of our show/hide regions.
+ base::RepeatingTimer<FullscreenExitBubble> mouse_position_checker_;
+
+ // The most recently seen mouse position, in screen coordinates. Used to see
+ // if the mouse has moved since our last check.
+ gfx::Point last_mouse_pos_;
+
+ DISALLOW_COPY_AND_ASSIGN(FullscreenExitBubble);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__
diff --git a/chrome/browser/views/generic_info_view.cc b/chrome/browser/ui/views/generic_info_view.cc
index 81ebb4a..81ebb4a 100644
--- a/chrome/browser/views/generic_info_view.cc
+++ b/chrome/browser/ui/views/generic_info_view.cc
diff --git a/chrome/browser/ui/views/generic_info_view.h b/chrome/browser/ui/views/generic_info_view.h
new file mode 100644
index 0000000..e2f6ddb
--- /dev/null
+++ b/chrome/browser/ui/views/generic_info_view.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_GENERIC_INFO_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_GENERIC_INFO_VIEW_H_
+#pragma once
+
+#include "base/gtest_prod_util.h"
+#include "base/scoped_ptr.h"
+#include "base/string16.h"
+#include "views/view.h"
+
+namespace views {
+class GridLayout;
+class Label;
+class Textfield;
+}
+
+// GenericInfoView, displays a tabular grid of read-only textual information,
+// <name, value> pairs. The fixed number of rows must be known at the time of
+// construction.
+class GenericInfoView : public views::View {
+ public:
+ // Constructs a info view with |number_of_rows| and populated with
+ // empty strings.
+ explicit GenericInfoView(int number_of_rows);
+
+ // Constructs a info view with |number_of_rows|, and populates
+ // the name column with localized strings having the given
+ // |name_string_ids|. The array of ids should contain |number_of_rows|
+ // values and should remain valid for the life of the view.
+ GenericInfoView(int number_of_rows, const int name_string_ids[]);
+
+ // The following methods should only be called after
+ // the view has been added to a view hierarchy.
+ void SetNameByStringId(int row, int id);
+ void SetName(int row, const string16& name);
+ void SetValue(int row, const string16& value);
+ void ClearValues() {
+ const string16 kEmptyString;
+ for (int i = 0; i < number_of_rows_; ++i)
+ SetValue(i, kEmptyString);
+ }
+
+ protected:
+ // views::View override
+ virtual void ViewHierarchyChanged(
+ bool is_add, views::View* parent, views::View* child);
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(GenericInfoViewTest, GenericInfoView);
+
+ void InitGenericInfoView();
+ void AddRow(int layout_id, views::GridLayout* layout,
+ views::Label* name, views::Textfield* value);
+
+ const int number_of_rows_;
+ const int* name_string_ids_;
+ scoped_array<views::Label*> name_views_;
+ scoped_array<views::Textfield*> value_views_;
+
+ DISALLOW_COPY_AND_ASSIGN(GenericInfoView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_GENERIC_INFO_VIEW_H_
+
diff --git a/chrome/browser/views/generic_info_view_unittest.cc b/chrome/browser/ui/views/generic_info_view_unittest.cc
index 6c26603..6c26603 100644
--- a/chrome/browser/views/generic_info_view_unittest.cc
+++ b/chrome/browser/ui/views/generic_info_view_unittest.cc
diff --git a/chrome/browser/views/html_dialog_view.cc b/chrome/browser/ui/views/html_dialog_view.cc
index f28e609..f28e609 100644
--- a/chrome/browser/views/html_dialog_view.cc
+++ b/chrome/browser/ui/views/html_dialog_view.cc
diff --git a/chrome/browser/ui/views/html_dialog_view.h b/chrome/browser/ui/views/html_dialog_view.h
new file mode 100644
index 0000000..5a51832
--- /dev/null
+++ b/chrome/browser/ui/views/html_dialog_view.h
@@ -0,0 +1,88 @@
+// Copyright (c) 2006-2008 The Chromium 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_VIEWS_HTML_DIALOG_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_HTML_DIALOG_VIEW_H_
+#pragma once
+
+#include <string>
+
+#include "chrome/browser/dom_ui/html_dialog_ui.h"
+#include "chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h"
+#include "chrome/browser/views/dom_view.h"
+#include "gfx/size.h"
+#include "views/window/window_delegate.h"
+
+class Browser;
+namespace views {
+class Window;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// HtmlDialogView is a view used to display an HTML dialog to the user. The
+// content of the dialogs is determined by the delegate
+// (HtmlDialogUIDelegate), but is basically a file URL along with a
+// JSON input string. The HTML is supposed to show a UI to the user and is
+// expected to send back a JSON file as a return value.
+//
+////////////////////////////////////////////////////////////////////////////////
+//
+// TODO(akalin): Make HtmlDialogView contain an HtmlDialogTabContentsDelegate
+// instead of inheriting from it to avoid violating the "no multiple
+// inheritance" rule.
+class HtmlDialogView
+ : public DOMView,
+ public HtmlDialogTabContentsDelegate,
+ public HtmlDialogUIDelegate,
+ public views::WindowDelegate {
+ public:
+ HtmlDialogView(Profile* profile, HtmlDialogUIDelegate* delegate);
+ virtual ~HtmlDialogView();
+
+ // Initializes the contents of the dialog (the DOMView and the callbacks).
+ void InitDialog();
+
+ // Overridden from views::View:
+ virtual gfx::Size GetPreferredSize();
+ virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
+
+ // Overridden from views::WindowDelegate:
+ virtual bool CanResize() const;
+ virtual bool IsModal() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual void WindowClosing();
+ virtual views::View* GetContentsView();
+ virtual views::View* GetInitiallyFocusedView();
+ virtual bool ShouldShowWindowTitle() const;
+
+ // Overridden from HtmlDialogUIDelegate:
+ 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);
+ virtual void CloseContents(TabContents* source);
+
+ private:
+ // 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_;
+
+ DISALLOW_COPY_AND_ASSIGN(HtmlDialogView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_HTML_DIALOG_VIEW_H_
diff --git a/chrome/browser/views/html_dialog_view_browsertest.cc b/chrome/browser/ui/views/html_dialog_view_browsertest.cc
index a2bcd35..a2bcd35 100644
--- a/chrome/browser/views/html_dialog_view_browsertest.cc
+++ b/chrome/browser/ui/views/html_dialog_view_browsertest.cc
diff --git a/chrome/browser/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc
index 775623e..775623e 100644
--- a/chrome/browser/views/hung_renderer_view.cc
+++ b/chrome/browser/ui/views/hung_renderer_view.cc
diff --git a/chrome/browser/views/importer_lock_view.cc b/chrome/browser/ui/views/importer_lock_view.cc
index 8fc1c9a..8fc1c9a 100644
--- a/chrome/browser/views/importer_lock_view.cc
+++ b/chrome/browser/ui/views/importer_lock_view.cc
diff --git a/chrome/browser/ui/views/importer_lock_view.h b/chrome/browser/ui/views/importer_lock_view.h
new file mode 100644
index 0000000..73e6e8c
--- /dev/null
+++ b/chrome/browser/ui/views/importer_lock_view.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_IMPORTER_LOCK_VIEW_H__
+#define CHROME_BROWSER_UI_VIEWS_IMPORTER_LOCK_VIEW_H__
+#pragma once
+
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+
+namespace views {
+class Label;
+class Window;
+}
+
+class ImporterHost;
+
+// ImporterLockView draws the dialog, and asks the user to shut Firefox
+// down before starting the import.
+class ImporterLockView : public views::View,
+ public views::DialogDelegate {
+ public:
+ explicit ImporterLockView(ImporterHost* host);
+ virtual ~ImporterLockView();
+
+ // Overridden from views::View.
+ virtual gfx::Size GetPreferredSize();
+ virtual void Layout();
+
+ // Overridden from views::DialogDelegate:
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool IsModal() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual bool Accept();
+ virtual bool Cancel();
+ virtual views::View* GetContentsView();
+
+ private:
+ views::Label* description_label_;
+
+ ImporterHost* importer_host_;
+
+ DISALLOW_COPY_AND_ASSIGN(ImporterLockView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_IMPORTER_LOCK_VIEW_H__
diff --git a/chrome/browser/views/importer_view.cc b/chrome/browser/ui/views/importer_view.cc
index 4ef686f..4ef686f 100644
--- a/chrome/browser/views/importer_view.cc
+++ b/chrome/browser/ui/views/importer_view.cc
diff --git a/chrome/browser/ui/views/importer_view.h b/chrome/browser/ui/views/importer_view.h
new file mode 100644
index 0000000..ca1ce1c
--- /dev/null
+++ b/chrome/browser/ui/views/importer_view.h
@@ -0,0 +1,109 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_IMPORTER_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_IMPORTER_VIEW_H_
+#pragma once
+
+#include "app/combobox_model.h"
+#include "base/string16.h"
+#include "chrome/browser/importer/importer.h"
+#include "views/controls/button/native_button.h"
+#include "views/controls/combobox/combobox.h"
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+
+namespace views {
+class Checkbox;
+class Label;
+class Window;
+}
+
+class Profile;
+
+// ImporterView draws the dialog that allows the user to select what to
+// import from other browsers.
+// Note: The UI team hasn't defined yet how the import UI will look like.
+// So now use dialog as a placeholder.
+class ImporterView : public views::View,
+ public views::DialogDelegate,
+ public views::ButtonListener,
+ public ComboboxModel,
+ public views::Combobox::Listener,
+ public ImportObserver {
+ public:
+ // Creates a new ImporterView. |initial_state| is a bitmask of ImportItems.
+ // Each checkbox for the bits in |initial_state| is checked.
+ ImporterView(Profile* profile, int initial_state);
+ virtual ~ImporterView();
+
+ // Overridden from views::View:
+ virtual gfx::Size GetPreferredSize();
+ virtual void Layout();
+
+ // Overridden from views::DialogDelegate:
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool IsDialogButtonEnabled(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool IsModal() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual bool Accept();
+ virtual views::View* GetContentsView();
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Overridden from ComboboxModel:
+ virtual int GetItemCount();
+ virtual string16 GetItemAt(int index);
+
+ // Overridden from ChromeViews::Combobox::Listener:
+ virtual void ItemChanged(views::Combobox* combobox,
+ int prev_index,
+ int new_index);
+
+ // Overridden from ImportObserver:
+ virtual void ImportCanceled();
+ virtual void ImportComplete();
+
+ private:
+ // Initializes the controls on the dialog.
+ void SetupControl();
+
+ // Creates and initializes a new check-box.
+ views::Checkbox* InitCheckbox(const std::wstring& text, bool checked);
+
+ // Create a bitmap from the checkboxes of the view.
+ uint16 GetCheckedItems();
+
+ // Enables/Disables all the checked items for the given state.
+ void SetCheckedItemsState(uint16 items);
+
+ // Sets all checked items in the given state.
+ void SetCheckedItems(uint16 items);
+
+ views::Label* import_from_label_;
+ views::Combobox* profile_combobox_;
+ views::Label* import_items_label_;
+ views::Checkbox* history_checkbox_;
+ views::Checkbox* favorites_checkbox_;
+ views::Checkbox* passwords_checkbox_;
+ views::Checkbox* search_engines_checkbox_;
+
+ scoped_refptr<ImporterHost> importer_host_;
+
+ // Stores the state of the checked items associated with the position of the
+ // selected item in the combo-box.
+ std::vector<uint16> checkbox_items_;
+
+ // Initial state of the |checkbox_items_|.
+ uint16 initial_state_;
+
+ Profile* profile_;
+
+ DISALLOW_COPY_AND_ASSIGN(ImporterView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_IMPORTER_VIEW_H_
diff --git a/chrome/browser/views/importing_progress_view.cc b/chrome/browser/ui/views/importing_progress_view.cc
index ae3135e..ae3135e 100644
--- a/chrome/browser/views/importing_progress_view.cc
+++ b/chrome/browser/ui/views/importing_progress_view.cc
diff --git a/chrome/browser/ui/views/importing_progress_view.h b/chrome/browser/ui/views/importing_progress_view.h
new file mode 100644
index 0000000..5ad1d00
--- /dev/null
+++ b/chrome/browser/ui/views/importing_progress_view.h
@@ -0,0 +1,95 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_IMPORTING_PROGRESS_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_IMPORTING_PROGRESS_VIEW_H_
+#pragma once
+
+#include "chrome/browser/importer/importer.h"
+#include "chrome/browser/importer/importer_data_types.h"
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+#include "views/window/window.h"
+
+namespace views {
+class CheckmarkThrobber;
+class Label;
+}
+
+class ImportingProgressView : public views::View,
+ public views::DialogDelegate,
+ public ImporterHost::Observer {
+ public:
+ // |items| is a bitmask of ImportItems being imported.
+ // |bookmark_import| is true if we're importing bookmarks from a
+ // bookmarks.html file.
+ ImportingProgressView(const std::wstring& source_name,
+ int16 items,
+ ImporterHost* coordinator,
+ ImportObserver* observer,
+ HWND parent_window,
+ bool bookmarks_import);
+ virtual ~ImportingProgressView();
+
+ protected:
+ // Overridden from ImporterHost::Observer:
+ virtual void ImportItemStarted(importer::ImportItem item);
+ virtual void ImportItemEnded(importer::ImportItem item);
+ virtual void ImportStarted();
+ virtual void ImportEnded();
+
+ // Overridden from views::DialogDelegate:
+ virtual int GetDialogButtons() const;
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool IsModal() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual bool Cancel();
+ virtual views::View* GetContentsView();
+
+ // Overridden from views::View:
+ virtual gfx::Size GetPreferredSize();
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+
+ private:
+ // Set up the control layout within this dialog.
+ void InitControlLayout();
+
+ // Various dialog controls.
+ scoped_ptr<views::CheckmarkThrobber> state_bookmarks_;
+ scoped_ptr<views::CheckmarkThrobber> state_searches_;
+ scoped_ptr<views::CheckmarkThrobber> state_passwords_;
+ scoped_ptr<views::CheckmarkThrobber> state_history_;
+ scoped_ptr<views::CheckmarkThrobber> state_cookies_;
+ views::Label* label_info_;
+ scoped_ptr<views::Label> label_bookmarks_;
+ scoped_ptr<views::Label> label_searches_;
+ scoped_ptr<views::Label> label_passwords_;
+ scoped_ptr<views::Label> label_history_;
+ scoped_ptr<views::Label> label_cookies_;
+
+ // The native window that we are parented to. Can be NULL.
+ HWND parent_window_;
+
+ // The importer host coordinating the import.
+ scoped_refptr<ImporterHost> coordinator_;
+
+ // An object that wants to be notified when the import is complete.
+ ImportObserver* import_observer_;
+
+ // The ImportItems we are importing.
+ int16 items_;
+
+ // True if the import operation is in progress.
+ bool importing_;
+
+ // Are we importing a bookmarks.html file?
+ bool bookmarks_import_;
+
+ DISALLOW_COPY_AND_ASSIGN(ImportingProgressView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_IMPORTING_PROGRESS_VIEW_H_
diff --git a/chrome/browser/views/indexed_db_info_view.cc b/chrome/browser/ui/views/indexed_db_info_view.cc
index 733ef6e..733ef6e 100644
--- a/chrome/browser/views/indexed_db_info_view.cc
+++ b/chrome/browser/ui/views/indexed_db_info_view.cc
diff --git a/chrome/browser/ui/views/indexed_db_info_view.h b/chrome/browser/ui/views/indexed_db_info_view.h
new file mode 100644
index 0000000..ea39c09
--- /dev/null
+++ b/chrome/browser/ui/views/indexed_db_info_view.h
@@ -0,0 +1,55 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_INDEXED_DB_INFO_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_INDEXED_DB_INFO_VIEW_H_
+#pragma once
+
+#include "views/view.h"
+#include "chrome/browser/browsing_data_indexed_db_helper.h"
+
+namespace views {
+class Label;
+class Textfield;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// IndexedDBInfoView
+//
+// Responsible for displaying a tabular grid of IndexedDB information.
+class IndexedDBInfoView : public views::View {
+ public:
+ IndexedDBInfoView();
+ virtual ~IndexedDBInfoView();
+
+ // Update the display from the specified Local Storage info.
+ void SetIndexedDBInfo(
+ const BrowsingDataIndexedDBHelper::IndexedDBInfo&
+ indexed_db_info);
+
+ // Clears the cookie display to indicate that no or multiple local storages
+ // are selected.
+ void ClearIndexedDBDisplay();
+
+ // Enables or disables the local storate property text fields.
+ void EnableIndexedDBDisplay(bool enabled);
+
+ protected:
+ // views::View overrides:
+ virtual void ViewHierarchyChanged(
+ bool is_add, views::View* parent, views::View* child);
+
+ private:
+ // Set up the view layout
+ void Init();
+
+ // Individual property labels
+ views::Textfield* origin_value_field_;
+ views::Textfield* size_value_field_;
+ views::Textfield* last_modified_value_field_;
+
+ DISALLOW_COPY_AND_ASSIGN(IndexedDBInfoView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_INDEXED_DB_INFO_VIEW_H_
diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/ui/views/info_bubble.cc
index 3ee1317..3ee1317 100644
--- a/chrome/browser/views/info_bubble.cc
+++ b/chrome/browser/ui/views/info_bubble.cc
diff --git a/chrome/browser/ui/views/info_bubble.h b/chrome/browser/ui/views/info_bubble.h
new file mode 100644
index 0000000..8b6d854
--- /dev/null
+++ b/chrome/browser/ui/views/info_bubble.h
@@ -0,0 +1,307 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_INFO_BUBBLE_H_
+#define CHROME_BROWSER_UI_VIEWS_INFO_BUBBLE_H_
+#pragma once
+
+#include "app/slide_animation.h"
+#include "third_party/skia/include/core/SkColor.h"
+#include "views/accelerator.h"
+#include "views/view.h"
+#include "chrome/browser/views/bubble_border.h"
+#if defined(OS_WIN)
+#include "views/widget/widget_win.h"
+#elif defined(OS_LINUX)
+#include "views/widget/widget_gtk.h"
+#endif
+
+// InfoBubble is used to display an arbitrary view above all other windows.
+// Think of InfoBubble as a tooltip that allows you to embed an arbitrary view
+// in the tooltip. Additionally the InfoBubble renders an arrow pointing at
+// the region the info bubble is providing the information about.
+//
+// To use an InfoBubble, invoke Show() and it'll take care of the rest. The
+// InfoBubble insets the contents for you, so the contents typically shouldn't
+// have any additional margins.
+
+#if defined(OS_WIN)
+class BorderWidget;
+#endif
+class InfoBubble;
+
+namespace views {
+class Widget;
+}
+
+namespace gfx {
+class Path;
+}
+
+// This is used to paint the border of the InfoBubble. Windows uses this via
+// BorderWidget (see below), while others can use it directly in the bubble.
+class BorderContents : public views::View {
+ public:
+ BorderContents() : bubble_border_(NULL) { }
+
+ // Must be called before this object can be used.
+ void Init();
+
+ // Given the size of the contents and the rect to point at, returns the bounds
+ // of both the border and the contents inside the bubble.
+ // |arrow_location| specifies the preferred location for the arrow
+ // anchor. If the bubble does not fit on the monitor and
+ // |allow_bubble_offscreen| is false, the arrow location may change so the
+ // bubble shows entirely.
+ virtual void SizeAndGetBounds(
+ const gfx::Rect& position_relative_to, // In screen coordinates
+ BubbleBorder::ArrowLocation arrow_location,
+ bool allow_bubble_offscreen,
+ const gfx::Size& contents_size,
+ gfx::Rect* contents_bounds, // Returned in window coordinates
+ gfx::Rect* window_bounds); // Returned in screen coordinates
+
+ protected:
+ virtual ~BorderContents() { }
+
+ // Returns the bounds for the monitor showing the specified |rect|.
+ // Overridden in unit-tests.
+ virtual gfx::Rect GetMonitorBounds(const gfx::Rect& rect);
+
+ // Margins between the contents and the inside of the border, in pixels.
+ static const int kLeftMargin = 6;
+ static const int kTopMargin = 6;
+ static const int kRightMargin = 6;
+ static const int kBottomMargin = 9;
+
+ BubbleBorder* bubble_border_;
+
+ private:
+ // Overridden from View:
+ virtual void Paint(gfx::Canvas* canvas);
+
+ // Changes |arrow_location| to its mirrored version, vertically if |vertical|
+ // is true, horizontally otherwise, if |window_bounds| don't fit in
+ // |monitor_bounds|.
+ void MirrorArrowIfOffScreen(bool vertical,
+ const gfx::Rect& position_relative_to,
+ const gfx::Rect& monitor_bounds,
+ const gfx::Size& local_contents_size,
+ BubbleBorder::ArrowLocation* arrow_location,
+ gfx::Rect* window_bounds);
+
+ // Computes how much |window_bounds| is off-screen of the monitor bounds
+ // |monitor_bounds| and puts the values in |offscreen_insets|.
+ // Returns false if |window_bounds| is actually contained in |monitor_bounds|,
+ // in which case |offscreen_insets| is not modified.
+ static bool ComputeOffScreenInsets(const gfx::Rect& monitor_bounds,
+ const gfx::Rect& window_bounds,
+ gfx::Insets* offscreen_insets);
+
+ // Convenience methods that returns the height of |insets| if |vertical| is
+ // true, its width otherwise.
+ static int GetInsetsLength(const gfx::Insets& insets, bool vertical);
+
+ DISALLOW_COPY_AND_ASSIGN(BorderContents);
+};
+
+#if defined(OS_WIN)
+// This is a window that surrounds the info bubble and paints the margin and
+// border. It is a separate window so that it can be a layered window, so that
+// we can use >1-bit alpha shadow images on the borders, which look nicer than
+// the Windows CS_DROPSHADOW shadows. The info bubble window itself cannot be a
+// layered window because that prevents it from hosting native child controls.
+class BorderWidget : public views::WidgetWin {
+ public:
+ BorderWidget();
+ virtual ~BorderWidget() { }
+
+ // Initializes the BrowserWidget making |owner| its owning window.
+ void Init(BorderContents* border_contents, HWND owner);
+
+ // Given the size of the contained contents (without margins), and the rect
+ // (in screen coordinates) to point to, sets the border window positions and
+ // sizes the border window and returns the bounds (in screen coordinates) the
+ // contents should use. |arrow_location| is prefered arrow location,
+ // the function tries to preserve the location and direction, in case of RTL
+ // arrow location is mirrored.
+ virtual gfx::Rect SizeAndGetBounds(const gfx::Rect& position_relative_to,
+ BubbleBorder::ArrowLocation arrow_location,
+ const gfx::Size& contents_size);
+
+ // Simple accessors.
+ BorderContents* border_contents() { return border_contents_; }
+
+ protected:
+ BorderContents* border_contents_;
+
+ private:
+ // Overridden from WidgetWin:
+ virtual LRESULT OnMouseActivate(HWND window,
+ UINT hit_test,
+ UINT mouse_message);
+
+ DISALLOW_COPY_AND_ASSIGN(BorderWidget);
+};
+#endif
+
+class InfoBubbleDelegate {
+ 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 the user pressing
+ // escape.
+ virtual void InfoBubbleClosing(InfoBubble* info_bubble,
+ bool closed_by_escape) = 0;
+
+ // Whether the InfoBubble should be closed when the Esc key is pressed.
+ virtual bool CloseOnEscape() = 0;
+
+ // Whether the InfoBubble should fade in when opening. When trying to
+ // determine whether to use FadeIn, consider whether the bubble is shown as a
+ // direct result of a user action or not. For example, if the bubble is being
+ // shown as a direct result of a mouse-click, we should not use FadeIn.
+ // However, if the bubble appears as a notification that something happened
+ // in the background, we use FadeIn.
+ virtual bool FadeInOnShow() = 0;
+
+ // The name of the window to which this delegate belongs.
+ virtual std::wstring accessible_name() { return L""; }
+};
+
+// TODO(sky): this code is ifdef-tastic. It might be cleaner to refactor the
+// WidgetFoo subclass into a separate class that calls into InfoBubble.
+// That way InfoBubble has no (or very few) ifdefs.
+class InfoBubble
+#if defined(OS_WIN)
+ : public views::WidgetWin,
+#elif defined(OS_LINUX)
+ : public views::WidgetGtk,
+#endif
+ public views::AcceleratorTarget,
+ public AnimationDelegate {
+ public:
+ // Shows the InfoBubble. |parent| is set as the parent window, |contents| are
+ // the contents shown in the bubble, and |position_relative_to| is a rect in
+ // screen coordinates at which the InfoBubble will point. Show() takes
+ // ownership of |contents| and deletes the created InfoBubble when another
+ // window is activated. You can explicitly close the bubble by invoking
+ // Close(). |arrow_location| specifies preferred bubble alignment.
+ // You may provide an optional |delegate| to:
+ // - Be notified when the InfoBubble is closed.
+ // - Prevent the InfoBubble from being closed when the Escape key is
+ // pressed (the default behavior).
+ static InfoBubble* Show(views::Widget* parent,
+ const gfx::Rect& position_relative_to,
+ BubbleBorder::ArrowLocation arrow_location,
+ views::View* contents,
+ InfoBubbleDelegate* delegate);
+
+#if defined(OS_CHROMEOS)
+ // Shows the InfoBubble not grabbing the focus. Others are the same as above.
+ // TYPE_POPUP widget is used to achieve the focusless effect.
+ static InfoBubble* ShowFocusless(views::Widget* parent,
+ const gfx::Rect& position_relative_to,
+ BubbleBorder::ArrowLocation arrow_location,
+ views::View* contents,
+ InfoBubbleDelegate* delegate);
+#endif
+
+ // Resizes and potentially moves the InfoBubble to best accommodate the
+ // contents preferred size.
+ void SizeToContents();
+
+ // Whether the InfoBubble should fade away when it closes. Generally speaking,
+ // we use FadeOut when the user selects something within the bubble that
+ // causes the bubble to dismiss. We don't use it when the bubble gets
+ // deactivated as a result of clicking outside the bubble.
+ void set_fade_away_on_close(bool fade_away_on_close) {
+ fade_away_on_close_ = fade_away_on_close;
+ }
+
+ // Overridden from WidgetWin:
+ virtual void Close();
+
+ // Overridden from AnimationDelegate:
+ virtual void AnimationEnded(const Animation* animation);
+ virtual void AnimationProgressed(const Animation* animation);
+
+ static const SkColor kBackgroundColor;
+
+ protected:
+ InfoBubble();
+#if defined(OS_CHROMEOS)
+ explicit InfoBubble(views::WidgetGtk::Type type);
+#endif
+ virtual ~InfoBubble() {}
+
+ // Creates the InfoBubble.
+ virtual void Init(views::Widget* parent,
+ const gfx::Rect& position_relative_to,
+ BubbleBorder::ArrowLocation arrow_location,
+ views::View* contents,
+ InfoBubbleDelegate* delegate);
+
+ // Instantiates and returns the BorderContents this InfoBubble should use.
+ // Subclasses can return their own BorderContents implementation.
+ virtual BorderContents* CreateBorderContents();
+
+#if defined(OS_WIN)
+ // Overridden from WidgetWin:
+ virtual void OnActivate(UINT action, BOOL minimized, HWND window);
+#elif defined(OS_LINUX)
+ // Overridden from WidgetGtk:
+ virtual void IsActiveChanged();
+#endif
+
+#if defined(OS_WIN)
+ // The window used to render the padding, border and arrow.
+ BorderWidget* border_;
+#elif defined(OS_LINUX)
+ // The view displaying the border.
+ BorderContents* border_contents_;
+#endif
+
+ private:
+ enum ShowStatus {
+ kOpen,
+ kClosing,
+ kClosed
+ };
+
+ // Closes the window notifying the delegate. |closed_by_escape| is true if
+ // the close is the result of pressing escape.
+ void DoClose(bool closed_by_escape);
+
+ // Animates to a visible state.
+ void FadeIn();
+ // Animates to a hidden state.
+ void FadeOut();
+
+ // Animates to a visible/hidden state (visible if |fade_in| is true).
+ void Fade(bool fade_in);
+
+ // Overridden from AcceleratorTarget:
+ virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
+
+ // The delegate, if any.
+ InfoBubbleDelegate* delegate_;
+
+ // The animation used to fade the bubble out.
+ scoped_ptr<SlideAnimation> animation_;
+
+ // The current visibility status of the bubble.
+ ShowStatus show_status_;
+
+ // Whether to fade away when the bubble closes.
+ bool fade_away_on_close_;
+
+ gfx::Rect position_relative_to_;
+ BubbleBorder::ArrowLocation arrow_location_;
+
+ views::View* contents_;
+
+ DISALLOW_COPY_AND_ASSIGN(InfoBubble);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_INFO_BUBBLE_H_
diff --git a/chrome/browser/views/info_bubble_unittest.cc b/chrome/browser/ui/views/info_bubble_unittest.cc
index 8d7f8ece..8d7f8ece 100644
--- a/chrome/browser/views/info_bubble_unittest.cc
+++ b/chrome/browser/ui/views/info_bubble_unittest.cc
diff --git a/chrome/browser/views/infobars/after_translate_infobar.cc b/chrome/browser/ui/views/infobars/after_translate_infobar.cc
index 63b6c8a..63b6c8a 100644
--- a/chrome/browser/views/infobars/after_translate_infobar.cc
+++ b/chrome/browser/ui/views/infobars/after_translate_infobar.cc
diff --git a/chrome/browser/ui/views/infobars/after_translate_infobar.h b/chrome/browser/ui/views/infobars/after_translate_infobar.h
new file mode 100644
index 0000000..18c74a7
--- /dev/null
+++ b/chrome/browser/ui/views/infobars/after_translate_infobar.h
@@ -0,0 +1,79 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_INFOBARS_AFTER_TRANSLATE_INFOBAR_H_
+#define CHROME_BROWSER_UI_VIEWS_INFOBARS_AFTER_TRANSLATE_INFOBAR_H_
+#pragma once
+
+#include "chrome/browser/translate/languages_menu_model.h"
+#include "chrome/browser/translate/options_menu_model.h"
+#include "chrome/browser/translate/translate_infobar_view.h"
+#include "chrome/browser/views/infobars/translate_infobar_base.h"
+#include "views/controls/button/button.h"
+#include "views/controls/link.h"
+#include "views/controls/menu/view_menu_delegate.h"
+
+class InfoBarTextButton;
+class TranslateInfoBarDelegate;
+
+namespace views {
+class Menu2;
+class MenuButton;
+}
+
+class AfterTranslateInfoBar : public TranslateInfoBarBase,
+ public views::ViewMenuDelegate {
+ public:
+ explicit AfterTranslateInfoBar(TranslateInfoBarDelegate* delegate);
+ virtual ~AfterTranslateInfoBar();
+
+ // Overridden from views::View:
+ virtual void Layout();
+
+ // Overridden from TranslateInfoBarView:
+ virtual void OriginalLanguageChanged();
+ virtual void TargetLanguageChanged();
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ protected:
+ // Overridden from views::ViewMenuDelegate:
+ virtual void RunMenu(View* source, const gfx::Point& pt);
+
+ private:
+ // Sets the text of the original or target language menu buttons to reflect
+ // the current value from the delegate.
+ void UpdateLanguageButtonText(LanguagesMenuModel::LanguageType language);
+
+ // The text displayed in the infobar is something like:
+ // "Translated from <lang1> to <lang2>"
+ // Where <lang1> and <lang2> are displayed in a combobox.
+ // So the text is split in 3 chunks, each one displayed in one of the label
+ // below.
+ views::Label* label_1_;
+ views::Label* label_2_;
+ views::Label* label_3_;
+
+ views::MenuButton* original_language_menu_button_;
+ views::MenuButton* target_language_menu_button_;
+ views::MenuButton* options_menu_button_;
+ InfoBarTextButton* revert_button_;
+
+ scoped_ptr<views::Menu2> original_language_menu_;
+ LanguagesMenuModel original_language_menu_model_;
+
+ scoped_ptr<views::Menu2> target_language_menu_;
+ LanguagesMenuModel target_language_menu_model_;
+
+ scoped_ptr<views::Menu2> options_menu_;
+ OptionsMenuModel options_menu_model_;
+
+ // True if the target language comes before the original one.
+ bool swapped_language_buttons_;
+
+ DISALLOW_COPY_AND_ASSIGN(AfterTranslateInfoBar);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_AFTER_TRANSLATE_INFOBAR_H_
diff --git a/chrome/browser/views/infobars/before_translate_infobar.cc b/chrome/browser/ui/views/infobars/before_translate_infobar.cc
index f4d636a..f4d636a 100644
--- a/chrome/browser/views/infobars/before_translate_infobar.cc
+++ b/chrome/browser/ui/views/infobars/before_translate_infobar.cc
diff --git a/chrome/browser/ui/views/infobars/before_translate_infobar.h b/chrome/browser/ui/views/infobars/before_translate_infobar.h
new file mode 100644
index 0000000..52ba882
--- /dev/null
+++ b/chrome/browser/ui/views/infobars/before_translate_infobar.h
@@ -0,0 +1,76 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_INFOBARS_BEFORE_TRANSLATE_INFOBAR_H_
+#define CHROME_BROWSER_UI_VIEWS_INFOBARS_BEFORE_TRANSLATE_INFOBAR_H_
+#pragma once
+
+#include "chrome/browser/translate/languages_menu_model.h"
+#include "chrome/browser/translate/options_menu_model.h"
+#include "chrome/browser/translate/translate_infobar_view.h"
+#include "chrome/browser/views/infobars/infobars.h"
+#include "chrome/browser/views/infobars/translate_infobar_base.h"
+#include "views/controls/button/button.h"
+#include "views/controls/link.h"
+#include "views/controls/menu/view_menu_delegate.h"
+
+class InfoBarTextButton;
+class TranslateInfoBarDelegate;
+
+namespace views {
+class Menu2;
+class MenuButton;
+}
+
+class BeforeTranslateInfoBar
+ : public TranslateInfoBarBase,
+ public views::ViewMenuDelegate {
+ public:
+ explicit BeforeTranslateInfoBar(TranslateInfoBarDelegate* delegate);
+ virtual ~BeforeTranslateInfoBar();
+
+ // Overridden from views::View:
+ virtual void Layout();
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Overridden from TranslateInfoBarView:
+ virtual void OriginalLanguageChanged();
+ virtual void TargetLanguageChanged();
+
+ protected:
+ // Overridden from views::ViewMenuDelegate:
+ virtual void RunMenu(View* source, const gfx::Point& pt);
+
+ private:
+ // Sets the text of the original language menu button to reflect the current
+ // value from the delegate.
+ void UpdateOriginalButtonText();
+
+ // The text displayed in the infobar is something like:
+ // "The page is in <lang>. Would you like to translate it?"
+ // Where <lang> is displayed in a combobox.
+ // So the text is split in 2 chunks, each one displayed in one of the label
+ // below.
+ views::Label* label_1_;
+ views::Label* label_2_;
+
+ views::MenuButton* language_menu_button_;
+ views::MenuButton* options_menu_button_;
+ InfoBarTextButton* accept_button_;
+ InfoBarTextButton* deny_button_;
+ InfoBarTextButton* never_translate_button_;
+ InfoBarTextButton* always_translate_button_;
+
+ scoped_ptr<views::Menu2> languages_menu_;
+ LanguagesMenuModel languages_menu_model_;
+
+ scoped_ptr<views::Menu2> options_menu_;
+ OptionsMenuModel options_menu_model_;
+
+ DISALLOW_COPY_AND_ASSIGN(BeforeTranslateInfoBar);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_BEFORE_TRANSLATE_INFOBAR_H_
diff --git a/chrome/browser/views/infobars/extension_infobar.cc b/chrome/browser/ui/views/infobars/extension_infobar.cc
index e2fb43f..e2fb43f 100644
--- a/chrome/browser/views/infobars/extension_infobar.cc
+++ b/chrome/browser/ui/views/infobars/extension_infobar.cc
diff --git a/chrome/browser/ui/views/infobars/extension_infobar.h b/chrome/browser/ui/views/infobars/extension_infobar.h
new file mode 100644
index 0000000..71cfa0a
--- /dev/null
+++ b/chrome/browser/ui/views/infobars/extension_infobar.h
@@ -0,0 +1,72 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_
+#define CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_
+#pragma once
+
+#include "chrome/browser/views/infobars/infobars.h"
+
+#include "chrome/browser/extensions/extension_infobar_delegate.h"
+#include "chrome/browser/extensions/image_loading_tracker.h"
+#include "chrome/browser/views/extensions/extension_view.h"
+#include "views/controls/menu/view_menu_delegate.h"
+
+class ExtensionContextMenuModel;
+class ExtensionInfoBarDelegate;
+
+namespace views {
+ class MenuButton;
+ class Menu2;
+}
+
+// This class implements InfoBars for Extensions.
+class ExtensionInfoBar : public InfoBar,
+ public ExtensionView::Container,
+ public ImageLoadingTracker::Observer,
+ public ExtensionInfoBarDelegate::DelegateObserver,
+ public views::ViewMenuDelegate {
+ public:
+ explicit ExtensionInfoBar(ExtensionInfoBarDelegate* delegate);
+ virtual ~ExtensionInfoBar();
+
+ // Overridden from ExtensionView::Container:
+ virtual void OnExtensionMouseMove(ExtensionView* view) {}
+ virtual void OnExtensionMouseLeave(ExtensionView* view) {}
+ virtual void OnExtensionPreferredSizeChanged(ExtensionView* view);
+
+ // Overridden from views::View:
+ virtual void Layout();
+
+ // Overridden from ImageLoadingTracker::Observer:
+ virtual void OnImageLoaded(
+ SkBitmap* image, ExtensionResource resource, int index);
+
+ // Overridden from ExtensionInfoBarDelegate::DelegateObserver:
+ virtual void OnDelegateDeleted();
+
+ // Overridden from views::ViewMenuDelegate:
+ virtual void RunMenu(View* source, const gfx::Point& pt);
+
+ private:
+ // Setup the menu button showing the small extension icon and its dropdown
+ // menu.
+ void SetupIconAndMenu();
+
+ NotificationRegistrar notification_registrar_;
+
+ ExtensionInfoBarDelegate* delegate_;
+
+ // The dropdown menu for accessing the contextual extension actions.
+ scoped_refptr<ExtensionContextMenuModel> options_menu_contents_;
+ scoped_ptr<views::Menu2> options_menu_menu_;
+ views::MenuButton* menu_;
+
+ // Keeps track of images being loaded on the File thread.
+ ImageLoadingTracker tracker_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBar);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_
diff --git a/chrome/browser/views/infobars/infobar_button_border.cc b/chrome/browser/ui/views/infobars/infobar_button_border.cc
index ed65885..ed65885 100644
--- a/chrome/browser/views/infobars/infobar_button_border.cc
+++ b/chrome/browser/ui/views/infobars/infobar_button_border.cc
diff --git a/chrome/browser/ui/views/infobars/infobar_button_border.h b/chrome/browser/ui/views/infobars/infobar_button_border.h
new file mode 100644
index 0000000..c8cfa83
--- /dev/null
+++ b/chrome/browser/ui/views/infobars/infobar_button_border.h
@@ -0,0 +1,53 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_INFOBARS_INFOBAR_BUTTON_BORDER_H_
+#define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_BUTTON_BORDER_H_
+#pragma once
+
+#include "views/border.h"
+
+#include "third_party/skia/include/core/SkBitmap.h"
+
+namespace gfx {
+class Canvas;
+}
+namespace views {
+class View;
+}
+
+// A TextButtonBorder that is dark and also paints the button frame in the
+// normal state.
+
+class InfoBarButtonBorder : public views::Border {
+ public:
+ InfoBarButtonBorder();
+ virtual ~InfoBarButtonBorder();
+
+ // Overriden from Border:
+ virtual void GetInsets(gfx::Insets* insets) const;
+ virtual void Paint(const views::View& view, gfx::Canvas* canvas) const;
+
+ private:
+ // Images
+ struct MBBImageSet {
+ SkBitmap* top_left;
+ SkBitmap* top;
+ SkBitmap* top_right;
+ SkBitmap* left;
+ SkBitmap* center;
+ SkBitmap* right;
+ SkBitmap* bottom_left;
+ SkBitmap* bottom;
+ SkBitmap* bottom_right;
+ };
+
+ MBBImageSet normal_set_;
+ MBBImageSet hot_set_;
+ MBBImageSet pushed_set_;
+
+ DISALLOW_COPY_AND_ASSIGN(InfoBarButtonBorder);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_BUTTON_BORDER_H_
diff --git a/chrome/browser/views/infobars/infobar_container.cc b/chrome/browser/ui/views/infobars/infobar_container.cc
index 5779fde..5779fde 100644
--- a/chrome/browser/views/infobars/infobar_container.cc
+++ b/chrome/browser/ui/views/infobars/infobar_container.cc
diff --git a/chrome/browser/ui/views/infobars/infobar_container.h b/chrome/browser/ui/views/infobars/infobar_container.h
new file mode 100644
index 0000000..c3a48fb
--- /dev/null
+++ b/chrome/browser/ui/views/infobars/infobar_container.h
@@ -0,0 +1,94 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_
+#define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_
+#pragma once
+
+#include "chrome/browser/views/accessible_pane_view.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "views/view.h"
+
+class BrowserView;
+class InfoBarDelegate;
+class TabContents;
+
+// A views::View subclass that contains a collection of InfoBars associated with
+// a TabContents.
+class InfoBarContainer : public AccessiblePaneView,
+ public NotificationObserver {
+ public:
+ // Implement this interface when you want to receive notifications from the
+ // InfoBarContainer
+ class Delegate {
+ public:
+ virtual ~Delegate() {}
+ virtual void InfoBarSizeChanged(bool is_animating) = 0;
+ };
+
+ explicit InfoBarContainer(Delegate* delegate);
+ virtual ~InfoBarContainer();
+
+ // Changes the TabContents for which this container is showing InfoBars. Can
+ // be NULL.
+ void ChangeTabContents(TabContents* contents);
+
+ // Called by child InfoBars as they animate. If |completed| is true, the
+ // animation has finished running.
+ void InfoBarAnimated(bool completed);
+
+ // 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);
+
+ // Overridden from views::View:
+ virtual gfx::Size GetPreferredSize();
+ virtual void Layout();
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+
+ protected:
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+
+ 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();
+
+ // Adds an InfoBar for the specified delegate, in response to a notification
+ // from the selected TabContents. The InfoBar's appearance will be animated
+ // if |use_animation| is true.
+ void AddInfoBar(InfoBarDelegate* delegate, bool use_animation);
+
+ // Removes an InfoBar for the specified delegate, in response to a
+ // notification from the selected TabContents. The InfoBar's disappearance
+ // will be animated if |use_animation| is true.
+ void RemoveInfoBar(InfoBarDelegate* delegate, bool use_animation);
+
+ // Replaces an InfoBar for the specified delegate with a new one. There is no
+ // animation.
+ void ReplaceInfoBar(InfoBarDelegate* old_delegate,
+ InfoBarDelegate* new_delegate);
+
+ NotificationRegistrar registrar_;
+
+ // The Delegate which receives notifications from the InfoBarContainer.
+ Delegate* delegate_;
+
+ // The TabContents for which we are currently showing InfoBars.
+ TabContents* tab_contents_;
+
+ DISALLOW_COPY_AND_ASSIGN(InfoBarContainer);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_
diff --git a/chrome/browser/views/infobars/infobar_text_button.cc b/chrome/browser/ui/views/infobars/infobar_text_button.cc
index ebf5d22..ebf5d22 100644
--- a/chrome/browser/views/infobars/infobar_text_button.cc
+++ b/chrome/browser/ui/views/infobars/infobar_text_button.cc
diff --git a/chrome/browser/ui/views/infobars/infobar_text_button.h b/chrome/browser/ui/views/infobars/infobar_text_button.h
new file mode 100644
index 0000000..14ee42f
--- /dev/null
+++ b/chrome/browser/ui/views/infobars/infobar_text_button.h
@@ -0,0 +1,38 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_INFOBARS_INFOBAR_TEXT_BUTTON_H_
+#define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_TEXT_BUTTON_H_
+#pragma once
+
+#include "views/controls/button/text_button.h"
+
+// A TextButton subclass that overrides OnMousePressed to default to
+// CustomButton so as to create pressed state effect.
+
+class InfoBarTextButton : public views::TextButton {
+ public:
+ // Creates a button with the specified |text|.
+ static InfoBarTextButton* Create(views::ButtonListener* listener,
+ const string16& text);
+ // Creates a button which text is the resource string identified by
+ // |message_id|.
+ static InfoBarTextButton* CreateWithMessageID(views::ButtonListener* listener,
+ int message_id);
+ static InfoBarTextButton* CreateWithMessageIDAndParam(
+ views::ButtonListener* listener, int message_id, const string16& param);
+
+ virtual ~InfoBarTextButton();
+
+ protected:
+ InfoBarTextButton(views::ButtonListener* listener, const string16& text);
+
+ // Overriden from TextButton:
+ virtual bool OnMousePressed(const views::MouseEvent& e);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(InfoBarTextButton);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_TEXT_BUTTON_H_
diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/ui/views/infobars/infobars.cc
index c96f72f..c96f72f 100644
--- a/chrome/browser/views/infobars/infobars.cc
+++ b/chrome/browser/ui/views/infobars/infobars.cc
diff --git a/chrome/browser/ui/views/infobars/infobars.h b/chrome/browser/ui/views/infobars/infobars.h
new file mode 100644
index 0000000..a168e3c
--- /dev/null
+++ b/chrome/browser/ui/views/infobars/infobars.h
@@ -0,0 +1,251 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_INFOBARS_INFOBARS_H_
+#define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBARS_H_
+#pragma once
+
+#include "app/animation.h"
+#include "base/task.h"
+#include "chrome/browser/tab_contents/infobar_delegate.h"
+#include "views/controls/button/button.h"
+#include "views/controls/link.h"
+#include "views/focus/focus_manager.h"
+
+class InfoBarContainer;
+class SlideAnimation;
+namespace views {
+class ExternalFocusTracker;
+class ImageButton;
+class ImageView;
+class Label;
+class NativeButton;
+}
+
+// This file contains implementations for some general purpose InfoBars. See
+// chrome/browser/tab_contents/infobar_delegate.h for the delegate interface(s)
+// that you must implement to use these.
+
+class InfoBarBackground : public views::Background {
+ public:
+ explicit InfoBarBackground(InfoBarDelegate::Type infobar_type);
+
+ // Overridden from views::Background:
+ virtual void Paint(gfx::Canvas* canvas, views::View* view) const;
+
+ private:
+ scoped_ptr<views::Background> gradient_background_;
+
+ DISALLOW_COPY_AND_ASSIGN(InfoBarBackground);
+};
+
+class InfoBar : public views::View,
+ public views::ButtonListener,
+ public views::FocusChangeListener,
+ public AnimationDelegate {
+ public:
+ explicit InfoBar(InfoBarDelegate* delegate);
+ virtual ~InfoBar();
+
+ InfoBarDelegate* delegate() const { return delegate_; }
+
+ // Set a link to the parent InfoBarContainer. This must be set before the
+ // InfoBar is added to the view hierarchy.
+ void set_container(InfoBarContainer* container) { container_ = container; }
+
+ // The target height of the InfoBar, regardless of what its current height
+ // is (due to animation).
+ static const double kDefaultTargetHeight;
+
+ static const int kHorizontalPadding;
+ static const int kIconLabelSpacing;
+ static const int kButtonButtonSpacing;
+ static const int kEndOfLabelSpacing;
+ static const int kCloseButtonSpacing;
+ static const int kButtonInLabelSpacing;
+
+ // Overridden from views::View:
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+ virtual gfx::Size GetPreferredSize();
+ virtual void Layout();
+
+ protected:
+ // Overridden from views::View:
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+
+ // Returns the available width of the View for use by child view layout,
+ // excluding the close button.
+ virtual int GetAvailableWidth() const;
+
+ // Removes our associated InfoBarDelegate from the associated TabContents.
+ // (Will lead to this InfoBar being closed).
+ void RemoveInfoBar() const;
+
+ void set_target_height(double height) { target_height_ = height; }
+
+ SlideAnimation* animation() { return animation_.get(); }
+
+ // Returns a centered y-position of a control of height specified in
+ // |prefsize| within the standard InfoBar height. Stable during an animation.
+ int CenterY(const gfx::Size prefsize);
+
+ // Returns a centered y-position of a control of height specified in
+ // |prefsize| within the standard InfoBar height, adjusted according to the
+ // current amount of animation offset the |parent| InfoBar currently has.
+ // Changes during an animation.
+ int OffsetY(views::View* parent, const gfx::Size prefsize);
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Overridden from views::FocusChangeListener:
+ virtual void FocusWillChange(View* focused_before, View* focused_now);
+
+ // Overridden from AnimationDelegate:
+ virtual void AnimationProgressed(const Animation* animation);
+ virtual void AnimationEnded(const Animation* animation);
+
+ private:
+ friend class InfoBarContainer;
+
+ // 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();
+
+ // Called when an InfoBar is added or removed from a view hierarchy to do
+ // setup and shutdown.
+ void InfoBarAdded();
+ void InfoBarRemoved();
+
+ // Destroys the external focus tracker, if present. If |restore_focus| is
+ // true, restores focus to the view tracked by the focus tracker before doing
+ // so.
+ void DestroyFocusTracker(bool restore_focus);
+
+ // Deletes this object (called after a return to the message loop to allow
+ // the stack in ViewHierarchyChanged to unwind).
+ void DeleteSelf();
+
+ // The InfoBar's container
+ InfoBarContainer* container_;
+
+ // The InfoBar's delegate.
+ InfoBarDelegate* delegate_;
+
+ // The Close Button at the right edge of the InfoBar.
+ views::ImageButton* close_button_;
+
+ // The animation that runs when the InfoBar is opened or closed.
+ scoped_ptr<SlideAnimation> animation_;
+
+ // Tracks and stores the last focused view which is not the InfoBar or any of
+ // its children. Used to restore focus once the InfoBar is closed.
+ scoped_ptr<views::ExternalFocusTracker> focus_tracker_;
+
+ // Used to delete this object after a return to the message loop.
+ ScopedRunnableMethodFactory<InfoBar> delete_factory_;
+
+ // The target height for the InfoBar.
+ double target_height_;
+
+ DISALLOW_COPY_AND_ASSIGN(InfoBar);
+};
+
+class AlertInfoBar : public InfoBar {
+ public:
+ explicit AlertInfoBar(AlertInfoBarDelegate* delegate);
+ virtual ~AlertInfoBar();
+
+ // Overridden from views::View:
+ virtual void Layout();
+
+ protected:
+ views::Label* label() const { return label_; }
+ views::ImageView* icon() const { return icon_; }
+
+ private:
+ AlertInfoBarDelegate* GetDelegate();
+
+ views::Label* label_;
+ views::ImageView* icon_;
+
+ DISALLOW_COPY_AND_ASSIGN(AlertInfoBar);
+};
+
+class LinkInfoBar : public InfoBar,
+ public views::LinkController {
+ public:
+ explicit LinkInfoBar(LinkInfoBarDelegate* delegate);
+ virtual ~LinkInfoBar();
+
+ // Overridden from views::LinkController:
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ // Overridden from views::View:
+ virtual void Layout();
+
+ private:
+ LinkInfoBarDelegate* GetDelegate();
+
+ views::ImageView* icon_;
+ views::Label* label_1_;
+ views::Label* label_2_;
+ views::Link* link_;
+
+ DISALLOW_COPY_AND_ASSIGN(LinkInfoBar);
+};
+
+class ConfirmInfoBar : public AlertInfoBar,
+ public views::LinkController {
+ public:
+ explicit ConfirmInfoBar(ConfirmInfoBarDelegate* delegate);
+ virtual ~ConfirmInfoBar();
+
+ // Overridden from views::LinkController:
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ // Overridden from views::View:
+ virtual void Layout();
+
+ protected:
+ // Overridden from views::View:
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Overridden from InfoBar:
+ virtual int GetAvailableWidth() const;
+
+ private:
+ void Init();
+
+ ConfirmInfoBarDelegate* GetDelegate();
+
+ views::NativeButton* ok_button_;
+ views::NativeButton* cancel_button_;
+ views::Link* link_;
+
+ bool initialized_;
+
+ DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBar);
+};
+
+
+#endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBARS_H_
diff --git a/chrome/browser/views/infobars/translate_infobar_base.cc b/chrome/browser/ui/views/infobars/translate_infobar_base.cc
index 4eb0bdd..4eb0bdd 100644
--- a/chrome/browser/views/infobars/translate_infobar_base.cc
+++ b/chrome/browser/ui/views/infobars/translate_infobar_base.cc
diff --git a/chrome/browser/ui/views/infobars/translate_infobar_base.h b/chrome/browser/ui/views/infobars/translate_infobar_base.h
new file mode 100644
index 0000000..2c5d091
--- /dev/null
+++ b/chrome/browser/ui/views/infobars/translate_infobar_base.h
@@ -0,0 +1,75 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_
+#define CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_
+#pragma once
+
+#include "chrome/browser/translate/translate_infobar_view.h"
+#include "chrome/browser/views/infobars/infobars.h"
+
+class TranslateInfoBarDelegate;
+
+namespace views {
+class MenuButton;
+class ViewMenuDelegate;
+}
+
+// This class contains some of the base functionality that translate infobars
+// use.
+class TranslateInfoBarBase : public TranslateInfoBarView,
+ public InfoBar {
+ public:
+ explicit TranslateInfoBarBase(TranslateInfoBarDelegate* delegate);
+ virtual ~TranslateInfoBarBase();
+
+ // TranslateInfoBarView implementation:
+ virtual void OriginalLanguageChanged() {}
+ virtual void TargetLanguageChanged() {}
+
+ // Overridden from views::View:
+ virtual void Layout();
+ virtual void PaintBackground(gfx::Canvas* canvas);
+
+ protected:
+ // Overridden from AnimationDelegate:
+ virtual void AnimationProgressed(const Animation* animation);
+
+ // Creates a label with the appropriate font and color for the translate
+ // infobars.
+ views::Label* CreateLabel(const string16& text);
+
+ // Creates a menu-button with a custom appearance for the translate infobars.
+ views::MenuButton* CreateMenuButton(const string16& text,
+ bool normal_has_border,
+ views::ViewMenuDelegate* menu_delegate);
+
+ // Returns the location at which the menu triggered by |menu_button| should be
+ // positioned.
+ gfx::Point DetermineMenuPosition(views::MenuButton* menu_button);
+
+ // Convenience to retrieve the TranslateInfoBarDelegate for this infobar.
+ TranslateInfoBarDelegate* GetDelegate() const;
+
+ // The translate icon.
+ views::ImageView* icon_;
+
+ InfoBarBackground normal_background_;
+ InfoBarBackground error_background_;
+ scoped_ptr<SlideAnimation> background_color_animation_;
+
+ private:
+ // Returns the background that should be displayed when not animating.
+ const InfoBarBackground& GetBackground() const;
+
+ // Paints |background| to |canvas| with the opacity level based on
+ // |animation_value|.
+ void FadeBackground(gfx::Canvas* canvas,
+ double animation_value,
+ const InfoBarBackground& background);
+
+ DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarBase);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_
diff --git a/chrome/browser/views/infobars/translate_message_infobar.cc b/chrome/browser/ui/views/infobars/translate_message_infobar.cc
index 8094d4e..8094d4e 100644
--- a/chrome/browser/views/infobars/translate_message_infobar.cc
+++ b/chrome/browser/ui/views/infobars/translate_message_infobar.cc
diff --git a/chrome/browser/ui/views/infobars/translate_message_infobar.h b/chrome/browser/ui/views/infobars/translate_message_infobar.h
new file mode 100644
index 0000000..b809c15
--- /dev/null
+++ b/chrome/browser/ui/views/infobars/translate_message_infobar.h
@@ -0,0 +1,29 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_INFOBARS_TRANSLATE_MESSAGE_INFOBAR_H_
+#define CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_MESSAGE_INFOBAR_H_
+#pragma once
+
+#include "chrome/browser/views/infobars/translate_infobar_base.h"
+
+class InfoBarTextButton;
+
+class TranslateMessageInfoBar : public TranslateInfoBarBase {
+ public:
+ explicit TranslateMessageInfoBar(TranslateInfoBarDelegate* delegate);
+
+ virtual void Layout();
+
+ // views::ButtonListener implementation:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ private:
+ views::Label* label_;
+ InfoBarTextButton* button_;
+
+ DISALLOW_COPY_AND_ASSIGN(TranslateMessageInfoBar);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_MESSAGE_INFOBAR_H_
diff --git a/chrome/browser/views/instant_confirm_view.cc b/chrome/browser/ui/views/instant_confirm_view.cc
index 4a714b2f..4a714b2f 100644
--- a/chrome/browser/views/instant_confirm_view.cc
+++ b/chrome/browser/ui/views/instant_confirm_view.cc
diff --git a/chrome/browser/ui/views/instant_confirm_view.h b/chrome/browser/ui/views/instant_confirm_view.h
new file mode 100644
index 0000000..53f72a2
--- /dev/null
+++ b/chrome/browser/ui/views/instant_confirm_view.h
@@ -0,0 +1,41 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_INSTANT_CONFIRM_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_INSTANT_CONFIRM_VIEW_H_
+#pragma once
+
+#include "views/controls/label.h"
+#include "views/controls/link.h"
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+
+class Profile;
+
+// The view shown in the instant confirm dialog.
+class InstantConfirmView : public views::View,
+ public views::DialogDelegate,
+ public views::LinkController {
+ public:
+ explicit InstantConfirmView(Profile* profile);
+
+ // DialogDelegate overrides:
+ virtual bool Accept(bool window_closing);
+ virtual bool Accept();
+ virtual bool Cancel();
+ virtual views::View* GetContentsView();
+ virtual std::wstring GetWindowTitle() const;
+ virtual gfx::Size GetPreferredSize();
+ virtual bool IsModal() const;
+
+ // LinkController overrides:
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ private:
+ Profile* profile_;
+
+ DISALLOW_COPY_AND_ASSIGN(InstantConfirmView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_INSTANT_CONFIRM_VIEW_H_
diff --git a/chrome/browser/views/js_modal_dialog_views.cc b/chrome/browser/ui/views/js_modal_dialog_views.cc
index c6348ea..c6348ea 100644
--- a/chrome/browser/views/js_modal_dialog_views.cc
+++ b/chrome/browser/ui/views/js_modal_dialog_views.cc
diff --git a/chrome/browser/ui/views/js_modal_dialog_views.h b/chrome/browser/ui/views/js_modal_dialog_views.h
new file mode 100644
index 0000000..ce7e221
--- /dev/null
+++ b/chrome/browser/ui/views/js_modal_dialog_views.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_JS_MODAL_DIALOG_VIEWS_H_
+#define CHROME_BROWSER_UI_VIEWS_JS_MODAL_DIALOG_VIEWS_H_
+#pragma once
+
+#include "chrome/browser/js_modal_dialog.h"
+
+#include <string>
+
+#include "app/message_box_flags.h"
+#include "chrome/browser/native_app_modal_dialog.h"
+#include "views/window/dialog_delegate.h"
+
+class MessageBoxView;
+
+class JSModalDialogViews : public NativeAppModalDialog,
+ public views::DialogDelegate {
+ public:
+ explicit JSModalDialogViews(JavaScriptAppModalDialog* parent);
+ virtual ~JSModalDialogViews();
+
+ // Overridden from NativeAppModalDialog:
+ virtual int GetAppModalDialogButtons() const;
+ virtual void ShowAppModalDialog();
+ virtual void ActivateAppModalDialog();
+ virtual void CloseAppModalDialog();
+ virtual void AcceptAppModalDialog();
+ virtual void CancelAppModalDialog();
+
+ // Overridden from views::DialogDelegate:
+ virtual int GetDefaultDialogButton() const;
+ virtual int GetDialogButtons() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual void WindowClosing();
+ virtual void DeleteDelegate();
+ virtual bool Cancel();
+ virtual bool Accept();
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+
+ // Overridden from views::WindowDelegate:
+ virtual bool IsModal() const { return true; }
+ virtual views::View* GetContentsView();
+ virtual views::View* GetInitiallyFocusedView();
+ virtual void OnClose();
+
+ private:
+ // A pointer to the AppModalDialog that owns us.
+ JavaScriptAppModalDialog* parent_;
+
+ // The message box view whose commands we handle.
+ MessageBoxView* message_box_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(JSModalDialogViews);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_JS_MODAL_DIALOG_VIEWS_H_
diff --git a/chrome/browser/views/keyword_editor_view.cc b/chrome/browser/ui/views/keyword_editor_view.cc
index 6cd877c..6cd877c 100644
--- a/chrome/browser/views/keyword_editor_view.cc
+++ b/chrome/browser/ui/views/keyword_editor_view.cc
diff --git a/chrome/browser/ui/views/keyword_editor_view.h b/chrome/browser/ui/views/keyword_editor_view.h
new file mode 100644
index 0000000..9720730
--- /dev/null
+++ b/chrome/browser/ui/views/keyword_editor_view.h
@@ -0,0 +1,117 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_KEYWORD_EDITOR_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_KEYWORD_EDITOR_VIEW_H_
+#pragma once
+
+#include <Windows.h>
+
+#include "base/string16.h"
+#include "chrome/browser/search_engines/edit_search_engine_controller.h"
+#include "chrome/browser/search_engines/keyword_editor_controller.h"
+#include "chrome/browser/search_engines/template_url_model_observer.h"
+#include "views/controls/button/button.h"
+#include "views/controls/table/table_view_observer.h"
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+
+namespace views {
+class Label;
+class NativeButton;
+}
+
+namespace {
+class BorderView;
+}
+
+class SearchEngineSelectionObserver;
+class SkBitmap;
+class TemplateURL;
+
+// KeywordEditorView allows the user to edit keywords.
+
+class KeywordEditorView : public views::View,
+ public views::TableViewObserver,
+ public views::ButtonListener,
+ public TemplateURLModelObserver,
+ public views::DialogDelegate,
+ public EditSearchEngineControllerDelegate {
+ public:
+ // Shows the KeywordEditorView for the specified profile. If there is a
+ // KeywordEditorView already open, it is closed and a new one is shown.
+ static void Show(Profile* profile);
+
+ // Shows the KeywordEditorView for the specified profile, and passes in
+ // an observer to be called back on view close.
+ static void ShowAndObserve(Profile* profile,
+ SearchEngineSelectionObserver* observer);
+
+ KeywordEditorView(Profile* profile,
+ SearchEngineSelectionObserver* observer);
+
+ virtual ~KeywordEditorView();
+
+ // Overridden from EditSearchEngineControllerDelegate.
+ // Calls AddTemplateURL or ModifyTemplateURL as appropriate.
+ virtual void OnEditedKeyword(const TemplateURL* template_url,
+ const string16& title,
+ const string16& keyword,
+ const std::string& url);
+
+ // Overridden to invoke Layout.
+ virtual gfx::Size GetPreferredSize();
+
+ // views::DialogDelegate methods:
+ virtual bool CanResize() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual std::wstring GetWindowName() const;
+ virtual int GetDialogButtons() const;
+ virtual bool Accept();
+ virtual bool Cancel();
+ virtual views::View* GetContentsView();
+
+ private:
+ void Init();
+
+ // Creates the layout and adds the views to it.
+ void InitLayoutManager();
+
+ // TableViewObserver method. Updates buttons contingent on the selection.
+ virtual void OnSelectionChanged();
+ // Edits the selected item.
+ virtual void OnDoubleClick();
+
+ // Button::ButtonListener method.
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // TemplateURLModelObserver notification.
+ virtual void OnTemplateURLModelChanged();
+
+ // Toggles whether the selected keyword is the default search provider.
+ void MakeDefaultTemplateURL();
+
+ // The profile.
+ Profile* profile_;
+
+ // Observer gets a callback when the KeywordEditorView closes.
+ SearchEngineSelectionObserver* observer_;
+
+ scoped_ptr<KeywordEditorController> controller_;
+
+ // True if the user has set a default search engine in this dialog.
+ bool default_chosen_;
+
+ // All the views are added as children, so that we don't need to delete
+ // them directly.
+ views::TableView* table_view_;
+ views::NativeButton* add_button_;
+ views::NativeButton* edit_button_;
+ views::NativeButton* remove_button_;
+ views::NativeButton* make_default_button_;
+
+ DISALLOW_COPY_AND_ASSIGN(KeywordEditorView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_KEYWORD_EDITOR_VIEW_H_
diff --git a/chrome/browser/ui/views/list_background.h b/chrome/browser/ui/views/list_background.h
new file mode 100644
index 0000000..82a3000
--- /dev/null
+++ b/chrome/browser/ui/views/list_background.h
@@ -0,0 +1,37 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_LIST_BACKGROUND_H_
+#define CHROME_BROWSER_UI_VIEWS_LIST_BACKGROUND_H_
+#pragma once
+
+#include "gfx/canvas_skia.h"
+#include "gfx/native_theme_win.h"
+#include "views/background.h"
+
+// A background object that paints the scrollable list background,
+// which may be rendered by the system visual styles system.
+class ListBackground : public views::Background {
+ public:
+ explicit ListBackground() {
+ SkColor list_color =
+ gfx::NativeTheme::instance()->GetThemeColorWithDefault(
+ gfx::NativeTheme::LIST, 1, TS_NORMAL, TMT_FILLCOLOR, COLOR_WINDOW);
+ SetNativeControlColor(list_color);
+ }
+ virtual ~ListBackground() {}
+
+ virtual void Paint(gfx::Canvas* canvas, views::View* view) const {
+ HDC dc = canvas->BeginPlatformPaint();
+ RECT native_lb = view->GetLocalBounds(true).ToRECT();
+ gfx::NativeTheme::instance()->PaintListBackground(dc, true, &native_lb);
+ canvas->EndPlatformPaint();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ListBackground);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_LIST_BACKGROUND_H_
+
diff --git a/chrome/browser/views/local_storage_info_view.cc b/chrome/browser/ui/views/local_storage_info_view.cc
index 35c7c49..35c7c49 100644
--- a/chrome/browser/views/local_storage_info_view.cc
+++ b/chrome/browser/ui/views/local_storage_info_view.cc
diff --git a/chrome/browser/ui/views/local_storage_info_view.h b/chrome/browser/ui/views/local_storage_info_view.h
new file mode 100644
index 0000000..c7cf5d2
--- /dev/null
+++ b/chrome/browser/ui/views/local_storage_info_view.h
@@ -0,0 +1,57 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_LOCAL_STORAGE_INFO_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_LOCAL_STORAGE_INFO_VIEW_H_
+#pragma once
+
+#include "views/view.h"
+#include "chrome/browser/browsing_data_local_storage_helper.h"
+
+namespace views {
+class Label;
+class Textfield;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// LocalStorageInfoView
+//
+// Responsible for displaying a tabular grid of Local Storage information.
+class LocalStorageInfoView : public views::View {
+ public:
+ LocalStorageInfoView();
+ virtual ~LocalStorageInfoView();
+
+ // Update the display from the specified Local Storage info.
+ void SetLocalStorageInfo(
+ const BrowsingDataLocalStorageHelper::LocalStorageInfo&
+ local_storage_info);
+
+ // Clears the cookie display to indicate that no or multiple local storages
+ // are selected.
+ void ClearLocalStorageDisplay();
+
+ // Enables or disables the local storate property text fields.
+ void EnableLocalStorageDisplay(bool enabled);
+
+ protected:
+ // views::View overrides:
+ virtual void ViewHierarchyChanged(
+ bool is_add, views::View* parent, views::View* child);
+
+ private:
+ // Set up the view layout
+ void Init();
+
+ // Individual property labels
+ views::Textfield* origin_value_field_;
+ views::Textfield* size_value_field_;
+ views::Textfield* last_modified_value_field_;
+
+ DISALLOW_COPY_AND_ASSIGN(LocalStorageInfoView);
+};
+
+
+#endif // CHROME_BROWSER_UI_VIEWS_LOCAL_STORAGE_INFO_VIEW_H_
+
diff --git a/chrome/browser/views/local_storage_set_item_info_view.cc b/chrome/browser/ui/views/local_storage_set_item_info_view.cc
index 8df4de4..8df4de4 100644
--- a/chrome/browser/views/local_storage_set_item_info_view.cc
+++ b/chrome/browser/ui/views/local_storage_set_item_info_view.cc
diff --git a/chrome/browser/ui/views/local_storage_set_item_info_view.h b/chrome/browser/ui/views/local_storage_set_item_info_view.h
new file mode 100644
index 0000000..496d222
--- /dev/null
+++ b/chrome/browser/ui/views/local_storage_set_item_info_view.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_LOCAL_STORAGE_SET_ITEM_INFO_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_LOCAL_STORAGE_SET_ITEM_INFO_VIEW_H_
+#pragma once
+
+#include <string>
+
+#include "base/string16.h"
+#include "views/view.h"
+
+namespace views {
+class Label;
+class Textfield;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// LocalStorageSetItemInfoView
+//
+// Responsible for displaying a tabular grid of Local Storage information when
+// prompting for permission to set an item.
+class LocalStorageSetItemInfoView : public views::View {
+ public:
+ LocalStorageSetItemInfoView();
+ virtual ~LocalStorageSetItemInfoView();
+
+ // Update the display from the specified Local Storage info.
+ void SetFields(const std::string& host,
+ const string16& key,
+ const string16& value);
+
+ // Clears the display to indicate that no or multiple local storages
+ // are selected.
+ void ClearLocalStorageDisplay();
+
+ // Enables or disables the local storate property text fields.
+ void EnableLocalStorageDisplay(bool enabled);
+
+ protected:
+ // views::View overrides:
+ virtual void ViewHierarchyChanged(
+ bool is_add, views::View* parent, views::View* child);
+
+ private:
+ // Set up the view layout
+ void Init();
+
+ // Individual property labels
+ views::Textfield* host_value_field_;
+ views::Textfield* key_value_field_;
+ views::Textfield* value_value_field_;
+
+ DISALLOW_COPY_AND_ASSIGN(LocalStorageSetItemInfoView);
+};
+
+
+#endif // CHROME_BROWSER_UI_VIEWS_LOCAL_STORAGE_SET_ITEM_INFO_VIEW_H_
+
diff --git a/chrome/browser/views/location_bar/click_handler.cc b/chrome/browser/ui/views/location_bar/click_handler.cc
index e9c414c..e9c414c 100644
--- a/chrome/browser/views/location_bar/click_handler.cc
+++ b/chrome/browser/ui/views/location_bar/click_handler.cc
diff --git a/chrome/browser/ui/views/location_bar/click_handler.h b/chrome/browser/ui/views/location_bar/click_handler.h
new file mode 100644
index 0000000..9854de8
--- /dev/null
+++ b/chrome/browser/ui/views/location_bar/click_handler.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_LOCATION_BAR_CLICK_HANDLER_H_
+#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CLICK_HANDLER_H_
+#pragma once
+
+#include "base/basictypes.h"
+
+class LocationBarView;
+
+namespace views {
+class MouseEvent;
+class View;
+}
+
+// This helper class is kept as a member by classes that need to show the Page
+// Info dialog on click, to encapsulate that logic in one place.
+class ClickHandler {
+ public:
+ ClickHandler(const views::View* owner, const LocationBarView* location_bar);
+
+ void OnMouseReleased(const views::MouseEvent& event, bool canceled);
+
+ private:
+ const views::View* owner_;
+ const LocationBarView* location_bar_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ClickHandler);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CLICK_HANDLER_H_
+
diff --git a/chrome/browser/views/location_bar/content_setting_image_view.cc b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc
index 2d5af65..2d5af65 100644
--- a/chrome/browser/views/location_bar/content_setting_image_view.cc
+++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc
diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.h b/chrome/browser/ui/views/location_bar/content_setting_image_view.h
new file mode 100644
index 0000000..8180c72
--- /dev/null
+++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_
+#pragma once
+
+#include "base/scoped_ptr.h"
+#include "chrome/browser/views/info_bubble.h"
+#include "chrome/common/content_settings_types.h"
+#include "views/controls/image_view.h"
+
+class ContentSettingImageModel;
+class InfoBubble;
+class LocationBarView;
+class Profile;
+class TabContents;
+
+namespace views {
+class MouseEvent;
+}
+
+class ContentSettingImageView : public views::ImageView,
+ public InfoBubbleDelegate {
+ public:
+ ContentSettingImageView(ContentSettingsType content_type,
+ const LocationBarView* parent,
+ Profile* profile);
+ virtual ~ContentSettingImageView();
+
+ void set_profile(Profile* profile) { profile_ = profile; }
+ void UpdateFromTabContents(const TabContents* tab_contents);
+
+ private:
+ // views::ImageView overrides:
+ virtual bool OnMousePressed(const views::MouseEvent& event);
+ virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
+ virtual void VisibilityChanged(View* starting_from, bool is_visible);
+
+ // InfoBubbleDelegate overrides:
+ virtual void InfoBubbleClosing(InfoBubble* info_bubble,
+ bool closed_by_escape);
+ virtual bool CloseOnEscape();
+ virtual bool FadeInOnShow() { return false; }
+
+ scoped_ptr<ContentSettingImageModel> content_setting_image_model_;
+
+ // The owning LocationBarView.
+ const LocationBarView* parent_;
+
+ // The currently active profile.
+ Profile* profile_;
+
+ // The currently shown info bubble if any.
+ InfoBubble* info_bubble_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingImageView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_
diff --git a/chrome/browser/views/location_bar/ev_bubble_view.cc b/chrome/browser/ui/views/location_bar/ev_bubble_view.cc
index 215ad51..215ad51 100644
--- a/chrome/browser/views/location_bar/ev_bubble_view.cc
+++ b/chrome/browser/ui/views/location_bar/ev_bubble_view.cc
diff --git a/chrome/browser/ui/views/location_bar/ev_bubble_view.h b/chrome/browser/ui/views/location_bar/ev_bubble_view.h
new file mode 100644
index 0000000..d80d98f
--- /dev/null
+++ b/chrome/browser/ui/views/location_bar/ev_bubble_view.h
@@ -0,0 +1,38 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_LOCATION_BAR_EV_BUBBLE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_EV_BUBBLE_VIEW_H_
+#pragma once
+
+#include "chrome/browser/views/location_bar/click_handler.h"
+#include "chrome/browser/views/location_bar/icon_label_bubble_view.h"
+
+class LocationBarView;
+
+namespace views {
+class MouseEvent;
+}
+
+// EVBubbleView displays the EV Bubble in the LocationBarView.
+class EVBubbleView : public IconLabelBubbleView {
+ public:
+ EVBubbleView(const int background_images[],
+ int contained_image,
+ const SkColor& color,
+ const LocationBarView* location_bar);
+ virtual ~EVBubbleView();
+
+ // Overridden from view.
+ virtual bool OnMousePressed(const views::MouseEvent& event);
+ virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
+
+ private:
+ ClickHandler click_handler_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(EVBubbleView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_EV_BUBBLE_VIEW_H_
+
diff --git a/chrome/browser/views/location_bar/icon_label_bubble_view.cc b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc
index 1e0159b..1e0159b 100644
--- a/chrome/browser/views/location_bar/icon_label_bubble_view.cc
+++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc
diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h
new file mode 100644
index 0000000..e8b7e11
--- /dev/null
+++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h
@@ -0,0 +1,64 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_
+#pragma once
+
+#include <string>
+
+#include "gfx/size.h"
+#include "views/painter.h"
+#include "views/view.h"
+
+namespace gfx {
+class Canvas;
+class Font;
+}
+namespace views {
+class ImageView;
+class Label;
+}
+
+class SkBitmap;
+
+// View used to draw a bubble to the left of the address, containing an icon and
+// a label. We use this as a base for the classes that handle the EV bubble and
+// tab-to-search UI.
+class IconLabelBubbleView : public views::View {
+ public:
+ IconLabelBubbleView(const int background_images[],
+ int contained_image,
+ const SkColor& color);
+ virtual ~IconLabelBubbleView();
+
+ void SetFont(const gfx::Font& font);
+ void SetLabel(const std::wstring& label);
+ void SetImage(const SkBitmap& bitmap);
+ void SetItemPadding(int padding) { item_padding_ = padding; }
+
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual gfx::Size GetPreferredSize();
+ virtual void Layout();
+
+ protected:
+ void SetElideInMiddle(bool elide_in_middle);
+ gfx::Size GetNonLabelSize();
+
+ private:
+ int GetNonLabelWidth();
+
+ // For painting the background.
+ views::HorizontalPainter background_painter_;
+
+ // The contents of the bubble.
+ views::ImageView* image_;
+ views::Label* label_;
+
+ int item_padding_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(IconLabelBubbleView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_
diff --git a/chrome/browser/views/location_bar/keyword_hint_view.cc b/chrome/browser/ui/views/location_bar/keyword_hint_view.cc
index eec0dd1..eec0dd1 100644
--- a/chrome/browser/views/location_bar/keyword_hint_view.cc
+++ b/chrome/browser/ui/views/location_bar/keyword_hint_view.cc
diff --git a/chrome/browser/ui/views/location_bar/keyword_hint_view.h b/chrome/browser/ui/views/location_bar/keyword_hint_view.h
new file mode 100644
index 0000000..d7b23ec
--- /dev/null
+++ b/chrome/browser/ui/views/location_bar/keyword_hint_view.h
@@ -0,0 +1,62 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_
+#pragma once
+
+#include <string>
+
+#include "gfx/size.h"
+#include "views/view.h"
+
+namespace gfx {
+class Font;
+}
+class Profile;
+namespace views {
+class Label;
+}
+
+// KeywordHintView is used by the location bar view to display a hint to the
+// user when the selected url has a corresponding keyword.
+//
+// Internally KeywordHintView uses two labels to render the text, and draws
+// the tab image itself.
+//
+// NOTE: This should really be called LocationBarKeywordHintView, but I
+// couldn't bring myself to use such a long name.
+class KeywordHintView : public views::View {
+ public:
+ explicit KeywordHintView(Profile* profile);
+ virtual ~KeywordHintView();
+
+ void SetFont(const gfx::Font& font);
+
+ void SetColor(const SkColor& color);
+
+ void SetKeyword(const std::wstring& keyword);
+ std::wstring keyword() const { return keyword_; }
+
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual gfx::Size GetPreferredSize();
+ // The minimum size is just big enough to show the tab.
+ virtual gfx::Size GetMinimumSize();
+ virtual void Layout();
+
+ void set_profile(Profile* profile) { profile_ = profile; }
+
+ private:
+ views::Label* leading_label_;
+ views::Label* trailing_label_;
+
+ // The keyword.
+ std::wstring keyword_;
+
+ Profile* profile_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(KeywordHintView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_
diff --git a/chrome/browser/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 09c18a9..09c18a9 100644
--- a/chrome/browser/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h
new file mode 100644
index 0000000..50351c1
--- /dev/null
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.h
@@ -0,0 +1,404 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include "base/task.h"
+#include "chrome/browser/autocomplete/autocomplete_edit.h"
+#include "chrome/browser/extensions/extension_context_menu_model.h"
+#include "chrome/browser/first_run/first_run.h"
+#include "chrome/browser/location_bar.h"
+#include "chrome/browser/search_engines/template_url_model_observer.h"
+#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/browser/toolbar_model.h"
+#include "chrome/browser/views/extensions/extension_popup.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "gfx/font.h"
+#include "gfx/rect.h"
+#include "views/controls/native/native_view_host.h"
+
+#if defined(OS_WIN)
+#include "chrome/browser/autocomplete/autocomplete_edit_view_win.h"
+#else
+#include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h"
+#include "chrome/browser/gtk/accessible_widget_helper_gtk.h"
+#endif
+
+class CommandUpdater;
+class ContentSettingImageView;
+class EVBubbleView;
+class ExtensionAction;
+class GURL;
+class InstantController;
+class KeywordHintView;
+class LocationIconView;
+class PageActionWithBadgeView;
+class Profile;
+class SelectedKeywordView;
+class StarView;
+class TemplateURLModel;
+
+namespace views {
+class HorizontalPainter;
+class Label;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// LocationBarView class
+//
+// The LocationBarView class is a View subclass that paints the background
+// of the URL bar strip and contains its content.
+//
+/////////////////////////////////////////////////////////////////////////////
+class LocationBarView : public LocationBar,
+ public LocationBarTesting,
+ public views::View,
+ public views::DragController,
+ public AutocompleteEditController,
+ public TemplateURLModelObserver {
+ public:
+ // The location bar view's class name.
+ static const char kViewClassName[];
+
+ class Delegate {
+ public:
+ // Should return the current tab contents.
+ virtual TabContents* GetTabContents() = 0;
+
+ // Returns the InstantController, or NULL if there isn't one.
+ virtual InstantController* GetInstant() = 0;
+
+ // Called by the location bar view when the user starts typing in the edit.
+ // This forces our security style to be UNKNOWN for the duration of the
+ // editing.
+ virtual void OnInputInProgress(bool in_progress) = 0;
+ };
+
+ enum ColorKind {
+ BACKGROUND = 0,
+ TEXT,
+ SELECTED_TEXT,
+ DEEMPHASIZED_TEXT,
+ SECURITY_TEXT,
+ };
+
+ // The modes reflect the different scenarios where a location bar can be used.
+ // The normal mode is the mode used in a regular browser window.
+ // In popup mode, the location bar view is read only and has a slightly
+ // different presentation (font size / color).
+ // In app launcher mode, the location bar is empty and no security states or
+ // page/browser actions are displayed.
+ enum Mode {
+ NORMAL = 0,
+ POPUP,
+ APP_LAUNCHER
+ };
+
+ LocationBarView(Profile* profile,
+ CommandUpdater* command_updater,
+ ToolbarModel* model,
+ Delegate* delegate,
+ Mode mode);
+ virtual ~LocationBarView();
+
+ void Init();
+
+ // True if this instance has been initialized by calling Init, which can only
+ // be called when the receiving instance is attached to a view container.
+ bool IsInitialized() const;
+
+ // Returns the appropriate color for the desired kind, based on the user's
+ // system theme.
+ static SkColor GetColor(ToolbarModel::SecurityLevel security_level,
+ ColorKind kind);
+
+ // 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);
+
+ void SetProfile(Profile* profile);
+ Profile* profile() const { return profile_; }
+
+ // Returns the current TabContents.
+ TabContents* GetTabContents() const;
+
+ // Sets |preview_enabled| for the PageAction View associated with this
+ // |page_action|. If |preview_enabled| is true, the view will display the
+ // PageActions icon even though it has not been activated by the extension.
+ // This is used by the ExtensionInstalledBubble 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 PageAction View which is associated with |page_action|.
+ views::View* GetPageActionView(ExtensionAction* page_action);
+
+ // Toggles the star on or off.
+ void SetStarToggled(bool on);
+
+ // Shows the bookmark bubble.
+ void ShowStarBubble(const GURL& url, bool newly_bookmarked);
+
+ // Sizing functions
+ virtual gfx::Size GetPreferredSize();
+
+ // Layout and Painting functions
+ virtual void Layout();
+ virtual void Paint(gfx::Canvas* canvas);
+
+ // No focus border for the location bar, the caret is enough.
+ virtual void PaintFocusBorder(gfx::Canvas* canvas) { }
+
+ // Called when any ancestor changes its size, asks the AutocompleteEditModel
+ // to close its popup.
+ virtual void VisibleBoundsInRootChanged();
+
+ // Set if we should show a focus rect while the location entry field is
+ // focused. Used when the toolbar is in full keyboard accessibility mode.
+ // Repaints if necessary.
+ virtual void SetShowFocusRect(bool show);
+
+ // Select all of the text. Needed when the user tabs through controls
+ // in the toolbar in full keyboard accessibility mode.
+ virtual void SelectAll();
+
+#if defined(OS_WIN)
+ // Event Handlers
+ virtual bool OnMousePressed(const views::MouseEvent& event);
+ virtual bool OnMouseDragged(const views::MouseEvent& event);
+ virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
+#endif
+
+ // AutocompleteEditController
+ virtual void OnAutocompleteWillClosePopup();
+ virtual void OnAutocompleteLosingFocus(gfx::NativeView view_gaining_focus);
+ virtual void OnAutocompleteWillAccept();
+ virtual bool OnCommitSuggestedText(const std::wstring& typed_text);
+ 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 OnInputInProgress(bool in_progress);
+ virtual void OnKillFocus();
+ virtual void OnSetFocus();
+ virtual SkBitmap GetFavIcon() const;
+ virtual std::wstring GetTitle() const;
+
+ // Overridden from views::View:
+ virtual std::string GetClassName() const;
+ virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e);
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+
+ // Overridden from views::DragController:
+ virtual void WriteDragData(View* sender,
+ const gfx::Point& press_pt,
+ OSExchangeData* data);
+ virtual int GetDragOperations(View* sender, const gfx::Point& p);
+ virtual bool CanStartDrag(View* sender,
+ const gfx::Point& press_pt,
+ const gfx::Point& p);
+
+ // Overridden from LocationBar:
+ 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 {
+ return location_entry_.get();
+ }
+ virtual AutocompleteEditView* location_entry() {
+ return location_entry_.get();
+ }
+ virtual LocationBarTesting* GetLocationBarForTesting() { return this; }
+
+ // Overridden from LocationBarTesting:
+ virtual int PageActionCount() { return page_action_views_.size(); }
+ virtual int PageActionVisibleCount();
+ virtual ExtensionAction* GetPageAction(size_t index);
+ virtual ExtensionAction* GetVisiblePageAction(size_t index);
+ virtual void TestPageActionPressed(size_t index);
+
+ // Overridden from TemplateURLModelObserver
+ virtual void OnTemplateURLModelChanged();
+
+ // Thickness of the left and right edges of the omnibox, in normal mode.
+ static const int kNormalHorizontalEdgeThickness;
+ // Thickness of the top and bottom edges of the omnibox.
+ static const int kVerticalEdgeThickness;
+ // Space between items in the location bar.
+ static const int kItemPadding;
+ // Space between items in the location bar when an extension keyword is
+ // showing.
+ static const int kExtensionItemPadding;
+ // Space between the edges and the items next to them.
+ static const int kEdgeItemPadding;
+ // Space between the edge and a bubble.
+ static const int kBubblePadding;
+
+ protected:
+ void Focus();
+
+ private:
+ typedef std::vector<ContentSettingImageView*> ContentSettingViews;
+
+ friend class PageActionImageView;
+ friend class PageActionWithBadgeView;
+ typedef std::vector<PageActionWithBadgeView*> PageActionViews;
+
+ // Returns the amount of horizontal space (in pixels) out of
+ // |location_bar_width| that is not taken up by the actual text in
+ // location_entry_.
+ int AvailableWidth(int location_bar_width);
+
+ // If |view| fits in |available_width|, it is made visible and positioned at
+ // the leading or trailing end of |bounds|, which are then shrunk
+ // appropriately. Otherwise |view| is made invisible.
+ // Note: |view| is expected to have already been positioned and sized
+ // vertically.
+ void LayoutView(views::View* view,
+ int padding,
+ int available_width,
+ bool leading,
+ gfx::Rect* bounds);
+
+ // Update the visibility state of the Content Blocked icons to reflect what is
+ // actually blocked on the current page.
+ void RefreshContentSettingViews();
+
+ // Delete all page action views that we have created.
+ void DeletePageActionViews();
+
+ // Update the views for the Page Actions, to reflect state changes for
+ // PageActions.
+ void RefreshPageActionViews();
+
+ // Sets the visibility of view to new_vis.
+ void ToggleVisibility(bool new_vis, views::View* view);
+
+#if defined(OS_WIN)
+ // Helper for the Mouse event handlers that does all the real work.
+ void OnMouseEvent(const views::MouseEvent& event, UINT msg);
+#endif
+
+ // Helper to show the first run info bubble.
+ void ShowFirstRunBubbleInternal(FirstRun::BubbleType bubble_type);
+
+ // Current profile. Not owned by us.
+ Profile* profile_;
+
+ // The Autocomplete Edit field.
+#if defined(OS_WIN)
+ scoped_ptr<AutocompleteEditViewWin> location_entry_;
+#else
+ scoped_ptr<AutocompleteEditViewGtk> location_entry_;
+#endif
+
+ // The CommandUpdater for the Browser object that corresponds to this View.
+ CommandUpdater* command_updater_;
+
+ // The model.
+ ToolbarModel* model_;
+
+ // Our delegate.
+ Delegate* delegate_;
+
+ // This is the string of text from the autocompletion session that the user
+ // entered or selected.
+ 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_;
+
+ // Font used by edit and some of the hints.
+ gfx::Font font_;
+
+ // An object used to paint the normal-mode background.
+ scoped_ptr<views::HorizontalPainter> painter_;
+
+ // An icon to the left of the edit field.
+ LocationIconView* location_icon_view_;
+
+ // A bubble displayed for EV HTTPS sites.
+ EVBubbleView* ev_bubble_view_;
+
+ // Location_entry view wrapper
+ views::NativeViewHost* location_entry_view_;
+
+ // The following views are used to provide hints and remind the user as to
+ // what is going in the edit. They are all added a children of the
+ // LocationBarView. At most one is visible at a time. Preference is
+ // given to the keyword_view_, then hint_view_.
+ // These autocollapse when the edit needs the room.
+
+ // Shown if the user has selected a keyword.
+ SelectedKeywordView* selected_keyword_view_;
+
+ // View responsible for showing suggested text. This is NULL when there is no
+ // suggested text.
+ views::Label* suggested_text_view_;
+
+ // Shown if the selected url has a corresponding keyword.
+ KeywordHintView* keyword_hint_view_;
+
+ // The content setting views.
+ ContentSettingViews content_setting_views_;
+
+ // The page action icon views.
+ PageActionViews page_action_views_;
+
+ // The star.
+ StarView* star_view_;
+
+ // The mode that dictates how the bar shows.
+ Mode mode_;
+
+ // True if we should show a focus rect while the location entry field is
+ // focused. Used when the toolbar is in full keyboard accessibility mode.
+ bool show_focus_rect_;
+
+ // Whether bubble text is short or long.
+ FirstRun::BubbleType bubble_type_;
+
+ // This is in case we're destroyed before the model loads. We store the model
+ // because calling profile_->GetTemplateURLModel() in the destructor causes a
+ // crash.
+ TemplateURLModel* template_url_model_;
+
+#if defined(OS_LINUX)
+ scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
+#endif
+
+ // Should instant be updated? This is set to false in OnAutocompleteWillAccept
+ // and true in OnAutocompleteAccept. This is needed as prior to accepting an
+ // autocomplete suggestion the model is reverted which triggers resetting
+ // instant.
+ bool update_instant_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_
diff --git a/chrome/browser/views/location_bar/location_icon_view.cc b/chrome/browser/ui/views/location_bar/location_icon_view.cc
index b862559..b862559 100644
--- a/chrome/browser/views/location_bar/location_icon_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_icon_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_icon_view.h b/chrome/browser/ui/views/location_bar/location_icon_view.h
new file mode 100644
index 0000000..02813c5
--- /dev/null
+++ b/chrome/browser/ui/views/location_bar/location_icon_view.h
@@ -0,0 +1,35 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_LOCATION_BAR_LOCATION_ICON_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_ICON_VIEW_H_
+#pragma once
+
+#include "chrome/browser/views/location_bar/click_handler.h"
+#include "views/controls/image_view.h"
+
+class LocationBarView;
+namespace views {
+class MouseEvent;
+}
+
+// LocationIconView is used to display an icon to the left of the edit field.
+// This shows the user's current action while editing, the page security
+// status on https pages, or a globe for other URLs.
+class LocationIconView : public views::ImageView {
+ public:
+ explicit LocationIconView(const LocationBarView* location_bar);
+ virtual ~LocationIconView();
+
+ // Overridden from view.
+ virtual bool OnMousePressed(const views::MouseEvent& event);
+ virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
+
+ private:
+ ClickHandler click_handler_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(LocationIconView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_ICON_VIEW_H_
diff --git a/chrome/browser/views/location_bar/page_action_image_view.cc b/chrome/browser/ui/views/location_bar/page_action_image_view.cc
index c7155bf..c7155bf 100644
--- a/chrome/browser/views/location_bar/page_action_image_view.cc
+++ b/chrome/browser/ui/views/location_bar/page_action_image_view.cc
diff --git a/chrome/browser/ui/views/location_bar/page_action_image_view.h b/chrome/browser/ui/views/location_bar/page_action_image_view.h
new file mode 100644
index 0000000..c7b9851
--- /dev/null
+++ b/chrome/browser/ui/views/location_bar/page_action_image_view.h
@@ -0,0 +1,113 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_
+#pragma once
+
+#include <map>
+#include <string>
+
+#include "base/scoped_ptr.h"
+#include "chrome/browser/extensions/image_loading_tracker.h"
+#include "chrome/browser/extensions/extension_context_menu_model.h"
+#include "chrome/browser/views/extensions/extension_popup.h"
+#include "views/controls/image_view.h"
+
+class LocationBarView;
+namespace views {
+class Menu2;
+};
+
+// PageActionImageView is used by the LocationBarView to display the icon for a
+// given PageAction and notify the extension when the icon is clicked.
+class PageActionImageView : public views::ImageView,
+ public ImageLoadingTracker::Observer,
+ public ExtensionContextMenuModel::PopupDelegate,
+ public ExtensionPopup::Observer {
+ public:
+ PageActionImageView(LocationBarView* owner,
+ Profile* profile,
+ ExtensionAction* page_action);
+ virtual ~PageActionImageView();
+
+ ExtensionAction* page_action() { return page_action_; }
+
+ int current_tab_id() { return current_tab_id_; }
+
+ void set_preview_enabled(bool preview_enabled) {
+ preview_enabled_ = preview_enabled;
+ }
+
+ // Overridden from view.
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+ virtual bool OnMousePressed(const views::MouseEvent& event);
+ virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
+ virtual bool OnKeyPressed(const views::KeyEvent& e);
+ virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture);
+
+ // Overridden from ImageLoadingTracker.
+ virtual void OnImageLoaded(
+ SkBitmap* image, ExtensionResource resource, int index);
+
+ // Overridden from ExtensionContextMenuModelModel::Delegate
+ virtual void InspectPopup(ExtensionAction* action);
+
+ // Overridden from ExtensionPopup::Observer
+ virtual void ExtensionPopupIsClosing(ExtensionPopup* popup);
+
+ // 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, const GURL& url);
+
+ // Either notify listeners or show a popup depending on the page action.
+ void ExecuteAction(int button, bool inspect_with_devtools);
+
+ private:
+ // Hides the active popup, if there is one.
+ void HidePopup();
+
+ // The location bar view that owns us.
+ LocationBarView* 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 bitmaps the page actions might need to show, mapped by path.
+ typedef std::map<std::string, SkBitmap> PageActionMap;
+ PageActionMap page_action_icons_;
+
+ // The context menu for this page action.
+ scoped_refptr<ExtensionContextMenuModel> context_menu_contents_;
+ scoped_ptr<views::Menu2> context_menu_menu_;
+
+ // The object that is waiting for the image loading to complete
+ // asynchronously.
+ ImageLoadingTracker tracker_;
+
+ // 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_;
+
+ // The string to show for a tooltip;
+ std::string tooltip_;
+
+ // 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 current popup and the button it came from. NULL if no popup.
+ ExtensionPopup* popup_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(PageActionImageView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_
diff --git a/chrome/browser/views/location_bar/page_action_with_badge_view.cc b/chrome/browser/ui/views/location_bar/page_action_with_badge_view.cc
index fd2204e..fd2204e 100644
--- a/chrome/browser/views/location_bar/page_action_with_badge_view.cc
+++ b/chrome/browser/ui/views/location_bar/page_action_with_badge_view.cc
diff --git a/chrome/browser/ui/views/location_bar/page_action_with_badge_view.h b/chrome/browser/ui/views/location_bar/page_action_with_badge_view.h
new file mode 100644
index 0000000..951516f
--- /dev/null
+++ b/chrome/browser/ui/views/location_bar/page_action_with_badge_view.h
@@ -0,0 +1,37 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_LOCATION_BAR_PAGE_ACTION_WITH_BADGE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_WITH_BADGE_VIEW_H_
+#pragma once
+
+#include "gfx/size.h"
+#include "views/view.h"
+
+class GURL;
+class PageActionImageView;
+class TabContents;
+
+// A container for the PageActionImageView plus its badge.
+class PageActionWithBadgeView : public views::View {
+ public:
+ explicit PageActionWithBadgeView(PageActionImageView* image_view);
+
+ PageActionImageView* image_view() { return image_view_; }
+
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+ virtual gfx::Size GetPreferredSize();
+
+ void UpdateVisibility(TabContents* contents, const GURL& url);
+
+ private:
+ virtual void Layout();
+
+ // The button this view contains.
+ PageActionImageView* image_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(PageActionWithBadgeView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_WITH_BADGE_VIEW_H_
diff --git a/chrome/browser/views/location_bar/selected_keyword_view.cc b/chrome/browser/ui/views/location_bar/selected_keyword_view.cc
index 182015b..182015b 100644
--- a/chrome/browser/views/location_bar/selected_keyword_view.cc
+++ b/chrome/browser/ui/views/location_bar/selected_keyword_view.cc
diff --git a/chrome/browser/ui/views/location_bar/selected_keyword_view.h b/chrome/browser/ui/views/location_bar/selected_keyword_view.h
new file mode 100644
index 0000000..3e274ce
--- /dev/null
+++ b/chrome/browser/ui/views/location_bar/selected_keyword_view.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_LOCATION_BAR_SELECTED_KEYWORD_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SELECTED_KEYWORD_VIEW_H_
+#pragma once
+
+#include <string>
+
+#include "chrome/browser/views/location_bar/icon_label_bubble_view.h"
+#include "views/controls/label.h"
+
+class Profile;
+namespace gfx {
+class Font;
+class Size;
+}
+
+// SelectedKeywordView displays the tab-to-search UI in the location bar view.
+class SelectedKeywordView : public IconLabelBubbleView {
+ public:
+ SelectedKeywordView(const int background_images[],
+ int contained_image,
+ const SkColor& color,
+ Profile* profile);
+ virtual ~SelectedKeywordView();
+
+ void SetFont(const gfx::Font& font);
+
+ virtual gfx::Size GetPreferredSize();
+ virtual gfx::Size GetMinimumSize();
+ virtual void Layout();
+
+ // The current keyword, or an empty string if no keyword is displayed.
+ void SetKeyword(const std::wstring& keyword);
+ std::wstring keyword() const { return keyword_; }
+
+ void set_profile(Profile* profile) { profile_ = profile; }
+
+ private:
+ // The keyword we're showing. If empty, no keyword is selected.
+ // NOTE: we don't cache the TemplateURL as it is possible for it to get
+ // deleted out from under us.
+ std::wstring keyword_;
+
+ // These labels are never visible. They are used to size the view. One
+ // label contains the complete description of the keyword, the second
+ // contains a truncated version of the description, for if there is not
+ // enough room to display the complete description.
+ views::Label full_label_;
+ views::Label partial_label_;
+
+ Profile* profile_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(SelectedKeywordView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SELECTED_KEYWORD_VIEW_H_
diff --git a/chrome/browser/views/location_bar/star_view.cc b/chrome/browser/ui/views/location_bar/star_view.cc
index 7d22441..7d22441 100644
--- a/chrome/browser/views/location_bar/star_view.cc
+++ b/chrome/browser/ui/views/location_bar/star_view.cc
diff --git a/chrome/browser/ui/views/location_bar/star_view.h b/chrome/browser/ui/views/location_bar/star_view.h
new file mode 100644
index 0000000..2ea7b35
--- /dev/null
+++ b/chrome/browser/ui/views/location_bar/star_view.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_LOCATION_BAR_STAR_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_VIEW_H_
+#pragma once
+
+#include "chrome/browser/views/info_bubble.h"
+#include "views/controls/image_view.h"
+
+class CommandUpdater;
+class InfoBubble;
+
+namespace views {
+class KeyEvent;
+class MouseEvent;
+}
+
+class StarView : public views::ImageView, public InfoBubbleDelegate {
+ public:
+ explicit StarView(CommandUpdater* command_updater);
+ virtual ~StarView();
+
+ // Toggles the star on or off.
+ void SetToggled(bool on);
+
+ private:
+ // views::ImageView overrides:
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+ virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip);
+ virtual bool OnMousePressed(const views::MouseEvent& event);
+ virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
+ virtual bool OnKeyPressed(const views::KeyEvent& e);
+
+ // InfoBubbleDelegate overrides:
+ virtual void InfoBubbleClosing(InfoBubble* info_bubble,
+ bool closed_by_escape);
+ virtual bool CloseOnEscape();
+ virtual bool FadeInOnShow() { return false; }
+
+ // The CommandUpdater for the Browser object that owns the location bar.
+ CommandUpdater* command_updater_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(StarView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_VIEW_H_
diff --git a/chrome/browser/views/login_view.cc b/chrome/browser/ui/views/login_view.cc
index 3bf2403..3bf2403 100644
--- a/chrome/browser/views/login_view.cc
+++ b/chrome/browser/ui/views/login_view.cc
diff --git a/chrome/browser/ui/views/login_view.h b/chrome/browser/ui/views/login_view.h
new file mode 100644
index 0000000..0a345bf
--- /dev/null
+++ b/chrome/browser/ui/views/login_view.h
@@ -0,0 +1,82 @@
+// Copyright (c) 2006-2008 The Chromium 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_VIEWS_LOGIN_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_LOGIN_VIEW_H_
+#pragma once
+
+#include "base/task.h"
+#include "chrome/browser/login_model.h"
+#include "views/view.h"
+
+namespace views {
+class Label;
+class Textfield;
+class LoginModel;
+} // namespace views
+
+// This class is responsible for displaying the contents of a login window
+// for HTTP/FTP authentication.
+class LoginView : public views::View, public LoginModelObserver {
+ public:
+ // |focus_view| indicates if the view can be focused.
+ LoginView(const std::wstring& explanation, bool focus_view);
+ virtual ~LoginView();
+
+ // Access the data in the username/password text fields.
+ std::wstring GetUsername();
+ std::wstring GetPassword();
+
+ // LoginModelObserver implementation.
+ virtual void OnAutofillDataAvailable(const std::wstring& username,
+ const std::wstring& password);
+
+ // Sets the model. This lets the observer notify the model
+ // when it has been closed / freed, so the model should no longer try and
+ // contact it. The view does not own the model, and it is the responsibility
+ // of the caller to inform this view if the model is deleted.
+ void SetModel(LoginModel* model);
+
+ virtual void RequestFocus();
+
+ protected:
+ // views::View overrides:
+ virtual void ViewHierarchyChanged(bool is_add, views::View *parent,
+ views::View *child);
+
+ virtual void NativeViewHierarchyChanged(bool attached,
+ gfx::NativeView native_view,
+ views::RootView* root_view);
+
+ private:
+ void FocusFirstField();
+
+ // Non-owning refs to the input text fields.
+ views::Textfield* username_field_;
+ views::Textfield* password_field_;
+
+ // Button labels
+ views::Label* username_label_;
+ views::Label* password_label_;
+
+ // Authentication message.
+ views::Label* message_label_;
+
+ // If not null, points to a model we need to notify of our own destruction
+ // so it doesn't try and access this when its too late.
+ LoginModel* login_model_;
+
+ ScopedRunnableMethodFactory<LoginView> focus_grabber_factory_;
+
+ // See description above constructor.
+ const bool focus_view_;
+
+ // Indicates that this view was created when focus manager was unavailable
+ // (on the hidden tab, for example). This is only used if focus_view_ is true.
+ bool focus_delayed_;
+
+ DISALLOW_COPY_AND_ASSIGN(LoginView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_LOGIN_VIEW_H_
diff --git a/chrome/browser/views/modal_dialog_delegate.cc b/chrome/browser/ui/views/modal_dialog_delegate.cc
index a08d611..a08d611 100644
--- a/chrome/browser/views/modal_dialog_delegate.cc
+++ b/chrome/browser/ui/views/modal_dialog_delegate.cc
diff --git a/chrome/browser/ui/views/modal_dialog_delegate.h b/chrome/browser/ui/views/modal_dialog_delegate.h
new file mode 100644
index 0000000..d03efc7
--- /dev/null
+++ b/chrome/browser/ui/views/modal_dialog_delegate.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_MODAL_DIALOG_DELEGATE_H_
+#define CHROME_BROWSER_UI_VIEWS_MODAL_DIALOG_DELEGATE_H_
+#pragma once
+
+#include "views/window/dialog_delegate.h"
+
+namespace views {
+class Window;
+}
+
+class ModalDialogDelegate : public views::DialogDelegate {
+ public:
+ virtual ~ModalDialogDelegate() {}
+ // Methods called from AppModalDialog.
+ virtual gfx::NativeWindow GetDialogRootWindow() = 0;
+ virtual void ShowModalDialog();
+ virtual void ActivateModalDialog();
+ virtual void CloseModalDialog();
+ protected:
+ ModalDialogDelegate();
+
+ // The dialog if it is currently visible.
+ views::Window* dialog_;
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_MODAL_DIALOG_DELEGATE_H_
+
diff --git a/chrome/browser/views/notifications/balloon_view.cc b/chrome/browser/ui/views/notifications/balloon_view.cc
index cf0442b..cf0442b 100644
--- a/chrome/browser/views/notifications/balloon_view.cc
+++ b/chrome/browser/ui/views/notifications/balloon_view.cc
diff --git a/chrome/browser/ui/views/notifications/balloon_view.h b/chrome/browser/ui/views/notifications/balloon_view.h
new file mode 100644
index 0000000..994075d
--- /dev/null
+++ b/chrome/browser/ui/views/notifications/balloon_view.h
@@ -0,0 +1,171 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_NOTIFICATIONS_BALLOON_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_NOTIFICATIONS_BALLOON_VIEW_H_
+#pragma once
+
+#include "app/slide_animation.h"
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "base/task.h"
+#include "chrome/browser/notifications/balloon.h"
+#include "chrome/browser/views/notifications/balloon_view_host.h"
+#include "chrome/common/notification_registrar.h"
+#include "chrome/common/notification_service.h"
+#include "gfx/path.h"
+#include "gfx/point.h"
+#include "gfx/rect.h"
+#include "gfx/size.h"
+#include "views/controls/button/menu_button.h"
+#include "views/controls/label.h"
+#include "views/controls/menu/view_menu_delegate.h"
+#include "views/view.h"
+#include "views/widget/widget_delegate.h"
+
+namespace views {
+class ButtonListener;
+class ImageButton;
+class ImagePainter;
+class TextButton;
+class WidgetWin;
+class Menu2;
+} // namespace views
+
+class BalloonCollection;
+class NotificationDetails;
+class NotificationOptionsMenuModel;
+class NotificationSource;
+
+// A balloon view is the UI component for a desktop notification toasts.
+// It draws a border, and within the border an HTML renderer.
+class BalloonViewImpl : public BalloonView,
+ public views::View,
+ public views::ViewMenuDelegate,
+ public views::WidgetDelegate,
+ public views::ButtonListener,
+ public NotificationObserver,
+ public 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 { return html_contents_.get(); }
+
+ private:
+ // views::View interface.
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual void DidChangeBounds(const gfx::Rect& previous,
+ const gfx::Rect& current);
+ virtual gfx::Size GetPreferredSize() {
+ return gfx::Size(1000, 1000);
+ }
+
+ // views::ViewMenuDelegate interface.
+ void RunMenu(views::View* source, const gfx::Point& pt);
+
+ // views::WidgetDelegate interface.
+ void DisplayChanged();
+ void WorkAreaChanged();
+
+ // views::ButtonListener interface.
+ virtual void ButtonPressed(views::Button* sender, const views::Event&);
+
+ // NotificationObserver interface.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // AnimationDelegate interface.
+ virtual void AnimationProgressed(const Animation* animation);
+
+ // Launches the options menu at screen coordinates |pt|.
+ void RunOptionsMenu(const gfx::Point& pt);
+
+ // Initializes the options menu.
+ void CreateOptionsMenu();
+
+ // Masks the contents to fit within the frame.
+ void GetContentsMask(const gfx::Rect& contents_rect, gfx::Path* path) const;
+
+ // Masks the frame for the rounded corners of the shadow-bubble.
+ void GetFrameMask(const gfx::Rect&, gfx::Path* path) const;
+
+ // Adjust the contents window size to be appropriate for the frame.
+ void SizeContentsWindow();
+
+ // 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 height of the part of the frame around the balloon.
+ int GetBalloonFrameHeight() const;
+
+ int GetTotalWidth() const;
+ int GetTotalHeight() const;
+
+ gfx::Rect GetCloseButtonBounds() const;
+ gfx::Rect GetOptionsButtonBounds() const;
+ gfx::Rect GetLabelBounds() 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;
+
+ // Non-owned pointer to the balloon which owns this object.
+ Balloon* balloon_;
+
+ // Non-owned pointer to the balloon collection this is a part of.
+ BalloonCollection* collection_;
+
+ // The window that contains the frame of the notification.
+ // Pointer owned by the View subclass.
+ views::Widget* frame_container_;
+
+ // The window that contains the contents of the notification.
+ // Pointer owned by the View subclass.
+ views::Widget* 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_;
+
+ // Pointer to sub-view is owned by the View sub-class.
+ views::ImageButton* close_button_;
+
+ // Pointer to sub-view is owned by View class.
+ views::Label* source_label_;
+
+ // An animation to move the balloon on the screen as its position changes.
+ scoped_ptr<SlideAnimation> animation_;
+ gfx::Rect anim_frame_start_;
+ gfx::Rect anim_frame_end_;
+
+ // The options menu.
+ scoped_ptr<NotificationOptionsMenuModel> options_menu_model_;
+ scoped_ptr<views::Menu2> options_menu_menu_;
+ views::MenuButton* options_menu_button_;
+
+ NotificationRegistrar notification_registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(BalloonViewImpl);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_NOTIFICATIONS_BALLOON_VIEW_H_
diff --git a/chrome/browser/views/notifications/balloon_view_host.cc b/chrome/browser/ui/views/notifications/balloon_view_host.cc
index 24a7fe2..24a7fe2 100644
--- a/chrome/browser/views/notifications/balloon_view_host.cc
+++ b/chrome/browser/ui/views/notifications/balloon_view_host.cc
diff --git a/chrome/browser/ui/views/notifications/balloon_view_host.h b/chrome/browser/ui/views/notifications/balloon_view_host.h
new file mode 100644
index 0000000..a2f6663
--- /dev/null
+++ b/chrome/browser/ui/views/notifications/balloon_view_host.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_NOTIFICATIONS_BALLOON_VIEW_HOST_H_
+#define CHROME_BROWSER_UI_VIEWS_NOTIFICATIONS_BALLOON_VIEW_HOST_H_
+#pragma once
+
+#include "chrome/browser/notifications/balloon_host.h"
+#include "views/controls/native/native_view_host.h"
+
+// 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);
+
+ virtual ~BalloonViewHost() {
+ Shutdown();
+ }
+
+ void SetPreferredSize(const gfx::Size& size) {
+ native_host_->SetPreferredSize(size);
+ }
+
+ // Accessors.
+ views::View* view() {
+ return native_host_;
+ }
+
+ gfx::NativeView native_view() const {
+ return native_host_->native_view();
+ }
+
+ // Initialize the view, parented to |parent|, and show it.
+ void Init(gfx::NativeView parent);
+
+ protected:
+ virtual void InitRenderWidgetHostView();
+ virtual RenderWidgetHostView* render_widget_host_view() const {
+ return render_widget_host_view_;
+ }
+
+ private:
+ // The platform-specific widget host view. Pointer is owned by the RVH.
+ RenderWidgetHostView* render_widget_host_view_;
+
+ // The views-specific host view. Pointer owned by the views hierarchy.
+ views::NativeViewHost* native_host_;
+
+ // The handle to the parent view.
+ gfx::NativeView parent_native_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(BalloonViewHost);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_NOTIFICATIONS_BALLOON_VIEW_HOST_H_
diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/ui/views/options/advanced_contents_view.cc
index b8513b6..b8513b6 100644
--- a/chrome/browser/views/options/advanced_contents_view.cc
+++ b/chrome/browser/ui/views/options/advanced_contents_view.cc
diff --git a/chrome/browser/ui/views/options/advanced_contents_view.h b/chrome/browser/ui/views/options/advanced_contents_view.h
new file mode 100644
index 0000000..7671e9b
--- /dev/null
+++ b/chrome/browser/ui/views/options/advanced_contents_view.h
@@ -0,0 +1,39 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_ADVANCED_CONTENTS_VIEW_H__
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_ADVANCED_CONTENTS_VIEW_H__
+#pragma once
+
+#include "chrome/browser/views/options/options_page_view.h"
+
+class AdvancedContentsView;
+namespace views {
+class ScrollView;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// AdvancedScrollViewContainer
+//
+// A View that contains a scroll view containing the Advanced options.
+
+class AdvancedScrollViewContainer : public views::View {
+ public:
+ explicit AdvancedScrollViewContainer(Profile* profile);
+ virtual ~AdvancedScrollViewContainer();
+
+ // views::View overrides:
+ virtual void Layout();
+
+ private:
+ // The contents of the advanced scroll view.
+ AdvancedContentsView* contents_view_;
+
+ // The scroll view that contains the advanced options.
+ views::ScrollView* scroll_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(AdvancedScrollViewContainer);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_ADVANCED_CONTENTS_VIEW_H__
diff --git a/chrome/browser/views/options/advanced_page_view.cc b/chrome/browser/ui/views/options/advanced_page_view.cc
index 712955c..712955c 100644
--- a/chrome/browser/views/options/advanced_page_view.cc
+++ b/chrome/browser/ui/views/options/advanced_page_view.cc
diff --git a/chrome/browser/ui/views/options/advanced_page_view.h b/chrome/browser/ui/views/options/advanced_page_view.h
new file mode 100644
index 0000000..5769be9
--- /dev/null
+++ b/chrome/browser/ui/views/options/advanced_page_view.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_ADVANCED_PAGE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_ADVANCED_PAGE_VIEW_H_
+#pragma once
+
+#include "chrome/browser/views/options/options_page_view.h"
+#include "views/controls/button/button.h"
+
+class AdvancedOptionsListModel;
+class AdvancedScrollViewContainer;
+class PrefService;
+namespace views {
+class NativeButton;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// AdvancedPageView
+
+class AdvancedPageView : public OptionsPageView,
+ public views::ButtonListener {
+ public:
+ explicit AdvancedPageView(Profile* profile);
+ virtual ~AdvancedPageView();
+
+ // Resets all prefs to their default values.
+ void ResetToDefaults();
+
+ // views::ButtonListener implementation:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ protected:
+ // OptionsPageView implementation:
+ virtual void InitControlLayout();
+
+ private:
+ // Controls for the Advanced page
+ AdvancedScrollViewContainer* advanced_scroll_view_;
+ views::NativeButton* reset_to_default_button_;
+
+ DISALLOW_COPY_AND_ASSIGN(AdvancedPageView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_ADVANCED_PAGE_VIEW_H_
diff --git a/chrome/browser/views/options/content_exceptions_table_view.cc b/chrome/browser/ui/views/options/content_exceptions_table_view.cc
index 1b81aa1..1b81aa1 100644
--- a/chrome/browser/views/options/content_exceptions_table_view.cc
+++ b/chrome/browser/ui/views/options/content_exceptions_table_view.cc
diff --git a/chrome/browser/ui/views/options/content_exceptions_table_view.h b/chrome/browser/ui/views/options/content_exceptions_table_view.h
new file mode 100644
index 0000000..f0b8dc2
--- /dev/null
+++ b/chrome/browser/ui/views/options/content_exceptions_table_view.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_CONTENT_EXCEPTIONS_TABLE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_CONTENT_EXCEPTIONS_TABLE_VIEW_H_
+#pragma once
+
+#include "chrome/browser/content_exceptions_table_model.h"
+#include "views/controls/table/table_view.h"
+
+// A thin wrapper around TableView that displays off-the-record entries in
+// italics.
+class ContentExceptionsTableView : public views::TableView {
+ public:
+ ContentExceptionsTableView(ContentExceptionsTableModel* model,
+ const std::vector<TableColumn>& columns);
+
+ virtual ~ContentExceptionsTableView() {}
+
+ private:
+ virtual bool GetCellColors(int model_row,
+ int column,
+ ItemColor* foreground,
+ ItemColor* background,
+ LOGFONT* logfont);
+
+ ContentExceptionsTableModel* exceptions_;
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_CONTENT_EXCEPTIONS_TABLE_VIEW_H_
diff --git a/chrome/browser/views/options/content_filter_page_view.cc b/chrome/browser/ui/views/options/content_filter_page_view.cc
index 756045f..756045f 100644
--- a/chrome/browser/views/options/content_filter_page_view.cc
+++ b/chrome/browser/ui/views/options/content_filter_page_view.cc
diff --git a/chrome/browser/ui/views/options/content_filter_page_view.h b/chrome/browser/ui/views/options/content_filter_page_view.h
new file mode 100644
index 0000000..baa96d10
--- /dev/null
+++ b/chrome/browser/ui/views/options/content_filter_page_view.h
@@ -0,0 +1,49 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_CONTENT_FILTER_PAGE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_CONTENT_FILTER_PAGE_VIEW_H_
+#pragma once
+
+#include "chrome/browser/views/options/options_page_view.h"
+#include "chrome/common/content_settings_types.h"
+#include "views/controls/button/button.h"
+
+namespace views {
+class Label;
+class NativeButton;
+class RadioButton;
+}
+class PrefService;
+
+////////////////////////////////////////////////////////////////////////////////
+// The ContentFilterPageView class is used to render the Images, JavaScript,
+// Pop-ups and Location pages in the Content Settings window.
+
+class ContentFilterPageView : public OptionsPageView,
+ public views::ButtonListener {
+ public:
+ ContentFilterPageView(Profile* profile, ContentSettingsType content_type);
+ virtual ~ContentFilterPageView();
+
+ protected:
+ // OptionsPageView implementation:
+ virtual void InitControlLayout();
+
+ // views::ButtonListener implementation:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ private:
+ ContentSettingsType content_type_;
+
+ // Controls for the content filter tab page.
+ views::RadioButton* allow_radio_;
+ views::RadioButton* ask_radio_;
+ views::RadioButton* block_radio_;
+ views::NativeButton* exceptions_button_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ContentFilterPageView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_CONTENT_FILTER_PAGE_VIEW_H_
diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/ui/views/options/content_page_view.cc
index 7f50426..7f50426 100644
--- a/chrome/browser/views/options/content_page_view.cc
+++ b/chrome/browser/ui/views/options/content_page_view.cc
diff --git a/chrome/browser/ui/views/options/content_page_view.h b/chrome/browser/ui/views/options/content_page_view.h
new file mode 100644
index 0000000..45a7390
--- /dev/null
+++ b/chrome/browser/ui/views/options/content_page_view.h
@@ -0,0 +1,117 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_CONTENT_PAGE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_CONTENT_PAGE_VIEW_H_
+#pragma once
+
+#include "chrome/browser/autofill/personal_data_manager.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/views/options/options_page_view.h"
+#include "chrome/browser/views/confirm_message_box_dialog.h"
+#include "views/controls/button/button.h"
+#include "views/controls/link.h"
+#include "views/view.h"
+
+namespace views {
+class Checkbox;
+class Label;
+class NativeButton;
+class RadioButton;
+}
+class FileDisplayArea;
+class OptionsGroupView;
+class PrefService;
+
+////////////////////////////////////////////////////////////////////////////////
+// ContentPageView
+
+class ContentPageView : public OptionsPageView,
+ public views::LinkController,
+ public ProfileSyncServiceObserver,
+ public views::ButtonListener,
+ public ConfirmMessageBoxObserver {
+ public:
+ explicit ContentPageView(Profile* profile);
+ virtual ~ContentPageView();
+
+ // views::ButtonListener implementation:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // views::LinkController method.
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ // ConfirmMessageBoxObserver implementation.
+ virtual void OnConfirmMessageAccept();
+
+ // ProfileSyncServiceObserver method.
+ virtual void OnStateChanged();
+
+ protected:
+ // OptionsPageView implementation:
+ virtual void InitControlLayout();
+ virtual void NotifyPrefChanged(const std::string* pref_name);
+
+ // views::View overrides:
+ virtual void Layout();
+
+ private:
+ // Updates various sync controls based on the current sync state.
+ void UpdateSyncControls();
+
+ // Returns whether initialization of controls is done or not.
+ bool is_initialized() const {
+ // If initialization is already done, all the UI controls data members
+ // should be non-NULL. So check for one of them to determine if controls
+ // are already initialized or not.
+ return sync_group_ != NULL;
+ }
+
+ // Init all the dialog controls.
+ void InitPasswordSavingGroup();
+ void InitFormAutofillGroup();
+ void InitBrowsingDataGroup();
+ void InitThemesGroup();
+ void InitSyncGroup();
+
+ // Controls for the Password Saving group
+ views::NativeButton* show_passwords_button_;
+ OptionsGroupView* passwords_group_;
+ views::RadioButton* passwords_asktosave_radio_;
+ views::RadioButton* passwords_neversave_radio_;
+
+ // Controls for the Form Autofill group
+ views::NativeButton* change_autofill_settings_button_;
+ OptionsGroupView* form_autofill_group_;
+
+ // Controls for the Themes group
+ OptionsGroupView* themes_group_;
+ views::NativeButton* themes_reset_button_;
+ views::Link* themes_gallery_link_;
+
+ // Controls for the browsing data group.
+ OptionsGroupView* browsing_data_group_;
+ views::NativeButton* import_button_;
+
+ // Controls for the Sync group.
+ OptionsGroupView* sync_group_;
+ views::Label* sync_status_label_;
+ views::Link* sync_action_link_;
+ views::NativeButton* sync_start_stop_button_;
+ views::NativeButton* sync_customize_button_;
+ views::Link* privacy_dashboard_link_;
+
+ BooleanPrefMember ask_to_save_passwords_;
+ BooleanPrefMember form_autofill_enabled_;
+ StringPrefMember is_using_default_theme_;
+
+ // Cached pointer to ProfileSyncService, if it exists. Kept up to date
+ // and NULL-ed out on destruction.
+ ProfileSyncService* sync_service_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContentPageView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_CONTENT_PAGE_VIEW_H_
diff --git a/chrome/browser/views/options/content_settings_window_view.cc b/chrome/browser/ui/views/options/content_settings_window_view.cc
index 2a2146c..2a2146c 100644
--- a/chrome/browser/views/options/content_settings_window_view.cc
+++ b/chrome/browser/ui/views/options/content_settings_window_view.cc
diff --git a/chrome/browser/ui/views/options/content_settings_window_view.h b/chrome/browser/ui/views/options/content_settings_window_view.h
new file mode 100644
index 0000000..077aa50
--- /dev/null
+++ b/chrome/browser/ui/views/options/content_settings_window_view.h
@@ -0,0 +1,92 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_CONTENT_SETTINGS_WINDOW_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_CONTENT_SETTINGS_WINDOW_VIEW_H_
+#pragma once
+
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/common/content_settings_types.h"
+#include "views/controls/listbox/listbox.h"
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+
+class Profile;
+class MessageLoop;
+class OptionsPageView;
+
+namespace views {
+class Label;
+} // namespace views
+
+///////////////////////////////////////////////////////////////////////////////
+// ContentSettingsWindowView
+//
+// The contents of the Options dialog window.
+//
+class ContentSettingsWindowView : public views::View,
+ public views::DialogDelegate,
+ public views::Listbox::Listener {
+ public:
+ explicit ContentSettingsWindowView(Profile* profile);
+ virtual ~ContentSettingsWindowView();
+
+ // Shows the Tab corresponding to the specified Content Settings page.
+ void ShowContentSettingsTab(ContentSettingsType page);
+
+ protected:
+ // views::View overrides:
+ virtual void Layout();
+ virtual gfx::Size GetPreferredSize();
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+
+ // views::DialogDelegate implementation:
+ virtual int GetDialogButtons() const {
+ return MessageBoxFlags::DIALOGBUTTON_CANCEL;
+ }
+ virtual std::wstring GetWindowTitle() const;
+ virtual void WindowClosing();
+ virtual bool Cancel();
+ virtual views::View* GetContentsView();
+
+ // views::Listbox::Listener implementation:
+ virtual void ListboxSelectionChanged(views::Listbox* sender);
+
+ private:
+ // Initializes the view.
+ void Init();
+
+ // Makes |pages_[page]| the currently visible page.
+ void ShowSettingsPage(int page);
+
+ // Returns the currently selected OptionsPageView.
+ const OptionsPageView* GetCurrentContentSettingsTabView() const;
+
+ // The Profile associated with these options.
+ Profile* profile_;
+
+ // The label above the left box.
+ views::Label* label_;
+
+ // The listbox used to select a page.
+ views::Listbox* listbox_;
+
+ // The last page the user was on when they opened the Options window.
+ IntegerPrefMember last_selected_page_;
+
+ // Stores the index of the currently visible page.
+ int current_page_;
+
+ // Stores the possible content pages displayed on the right.
+ // |pages_[current_page_]| is the currently displayed page, and it's the only
+ // parented View in |pages_|.
+ std::vector<View*> pages_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContentSettingsWindowView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_CONTENT_SETTINGS_WINDOW_VIEW_H_
+
diff --git a/chrome/browser/views/options/cookie_filter_page_view.cc b/chrome/browser/ui/views/options/cookie_filter_page_view.cc
index d8ab81b..d8ab81b 100644
--- a/chrome/browser/views/options/cookie_filter_page_view.cc
+++ b/chrome/browser/ui/views/options/cookie_filter_page_view.cc
diff --git a/chrome/browser/ui/views/options/cookie_filter_page_view.h b/chrome/browser/ui/views/options/cookie_filter_page_view.h
new file mode 100644
index 0000000..68c494f
--- /dev/null
+++ b/chrome/browser/ui/views/options/cookie_filter_page_view.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_COOKIE_FILTER_PAGE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_COOKIE_FILTER_PAGE_VIEW_H_
+#pragma once
+
+#include "chrome/browser/views/options/content_filter_page_view.h"
+
+#include "chrome/browser/prefs/pref_member.h"
+
+namespace views {
+class Checkbox;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// CookieFilterPageView class is used to render the cookie content settings tab.
+
+class CookieFilterPageView : public ContentFilterPageView,
+ public views::LinkController {
+ public:
+ explicit CookieFilterPageView(Profile* profile);
+ virtual ~CookieFilterPageView();
+
+ private:
+ // Overridden from ContentFilterPageView:
+ virtual void InitControlLayout();
+
+ // OptionsPageView implementation:
+ virtual void NotifyPrefChanged(const std::string* pref_name);
+
+ // views::ButtonListener implementation:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Overridden from views::LinkController:
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ private:
+ // Controls for the cookie filter tab page view.
+ views::Checkbox* block_3rdparty_check_;
+ views::Checkbox* clear_on_close_check_;
+ views::NativeButton* show_cookies_button_;
+
+ // Clear locally stored site data on exit pref.
+ BooleanPrefMember clear_site_data_on_exit_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(CookieFilterPageView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_COOKIE_FILTER_PAGE_VIEW_H_
+
diff --git a/chrome/browser/views/options/cookies_view.cc b/chrome/browser/ui/views/options/cookies_view.cc
index 5e2b6d0..5e2b6d0 100644
--- a/chrome/browser/views/options/cookies_view.cc
+++ b/chrome/browser/ui/views/options/cookies_view.cc
diff --git a/chrome/browser/ui/views/options/cookies_view.h b/chrome/browser/ui/views/options/cookies_view.h
new file mode 100644
index 0000000..1d117f7
--- /dev/null
+++ b/chrome/browser/ui/views/options/cookies_view.h
@@ -0,0 +1,159 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_COOKIES_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_COOKIES_VIEW_H_
+#pragma once
+
+#include <string>
+
+#include "base/task.h"
+#include "chrome/browser/cookies_tree_model.h"
+#include "net/base/cookie_monster.h"
+#include "views/controls/button/button.h"
+#include "views/controls/tree/tree_view.h"
+#include "views/controls/textfield/textfield.h"
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+#include "views/window/window.h"
+
+namespace views {
+
+class Label;
+class NativeButton;
+
+} // namespace views
+
+
+class AppCacheInfoView;
+class CookieInfoView;
+class CookiesTreeView;
+class DatabaseInfoView;
+class IndexedDBInfoView;
+class LocalStorageInfoView;
+class Profile;
+class Timer;
+class TreeModel;
+class TreeModelNode;
+
+
+class CookiesView : public CookiesTreeModel::Observer,
+ public views::View,
+ public views::DialogDelegate,
+ public views::ButtonListener,
+ public views::TreeViewController,
+ public views::Textfield::Controller {
+ public:
+ // Show the Cookies Window, creating one if necessary.
+ static void ShowCookiesWindow(Profile* profile);
+
+ virtual ~CookiesView();
+
+ // Updates the display to show only the search results.
+ void UpdateSearchResults();
+
+ // 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.
+
+ // views::ButtonListener implementation.
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // views::TreeViewController implementation.
+ virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view);
+
+ // views::TreeViewController implementation.
+ virtual void OnTreeViewKeyDown(app::KeyboardCode keycode);
+
+ // views::Textfield::Controller implementation.
+ virtual void ContentsChanged(views::Textfield* sender,
+ const std::wstring& new_contents);
+ virtual bool HandleKeystroke(views::Textfield* sender,
+ const views::Textfield::Keystroke& key);
+
+ // views::WindowDelegate implementation.
+ virtual int GetDialogButtons() const {
+ return MessageBoxFlags::DIALOGBUTTON_CANCEL;
+ }
+ virtual views::View* GetInitiallyFocusedView() {
+ return search_field_;
+ }
+
+ virtual bool CanResize() const { return true; }
+ virtual std::wstring GetWindowTitle() const;
+ virtual void WindowClosing();
+ virtual views::View* GetContentsView();
+
+ // views::View overrides:
+ virtual void Layout();
+ virtual gfx::Size GetPreferredSize();
+
+ protected:
+ // views::View overrides:
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+
+ private:
+ class InfoPanelView;
+
+ // Use the static factory method to show.
+ explicit CookiesView(Profile* profile);
+
+ // Initialize the dialog contents and layout.
+ void Init();
+
+ // Resets the display to what it would be if there were no search query.
+ void ResetSearchQuery();
+
+ // Update the UI when there are no cookies.
+ void UpdateForEmptyState();
+
+ // Enable or disable the remove and remove all buttons.
+ void UpdateRemoveButtonsState();
+
+ // Updates view to be visible inside detailed_info_view_;
+ void UpdateVisibleDetailedInfo(views::View* view);
+
+ // Assorted dialog controls
+ views::Label* search_label_;
+ views::Textfield* search_field_;
+ views::NativeButton* clear_search_button_;
+ views::Label* description_label_;
+ CookiesTreeView* cookies_tree_;
+ InfoPanelView* info_panel_;
+ CookieInfoView* cookie_info_view_;
+ DatabaseInfoView* database_info_view_;
+ LocalStorageInfoView* local_storage_info_view_;
+ AppCacheInfoView* appcache_info_view_;
+ IndexedDBInfoView* indexed_db_info_view_;
+ views::NativeButton* remove_button_;
+ views::NativeButton* remove_all_button_;
+
+ // The Cookies Tree model
+ scoped_ptr<CookiesTreeModel> cookies_tree_model_;
+
+ // The Profile for which Cookies are displayed
+ Profile* profile_;
+
+ // 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> search_update_factory_;
+
+ // Our containing window. If this is non-NULL there is a visible Cookies
+ // window somewhere.
+ static views::Window* instance_;
+
+ DISALLOW_COPY_AND_ASSIGN(CookiesView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_COOKIES_VIEW_H_
diff --git a/chrome/browser/views/options/exception_editor_view.cc b/chrome/browser/ui/views/options/exception_editor_view.cc
index 93ca859..93ca859 100644
--- a/chrome/browser/views/options/exception_editor_view.cc
+++ b/chrome/browser/ui/views/options/exception_editor_view.cc
diff --git a/chrome/browser/ui/views/options/exception_editor_view.h b/chrome/browser/ui/views/options/exception_editor_view.h
new file mode 100644
index 0000000..571e29e
--- /dev/null
+++ b/chrome/browser/ui/views/options/exception_editor_view.h
@@ -0,0 +1,114 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_
+#pragma once
+
+#include <string>
+
+#include "chrome/browser/content_setting_combo_model.h"
+#include "chrome/browser/host_content_settings_map.h"
+#include "chrome/common/content_settings.h"
+#include "chrome/common/content_settings_types.h"
+#include "views/window/dialog_delegate.h"
+#include "views/controls/button/checkbox.h"
+#include "views/controls/combobox/combobox.h"
+#include "views/controls/textfield/textfield.h"
+
+namespace views {
+class ImageView;
+class Label;
+}
+
+class ContentExceptionsTableModel;
+
+// ExceptionEditorView is responsible for showing a dialog that allows the user
+// to create or edit a single content exception. If the user clicks ok the
+// delegate is notified and completes the edit.
+//
+// To use an ExceptionEditorView create one and invoke Show on it.
+// ExceptionEditorView is deleted when the dialog closes.
+class ExceptionEditorView : public views::View,
+ public views::Textfield::Controller,
+ public views::DialogDelegate {
+ public:
+ class Delegate {
+ public:
+ // Invoked when the user accepts the edit.
+ virtual void AcceptExceptionEdit(
+ const HostContentSettingsMap::Pattern& pattern,
+ ContentSetting setting,
+ bool is_off_the_record,
+ int index,
+ bool is_new) = 0;
+
+ protected:
+ virtual ~Delegate() {}
+ };
+
+ // Creates a new ExceptionEditorView with the supplied args. |index| is the
+ // index into the ContentExceptionsTableModel of the exception. This is not
+ // used by ExceptionEditorView but instead passed to the delegate.
+ ExceptionEditorView(Delegate* delegate,
+ ContentExceptionsTableModel* model,
+ bool allow_off_the_record,
+ int index,
+ const HostContentSettingsMap::Pattern& pattern,
+ ContentSetting setting,
+ bool is_off_the_record);
+ virtual ~ExceptionEditorView() {}
+
+ void Show(gfx::NativeWindow parent);
+
+ // views::DialogDelegate overrides.
+ virtual bool IsModal() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual bool IsDialogButtonEnabled(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool Cancel();
+ virtual bool Accept();
+ virtual views::View* GetContentsView();
+
+ // views::Textfield::Controller overrides. Updates whether the user can
+ // accept the dialog as well as updating image views showing whether value is
+ // valid.
+ virtual void ContentsChanged(views::Textfield* sender,
+ const std::wstring& new_contents);
+ virtual bool HandleKeystroke(views::Textfield* sender,
+ const views::Textfield::Keystroke& key);
+
+ private:
+ void Init();
+
+ views::Label* CreateLabel(int message_id);
+
+ // Returns true if we're adding a new item.
+ bool is_new() const { return index_ == -1; }
+
+ bool IsPatternValid(const HostContentSettingsMap::Pattern& pattern,
+ bool is_off_the_record) const;
+
+ void UpdateImageView(views::ImageView* image_view, bool is_valid);
+
+ Delegate* delegate_;
+ ContentExceptionsTableModel* model_;
+ ContentSettingComboModel cb_model_;
+
+ // Index of the item being edited. If -1, indices this is a new entry.
+ const bool allow_off_the_record_;
+ const int index_;
+ const HostContentSettingsMap::Pattern pattern_;
+ const ContentSetting setting_;
+ const bool is_off_the_record_;
+
+ views::Textfield* pattern_tf_;
+ views::ImageView* pattern_iv_;
+ views::Combobox* action_cb_;
+ views::Checkbox* incognito_cb_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExceptionEditorView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_
diff --git a/chrome/browser/views/options/exceptions_page_view.cc b/chrome/browser/ui/views/options/exceptions_page_view.cc
index 7788c5c..7788c5c 100644
--- a/chrome/browser/views/options/exceptions_page_view.cc
+++ b/chrome/browser/ui/views/options/exceptions_page_view.cc
diff --git a/chrome/browser/ui/views/options/exceptions_page_view.h b/chrome/browser/ui/views/options/exceptions_page_view.h
new file mode 100644
index 0000000..decb69b
--- /dev/null
+++ b/chrome/browser/ui/views/options/exceptions_page_view.h
@@ -0,0 +1,75 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_OPTIONS_EXCEPTIONS_PAGE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_EXCEPTIONS_PAGE_VIEW_H_
+#pragma once
+
+#include <vector>
+
+#include "chrome/browser/views/options/options_page_view.h"
+#include "chrome/browser/views/options/passwords_page_view.h"
+#include "views/controls/table/table_view_observer.h"
+
+class Profile;
+
+///////////////////////////////////////////////////////////////////////////////
+// ExceptionsTableModel
+class ExceptionsTableModel : public PasswordsTableModel {
+ public:
+ explicit ExceptionsTableModel(Profile* profile);
+ virtual ~ExceptionsTableModel();
+
+ // TableModel methods.
+ virtual std::wstring GetText(int row, int column);
+ virtual int CompareValues(int row1, int row2, int col_id);
+
+ // PasswordStoreConsumer implementation.
+ virtual void OnPasswordStoreRequestDone(
+ int handle, const std::vector<webkit_glue::PasswordForm*>& result);
+ // Request all logins data.
+ void GetAllExceptionsForProfile();
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// ExceptionsPageView
+class ExceptionsPageView : public OptionsPageView,
+ public views::TableViewObserver,
+ public views::ButtonListener,
+ public PasswordsTableModelObserver {
+ public:
+ explicit ExceptionsPageView(Profile* profile);
+ virtual ~ExceptionsPageView();
+
+ // views::TableViewObserverImplementation.
+ virtual void OnSelectionChanged();
+
+ // views::ButtonListener implementation.
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // PasswordsTableModelObserver implementation.
+ virtual void OnRowCountChanged(size_t rows);
+
+ protected:
+ virtual void InitControlLayout();
+
+ private:
+ // Helper to configure our buttons and labels.
+ void SetupButtons();
+
+ // Helper to configure our table view.
+ void SetupTable();
+
+ ExceptionsTableModel table_model_;
+ views::TableView* table_view_;
+
+ // The buttons and labels.
+ views::NativeButton remove_button_;
+ views::NativeButton remove_all_button_;
+ MultiLabelButtons show_button_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExceptionsPageView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_EXCEPTIONS_PAGE_VIEW_H_
diff --git a/chrome/browser/views/options/exceptions_view.cc b/chrome/browser/ui/views/options/exceptions_view.cc
index eadaf75..eadaf75 100644
--- a/chrome/browser/views/options/exceptions_view.cc
+++ b/chrome/browser/ui/views/options/exceptions_view.cc
diff --git a/chrome/browser/ui/views/options/exceptions_view.h b/chrome/browser/ui/views/options/exceptions_view.h
new file mode 100644
index 0000000..3624816
--- /dev/null
+++ b/chrome/browser/ui/views/options/exceptions_view.h
@@ -0,0 +1,117 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_EXCEPTIONS_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_EXCEPTIONS_VIEW_H_
+#pragma once
+
+#include <string>
+
+#include "chrome/browser/content_exceptions_table_model.h"
+#include "chrome/browser/views/options/exception_editor_view.h"
+#include "chrome/common/content_settings.h"
+#include "chrome/common/content_settings_types.h"
+#include "views/controls/button/button.h"
+#include "views/controls/table/table_view_observer.h"
+#include "views/window/dialog_delegate.h"
+
+class HostContentSettingsMap;
+
+namespace views {
+class NativeButton;
+class TableView;
+}
+
+// ExceptionsView is responsible for showing the user the set of content
+// exceptions for a specific type. The exceptions are shown in a table view
+// by way of a ContentExceptionsTableModel. The user can add/edit/remove
+// exceptions. Editing and creating new exceptions is done way of the
+// ExceptionEditorView.
+// Use the ShowExceptionsWindow method to create and show an ExceptionsView
+// for a specific type. ExceptionsView is deleted when the window closes.
+class ExceptionsView : public ExceptionEditorView::Delegate,
+ public views::View,
+ public views::ButtonListener,
+ public views::DialogDelegate,
+ public views::TableViewObserver {
+ public:
+ // Shows the Exceptions window.
+ static void ShowExceptionsWindow(gfx::NativeWindow parent,
+ HostContentSettingsMap* map,
+ HostContentSettingsMap* off_the_record_map,
+ ContentSettingsType content_type);
+
+ virtual ~ExceptionsView();
+
+ // TableViewObserver overrides:
+ virtual void OnSelectionChanged();
+ virtual void OnDoubleClick();
+ virtual void OnTableViewDelete(views::TableView* table_view);
+
+ // views::ButtonListener implementation.
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // views::View overrides:
+ virtual void Layout();
+ virtual gfx::Size GetPreferredSize();
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+
+ // views::WindowDelegate implementation.
+ virtual int GetDialogButtons() const {
+ return MessageBoxFlags::DIALOGBUTTON_CANCEL;
+ }
+ virtual bool CanResize() const { return true; }
+ virtual std::wstring GetWindowTitle() const;
+ virtual views::View* GetContentsView() { return this; }
+
+ // ExceptionEditorView::Delegate implementation.
+ virtual void AcceptExceptionEdit(
+ const HostContentSettingsMap::Pattern& pattern,
+ ContentSetting setting,
+ bool is_off_the_record,
+ int index,
+ bool is_new);
+
+ private:
+ ExceptionsView(HostContentSettingsMap* map,
+ HostContentSettingsMap* off_the_record_map,
+ ContentSettingsType type);
+
+ void Init();
+
+ // Resets the enabled state of the buttons from the model.
+ void UpdateButtonState();
+
+ // Adds a new item.
+ void Add();
+
+ // Edits the selected item.
+ void Edit();
+
+ // Removes the selected item.
+ void Remove();
+
+ // Removes all.
+ void RemoveAll();
+
+ // The model displayed in the table.
+ ContentExceptionsTableModel model_;
+
+ // True if the user can also add off the record entries.
+ bool allow_off_the_record_;
+
+ views::TableView* table_;
+
+ views::NativeButton* add_button_;
+ views::NativeButton* edit_button_;
+ views::NativeButton* remove_button_;
+ views::NativeButton* remove_all_button_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExceptionsView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_EXCEPTIONS_VIEW_H_
+
diff --git a/chrome/browser/views/options/fonts_languages_window_view.cc b/chrome/browser/ui/views/options/fonts_languages_window_view.cc
index cab82c7..cab82c7 100644
--- a/chrome/browser/views/options/fonts_languages_window_view.cc
+++ b/chrome/browser/ui/views/options/fonts_languages_window_view.cc
diff --git a/chrome/browser/ui/views/options/fonts_languages_window_view.h b/chrome/browser/ui/views/options/fonts_languages_window_view.h
new file mode 100644
index 0000000..65afe52
--- /dev/null
+++ b/chrome/browser/ui/views/options/fonts_languages_window_view.h
@@ -0,0 +1,74 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_OPTIONS_FONTS_LANGUAGES_WINDOW_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_FONTS_LANGUAGES_WINDOW_VIEW_H_
+#pragma once
+
+#include "chrome/browser/fonts_languages_window.h"
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+
+class Profile;
+class FontsPageView;
+class LanguagesPageView;
+
+namespace views {
+class TabbedPane;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// FontsLanguagesWindowView
+//
+// The contents of the "Fonts and Languages Preferences" dialog window.
+//
+class FontsLanguagesWindowView : public views::View,
+ public views::DialogDelegate {
+ public:
+ explicit FontsLanguagesWindowView(Profile* profile);
+ virtual ~FontsLanguagesWindowView();
+
+ // views::DialogDelegate implementation:
+ virtual bool Accept();
+
+ // views::WindowDelegate Methods:
+ virtual bool IsModal() const { return true; }
+ virtual std::wstring GetWindowTitle() const;
+ virtual views::View* GetContentsView();
+ virtual void WindowClosing();
+
+ // views::View overrides:
+ virtual void Layout();
+ virtual gfx::Size GetPreferredSize();
+
+ // Shows the tab corresponding to the specified |page|.
+ void ShowTabPage(FontsLanguagesPage page);
+
+ protected:
+ // views::View overrides:
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+ private:
+ // Init the assorted Tabbed pages
+ void Init();
+
+ // The Tab view that contains all of the options pages.
+ views::TabbedPane* tabs_;
+
+ // Fonts Page View handle remembered so that prefs is updated only when
+ // OK is pressed.
+ FontsPageView* fonts_page_;
+
+ // Languages Page View handle remembered so that prefs is updated only when
+ // OK is pressed.
+ LanguagesPageView* languages_page_;
+
+ // The Profile associated with these options.
+ Profile* profile_;
+
+ DISALLOW_COPY_AND_ASSIGN(FontsLanguagesWindowView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_FONTS_LANGUAGES_WINDOW_VIEW_H_
diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/ui/views/options/fonts_page_view.cc
index 3a98b15..3a98b15 100644
--- a/chrome/browser/views/options/fonts_page_view.cc
+++ b/chrome/browser/ui/views/options/fonts_page_view.cc
diff --git a/chrome/browser/ui/views/options/fonts_page_view.h b/chrome/browser/ui/views/options/fonts_page_view.h
new file mode 100644
index 0000000..7627aa7
--- /dev/null
+++ b/chrome/browser/ui/views/options/fonts_page_view.h
@@ -0,0 +1,130 @@
+// Copyright (c) 2006-2008 The Chromium 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_VIEWS_OPTIONS_FONTS_PAGE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_FONTS_PAGE_VIEW_H_
+#pragma once
+
+#include <string>
+
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/browser/shell_dialogs.h"
+#include "chrome/browser/views/options/options_page_view.h"
+#include "views/controls/combobox/combobox.h"
+#include "views/controls/button/button.h"
+#include "views/view.h"
+
+namespace views {
+class GroupboxView;
+class Label;
+class NativeButton;
+class TableView;
+}
+
+class DefaultEncodingComboboxModel;
+class FontDisplayView;
+class TableModel;
+
+///////////////////////////////////////////////////////////////////////////////
+// FontsPageView
+
+class FontsPageView : public OptionsPageView,
+ public views::Combobox::Listener,
+ public SelectFontDialog::Listener,
+ public views::ButtonListener {
+ public:
+ explicit FontsPageView(Profile* profile);
+
+ // views::ButtonListener implementation:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // views::Combobox::Listener implementation:
+ virtual void ItemChanged(views::Combobox* combo_box,
+ int prev_index,
+ int new_index);
+
+ // SelectFontDialog::Listener implementation:
+ virtual void FontSelected(const gfx::Font& font, void* params);
+
+ // Save Changes made to relevent pref members associated with this tab.
+ // This is public since it is called by FontsLanguageWindowView in its
+ // Dialog Delegate Accept() method.
+ void SaveChanges();
+
+ protected:
+ // OptionsPageView implementation:
+ virtual void InitControlLayout();
+ virtual void NotifyPrefChanged(const std::string* pref_name);
+
+ private:
+ enum FontTypeBeingChanged {
+ NONE,
+ SERIF,
+ SANS_SERIF,
+ FIXED_WIDTH
+ };
+
+ virtual ~FontsPageView();
+
+ // Init Dialog controls.
+ void InitFontLayout();
+ void InitEncodingLayout();
+
+ bool serif_button_pressed_;
+ bool sans_serif_button_pressed_;
+ bool fixed_width_button_pressed_;
+ bool encoding_dropdown_clicked_;
+
+ views::Label* fonts_group_title_;
+ views::Label* encoding_group_title_;
+
+ views::View* fonts_contents_;
+ views::View* encoding_contents_;
+
+ // Fonts settings.
+ // Select Font dialogs.
+ scoped_refptr<SelectFontDialog> select_font_dialog_;
+
+ // Buttons.
+ views::NativeButton* fixed_width_font_change_page_button_;
+ views::NativeButton* serif_font_change_page_button_;
+ views::NativeButton* sans_serif_font_change_page_button_;
+
+ // FontDisplayView objects to display selected font.
+ FontDisplayView* fixed_width_font_display_view_;
+ FontDisplayView* serif_font_display_view_;
+ FontDisplayView* sans_serif_font_display_view_;
+
+ // Labels to describe what is to be changed.
+ views::Label* fixed_width_font_label_;
+ views::Label* serif_font_label_;
+ views::Label* sans_serif_font_label_;
+
+ // Advanced Font names and sizes as PrefMembers.
+ StringPrefMember serif_name_;
+ StringPrefMember sans_serif_name_;
+ StringPrefMember fixed_width_name_;
+ IntegerPrefMember serif_size_;
+ IntegerPrefMember sans_serif_size_;
+ IntegerPrefMember fixed_width_size_;
+ int serif_font_size_pixel_;
+ int sans_serif_font_size_pixel_;
+ int fixed_width_font_size_pixel_;
+ StringPrefMember default_encoding_;
+ bool font_changed_;
+
+ // Windows font picker flag;
+ FontTypeBeingChanged font_type_being_changed_;
+
+ // Default Encoding.
+ scoped_ptr<DefaultEncodingComboboxModel> default_encoding_combobox_model_;
+ views::Label* default_encoding_combobox_label_;
+ views::Combobox* default_encoding_combobox_;
+ std::string default_encoding_selected_;
+ bool default_encoding_changed_;
+
+ DISALLOW_COPY_AND_ASSIGN(FontsPageView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_FONTS_PAGE_VIEW_H_
diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/ui/views/options/general_page_view.cc
index e7c4d3e..e7c4d3e 100644
--- a/chrome/browser/views/options/general_page_view.cc
+++ b/chrome/browser/ui/views/options/general_page_view.cc
diff --git a/chrome/browser/ui/views/options/general_page_view.h b/chrome/browser/ui/views/options/general_page_view.h
new file mode 100644
index 0000000..129fe5e
--- /dev/null
+++ b/chrome/browser/ui/views/options/general_page_view.h
@@ -0,0 +1,172 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_GENERAL_PAGE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_GENERAL_PAGE_VIEW_H_
+#pragma once
+
+#include "chrome/browser/prefs/pref_change_registrar.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/browser/shell_integration.h"
+#include "chrome/browser/views/options/options_page_view.h"
+#include "chrome/browser/views/url_picker.h"
+#include "views/controls/combobox/combobox.h"
+#include "views/controls/button/button.h"
+#include "views/controls/link.h"
+#include "views/controls/table/table_view_observer.h"
+#include "views/view.h"
+
+namespace views {
+class Checkbox;
+class GroupboxView;
+class Label;
+class NativeButton;
+class RadioButton;
+class TableView;
+class Textfield;
+}
+class CustomHomePagesTableModel;
+class OptionsGroupView;
+class SearchEngineListModel;
+class TableModel;
+
+///////////////////////////////////////////////////////////////////////////////
+// GeneralPageView
+
+class GeneralPageView : public OptionsPageView,
+ public views::Combobox::Listener,
+ public views::ButtonListener,
+ public views::Textfield::Controller,
+ public UrlPickerDelegate,
+ public views::TableViewObserver,
+ public ShellIntegration::DefaultBrowserObserver,
+ public views::LinkController {
+ public:
+ explicit GeneralPageView(Profile* profile);
+ virtual ~GeneralPageView();
+
+ protected:
+ // views::ButtonListener implementation:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // views::Combobox::Listener implementation:
+ virtual void ItemChanged(views::Combobox* combobox,
+ int prev_index,
+ int new_index);
+
+ // views::Textfield::Controller implementation:
+ virtual void ContentsChanged(views::Textfield* sender,
+ const std::wstring& new_contents);
+ virtual bool HandleKeystroke(views::Textfield* sender,
+ const views::Textfield::Keystroke& key);
+
+ // OptionsPageView implementation:
+ virtual void InitControlLayout();
+ virtual void NotifyPrefChanged(const std::string* pref_name);
+ virtual void HighlightGroup(OptionsGroup highlight_group);
+
+ // LinkController implementation:
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ private:
+ // ShellIntegration::DefaultBrowserObserver implementation:
+ // Updates the UI state to reflect the current default browser state.
+ virtual void SetDefaultBrowserUIState(
+ ShellIntegration::DefaultBrowserUIState state);
+
+ // For Side by Side installs, this will disable the Default Browser setting
+ // and display an explanitory message.
+ void SetDefaultBrowserUIStateForSxS();
+
+ // Init all the dialog controls
+ void InitStartupGroup();
+ void InitHomepageGroup();
+ void InitDefaultSearchGroup();
+ void InitDefaultBrowserGroup();
+
+ // Saves the startup preference from that of the ui.
+ void SaveStartupPref();
+
+ // Shows a dialog allowing the user to add a new URL to the set of URLs
+ // launched on startup.
+ void AddURLToStartupURLs();
+
+ // Removes the selected URL from the list of startup urls.
+ void RemoveURLsFromStartupURLs();
+
+ // Resets the list of urls to launch on startup from the list of open
+ // browsers.
+ void SetStartupURLToCurrentPage();
+
+ // Enables/Disables the controls associated with the custom start pages
+ // option if that preference is not selected.
+ void EnableCustomHomepagesControls(bool enable);
+
+ // UrlPickerDelegate. Adds the URL to the list of startup urls.
+ virtual void AddBookmark(UrlPicker* dialog,
+ const std::wstring& title,
+ const GURL& url);
+
+ // 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();
+
+ // Invoked when the selection of the table view changes. Updates the enabled
+ // property of the remove button.
+ virtual void OnSelectionChanged();
+
+ // 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);
+
+ // Sets the default search provider for the selected item in the combobox.
+ void SetDefaultSearchProvider();
+
+ // Controls for the Startup group
+ OptionsGroupView* startup_group_;
+ views::RadioButton* startup_homepage_radio_;
+ views::RadioButton* startup_last_session_radio_;
+ views::RadioButton* startup_custom_radio_;
+ views::NativeButton* startup_add_custom_page_button_;
+ views::NativeButton* startup_remove_custom_page_button_;
+ views::NativeButton* startup_use_current_page_button_;
+ views::TableView* startup_custom_pages_table_;
+ scoped_ptr<CustomHomePagesTableModel> startup_custom_pages_table_model_;
+
+ // Controls for the Home Page group
+ OptionsGroupView* homepage_group_;
+ views::RadioButton* homepage_use_newtab_radio_;
+ views::RadioButton* homepage_use_url_radio_;
+ views::Textfield* homepage_use_url_textfield_;
+ views::Checkbox* homepage_show_home_button_checkbox_;
+ BooleanPrefMember new_tab_page_is_home_page_;
+ StringPrefMember homepage_;
+ BooleanPrefMember show_home_button_;
+
+ // Controls for the Search group
+ OptionsGroupView* default_search_group_;
+ views::Combobox* default_search_engine_combobox_;
+ views::NativeButton* default_search_manage_engines_button_;
+ scoped_ptr<SearchEngineListModel> default_search_engines_model_;
+ views::Checkbox* instant_checkbox_;
+ views::Link* instant_link_;
+
+ // Controls for the Default Browser group
+ OptionsGroupView* default_browser_group_;
+ views::Label* default_browser_status_label_;
+ views::NativeButton* default_browser_use_as_default_button_;
+
+ // The helper object that performs default browser set/check tasks.
+ scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_;
+
+ PrefChangeRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(GeneralPageView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_GENERAL_PAGE_VIEW_H_
diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/ui/views/options/languages_page_view.cc
index 207841c..207841c 100644
--- a/chrome/browser/views/options/languages_page_view.cc
+++ b/chrome/browser/ui/views/options/languages_page_view.cc
diff --git a/chrome/browser/ui/views/options/languages_page_view.h b/chrome/browser/ui/views/options/languages_page_view.h
new file mode 100644
index 0000000..f6a1372
--- /dev/null
+++ b/chrome/browser/ui/views/options/languages_page_view.h
@@ -0,0 +1,119 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_LANGUAGES_PAGE_VIEW_H__
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_LANGUAGES_PAGE_VIEW_H__
+#pragma once
+
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/browser/views/options/options_page_view.h"
+#include "views/controls/combobox/combobox.h"
+#include "views/controls/button/button.h"
+#include "views/controls/table/table_view_observer.h"
+#include "views/view.h"
+
+namespace views {
+class Checkbox;
+class Label;
+class NativeButton;
+class TableView;
+}
+
+class AddLanguageView;
+class LanguageComboboxModel;
+class LanguageOrderTableModel;
+class TableModel;
+
+///////////////////////////////////////////////////////////////////////////////
+// LanguagesPageView
+
+class LanguagesPageView : public OptionsPageView,
+ public views::ButtonListener,
+ public views::TableViewObserver,
+ public views::Combobox::Listener {
+ public:
+ explicit LanguagesPageView(Profile* profile);
+ virtual ~LanguagesPageView();
+
+ // views::ButtonListener implementation:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Save Changes made to relevant pref members associated with this tab.
+ // This is public since it is called by FontsLanguageWindowView in its
+ // Dialog Delegate Accept() method.
+ void SaveChanges();
+
+ // This is public because when user clicks OK in AddLanguageView dialog,
+ // this is called back in the LanguagePageView delegate in order to add
+ // this language to the table model in this tab.
+ void OnAddLanguage(const std::string& new_language);
+
+ protected:
+ // OptionsPageView implementation:
+ virtual void InitControlLayout();
+ virtual void NotifyPrefChanged(const std::string* pref_name);
+
+ // views::Combobox::Listener implementation:
+ virtual void ItemChanged(views::Combobox* sender,
+ int prev_index,
+ int new_index);
+
+ private:
+ // Invoked when the selection of the table view changes. Updates the enabled
+ // property of the remove button.
+ virtual void OnSelectionChanged();
+ void OnRemoveLanguage();
+ void OnMoveDownLanguage();
+ void OnMoveUpLanguage();
+
+ views::Label* languages_instructions_;
+ views::View* languages_contents_;
+ views::View* button_stack_;
+ views::TableView* language_order_table_;
+ views::NativeButton* move_up_button_;
+ views::NativeButton* move_down_button_;
+ views::NativeButton* add_button_;
+ views::NativeButton* remove_button_;
+ views::Label* language_info_label_;
+ views::Label* ui_language_label_;
+ views::Combobox* change_ui_language_combobox_;
+ views::Combobox* change_dictionary_language_combobox_;
+ views::Checkbox* enable_autospellcorrect_checkbox_;
+ views::Checkbox* enable_spellchecking_checkbox_;
+ views::Label* dictionary_language_label_;
+
+ scoped_ptr<LanguageOrderTableModel> language_order_table_model_;
+ AddLanguageView* add_language_instance_;
+ StringPrefMember accept_languages_;
+
+ // The contents of the "user interface language" combobox.
+ scoped_ptr<LanguageComboboxModel> ui_language_model_;
+ StringPrefMember app_locale_;
+ int ui_language_index_selected_;
+ int starting_ui_language_index_;
+
+ // The contents of the "dictionary language" combobox.
+ scoped_ptr<LanguageComboboxModel> dictionary_language_model_;
+ StringPrefMember dictionary_language_;
+
+ // SpellChecker enable pref.
+ BooleanPrefMember enable_spellcheck_;
+
+ // Auto spell correction pref.
+ BooleanPrefMember enable_autospellcorrect_;
+
+ // This is assigned the new index of spellcheck language if the language
+ // is changed. Otherwise, it remains -1, and pref members are not updated.
+ int spellcheck_language_index_selected_;
+ std::string spellcheck_language_added_;
+
+ bool language_table_edited_;
+ bool language_warning_shown_;
+ bool enable_spellcheck_checkbox_clicked_;
+ bool enable_autospellcorrect_checkbox_clicked_;
+
+ DISALLOW_COPY_AND_ASSIGN(LanguagesPageView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_LANGUAGES_PAGE_VIEW_H__
diff --git a/chrome/browser/views/options/managed_prefs_banner_view.cc b/chrome/browser/ui/views/options/managed_prefs_banner_view.cc
index e063d14..e063d14 100644
--- a/chrome/browser/views/options/managed_prefs_banner_view.cc
+++ b/chrome/browser/ui/views/options/managed_prefs_banner_view.cc
diff --git a/chrome/browser/ui/views/options/managed_prefs_banner_view.h b/chrome/browser/ui/views/options/managed_prefs_banner_view.h
new file mode 100644
index 0000000..71396d8
--- /dev/null
+++ b/chrome/browser/ui/views/options/managed_prefs_banner_view.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_MANAGED_PREFS_BANNER_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_MANAGED_PREFS_BANNER_VIEW_H_
+#pragma once
+
+#include "chrome/browser/policy/managed_prefs_banner_base.h"
+#include "views/view.h"
+
+namespace views {
+class ImageView;
+class Label;
+}
+
+// Displays a banner showing a warning message that tells the user some options
+// cannot be changed because the relevant preferences are managed by their
+// system administrator.
+class ManagedPrefsBannerView : public policy::ManagedPrefsBannerBase,
+ public views::View {
+ public:
+ // Initialize the banner. |page| is used to determine the names of the
+ // preferences that control the banner visibility through their managed flag.
+ ManagedPrefsBannerView(PrefService* pref_service, OptionsPage page);
+ virtual ~ManagedPrefsBannerView() {}
+
+ private:
+ // Initialize contents and layout.
+ void Init();
+
+ // views::View overrides.
+ virtual gfx::Size GetPreferredSize();
+ virtual void Layout();
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+
+ // ManagedPrefsBannerBase override.
+ virtual void OnUpdateVisibility();
+
+ // Holds the warning icon image and text label and renders the border.
+ views::View* content_;
+ // Warning icon image.
+ views::ImageView* warning_image_;
+ // The label responsible for rendering the warning text.
+ views::Label* label_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ManagedPrefsBannerView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_MANAGED_PREFS_BANNER_VIEW_H_
diff --git a/chrome/browser/views/options/options_group_view.cc b/chrome/browser/ui/views/options/options_group_view.cc
index ef3e5dd..ef3e5dd 100644
--- a/chrome/browser/views/options/options_group_view.cc
+++ b/chrome/browser/ui/views/options/options_group_view.cc
diff --git a/chrome/browser/ui/views/options/options_group_view.h b/chrome/browser/ui/views/options/options_group_view.h
new file mode 100644
index 0000000..0d391b4
--- /dev/null
+++ b/chrome/browser/ui/views/options/options_group_view.h
@@ -0,0 +1,63 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_OPTIONS_GROUP_VIEW_H__
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_OPTIONS_GROUP_VIEW_H__
+#pragma once
+
+#include "views/view.h"
+
+namespace views {
+class Label;
+class Separator;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// OptionsGroupView
+//
+// A helper View that gathers related options into groups with a title and
+// optional description.
+//
+class OptionsGroupView : public views::View {
+ public:
+ OptionsGroupView(views::View* contents,
+ const std::wstring& title,
+ const std::wstring& description,
+ bool show_separator);
+ virtual ~OptionsGroupView();
+
+ // Sets the group as being highlighted to attract attention.
+ void SetHighlighted(bool highlighted);
+
+ // Retrieves the width of the ContentsView. Used to help size wrapping items.
+ int GetContentsWidth() const;
+
+ protected:
+ // views::View overrides:
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+
+ private:
+ void Init();
+
+ views::View* contents_;
+ views::Label* title_label_;
+ views::Label* description_label_;
+ views::Separator* separator_;
+
+ // True if we should show a separator line below the contents of this
+ // section.
+ bool show_separator_;
+
+ // True if this section should have a highlighted treatment to draw the
+ // user's attention.
+ bool highlighted_;
+
+ DISALLOW_COPY_AND_ASSIGN(OptionsGroupView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_OPTIONS_GROUP_VIEW_H__
diff --git a/chrome/browser/views/options/options_page_view.cc b/chrome/browser/ui/views/options/options_page_view.cc
index 6073442..6073442 100644
--- a/chrome/browser/views/options/options_page_view.cc
+++ b/chrome/browser/ui/views/options/options_page_view.cc
diff --git a/chrome/browser/ui/views/options/options_page_view.h b/chrome/browser/ui/views/options/options_page_view.h
new file mode 100644
index 0000000..8562f11
--- /dev/null
+++ b/chrome/browser/ui/views/options/options_page_view.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H__
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H__
+#pragma once
+
+#include "chrome/browser/options_page_base.h"
+#include "views/controls/link.h"
+#include "views/controls/button/native_button.h"
+
+class PrefService;
+
+///////////////////////////////////////////////////////////////////////////////
+// OptionsPageView
+//
+// A base class for Options dialog pages that handles ensuring control
+// initialization is done just once.
+//
+class OptionsPageView : public views::View,
+ public OptionsPageBase {
+ public:
+ virtual ~OptionsPageView();
+
+ // Returns true if the window containing this view can be closed, given the
+ // current state of this view. This can be used to prevent the window from
+ // being closed when a modal dialog box is showing, for example.
+ virtual bool CanClose() const { return true; }
+
+ protected:
+ // This class cannot be instantiated directly, but its constructor must be
+ // called by derived classes.
+ explicit OptionsPageView(Profile* profile);
+
+ // Initializes the layout of the controls within the panel.
+ virtual void InitControlLayout() = 0;
+
+ // views::View overrides:
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+
+ private:
+ // Whether or not the control layout has been initialized for this page.
+ bool initialized_;
+
+ DISALLOW_COPY_AND_ASSIGN(OptionsPageView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H__
diff --git a/chrome/browser/views/options/options_window_view.cc b/chrome/browser/ui/views/options/options_window_view.cc
index 8201bd8..8201bd8 100644
--- a/chrome/browser/views/options/options_window_view.cc
+++ b/chrome/browser/ui/views/options/options_window_view.cc
diff --git a/chrome/browser/views/options/passwords_exceptions_window_view.cc b/chrome/browser/ui/views/options/passwords_exceptions_window_view.cc
index 5c786ac..5c786ac 100644
--- a/chrome/browser/views/options/passwords_exceptions_window_view.cc
+++ b/chrome/browser/ui/views/options/passwords_exceptions_window_view.cc
diff --git a/chrome/browser/ui/views/options/passwords_exceptions_window_view.h b/chrome/browser/ui/views/options/passwords_exceptions_window_view.h
new file mode 100644
index 0000000..24ef781
--- /dev/null
+++ b/chrome/browser/ui/views/options/passwords_exceptions_window_view.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_OPTIONS_PASSWORDS_EXCEPTIONS_WINDOW_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_PASSWORDS_EXCEPTIONS_WINDOW_VIEW_H_
+#pragma once
+
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+
+class Profile;
+class PasswordsPageView;
+class ExceptionsPageView;
+
+namespace views {
+class TabbedPane;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// PasswordsExceptionsWindowView
+//
+// The contents of the "Save passwords and exceptions" dialog window.
+//
+class PasswordsExceptionsWindowView : public views::View,
+ public views::DialogDelegate {
+ public:
+ explicit PasswordsExceptionsWindowView(Profile* profile);
+ virtual ~PasswordsExceptionsWindowView() {}
+
+ // Show the PasswordManagerExceptionsView for the given profile.
+ static void Show(Profile* profile);
+
+ // views::View methods.
+ virtual void Layout();
+ virtual gfx::Size GetPreferredSize();
+ virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
+ views::View* child);
+
+ // views::DialogDelegate methods:
+ virtual int GetDialogButtons() const;
+ virtual bool CanResize() const { return true; }
+ virtual bool CanMaximize() const { return false; }
+ virtual bool IsAlwaysOnTop() const { return false; }
+ virtual bool HasAlwaysOnTopMenu() const { return false; }
+ virtual std::wstring GetWindowTitle() const;
+ virtual void WindowClosing();
+ virtual views::View* GetContentsView();
+
+ private:
+ void Init();
+
+ // The Tab view that contains all of the options pages.
+ views::TabbedPane* tabs_;
+
+ PasswordsPageView* passwords_page_view_;
+
+ ExceptionsPageView* exceptions_page_view_;
+
+ Profile* profile_;
+
+ static PasswordsExceptionsWindowView* instance_;
+
+ DISALLOW_COPY_AND_ASSIGN(PasswordsExceptionsWindowView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_PASSWORDS_EXCEPTIONS_WINDOW_VIEW_H_
diff --git a/chrome/browser/views/options/passwords_page_view.cc b/chrome/browser/ui/views/options/passwords_page_view.cc
index 6d22d5e..6d22d5e 100644
--- a/chrome/browser/views/options/passwords_page_view.cc
+++ b/chrome/browser/ui/views/options/passwords_page_view.cc
diff --git a/chrome/browser/ui/views/options/passwords_page_view.h b/chrome/browser/ui/views/options/passwords_page_view.h
new file mode 100644
index 0000000..0204db5
--- /dev/null
+++ b/chrome/browser/ui/views/options/passwords_page_view.h
@@ -0,0 +1,200 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_OPTIONS_PASSWORDS_PAGE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_PASSWORDS_PAGE_VIEW_H_
+#pragma once
+
+#include <vector>
+
+#include "app/table_model.h"
+#include "app/text_elider.h"
+#include "base/scoped_ptr.h"
+#include "base/stl_util-inl.h"
+#include "chrome/browser/password_manager/password_store.h"
+#include "chrome/browser/profile.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/browser/views/confirm_message_box_dialog.h"
+#include "chrome/browser/views/options/options_page_view.h"
+#include "views/controls/button/native_button.h"
+#include "views/controls/label.h"
+#include "views/controls/table/table_view.h"
+#include "views/controls/table/table_view_observer.h"
+#include "views/window/dialog_delegate.h"
+#include "views/window/window.h"
+#include "webkit/glue/password_form.h"
+
+///////////////////////////////////////////////////////////////////////////////
+// PasswordTableModelObserver
+// An observer interface to notify change of row count in a table model. This
+// allow the container view of TableView(i.e. PasswordsPageView and
+// ExceptionsPageView), to be notified of row count changes directly
+// from the TableModel. We have two different observers in
+// PasswordsTableModel, namely TableModelObserver and
+// PasswordsTableModelObserver, rather than adding this event to
+// TableModelObserver because only container view of
+// PasswordsTableModel cares about this event.
+class PasswordsTableModelObserver {
+ public:
+ virtual void OnRowCountChanged(size_t rows) = 0;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// MultiLabelButtons
+// A button that can have 2 different labels set on it and for which the
+// preferred size is the size of the widest string.
+class MultiLabelButtons : public views::NativeButton {
+ public:
+ MultiLabelButtons(views::ButtonListener* listener,
+ const std::wstring& label,
+ const std::wstring& alt_label);
+
+ virtual gfx::Size GetPreferredSize();
+
+ private:
+ std::wstring label_;
+ std::wstring alt_label_;
+ gfx::Size pref_size_;
+
+ DISALLOW_COPY_AND_ASSIGN(MultiLabelButtons);
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// PasswordsTableModel
+class PasswordsTableModel : public TableModel,
+ public PasswordStoreConsumer {
+ public:
+ explicit PasswordsTableModel(Profile* profile);
+ virtual ~PasswordsTableModel();
+
+ // TableModel methods.
+ virtual int RowCount();
+ virtual std::wstring GetText(int row, int column);
+ virtual int CompareValues(int row1, int row2, int column_id);
+ virtual void SetObserver(TableModelObserver* observer);
+
+ // Delete the PasswordForm at specified row from the database (and remove
+ // from view).
+ void ForgetAndRemoveSignon(int row);
+
+ // Delete all saved signons for the active profile (via web data service),
+ // and clear the view.
+ void ForgetAndRemoveAllSignons();
+
+ // PasswordStoreConsumer implementation.
+ virtual void OnPasswordStoreRequestDone(
+ int handle, const std::vector<webkit_glue::PasswordForm*>& result);
+
+ // Request saved logins data.
+ void GetAllSavedLoginsForProfile();
+
+ // Return the PasswordForm at the specified index.
+ webkit_glue::PasswordForm* GetPasswordFormAt(int row);
+
+ // Set the observer who concerns about how many rows are in the table.
+ void set_row_count_observer(PasswordsTableModelObserver* observer) {
+ row_count_observer_ = observer;
+ }
+
+ protected:
+ // Wraps the PasswordForm from the database and caches the display URL for
+ // quick sorting.
+ struct PasswordRow {
+ PasswordRow(const gfx::SortedDisplayURL& url,
+ webkit_glue::PasswordForm* password_form)
+ : display_url(url), form(password_form) {
+ }
+
+ // Contains the URL that is displayed along with the
+ gfx::SortedDisplayURL display_url;
+
+ // The underlying PasswordForm. We own this.
+ scoped_ptr<webkit_glue::PasswordForm> form;
+ };
+
+ // The password store associated with the currently active profile.
+ PasswordStore* password_store() {
+ return profile_->GetPasswordStore(Profile::EXPLICIT_ACCESS);
+ }
+
+ // The TableView observing this model.
+ TableModelObserver* observer_;
+
+ // Dispatching row count events specific to this password manager table model
+ // to this observer.
+ PasswordsTableModelObserver* row_count_observer_;
+
+ // Handle to any pending PasswordStore login lookup query.
+ int pending_login_query_;
+
+ // The set of passwords we're showing.
+ typedef std::vector<PasswordRow*> PasswordRows;
+ PasswordRows saved_signons_;
+ STLElementDeleter<PasswordRows> saved_signons_cleanup_;
+
+ Profile* profile_;
+
+ private:
+ // Cancel any pending login query involving a callback.
+ void CancelLoginsQuery();
+
+ DISALLOW_COPY_AND_ASSIGN(PasswordsTableModel);
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// PasswordsPageView
+class PasswordsPageView : public OptionsPageView,
+ public views::TableViewObserver,
+ public views::ButtonListener,
+ public PasswordsTableModelObserver,
+ public ConfirmMessageBoxObserver {
+ public:
+ explicit PasswordsPageView(Profile* profile);
+ virtual ~PasswordsPageView();
+
+ // views::TableViewObserverImplementation.
+ virtual void OnSelectionChanged();
+
+ // views::ButtonListener implementation.
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // PasswordsTableModelObserver implementation.
+ virtual void OnRowCountChanged(size_t rows);
+
+ // ConfirmMessageBoxObserver implementation.
+ virtual void OnConfirmMessageAccept();
+
+ protected:
+ virtual void InitControlLayout();
+
+ private:
+ // Helper to configure our buttons and labels.
+ void SetupButtonsAndLabels();
+
+ // Helper to configure our table view.
+ void SetupTable();
+
+ // Helper that hides the password.
+ void HidePassword();
+
+ // Handles changes to the observed preferences and updates the UI.
+ void NotifyPrefChanged(const std::string* pref_name);
+
+ PasswordsTableModel table_model_;
+ views::TableView* table_view_;
+
+ // The buttons and labels.
+ MultiLabelButtons show_button_;
+ views::NativeButton remove_button_;
+ views::NativeButton remove_all_button_;
+ views::Label password_label_;
+ webkit_glue::PasswordForm* current_selected_password_;
+
+ // Tracks the preference that controls whether showing passwords is allowed.
+ BooleanPrefMember allow_show_passwords_;
+
+ DISALLOW_COPY_AND_ASSIGN(PasswordsPageView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_PASSWORDS_PAGE_VIEW_H_
diff --git a/chrome/browser/views/options/plugin_filter_page_view.cc b/chrome/browser/ui/views/options/plugin_filter_page_view.cc
index eeb5c6c..eeb5c6c 100644
--- a/chrome/browser/views/options/plugin_filter_page_view.cc
+++ b/chrome/browser/ui/views/options/plugin_filter_page_view.cc
diff --git a/chrome/browser/ui/views/options/plugin_filter_page_view.h b/chrome/browser/ui/views/options/plugin_filter_page_view.h
new file mode 100644
index 0000000..f874774
--- /dev/null
+++ b/chrome/browser/ui/views/options/plugin_filter_page_view.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_PLUGIN_FILTER_PAGE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_PLUGIN_FILTER_PAGE_VIEW_H_
+#pragma once
+
+#include "chrome/browser/views/options/content_filter_page_view.h"
+
+////////////////////////////////////////////////////////////////////////////////
+// PluginFilterPageView class is used to render the plugin content settings tab.
+
+class PluginFilterPageView : public ContentFilterPageView,
+ public views::LinkController {
+ public:
+ explicit PluginFilterPageView(Profile* profile);
+ virtual ~PluginFilterPageView();
+
+ private:
+ // Overridden from ContentFilterPageView:
+ virtual void InitControlLayout();
+
+ // Overridden from views::LinkController:
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(PluginFilterPageView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_PLUGIN_FILTER_PAGE_VIEW_H_
+
diff --git a/chrome/browser/views/options/simple_content_exceptions_view.cc b/chrome/browser/ui/views/options/simple_content_exceptions_view.cc
index 5df84aa..5df84aa 100644
--- a/chrome/browser/views/options/simple_content_exceptions_view.cc
+++ b/chrome/browser/ui/views/options/simple_content_exceptions_view.cc
diff --git a/chrome/browser/ui/views/options/simple_content_exceptions_view.h b/chrome/browser/ui/views/options/simple_content_exceptions_view.h
new file mode 100644
index 0000000..4e6a075
--- /dev/null
+++ b/chrome/browser/ui/views/options/simple_content_exceptions_view.h
@@ -0,0 +1,95 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_VIEW_H_
+#pragma once
+
+#include <string>
+
+#include "chrome/browser/remove_rows_table_model.h"
+#include "chrome/common/content_settings.h"
+#include "views/controls/button/button.h"
+#include "views/controls/table/table_view_observer.h"
+#include "views/window/dialog_delegate.h"
+
+namespace views {
+class NativeButton;
+class TableView;
+}
+
+// SimpleContentExceptionsView is responsible for showing the user the set of
+// site-specific permissions. The exceptions are shown in a table view by way
+// of a RemoveRowsTableModel. The user can remove exceptions.
+// Use the ShowExceptionsWindow method to create and show a
+// SimpleContentExceptionsView, which is deleted when the window closes.
+class SimpleContentExceptionsView : public views::View,
+ public views::ButtonListener,
+ public views::DialogDelegate,
+ public views::TableViewObserver {
+ public:
+ // Shows the Exceptions window. Takes ownership of |model|.
+ static void ShowExceptionsWindow(gfx::NativeWindow parent,
+ RemoveRowsTableModel* model,
+ int title_message_id);
+
+ virtual ~SimpleContentExceptionsView();
+
+ // TableViewObserver overrides:
+ virtual void OnSelectionChanged();
+ virtual void OnTableViewDelete(views::TableView* table_view);
+
+ // views::ButtonListener implementation.
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // views::View overrides:
+ virtual void Layout();
+ virtual gfx::Size GetPreferredSize();
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+
+ // views::WindowDelegate implementation.
+ virtual int GetDialogButtons() const {
+ return MessageBoxFlags::DIALOGBUTTON_CANCEL;
+ }
+ virtual bool CanResize() const { return true; }
+ virtual std::wstring GetWindowTitle() const;
+ virtual views::View* GetContentsView() { return this; }
+
+ private:
+ // Takes ownership of |model|.
+ explicit SimpleContentExceptionsView(RemoveRowsTableModel* model,
+ int title_message_id);
+
+ void Init();
+
+ // Resets the enabled state of the buttons from the model.
+ void UpdateButtonState();
+
+ // Returns the set of selected rows.
+ RemoveRowsTableModel::Rows GetSelectedRows() const;
+
+ // Removes the selected item.
+ void Remove();
+
+ // Removes all.
+ void RemoveAll();
+
+ // The model displayed in the table.
+ scoped_ptr<RemoveRowsTableModel> model_;
+
+ views::TableView* table_;
+
+ views::NativeButton* remove_button_;
+ views::NativeButton* remove_all_button_;
+
+ // The message id of the window title.
+ int title_message_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(SimpleContentExceptionsView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_VIEW_H_
+
diff --git a/chrome/browser/views/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info_bubble_view.cc
index 90fa667..90fa667 100644
--- a/chrome/browser/views/page_info_bubble_view.cc
+++ b/chrome/browser/ui/views/page_info_bubble_view.cc
diff --git a/chrome/browser/ui/views/page_info_bubble_view.h b/chrome/browser/ui/views/page_info_bubble_view.h
new file mode 100644
index 0000000..a2124da
--- /dev/null
+++ b/chrome/browser/ui/views/page_info_bubble_view.h
@@ -0,0 +1,83 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_
+#pragma once
+
+#include "chrome/browser/page_info_model.h"
+#include "chrome/browser/views/info_bubble.h"
+#include "views/controls/link.h"
+#include "views/view.h"
+
+namespace views {
+class Label;
+}
+
+class PageInfoBubbleView : public views::View,
+ public PageInfoModel::PageInfoModelObserver,
+ public InfoBubbleDelegate,
+ public views::LinkController,
+ public AnimationDelegate {
+ public:
+ PageInfoBubbleView(gfx::NativeWindow parent_window,
+ Profile* profile,
+ const GURL& url,
+ const NavigationEntry::SSLStatus& ssl,
+ bool show_history);
+ virtual ~PageInfoBubbleView();
+
+ // Show the certificate dialog.
+ void ShowCertDialog();
+
+ void set_info_bubble(InfoBubble* info_bubble) { info_bubble_ = info_bubble; }
+
+ // View methods:
+ virtual gfx::Size GetPreferredSize();
+
+ // PageInfoModel::PageInfoModelObserver methods:
+ virtual void ModelChanged();
+
+ // InfoBubbleDelegate methods:
+ virtual void InfoBubbleClosing(InfoBubble* info_bubble,
+ bool closed_by_escape) {}
+ virtual bool CloseOnEscape() { return true; }
+ virtual bool FadeInOnShow() { return false; }
+ virtual std::wstring accessible_name() { return L"PageInfoBubble"; }
+
+ // LinkController methods:
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ // Overridden from AnimationDelegate.
+ virtual void AnimationEnded(const Animation* animation);
+ virtual void AnimationProgressed(const Animation* animation);
+
+ private:
+ // Layout the sections within the bubble.
+ void LayoutSections();
+
+ // The model providing the various section info.
+ PageInfoModel model_;
+
+ // The parent window of the InfoBubble showing this view.
+ gfx::NativeWindow parent_window_;
+
+ // The id of the certificate for this page.
+ int cert_id_;
+
+ InfoBubble* info_bubble_;
+
+ // The Help Center link at the bottom of the bubble.
+ views::Link* help_center_link_;
+
+ // Animation that helps us change size smoothly as more data comes in.
+ SlideAnimation resize_animation_;
+
+ // The height of the info bubble at the start of the resize animation.
+ int animation_start_height_;
+
+ DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_
diff --git a/chrome/browser/views/pinned_contents_info_bubble.cc b/chrome/browser/ui/views/pinned_contents_info_bubble.cc
index c064c16..c064c16 100644
--- a/chrome/browser/views/pinned_contents_info_bubble.cc
+++ b/chrome/browser/ui/views/pinned_contents_info_bubble.cc
diff --git a/chrome/browser/ui/views/pinned_contents_info_bubble.h b/chrome/browser/ui/views/pinned_contents_info_bubble.h
new file mode 100644
index 0000000..d1070b6
--- /dev/null
+++ b/chrome/browser/ui/views/pinned_contents_info_bubble.h
@@ -0,0 +1,68 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_PINNED_CONTENTS_INFO_BUBBLE_H_
+#define CHROME_BROWSER_UI_VIEWS_PINNED_CONTENTS_INFO_BUBBLE_H_
+#pragma once
+
+#include "chrome/browser/views/info_bubble.h"
+
+// This is a specialization of BorderContents, used to draw a border around
+// an InfoBubble that has its contents pinned to a specific location. See
+// base class for details.
+class PinnedContentsBorderContents : public BorderContents {
+ public:
+ explicit PinnedContentsBorderContents(const gfx::Point& bubble_anchor)
+ : bubble_anchor_(bubble_anchor) {}
+
+ // BorderContents overrides:
+ virtual void SizeAndGetBounds(
+ const gfx::Rect& position_relative_to, // In screen coordinates
+ BubbleBorder::ArrowLocation arrow_location,
+ bool allow_bubble_offscreen,
+ const gfx::Size& contents_size,
+ gfx::Rect* contents_bounds, // Returned in window coordinates
+ gfx::Rect* window_bounds); // Returned in screen coordinates
+
+ private:
+ // The location of the pinned contents (in screen coordinates).
+ const gfx::Point bubble_anchor_;
+
+ DISALLOW_COPY_AND_ASSIGN(PinnedContentsBorderContents);
+};
+
+// A specialization of the InfoBubble. Used to draw an InfoBubble which, in
+// addition to having an arrow pointing to where the user clicked, also shifts
+// the bubble horizontally to fix it to a specific location. See base class
+// for details.
+class PinnedContentsInfoBubble : public InfoBubble {
+ public:
+ // Shows the InfoBubble (see base class function for details).
+ // |bubble_anchor| specifies how far horizontally to shift the bubble in
+ // order to anchor its contents. Once the InfoBubble has been anchored its
+ // arrow may be pointing to a slightly different |y| location than specified
+ // in |position_relative_to|.
+ static PinnedContentsInfoBubble* Show(
+ views::Widget* parent,
+ const gfx::Rect& position_relative_to,
+ BubbleBorder::ArrowLocation arrow_location,
+ const gfx::Point& bubble_anchor_,
+ views::View* contents,
+ InfoBubbleDelegate* delegate);
+
+ // InfoBubble overrides:
+ virtual BorderContents* CreateBorderContents();
+
+ private:
+ explicit PinnedContentsInfoBubble(const gfx::Point& bubble_anchor)
+ : bubble_anchor_(bubble_anchor) {}
+ virtual ~PinnedContentsInfoBubble() {}
+
+ // The location of the pinned contents (in screen coordinates).
+ const gfx::Point bubble_anchor_;
+
+ DISALLOW_COPY_AND_ASSIGN(PinnedContentsInfoBubble);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_PINNED_CONTENTS_INFO_BUBBLE_H_
diff --git a/chrome/browser/views/reload_button.cc b/chrome/browser/ui/views/reload_button.cc
index 43015e7..43015e7 100644
--- a/chrome/browser/views/reload_button.cc
+++ b/chrome/browser/ui/views/reload_button.cc
diff --git a/chrome/browser/ui/views/reload_button.h b/chrome/browser/ui/views/reload_button.h
new file mode 100644
index 0000000..d83eeeb
--- /dev/null
+++ b/chrome/browser/ui/views/reload_button.h
@@ -0,0 +1,82 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_RELOAD_BUTTON_H__
+#define CHROME_BROWSER_UI_VIEWS_RELOAD_BUTTON_H__
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/gtest_prod_util.h"
+#include "base/timer.h"
+#include "views/controls/button/image_button.h"
+
+class Browser;
+class LocationBarView;
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// ReloadButton
+//
+// The reload button in the toolbar, which changes to a stop button when a page
+// load is in progress. Trickiness comes from the desire to have the 'stop'
+// button not change back to 'reload' if the user's mouse is hovering over it
+// (to prevent mis-clicks).
+//
+////////////////////////////////////////////////////////////////////////////////
+
+class ReloadButton : public views::ToggleImageButton,
+ public views::ButtonListener {
+ public:
+ enum Mode { MODE_RELOAD = 0, MODE_STOP };
+
+ ReloadButton(LocationBarView* location_bar, Browser* Browser);
+ virtual ~ReloadButton();
+
+ // Ask for a specified button state. If |force| is true this will be applied
+ // immediately.
+ void ChangeMode(Mode mode, bool force);
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* /* button */,
+ const views::Event& event);
+
+ // Overridden from views::View:
+ virtual void OnMouseExited(const views::MouseEvent& e);
+ virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip);
+
+ private:
+ friend class ReloadButtonTest;
+
+ void OnDoubleClickTimer();
+ void OnStopToReloadTimer();
+
+ base::OneShotTimer<ReloadButton> double_click_timer_;
+ base::OneShotTimer<ReloadButton> stop_to_reload_timer_;
+
+ // These may be NULL when testing.
+ LocationBarView* location_bar_;
+ Browser* 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_;
+
+ // 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(ReloadButton);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_RELOAD_BUTTON_H__
diff --git a/chrome/browser/views/reload_button_unittest.cc b/chrome/browser/ui/views/reload_button_unittest.cc
index 5f8255b..5f8255b 100644
--- a/chrome/browser/views/reload_button_unittest.cc
+++ b/chrome/browser/ui/views/reload_button_unittest.cc
diff --git a/chrome/browser/views/repost_form_warning_view.cc b/chrome/browser/ui/views/repost_form_warning_view.cc
index 7d7ed67..7d7ed67 100644
--- a/chrome/browser/views/repost_form_warning_view.cc
+++ b/chrome/browser/ui/views/repost_form_warning_view.cc
diff --git a/chrome/browser/ui/views/repost_form_warning_view.h b/chrome/browser/ui/views/repost_form_warning_view.h
new file mode 100644
index 0000000..980eab0
--- /dev/null
+++ b/chrome/browser/ui/views/repost_form_warning_view.h
@@ -0,0 +1,57 @@
+// Copyright (c) 2006-2008 The Chromium 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_VIEWS_REPOST_FORM_WARNING_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_REPOST_FORM_WARNING_VIEW_H_
+#pragma once
+
+#include "chrome/browser/tab_contents/constrained_window.h"
+#include "chrome/common/notification_registrar.h"
+#include "gfx/native_widget_types.h"
+#include "views/window/dialog_delegate.h"
+
+class ConstrainedWindow;
+class MessageBoxView;
+class NavigationController;
+class RepostFormWarningController;
+class TabContents;
+namespace views {
+class Window;
+}
+
+// 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 RepostFormWarningView : public ConstrainedDialogDelegate {
+ public:
+ // Use BrowserWindow::ShowRepostFormWarningDialog to use.
+ RepostFormWarningView(gfx::NativeWindow parent_window,
+ TabContents* tab_contents);
+
+ // views::DialogDelegate Methods:
+ virtual std::wstring GetWindowTitle() const;
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual void DeleteDelegate();
+
+ virtual bool Cancel();
+ virtual bool Accept();
+
+ // views::WindowDelegate Methods:
+ virtual views::View* GetContentsView();
+
+ private:
+ virtual ~RepostFormWarningView();
+
+ // The message box view whose commands we handle.
+ MessageBoxView* message_box_view_;
+
+ scoped_ptr<RepostFormWarningController> controller_;
+
+ DISALLOW_COPY_AND_ASSIGN(RepostFormWarningView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_REPOST_FORM_WARNING_VIEW_H_
diff --git a/chrome/browser/views/restart_message_box.cc b/chrome/browser/ui/views/restart_message_box.cc
index c054098..c054098 100644
--- a/chrome/browser/views/restart_message_box.cc
+++ b/chrome/browser/ui/views/restart_message_box.cc
diff --git a/chrome/browser/ui/views/restart_message_box.h b/chrome/browser/ui/views/restart_message_box.h
new file mode 100644
index 0000000..cfa3da5
--- /dev/null
+++ b/chrome/browser/ui/views/restart_message_box.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_RESTART_MESSAGE_BOX_H_
+#define CHROME_BROWSER_UI_VIEWS_RESTART_MESSAGE_BOX_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "gfx/native_widget_types.h"
+#include "views/window/dialog_delegate.h"
+
+class MessageBoxView;
+
+// A dialog box that tells the user that s/he needs to restart Chrome
+// for a change to take effect.
+class RestartMessageBox : public views::DialogDelegate {
+ public:
+ // This box is modal to |parent_window|.
+ static void ShowMessageBox(gfx::NativeWindow parent_window);
+
+ protected:
+ // views::DialogDelegate:
+ virtual int GetDialogButtons() const;
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual std::wstring GetWindowTitle() const;
+
+ // views::WindowDelegate:
+ virtual void DeleteDelegate();
+ virtual bool IsModal() const;
+ virtual views::View* GetContentsView();
+
+ private:
+ explicit RestartMessageBox(gfx::NativeWindow parent_window);
+ virtual ~RestartMessageBox();
+
+ MessageBoxView* message_box_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(RestartMessageBox);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_RESTART_MESSAGE_BOX_H_
diff --git a/chrome/browser/views/sad_tab_view.cc b/chrome/browser/ui/views/sad_tab_view.cc
index 31f45fd..31f45fd 100644
--- a/chrome/browser/views/sad_tab_view.cc
+++ b/chrome/browser/ui/views/sad_tab_view.cc
diff --git a/chrome/browser/ui/views/sad_tab_view.h b/chrome/browser/ui/views/sad_tab_view.h
new file mode 100644
index 0000000..22c088a
--- /dev/null
+++ b/chrome/browser/ui/views/sad_tab_view.h
@@ -0,0 +1,62 @@
+// Copyright (c) 2006-2008 The Chromium 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_VIEWS_SAD_TAB_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_SAD_TAB_VIEW_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "gfx/font.h"
+#include "views/controls/link.h"
+#include "views/view.h"
+
+class SkBitmap;
+class TabContents;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// SadTabView
+//
+// A views::View subclass used to render the presentation of the crashed
+// "sad tab" in the browser window when a renderer is destroyed unnaturally.
+//
+///////////////////////////////////////////////////////////////////////////////
+class SadTabView : public views::View,
+ public views::LinkController {
+ public:
+ explicit SadTabView(TabContents* tab_contents);
+ virtual ~SadTabView() {}
+
+ // Overridden from views::View:
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual void Layout();
+
+ // Overridden from views::LinkController:
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
+ private:
+ static void InitClass();
+
+ // Assorted resources for display.
+ static SkBitmap* sad_tab_bitmap_;
+ static gfx::Font* title_font_;
+ static gfx::Font* message_font_;
+ static std::wstring title_;
+ static std::wstring message_;
+ static int title_width_;
+
+ TabContents* tab_contents_;
+ views::Link* learn_more_link_;
+
+ // Regions within the display for different components, populated by
+ // Layout().
+ gfx::Rect icon_bounds_;
+ gfx::Rect title_bounds_;
+ gfx::Rect message_bounds_;
+ gfx::Rect link_bounds_;
+
+ DISALLOW_COPY_AND_ASSIGN(SadTabView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_SAD_TAB_VIEW_H__
diff --git a/chrome/browser/views/select_file_dialog.cc b/chrome/browser/ui/views/select_file_dialog.cc
index da8427c..da8427c 100644
--- a/chrome/browser/views/select_file_dialog.cc
+++ b/chrome/browser/ui/views/select_file_dialog.cc
diff --git a/chrome/browser/views/shell_dialogs_win.cc b/chrome/browser/ui/views/shell_dialogs_win.cc
index bc5f92b..bc5f92b 100644
--- a/chrome/browser/views/shell_dialogs_win.cc
+++ b/chrome/browser/ui/views/shell_dialogs_win.cc
diff --git a/chrome/browser/views/shell_dialogs_win_unittest.cc b/chrome/browser/ui/views/shell_dialogs_win_unittest.cc
index 0c2cad5..0c2cad5 100644
--- a/chrome/browser/views/shell_dialogs_win_unittest.cc
+++ b/chrome/browser/ui/views/shell_dialogs_win_unittest.cc
diff --git a/chrome/browser/views/ssl_client_certificate_selector_win.cc b/chrome/browser/ui/views/ssl_client_certificate_selector_win.cc
index 5eddcef..5eddcef 100644
--- a/chrome/browser/views/ssl_client_certificate_selector_win.cc
+++ b/chrome/browser/ui/views/ssl_client_certificate_selector_win.cc
diff --git a/chrome/browser/views/status_bubble_views.cc b/chrome/browser/ui/views/status_bubble_views.cc
index 234b6f0..234b6f0 100644
--- a/chrome/browser/views/status_bubble_views.cc
+++ b/chrome/browser/ui/views/status_bubble_views.cc
diff --git a/chrome/browser/ui/views/status_bubble_views.h b/chrome/browser/ui/views/status_bubble_views.h
new file mode 100644
index 0000000..118f027
--- /dev/null
+++ b/chrome/browser/ui/views/status_bubble_views.h
@@ -0,0 +1,136 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_STATUS_BUBBLE_VIEWS_H_
+#define CHROME_BROWSER_UI_VIEWS_STATUS_BUBBLE_VIEWS_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "base/string16.h"
+#include "base/task.h"
+#include "chrome/browser/status_bubble.h"
+#include "googleurl/src/gurl.h"
+#include "gfx/rect.h"
+
+class GURL;
+namespace gfx {
+class Point;
+}
+namespace views {
+class View;
+class Widget;
+}
+
+// StatusBubble displays a bubble of text that fades in, hovers over the
+// browser chrome and fades away when not needed. It is primarily designed
+// to allow users to see where hovered links point to.
+class StatusBubbleViews : public StatusBubble {
+ public:
+ // How wide the bubble's shadow is.
+ static const int kShadowThickness;
+
+ // The combined vertical padding above and below the text.
+ static const int kTotalVerticalPadding = 7;
+
+ // |base_view| is the view that this bubble is positioned relative to.
+ explicit StatusBubbleViews(views::View* base_view);
+ ~StatusBubbleViews();
+
+ views::View* base_view() { return base_view_; }
+
+ // Reposition the bubble - as we are using a WS_POPUP for the bubble,
+ // we have to manually position it when the browser window moves.
+ void Reposition();
+
+ // The bubble only has a preferred height: the sum of the height of
+ // the font and kTotalVerticalPadding.
+ gfx::Size GetPreferredSize();
+
+ // Set the bounds of the bubble relative to |base_view_|.
+ void SetBounds(int x, int y, int w, int h);
+
+ // Set bubble to new width.
+ void SetBubbleWidth(int width);
+
+ // Overridden from StatusBubble:
+ 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);
+ virtual void UpdateDownloadShelfVisibility(bool visible);
+
+ private:
+ class StatusView;
+ class StatusViewExpander;
+
+ // Initializes the popup and view.
+ void Init();
+
+ // Attempt to move the status bubble out of the way of the cursor, allowing
+ // users to see links in the region normally occupied by the status bubble.
+ void AvoidMouse(const gfx::Point& location);
+
+ // Returns true if the base_view_'s widget is visible and not minimized.
+ bool IsFrameVisible();
+
+ // Expand bubble size to accommodate a long URL.
+ void ExpandBubble();
+
+ // Cancel all waiting expansion animations in the timer.
+ void CancelExpandTimer();
+
+ // Get the standard width for a status bubble in the current frame size.
+ int GetStandardStatusBubbleWidth();
+
+ // Get the maximum possible width for a status bubble in the current frame
+ // size.
+ int GetMaxStatusBubbleWidth();
+
+ // The status text we want to display when there are no URLs to display.
+ string16 status_text_;
+
+ // The url we want to display when there is no status text to display.
+ string16 url_text_;
+
+ // The original, non-elided URL.
+ GURL url_;
+
+ // Used to elide the original URL again when we expand it.
+ string16 languages_;
+
+ // Position relative to the base_view_.
+ gfx::Point original_position_;
+ // original_position_ adjusted according to the current RTL.
+ gfx::Point position_;
+ gfx::Size size_;
+
+ // How vertically offset the bubble is from its root position_.
+ int offset_;
+
+ // We use a HWND for the popup so that it may float above any HWNDs in our
+ // UI (the location bar, for example).
+ scoped_ptr<views::Widget> popup_;
+ double opacity_;
+
+ views::View* base_view_;
+ StatusView* view_;
+
+ // Manages the expansion of a status bubble to fit a long URL.
+ scoped_ptr<StatusViewExpander> expand_view_;
+
+ // If the download shelf is visible, do not obscure it.
+ bool download_shelf_is_visible_;
+
+ // If the bubble has already been expanded, and encounters a new URL,
+ // change size immediately, with no hover.
+ bool is_expanded_;
+
+ // Times expansion of status bubble when URL is too long for standard width.
+ ScopedRunnableMethodFactory<StatusBubbleViews> expand_timer_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(StatusBubbleViews);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_STATUS_BUBBLE_VIEWS_H_
diff --git a/chrome/browser/views/status_icons/status_icon_win.cc b/chrome/browser/ui/views/status_icons/status_icon_win.cc
index 5545560..5545560 100644
--- a/chrome/browser/views/status_icons/status_icon_win.cc
+++ b/chrome/browser/ui/views/status_icons/status_icon_win.cc
diff --git a/chrome/browser/ui/views/status_icons/status_icon_win.h b/chrome/browser/ui/views/status_icons/status_icon_win.h
new file mode 100644
index 0000000..74c3742
--- /dev/null
+++ b/chrome/browser/ui/views/status_icons/status_icon_win.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_
+#define CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_
+#pragma once
+
+#include <windows.h>
+#include <shellapi.h>
+
+#include "base/scoped_handle_win.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/status_icons/status_icon.h"
+
+namespace views {
+class Menu2;
+}
+
+class StatusIconWin : public StatusIcon {
+ public:
+ // Constructor which provides this icon's unique ID and messaging window.
+ StatusIconWin(UINT id, HWND window, UINT message);
+ virtual ~StatusIconWin();
+
+ // Overridden from StatusIcon:
+ virtual void SetImage(const SkBitmap& image);
+ virtual void SetPressedImage(const SkBitmap& image);
+ virtual void SetToolTip(const string16& tool_tip);
+
+ UINT icon_id() const { return icon_id_; }
+
+ UINT message_id() const { return message_id_; }
+
+ // Handles a click event from the user - if |left_button_click| is true and
+ // there is a registered observer, passes the click event to the observer,
+ // otherwise displays the context menu if there is one.
+ void HandleClickEvent(int x, int y, bool left_button_click);
+
+ protected:
+ // Overridden from StatusIcon.
+ virtual void UpdatePlatformContextMenu(menus::MenuModel* menu);
+
+ private:
+ void InitIconData(NOTIFYICONDATA* icon_data);
+
+ // The unique ID corresponding to this icon.
+ UINT icon_id_;
+
+ // Window used for processing messages from this icon.
+ HWND window_;
+
+ // The message identifier used for status icon messages.
+ UINT message_id_;
+
+ // The currently-displayed icon for the window.
+ ScopedHICON icon_;
+
+ // Context menu associated with this icon (if any).
+ scoped_ptr<views::Menu2> context_menu_;
+
+ DISALLOW_COPY_AND_ASSIGN(StatusIconWin);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_
diff --git a/chrome/browser/views/status_icons/status_tray_gtk.cc b/chrome/browser/ui/views/status_icons/status_tray_gtk.cc
index 7cd0666..7cd0666 100644
--- a/chrome/browser/views/status_icons/status_tray_gtk.cc
+++ b/chrome/browser/ui/views/status_icons/status_tray_gtk.cc
diff --git a/chrome/browser/views/status_icons/status_tray_win.cc b/chrome/browser/ui/views/status_icons/status_tray_win.cc
index 29ed025..29ed025 100644
--- a/chrome/browser/views/status_icons/status_tray_win.cc
+++ b/chrome/browser/ui/views/status_icons/status_tray_win.cc
diff --git a/chrome/browser/ui/views/status_icons/status_tray_win.h b/chrome/browser/ui/views/status_icons/status_tray_win.h
new file mode 100644
index 0000000..c6d3c52
--- /dev/null
+++ b/chrome/browser/ui/views/status_icons/status_tray_win.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_
+#define CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_
+#pragma once
+
+#include <windows.h>
+
+#include "chrome/browser/status_icons/status_tray.h"
+
+class StatusTrayWin : public StatusTray {
+ public:
+ StatusTrayWin();
+ ~StatusTrayWin();
+
+ // Exposed for testing.
+ LRESULT CALLBACK WndProc(HWND hwnd,
+ UINT message,
+ WPARAM wparam,
+ LPARAM lparam);
+ protected:
+ // Overriden from StatusTray:
+ virtual StatusIcon* CreatePlatformStatusIcon();
+
+ private:
+ // Static callback invoked when a message comes in to our messaging window.
+ static LRESULT CALLBACK WndProcStatic(HWND hwnd,
+ UINT message,
+ WPARAM wparam,
+ LPARAM lparam);
+
+ // The unique icon ID we will assign to the next icon.
+ UINT next_icon_id_;
+ // The window used for processing events.
+ HWND window_;
+
+ DISALLOW_COPY_AND_ASSIGN(StatusTrayWin);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_
+
diff --git a/chrome/browser/views/status_icons/status_tray_win_unittest.cc b/chrome/browser/ui/views/status_icons/status_tray_win_unittest.cc
index c824755..c824755 100644
--- a/chrome/browser/views/status_icons/status_tray_win_unittest.cc
+++ b/chrome/browser/ui/views/status_icons/status_tray_win_unittest.cc
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container.h b/chrome/browser/ui/views/tab_contents/native_tab_contents_container.h
new file mode 100644
index 0000000..bca954d
--- /dev/null
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_H_
+#define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_H_
+#pragma once
+
+class RenderViewHost;
+class TabContents;
+class TabContentsContainer;
+namespace views {
+class View;
+}
+
+// An interface that the TabContentsContainer uses to talk to a platform-
+// specific view that hosts the native handle of the TabContents' view.
+class NativeTabContentsContainer {
+ public:
+ // Creates an appropriate native container for the current platform.
+ static NativeTabContentsContainer* CreateNativeContainer(
+ TabContentsContainer* container);
+
+ // Attaches the new TabContents to the native container.
+ virtual void AttachContents(TabContents* contents) = 0;
+
+ // Detaches the old TabContents from the native container.
+ virtual void DetachContents(TabContents* contents) = 0;
+
+ // Tells the container to update less frequently during resizing operations
+ // so performance is better.
+ virtual void SetFastResize(bool fast_resize) = 0;
+
+ // Tells the container that the RenderViewHost for the attached TabContents
+ // has changed and it should update focus.
+ virtual void RenderViewHostChanged(RenderViewHost* old_host,
+ RenderViewHost* new_host) = 0;
+
+ // Tells the container that |tab_contents| got the focus.
+ virtual void TabContentsFocused(TabContents* tab_contents) = 0;
+
+ // Retrieves the views::View that hosts the TabContents.
+ virtual views::View* GetView() = 0;
+ protected:
+ virtual ~NativeTabContentsContainer() {}
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_H_
diff --git a/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc
index 0c07fa7..0c07fa7 100644
--- a/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.h b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.h
new file mode 100644
index 0000000..a863e2b
--- /dev/null
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_GTK_H_
+#define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "chrome/browser/views/tab_contents/native_tab_contents_container.h"
+#include "views/controls/native/native_view_host.h"
+
+class NativeTabContentsContainerGtk : public NativeTabContentsContainer,
+ public views::NativeViewHost {
+ public:
+ explicit NativeTabContentsContainerGtk(TabContentsContainer* container);
+ virtual ~NativeTabContentsContainerGtk();
+
+ // Overridden from NativeTabContentsContainer:
+ virtual void AttachContents(TabContents* contents);
+ virtual void DetachContents(TabContents* contents);
+ virtual void SetFastResize(bool fast_resize);
+ virtual void RenderViewHostChanged(RenderViewHost* old_host,
+ RenderViewHost* new_host);
+ virtual void TabContentsFocused(TabContents* tab_contents);
+ virtual views::View* GetView();
+
+ // Overridden from views::View:
+ virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e);
+ virtual views::FocusTraversable* GetFocusTraversable();
+ virtual bool IsFocusable() const;
+ virtual void Focus();
+ virtual void RequestFocus();
+ virtual void AboutToRequestFocusFromTabTraversal(bool reverse);
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+
+ private:
+ TabContentsContainer* container_;
+
+ gulong focus_callback_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(NativeTabContentsContainerGtk);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_GTK_H_
diff --git a/chrome/browser/views/tab_contents/native_tab_contents_container_win.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc
index eba411f..eba411f 100644
--- a/chrome/browser/views/tab_contents/native_tab_contents_container_win.cc
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.h b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.h
new file mode 100644
index 0000000..8d12f0e
--- /dev/null
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.h
@@ -0,0 +1,41 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_WIN_H_
+#define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_WIN_H_
+#pragma once
+
+#include "chrome/browser/views/tab_contents/native_tab_contents_container.h"
+#include "views/controls/native/native_view_host.h"
+
+class NativeTabContentsContainerWin : public NativeTabContentsContainer,
+ public views::NativeViewHost {
+ public:
+ explicit NativeTabContentsContainerWin(TabContentsContainer* container);
+ virtual ~NativeTabContentsContainerWin();
+
+ // Overridden from NativeTabContentsContainer:
+ virtual void AttachContents(TabContents* contents);
+ virtual void DetachContents(TabContents* contents);
+ virtual void SetFastResize(bool fast_resize);
+ virtual void RenderViewHostChanged(RenderViewHost* old_host,
+ RenderViewHost* new_host);
+ virtual void TabContentsFocused(TabContents* tab_contents);
+ virtual views::View* GetView();
+
+ // Overridden from views::View:
+ virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e);
+ virtual bool IsFocusable() const;
+ virtual void Focus();
+ virtual void RequestFocus();
+ virtual void AboutToRequestFocusFromTabTraversal(bool reverse);
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+
+ private:
+ TabContentsContainer* container_;
+
+ DISALLOW_COPY_AND_ASSIGN(NativeTabContentsContainerWin);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_WIN_H_
diff --git a/chrome/browser/views/tab_contents/render_view_context_menu_views.cc b/chrome/browser/ui/views/tab_contents/render_view_context_menu_views.cc
index e7ac1a6..e7ac1a6 100644
--- a/chrome/browser/views/tab_contents/render_view_context_menu_views.cc
+++ b/chrome/browser/ui/views/tab_contents/render_view_context_menu_views.cc
diff --git a/chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h b/chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h
new file mode 100644
index 0000000..266e762
--- /dev/null
+++ b/chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h
@@ -0,0 +1,47 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_VIEWS_H_
+#define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_VIEWS_H_
+#pragma once
+
+#include "base/scoped_ptr.h"
+#include "base/scoped_vector.h"
+#include "chrome/browser/tab_contents/render_view_context_menu.h"
+#include "views/controls/menu/menu_2.h"
+
+class RenderViewContextMenuViews : public RenderViewContextMenu {
+ public:
+ RenderViewContextMenuViews(TabContents* tab_contents,
+ const ContextMenuParams& params);
+
+ virtual ~RenderViewContextMenuViews();
+
+ void RunMenuAt(int x, int y);
+
+ gfx::NativeMenu GetMenuHandle() const {
+ return (menu_.get() ? menu_->GetNativeMenu() : NULL);
+ }
+
+#if defined(OS_WIN)
+ // Set this menu to show for an external tab contents. This
+ // only has an effect before Init() is called.
+ void SetExternal();
+#endif
+
+ void UpdateMenuItemStates();
+
+ protected:
+ // RenderViewContextMenu implementation --------------------------------------
+ virtual void PlatformInit();
+ virtual bool GetAcceleratorForCommandId(int command_id,
+ menus::Accelerator* accelerator);
+ private:
+ // The context menu itself and its contents.
+ scoped_ptr<views::Menu2> menu_;
+
+ DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuViews);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_VIEWS_H_
diff --git a/chrome/browser/views/tab_contents/tab_contents_container.cc b/chrome/browser/ui/views/tab_contents/tab_contents_container.cc
index a75743d..a75743d 100644
--- a/chrome/browser/views/tab_contents/tab_contents_container.cc
+++ b/chrome/browser/ui/views/tab_contents/tab_contents_container.cc
diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container.h b/chrome/browser/ui/views/tab_contents/tab_contents_container.h
new file mode 100644
index 0000000..8e7d62e
--- /dev/null
+++ b/chrome/browser/ui/views/tab_contents/tab_contents_container.h
@@ -0,0 +1,81 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_
+#define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_
+#pragma once
+
+#include "chrome/browser/views/tab_contents/native_tab_contents_container.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "views/view.h"
+
+class NativeTabContentsContainer;
+class RenderViewHost;
+class TabContents;
+
+class TabContentsContainer : public views::View,
+ public NotificationObserver {
+ public:
+ TabContentsContainer();
+ virtual ~TabContentsContainer();
+
+ // Changes the TabContents associated with this view.
+ void ChangeTabContents(TabContents* contents);
+
+ View* GetFocusView() { return native_container_->GetView(); }
+
+ // Accessor for |tab_contents_|.
+ TabContents* tab_contents() const { return tab_contents_; }
+
+ // Called by the BrowserView to notify that |tab_contents| got the focus.
+ void TabContentsFocused(TabContents* tab_contents);
+
+ // Tells the container to update less frequently during resizing operations
+ // so performance is better.
+ void SetFastResize(bool fast_resize);
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Overridden from views::View:
+ virtual void Layout();
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+
+ protected:
+ // Overridden from views::View:
+ virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
+ views::View* child);
+
+ private:
+ // Add or remove observers for events that we care about.
+ void AddObservers();
+ void RemoveObservers();
+
+ // Called when the RenderViewHost of the hosted TabContents has changed, e.g.
+ // to show an interstitial page.
+ void RenderViewHostChanged(RenderViewHost* old_host,
+ RenderViewHost* new_host);
+
+ // 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);
+
+ // An instance of a NativeTabContentsContainer object that holds the native
+ // view handle associated with the attached TabContents.
+ NativeTabContentsContainer* native_container_;
+
+ // The attached TabContents.
+ TabContents* tab_contents_;
+
+ // Handles registering for our notifications.
+ NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabContentsContainer);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_
diff --git a/chrome/browser/views/tab_contents/tab_contents_drag_win.cc b/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc
index 51d8f3a..51d8f3a 100644
--- a/chrome/browser/views/tab_contents/tab_contents_drag_win.cc
+++ b/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc
diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h b/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h
new file mode 100644
index 0000000..d787931
--- /dev/null
+++ b/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h
@@ -0,0 +1,100 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_
+#define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_
+#pragma once
+
+#include "app/os_exchange_data_provider_win.h"
+#include "base/platform_thread.h"
+#include "base/ref_counted.h"
+#include "base/scoped_ptr.h"
+#include "gfx/point.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h"
+
+class DragDropThread;
+class TabContentsViewWin;
+class WebDragSource;
+struct WebDropData;
+
+// Windows-specific drag-and-drop handling in TabContentsView.
+// If we are dragging a virtual file out of the browser, we use a background
+// thread to do the drag-and-drop because we do not want to run nested
+// message loop in the UI thread. For all other cases, the drag-and-drop happens
+// in the UI thread.
+class TabContentsDragWin
+ : public DataObjectImpl::Observer,
+ public base::RefCountedThreadSafe<TabContentsDragWin> {
+ public:
+ explicit TabContentsDragWin(TabContentsViewWin* view);
+ virtual ~TabContentsDragWin();
+
+ // Called on UI thread.
+ void StartDragging(const WebDropData& drop_data,
+ WebKit::WebDragOperationsMask ops,
+ const SkBitmap& image,
+ const gfx::Point& image_offset);
+ void CancelDrag();
+
+ // DataObjectImpl::Observer implementation.
+ // Called on drag-and-drop thread.
+ virtual void OnWaitForData();
+ virtual void OnDataObjectDisposed();
+
+ private:
+ // Called on either UI thread or drag-and-drop thread.
+ void PrepareDragForDownload(const WebDropData& drop_data,
+ OSExchangeData* data,
+ const GURL& page_url,
+ const std::string& page_encoding);
+ void PrepareDragForFileContents(const WebDropData& drop_data,
+ OSExchangeData* data);
+ void PrepareDragForUrl(const WebDropData& drop_data, OSExchangeData* data);
+ void DoDragging(const WebDropData& drop_data,
+ WebKit::WebDragOperationsMask ops,
+ const GURL& page_url,
+ const std::string& page_encoding,
+ const SkBitmap& image,
+ const gfx::Point& image_offset);
+
+ // Called on drag-and-drop thread.
+ void StartBackgroundDragging(const WebDropData& drop_data,
+ WebKit::WebDragOperationsMask ops,
+ const GURL& page_url,
+ const std::string& page_encoding,
+ const SkBitmap& image,
+ const gfx::Point& image_offset);
+ // Called on UI thread.
+ void EndDragging(bool restore_suspended_state);
+ void CloseThread();
+
+ // For debug check only. Access only on drag-and-drop thread.
+ PlatformThreadId drag_drop_thread_id_;
+
+ // All the member variables below are accessed on UI thread.
+
+ // Keep track of the TabContentsViewWin it is associated with.
+ TabContentsViewWin* view_;
+
+ // |drag_source_| is our callback interface passed to the system when we
+ // want to initiate a drag and drop operation. We use it to tell if a
+ // drag operation is happening.
+ scoped_refptr<WebDragSource> drag_source_;
+
+ // The thread used by the drag-out download. This is because we want to avoid
+ // running nested message loop in main UI thread.
+ scoped_ptr<DragDropThread> drag_drop_thread_;
+
+ // The flag to guard that EndDragging is not called twice.
+ bool drag_ended_;
+
+ // Keep track of the old suspended state of the drop target.
+ bool old_drop_target_suspended_state_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabContentsDragWin);
+};
+
+
+#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/ui/views/tab_contents/tab_contents_view_gtk.cc
index 0a31684..0a31684 100644
--- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
+++ b/chrome/browser/ui/views/tab_contents/tab_contents_view_gtk.cc
diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_view_gtk.h b/chrome/browser/ui/views/tab_contents/tab_contents_view_gtk.h
new file mode 100644
index 0000000..5352aaf4
--- /dev/null
+++ b/chrome/browser/ui/views/tab_contents/tab_contents_view_gtk.h
@@ -0,0 +1,141 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_
+#define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_
+#pragma once
+
+#include <vector>
+
+#include "base/scoped_ptr.h"
+#include "chrome/browser/tab_contents/tab_contents_view.h"
+#include "gfx/size.h"
+#include "views/widget/widget_gtk.h"
+
+class ConstrainedWindowGtk;
+typedef struct _GtkFloatingContainer GtkFloatingContainer;
+class RenderViewContextMenuViews;
+class SadTabView;
+class SkBitmap;
+class TabContentsDragSource;
+class WebDragDestGtk;
+namespace gfx {
+class Point;
+}
+namespace views {
+class NativeViewHost;
+}
+
+// Gtk-specific implementation of the TabContentsView for the views-based front
+// end. It is a WidgetGtk that contains all of the contents of the tab and
+// associated child views.
+class TabContentsViewGtk : public TabContentsView,
+ public views::WidgetGtk {
+ public:
+ // The corresponding TabContents is passed in the constructor, and manages our
+ // lifetime. This doesn't need to be the case, but is this way currently
+ // because that's what was easiest when they were split.
+ explicit TabContentsViewGtk(TabContents* tab_contents);
+ virtual ~TabContentsViewGtk();
+
+ // Unlike Windows, ConstrainedWindows need to collaborate with the
+ // TabContentsViewGtk to position the dialogs.
+ void AttachConstrainedWindow(ConstrainedWindowGtk* constrained_window);
+ void RemoveConstrainedWindow(ConstrainedWindowGtk* constrained_window);
+
+ gboolean OnMouseMove(GtkWidget* widget, GdkEventMotion* event);
+
+ // TabContentsView implementation --------------------------------------------
+
+ virtual void CreateView(const gfx::Size& initial_size);
+ virtual RenderWidgetHostView* CreateViewForWidget(
+ RenderWidgetHost* render_widget_host);
+ virtual gfx::NativeView GetNativeView() const;
+ virtual gfx::NativeView GetContentNativeView() const;
+ virtual gfx::NativeWindow GetTopLevelNativeWindow() const;
+ virtual void GetContainerBounds(gfx::Rect* out) const;
+ virtual void SetPageTitle(const std::wstring& title);
+ virtual void OnTabCrashed();
+ virtual void SizeContents(const gfx::Size& size);
+ virtual void Focus();
+ virtual void SetInitialFocus();
+ virtual void StoreFocus();
+ virtual void RestoreFocus();
+
+ // Backend implementation of RenderViewHostDelegate::View.
+ virtual void ShowContextMenu(const ContextMenuParams& params);
+ virtual void ShowPopupMenu(const gfx::Rect& bounds,
+ int item_height,
+ double item_font_size,
+ int selected_item,
+ const std::vector<WebMenuItem>& items,
+ bool right_aligned);
+ virtual void StartDragging(const WebDropData& drop_data,
+ WebKit::WebDragOperationsMask ops_allowed,
+ const SkBitmap& image,
+ const gfx::Point& image_offset);
+ virtual void UpdateDragCursor(WebKit::WebDragOperation operation);
+ virtual void GotFocus();
+ virtual void TakeFocus(bool reverse);
+
+ private:
+ // Signal handlers -----------------------------------------------------------
+
+ // Overridden from views::WidgetGtk:
+ virtual gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event);
+ virtual void OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation);
+ virtual gboolean OnPaint(GtkWidget* widget, GdkEventExpose* event);
+ virtual void OnShow(GtkWidget* widget);
+ virtual void OnHide(GtkWidget* widget);
+
+ // Handles notifying the TabContents and other operations when the window was
+ // shown or hidden.
+ void WasHidden();
+ void WasShown();
+
+ // Handles resizing of the contents. This will notify the RenderWidgetHostView
+ // of the change, reposition popups, and the find in page bar.
+ void WasSized(const gfx::Size& size);
+
+ // For any floating views (ConstrainedDialogs) this function centers them
+ // within this view. It's called whem a ConstrainedDialog is attached and
+ // when this view is resized.
+ void SetFloatingPosition(const gfx::Size& size);
+
+ // ---------------------------------------------------------------------------
+
+ // Used to render the sad tab. This will be non-NULL only when the sad tab is
+ // visible.
+ SadTabView* sad_tab_;
+
+ // Whether to ignore the next CHAR keyboard event.
+ bool ignore_next_char_event_;
+
+ // The id used in the ViewStorage to store the last focused view.
+ int last_focused_view_storage_id_;
+
+ // The context menu. Callbacks are asynchronous so we need to keep it around.
+ scoped_ptr<RenderViewContextMenuViews> context_menu_;
+
+ // Handles drags from this TabContentsView.
+ scoped_ptr<TabContentsDragSource> drag_source_;
+
+ // The event for the last mouse down we handled. We need this for drags.
+ GdkEventButton last_mouse_down_;
+
+ // The helper object that handles drag destination related interactions with
+ // GTK.
+ scoped_ptr<WebDragDestGtk> drag_dest_;
+
+ // Current size. See comment in WidgetGtk as to why this is cached.
+ gfx::Size size_;
+
+ // Each individual UI for constrained dialogs currently displayed. The
+ // objects in this vector are owned by the TabContents, not the view.
+ std::vector<ConstrainedWindowGtk*> constrained_windows_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_win.cc b/chrome/browser/ui/views/tab_contents/tab_contents_view_win.cc
index f3126d1..f3126d1 100644
--- a/chrome/browser/views/tab_contents/tab_contents_view_win.cc
+++ b/chrome/browser/ui/views/tab_contents/tab_contents_view_win.cc
diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_view_win.h b/chrome/browser/ui/views/tab_contents/tab_contents_view_win.h
new file mode 100644
index 0000000..fcfbfe4
--- /dev/null
+++ b/chrome/browser/ui/views/tab_contents/tab_contents_view_win.h
@@ -0,0 +1,152 @@
+// Copyright (c) 2006-2008 The Chromium 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_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_WIN_H_
+#define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_WIN_H_
+#pragma once
+
+#include "base/scoped_ptr.h"
+#include "base/timer.h"
+#include "chrome/browser/tab_contents/tab_contents_view.h"
+#include "gfx/size.h"
+#include "views/widget/widget_win.h"
+
+class RenderViewContextMenuViews;
+class SadTabView;
+class SkBitmap;
+class TabContentsDragWin;
+struct WebDropData;
+class WebDragSource;
+class WebDropTarget;
+namespace gfx {
+class Point;
+}
+
+// Windows-specific implementation of the TabContentsView. It is a HWND that
+// contains all of the contents of the tab and associated child views.
+class TabContentsViewWin : public TabContentsView,
+ public views::WidgetWin {
+ public:
+ // The corresponding TabContents is passed in the constructor, and manages our
+ // lifetime. This doesn't need to be the case, but is this way currently
+ // because that's what was easiest when they were split.
+ explicit TabContentsViewWin(TabContents* tab_contents);
+ virtual ~TabContentsViewWin();
+
+ // Reset the native parent of this view to NULL. Unparented windows should
+ // not receive any messages.
+ virtual void Unparent();
+
+ // TabContentsView implementation --------------------------------------------
+
+ virtual void CreateView(const gfx::Size& initial_size);
+ virtual RenderWidgetHostView* CreateViewForWidget(
+ RenderWidgetHost* render_widget_host);
+ virtual gfx::NativeView GetNativeView() const;
+ virtual gfx::NativeView GetContentNativeView() const;
+ virtual gfx::NativeWindow GetTopLevelNativeWindow() const;
+ virtual void GetContainerBounds(gfx::Rect* out) const;
+ virtual void SetPageTitle(const std::wstring& title);
+ virtual void OnTabCrashed();
+ virtual void SizeContents(const gfx::Size& size);
+ virtual void Focus();
+ virtual void SetInitialFocus();
+ virtual void StoreFocus();
+ virtual void RestoreFocus();
+ virtual bool IsDoingDrag() const;
+ virtual void CancelDragAndCloseTab();
+
+ // Backend implementation of RenderViewHostDelegate::View.
+ virtual void ShowContextMenu(const ContextMenuParams& params);
+ virtual void ShowPopupMenu(const gfx::Rect& bounds,
+ int item_height,
+ double item_font_size,
+ int selected_item,
+ const std::vector<WebMenuItem>& items,
+ bool right_aligned);
+ virtual void StartDragging(const WebDropData& drop_data,
+ WebKit::WebDragOperationsMask operations,
+ const SkBitmap& image,
+ const gfx::Point& image_offset);
+ virtual void UpdateDragCursor(WebKit::WebDragOperation operation);
+ virtual void GotFocus();
+ virtual void TakeFocus(bool reverse);
+
+ // WidgetWin overridde.
+ virtual views::FocusManager* GetFocusManager();
+
+ void EndDragging();
+
+ WebDropTarget* drop_target() const { return drop_target_.get(); }
+
+ private:
+ // A helper method for closing the tab.
+ void CloseTab();
+
+ // Windows events ------------------------------------------------------------
+
+ // Overrides from WidgetWin.
+ virtual void OnDestroy();
+ virtual void OnHScroll(int scroll_type, short position, HWND scrollbar);
+ virtual void OnMouseLeave();
+ virtual LRESULT OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param);
+ virtual void OnPaint(HDC junk_dc);
+ virtual LRESULT OnReflectedMessage(UINT msg, WPARAM w_param, LPARAM l_param);
+ virtual void OnVScroll(int scroll_type, short position, HWND scrollbar);
+ virtual void OnWindowPosChanged(WINDOWPOS* window_pos);
+ virtual void OnSize(UINT param, const WTL::CSize& size);
+ virtual LRESULT OnNCCalcSize(BOOL w_param, LPARAM l_param);
+ virtual void OnNCPaint(HRGN rgn);
+
+ // Backend for all scroll messages, the |message| parameter indicates which
+ // one it is.
+ void ScrollCommon(UINT message, int scroll_type, short position,
+ HWND scrollbar);
+
+ // Handles notifying the TabContents and other operations when the window was
+ // shown or hidden.
+ void WasHidden();
+ void WasShown();
+
+ // Handles resizing of the contents. This will notify the RenderWidgetHostView
+ // of the change, reposition popups, and the find in page bar.
+ void WasSized(const gfx::Size& size);
+
+ // TODO(brettw) comment these. They're confusing.
+ bool ScrollZoom(int scroll_type);
+ void WheelZoom(int distance);
+
+ // ---------------------------------------------------------------------------
+
+ // A drop target object that handles drags over this TabContents.
+ scoped_refptr<WebDropTarget> drop_target_;
+
+ // Used to render the sad tab. This will be non-NULL only when the sad tab is
+ // visible.
+ SadTabView* sad_tab_;
+
+ // The id used in the ViewStorage to store the last focused view.
+ int last_focused_view_storage_id_;
+
+ // The context menu. Callbacks are asynchronous so we need to keep it around.
+ scoped_ptr<RenderViewContextMenuViews> context_menu_;
+
+ // The FocusManager associated with this tab. Stored as it is not directly
+ // accessible when unparented.
+ views::FocusManager* focus_manager_;
+
+ // Set to true if we want to close the tab after the system drag operation
+ // has finished.
+ bool close_tab_after_drag_ends_;
+
+ // Used to close the tab after the stack has unwound.
+ base::OneShotTimer<TabContentsViewWin> close_tab_timer_;
+
+ // Used to handle the drag-and-drop.
+ scoped_refptr<TabContentsDragWin> drag_handler_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabContentsViewWin);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_WIN_H_
diff --git a/chrome/browser/views/tab_icon_view.cc b/chrome/browser/ui/views/tab_icon_view.cc
index 547b039..547b039 100644
--- a/chrome/browser/views/tab_icon_view.cc
+++ b/chrome/browser/ui/views/tab_icon_view.cc
diff --git a/chrome/browser/ui/views/tab_icon_view.h b/chrome/browser/ui/views/tab_icon_view.h
new file mode 100644
index 0000000..2b83d29
--- /dev/null
+++ b/chrome/browser/ui/views/tab_icon_view.h
@@ -0,0 +1,73 @@
+// Copyright (c) 2006-2008 The Chromium 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_VIEWS_TAB_ICON_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_TAB_ICON_VIEW_H_
+#pragma once
+
+#include "views/view.h"
+
+class SkBitmap;
+class TabContents;
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// A view to display a tab fav icon or a throbber.
+//
+////////////////////////////////////////////////////////////////////////////////
+class TabIconView : public views::View {
+ public:
+ // Classes implement this interface to provide state for the TabIconView.
+ class TabIconViewModel {
+ public:
+ // Returns true if the TabIconView should show a loading animation.
+ virtual bool ShouldTabIconViewAnimate() const = 0;
+
+ // Returns the favicon to display in the icon view
+ virtual SkBitmap GetFavIconForTabIconView() = 0;
+ };
+
+ static void InitializeIfNeeded();
+
+ explicit TabIconView(TabIconViewModel* provider);
+ virtual ~TabIconView();
+
+ // Invoke whenever the tab state changes or the throbber should update.
+ void Update();
+
+ // Set the throbber to the light style (for use on dark backgrounds).
+ void set_is_light(bool is_light) { is_light_ = is_light; }
+
+ // Overriden from View
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual gfx::Size GetPreferredSize();
+
+ private:
+ void PaintThrobber(gfx::Canvas* canvas);
+ void PaintFavIcon(gfx::Canvas* canvas, const SkBitmap& bitmap);
+ void PaintIcon(gfx::Canvas* canvas,
+ const SkBitmap& bitmap,
+ int src_x,
+ int src_y,
+ int src_w,
+ int src_h,
+ bool filter);
+
+ // Our model.
+ TabIconViewModel* model_;
+
+ // Whether the throbber is running.
+ bool throbber_running_;
+
+ // Whether we should display our light or dark style.
+ bool is_light_;
+
+ // Current frame of the throbber being painted. This is only used if
+ // throbber_running_ is true.
+ int throbber_frame_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabIconView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TAB_ICON_VIEW_H_
diff --git a/chrome/browser/views/tabs/base_tab.cc b/chrome/browser/ui/views/tabs/base_tab.cc
index fa752b3..fa752b3 100644
--- a/chrome/browser/views/tabs/base_tab.cc
+++ b/chrome/browser/ui/views/tabs/base_tab.cc
diff --git a/chrome/browser/ui/views/tabs/base_tab.h b/chrome/browser/ui/views/tabs/base_tab.h
new file mode 100644
index 0000000..ff8cb55
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/base_tab.h
@@ -0,0 +1,204 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TABS_BASE_TAB_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_H_
+#pragma once
+
+#include "app/animation.h"
+#include "base/ref_counted.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/views/tabs/tab_renderer_data.h"
+#include "views/controls/button/button.h"
+#include "views/view.h"
+
+class AnimationContainer;
+class BaseTab;
+class SlideAnimation;
+class TabController;
+class ThrobAnimation;
+
+namespace gfx {
+class Font;
+} // namespace gfx
+
+namespace views {
+class ImageButton;
+} // namespace views
+
+// Base class for tab renderers.
+class BaseTab : public AnimationDelegate,
+ public views::ButtonListener,
+ public views::ContextMenuController,
+ public views::View {
+ public:
+ explicit BaseTab(TabController* controller);
+ virtual ~BaseTab();
+
+ // Sets the data this tabs displays. Invokes DataChanged for subclasses to
+ // update themselves appropriately.
+ void SetData(const TabRendererData& data);
+ const TabRendererData& data() const { return data_; }
+
+ // Sets the network state. If the network state changes NetworkStateChanged is
+ // invoked.
+ virtual void UpdateLoadingAnimation(TabRendererData::NetworkState state);
+
+ // Starts/Stops a pulse animation.
+ void StartPulse();
+ void StopPulse();
+
+ // Used to set/check whether this Tab is being animated closed.
+ void set_closing(bool closing) { closing_ = closing; }
+ bool closing() const { return closing_; }
+
+ // See description above field.
+ void set_dragging(bool dragging) { dragging_ = dragging; }
+ bool dragging() const { return dragging_; }
+
+ // Sets the container all animations run from.
+ void set_animation_container(AnimationContainer* container) {
+ animation_container_ = container;
+ }
+ AnimationContainer* animation_container() const {
+ return animation_container_.get();
+ }
+
+ // Set the theme provider - because we get detached, we are frequently
+ // outside of a hierarchy with a theme provider at the top. This should be
+ // called whenever we're detached or attached to a hierarchy.
+ void set_theme_provider(ThemeProvider* provider) {
+ theme_provider_ = provider;
+ }
+
+ // Returns true if the tab is selected.
+ virtual bool IsSelected() const;
+
+ // Returns true if the tab is closeable.
+ bool IsCloseable() const;
+
+ // views::View overrides:
+ virtual void OnMouseEntered(const views::MouseEvent& event);
+ virtual void OnMouseExited(const views::MouseEvent& event);
+ virtual bool OnMousePressed(const views::MouseEvent& event);
+ virtual bool OnMouseDragged(const views::MouseEvent& event);
+ virtual void OnMouseReleased(const views::MouseEvent& event,
+ bool canceled);
+ virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip);
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+ virtual ThemeProvider* GetThemeProvider();
+
+ protected:
+ // Invoked from SetData after |data_| has been updated to the new data.
+ virtual void DataChanged(const TabRendererData& old) {}
+
+ // Invoked if data_.network_state changes, or the network_state is not none.
+ virtual void AdvanceLoadingAnimation(TabRendererData::NetworkState old_state,
+ TabRendererData::NetworkState state);
+
+ TabController* controller() const { return controller_; }
+
+ // Returns the pulse animation. The pulse animation is non-null if StartPulse
+ // has been invoked.
+ ThrobAnimation* pulse_animation() const { return pulse_animation_.get(); }
+
+ // Returns the hover animation. This may return null.
+ const SlideAnimation* hover_animation() const {
+ return hover_animation_.get();
+ }
+
+ views::ImageButton* close_button() const { return close_button_; }
+
+ // Paints the icon at the specified coordinates, mirrored for RTL if needed.
+ void PaintIcon(gfx::Canvas* canvas, int x, int y);
+ void PaintTitle(gfx::Canvas* canvas, SkColor title_color);
+
+ // Overridden from AnimationDelegate:
+ virtual void AnimationProgressed(const Animation* animation);
+ virtual void AnimationCanceled(const Animation* animation);
+ virtual void AnimationEnded(const Animation* animation);
+
+ // views::ButtonListener overrides:
+ virtual void ButtonPressed(views::Button* sender,
+ const views::Event& event);
+
+ // views::ContextMenuController overrides:
+ virtual void ShowContextMenu(views::View* source,
+ const gfx::Point& p,
+ bool is_mouse_gesture);
+
+ // Returns the bounds of the title.
+ virtual const gfx::Rect& title_bounds() const = 0;
+
+ static gfx::Font* font() { return font_; }
+ static int font_height() { return font_height_; }
+
+ private:
+ // The animation object used to swap the favicon with the sad tab icon.
+ class FavIconCrashAnimation;
+
+ // Set the temporary offset for the favicon. This is used during the crash
+ // animation.
+ void SetFavIconHidingOffset(int offset);
+
+ void DisplayCrashedFavIcon();
+ void ResetCrashedFavIcon();
+
+ // Starts/Stops the crash animation.
+ void StartCrashAnimation();
+ void StopCrashAnimation();
+
+ // Return true if the crash animation is currently running.
+ bool IsPerformingCrashAnimation() const;
+
+ static void InitResources();
+
+ // The controller.
+ // WARNING: this is null during detached tab dragging.
+ TabController* controller_;
+
+ TabRendererData data_;
+
+ // True if the tab is being animated closed.
+ bool closing_;
+
+ // True if the tab is being dragged.
+ bool dragging_;
+
+ // Pulse animation.
+ scoped_ptr<ThrobAnimation> pulse_animation_;
+
+ // Hover animation.
+ scoped_ptr<SlideAnimation> hover_animation_;
+
+ // Crash animation.
+ scoped_ptr<FavIconCrashAnimation> crash_animation_;
+
+ scoped_refptr<AnimationContainer> animation_container_;
+
+ views::ImageButton* close_button_;
+
+ // The current index of the loading animation.
+ int loading_animation_frame_;
+
+ // Whether to disable throbber animations. Only true if this is an app tab
+ // renderer and a command line flag has been passed in to disable the
+ // animations.
+ bool throbber_disabled_;
+
+ ThemeProvider* theme_provider_;
+
+ // The offset used to animate the favicon location. This is used when the tab
+ // crashes.
+ int fav_icon_hiding_offset_;
+
+ bool should_display_crashed_favicon_;
+
+ static gfx::Font* font_;
+ static int font_height_;
+
+ DISALLOW_COPY_AND_ASSIGN(BaseTab);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_H_
diff --git a/chrome/browser/views/tabs/base_tab_strip.cc b/chrome/browser/ui/views/tabs/base_tab_strip.cc
index 4f844ed..4f844ed 100644
--- a/chrome/browser/views/tabs/base_tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/base_tab_strip.cc
diff --git a/chrome/browser/ui/views/tabs/base_tab_strip.h b/chrome/browser/ui/views/tabs/base_tab_strip.h
new file mode 100644
index 0000000..9882101
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/base_tab_strip.h
@@ -0,0 +1,266 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TABS_BASE_TAB_STRIP_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_STRIP_H_
+#pragma once
+
+#include <vector>
+
+#include "base/scoped_ptr.h"
+#include "chrome/browser/views/tabs/base_tab.h"
+#include "chrome/browser/views/tabs/tab_controller.h"
+#include "views/animation/bounds_animator.h"
+#include "views/view.h"
+
+class BaseTab;
+class DraggedTabController;
+class TabStrip;
+class TabStripController;
+class ThemeProvider;
+
+// Base class for the view tab strip implementations.
+class BaseTabStrip : public views::View,
+ public TabController {
+ public:
+ enum Type {
+ HORIZONTAL_TAB_STRIP,
+ VERTICAL_TAB_STRIP
+ };
+
+ BaseTabStrip(TabStripController* controller, Type type);
+ virtual ~BaseTabStrip();
+
+ Type type() const { return type_; }
+
+ // Returns the preferred height of this TabStrip. This is based on the
+ // typical height of its constituent tabs.
+ virtual int GetPreferredHeight() = 0;
+
+ // Set the background offset used by inactive tabs to match the frame image.
+ virtual void SetBackgroundOffset(const gfx::Point& offset) = 0;
+
+ // Returns true if the specified point(TabStrip coordinates) is
+ // in the window caption area of the browser window.
+ virtual bool IsPositionInWindowCaption(const gfx::Point& point) = 0;
+
+ // Sets the bounds of the tab at the specified |tab_index|. |tab_bounds| are
+ // in TabStrip coordinates.
+ virtual void SetDraggedTabBounds(int tab_index,
+ const gfx::Rect& tab_bounds) = 0;
+
+ // Updates the loading animations displayed by tabs in the tabstrip to the
+ // next frame.
+ void UpdateLoadingAnimations();
+
+ // Returns true if Tabs in this TabStrip are currently changing size or
+ // position.
+ virtual bool IsAnimating() const;
+
+ // Returns this object as a TabStrip if it is one.
+ virtual TabStrip* AsTabStrip() = 0;
+
+ // Starts highlighting the tab at the specified index.
+ virtual void StartHighlight(int model_index) = 0;
+
+ // Stops all tab higlighting.
+ virtual void StopAllHighlighting() = 0;
+
+ // Returns the selected tab.
+ virtual BaseTab* GetSelectedBaseTab() const;
+
+ // Retrieves the ideal bounds for the Tab at the specified index.
+ const gfx::Rect& ideal_bounds(int tab_data_index) {
+ return tab_data_[tab_data_index].ideal_bounds;
+ }
+
+ // Creates and returns a tab that can be used for dragging. Ownership passes
+ // to the caller.
+ virtual BaseTab* CreateTabForDragging() = 0;
+
+ // Adds a tab at the specified index.
+ void AddTabAt(int model_index,
+ bool foreground,
+ const TabRendererData& data);
+
+ // Invoked from the controller when the close initiates from the TabController
+ // (the user clicked the tab close button or middle clicked the tab). This is
+ // invoked from Close. Because of unload handlers Close is not always
+ // immediately followed by RemoveTabAt.
+ virtual void PrepareForCloseAt(int model_index) {}
+
+ // Removes a tab at the specified index.
+ virtual void RemoveTabAt(int model_index) = 0;
+
+ // Selects a tab at the specified index. |old_model_index| is the selected
+ // index prior to the selection change.
+ virtual void SelectTabAt(int old_model_index, int new_model_index) = 0;
+
+ // Moves a tab.
+ virtual void MoveTab(int from_model_index, int to_model_index);
+
+ // Invoked when the title of a tab changes and the tab isn't loading.
+ virtual void TabTitleChangedNotLoading(int model_index) = 0;
+
+ // Sets the tab data at the specified model index.
+ virtual void SetTabData(int model_index, const TabRendererData& data);
+
+ // Returns the tab at the specified model index.
+ virtual BaseTab* GetBaseTabAtModelIndex(int model_index) const;
+
+ // Returns the tab at the specified tab index.
+ BaseTab* base_tab_at_tab_index(int tab_index) const {
+ return tab_data_[tab_index].tab;
+ }
+
+ // Returns the index of the specified tab in the model coordiate system, or
+ // -1 if tab is closing or not valid.
+ virtual int GetModelIndexOfBaseTab(const BaseTab* tab) const;
+
+ // Gets the number of Tabs in the tab strip.
+ // WARNING: this is the number of tabs displayed by the tabstrip, which if
+ // an animation is ongoing is not necessarily the same as the number of tabs
+ // in the model.
+ int tab_count() const { return static_cast<int>(tab_data_.size()); }
+
+ // Cover method for TabStripController::GetCount.
+ int GetModelCount() const;
+
+ // Cover method for TabStripController::IsValidIndex.
+ bool IsValidModelIndex(int model_index) const;
+
+ // Returns the index into |tab_data_| corresponding to the index from the
+ // TabStripModel, or |tab_data_.size()| if there is no tab representing
+ // |model_index|.
+ int ModelIndexToTabIndex(int model_index) const;
+
+ TabStripController* controller() const { return controller_.get(); }
+
+ // Returns true if a drag session is currently active.
+ bool IsDragSessionActive() const;
+
+ // TabController overrides:
+ virtual void SelectTab(BaseTab* tab);
+ virtual void CloseTab(BaseTab* tab);
+ virtual void ShowContextMenu(BaseTab* tab, const gfx::Point& p);
+ virtual bool IsTabSelected(const BaseTab* tab) const;
+ virtual bool IsTabPinned(const BaseTab* tab) const;
+ virtual bool IsTabCloseable(const BaseTab* tab) const;
+ virtual void MaybeStartDrag(BaseTab* tab,
+ const views::MouseEvent& event);
+ virtual void ContinueDrag(const views::MouseEvent& event);
+ virtual bool EndDrag(bool canceled);
+ virtual BaseTab* GetTabAt(BaseTab* tab,
+ const gfx::Point& tab_in_tab_coordinates);
+
+ // View overrides:
+ virtual void Layout();
+
+ protected:
+ // The Tabs we contain, and their last generated "good" bounds.
+ struct TabData {
+ BaseTab* tab;
+ gfx::Rect ideal_bounds;
+ };
+
+ // View overrides.
+ virtual bool OnMouseDragged(const views::MouseEvent& event);
+ virtual void OnMouseReleased(const views::MouseEvent& event,
+ bool canceled);
+
+ // Creates and returns a new tab. The caller owners the returned tab.
+ virtual BaseTab* CreateTab() = 0;
+
+ // Invoked from |AddTabAt| after the newly created tab has been inserted.
+ // Subclasses should either start an animation, or layout.
+ virtual void StartInsertTabAnimation(int model_index, bool foreground) = 0;
+
+ // Invoked from |MoveTab| after |tab_data_| has been updated to animate the
+ // move.
+ virtual void StartMoveTabAnimation() = 0;
+
+ // Starts the remove tab animation.
+ virtual void StartRemoveTabAnimation(int model_index);
+
+ // Starts the mini-tab animation.
+ virtual void StartMiniTabAnimation();
+
+ // Returns whether the highlight button should be highlighted after a remove.
+ virtual bool ShouldHighlightCloseButtonAfterRemove() { return true; }
+
+ // Animates all the views to their ideal bounds.
+ // NOTE: this does *not* invoke GenerateIdealBounds, it uses the bounds
+ // currently set in ideal_bounds.
+ virtual void AnimateToIdealBounds() = 0;
+
+ // Cleans up the Tab from the TabStrip. This is called from the tab animation
+ // code and is not a general-purpose method.
+ void RemoveAndDeleteTab(BaseTab* tab);
+
+ // Resets the bounds of all non-closing tabs.
+ virtual void GenerateIdealBounds() = 0;
+
+ void set_ideal_bounds(int index, const gfx::Rect& bounds) {
+ tab_data_[index].ideal_bounds = bounds;
+ }
+
+ // Returns the index into |tab_data_| corresponding to the specified tab, or
+ // -1 if the tab isn't in |tab_data_|.
+ int TabIndexOfTab(BaseTab* tab) const;
+
+ // Stops any ongoing animations. If |layout| is true and an animation is
+ // ongoing this does a layout.
+ virtual void StopAnimating(bool layout) = 0;
+
+ // Destroys the active drag controller.
+ void DestroyDragController();
+
+ // Used by DraggedTabController when the user starts or stops dragging a tab.
+ void StartedDraggingTab(BaseTab* tab);
+ void StoppedDraggingTab(BaseTab* tab);
+
+ // See description above field for details.
+ bool attaching_dragged_tab() const { return attaching_dragged_tab_; }
+
+ views::BoundsAnimator& bounds_animator() { return bounds_animator_; }
+
+ // Invoked prior to starting a new animation.
+ virtual void PrepareForAnimation();
+
+ // Creates an AnimationDelegate that resets state after a remove animation
+ // completes. The caller owns the returned object.
+ AnimationDelegate* CreateRemoveTabDelegate(BaseTab* tab);
+
+ // Invoked from Layout if the size changes or layout is really needed.
+ virtual void DoLayout();
+
+ private:
+ class RemoveTabDelegate;
+
+ friend class DraggedTabController;
+
+ // See description above field for details.
+ void set_attaching_dragged_tab(bool value) { attaching_dragged_tab_ = value; }
+
+ scoped_ptr<TabStripController> controller_;
+
+ const Type type_;
+
+ std::vector<TabData> tab_data_;
+
+ // The controller for a drag initiated from a Tab. Valid for the lifetime of
+ // the drag session.
+ scoped_ptr<DraggedTabController> drag_controller_;
+
+ // If true, the insert is a result of a drag attaching the tab back to the
+ // model.
+ bool attaching_dragged_tab_;
+
+ views::BoundsAnimator bounds_animator_;
+
+ // Size we last layed out at.
+ gfx::Size last_layout_size_;
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_STRIP_H_
diff --git a/chrome/browser/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
index 78b1aa1..78b1aa1 100644
--- a/chrome/browser/views/tabs/browser_tab_strip_controller.cc
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h
new file mode 100644
index 0000000..8cfb548
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h
@@ -0,0 +1,121 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_
+#pragma once
+
+#include "base/scoped_ptr.h"
+#include "chrome/browser/tabs/tab_strip_model.h"
+#include "chrome/browser/views/tabs/tab_strip_controller.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+
+class BaseTab;
+class BaseTabStrip;
+class Browser;
+
+struct TabRendererData;
+
+// An implementation of TabStripController that sources data from the
+// TabContentses in a TabStripModel.
+class BrowserTabStripController : public TabStripController,
+ public TabStripModelObserver,
+ public NotificationObserver {
+ public:
+ BrowserTabStripController(Browser* browser, TabStripModel* model);
+ virtual ~BrowserTabStripController();
+
+ void InitFromModel(BaseTabStrip* tabstrip);
+
+ TabStripModel* model() const { return model_; }
+
+ bool IsCommandEnabledForTab(TabStripModel::ContextMenuCommand command_id,
+ BaseTab* tab) const;
+ bool IsCommandCheckedForTab(TabStripModel::ContextMenuCommand command_id,
+ BaseTab* tab) const;
+ void ExecuteCommandForTab(TabStripModel::ContextMenuCommand command_id,
+ BaseTab* tab);
+ bool IsTabPinned(BaseTab* tab);
+
+ // TabStripController implementation:
+ virtual int GetCount() const;
+ virtual bool IsValidIndex(int model_index) const;
+ virtual int GetSelectedIndex() const;
+ virtual bool IsTabSelected(int model_index) const;
+ virtual bool IsTabPinned(int model_index) const;
+ virtual bool IsTabCloseable(int model_index) const;
+ virtual bool IsNewTabPage(int model_index) const;
+ virtual void SelectTab(int model_index);
+ virtual void CloseTab(int model_index);
+ virtual void ShowContextMenu(BaseTab* tab, const gfx::Point& p);
+ virtual void UpdateLoadingAnimations();
+ virtual int HasAvailableDragActions() const;
+ virtual void PerformDrop(bool drop_before, int index, const GURL& url);
+ virtual bool IsCompatibleWith(BaseTabStrip* other) const;
+ virtual void CreateNewTab();
+
+ // TabStripModelObserver implementation:
+ virtual void TabInsertedAt(TabContents* contents,
+ int model_index,
+ bool foreground);
+ virtual void TabDetachedAt(TabContents* contents, int model_index);
+ virtual void TabSelectedAt(TabContents* old_contents,
+ TabContents* contents,
+ int model_index,
+ bool user_gesture);
+ virtual void TabMoved(TabContents* contents,
+ int from_model_index,
+ int to_model_index);
+ virtual void TabChangedAt(TabContents* contents,
+ int model_index,
+ TabChangeType change_type);
+ virtual void TabReplacedAt(TabContents* old_contents,
+ TabContents* new_contents,
+ int model_index);
+ virtual void TabPinnedStateChanged(TabContents* contents, int model_index);
+ virtual void TabMiniStateChanged(TabContents* contents, int model_index);
+ virtual void TabBlockedStateChanged(TabContents* contents, int model_index);
+
+ // NotificationObserver implementation:
+ virtual void Observe(NotificationType type, const NotificationSource& source,
+ const NotificationDetails& details);
+
+ private:
+ class TabContextMenuContents;
+
+ // Invokes tabstrip_->SetTabData.
+ void SetTabDataAt(TabContents* contents, int model_index);
+
+ // Sets the TabRendererData from the TabStripModel.
+ void SetTabRendererDataFromModel(TabContents* contents,
+ int model_index,
+ TabRendererData* data);
+
+ void StartHighlightTabsForCommand(
+ TabStripModel::ContextMenuCommand command_id,
+ BaseTab* tab);
+ void StopHighlightTabsForCommand(
+ TabStripModel::ContextMenuCommand command_id,
+ BaseTab* tab);
+
+ Profile* profile() const { return model_->profile(); }
+
+ TabStripModel* model_;
+
+ BaseTabStrip* tabstrip_;
+
+ // Non-owning pointer to the browser which is using this controller.
+ Browser* browser_;
+
+ // If non-NULL it means we're showing a menu for the tab.
+ scoped_ptr<TabContextMenuContents> context_menu_contents_;
+
+ NotificationRegistrar notification_registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_
+
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
index 3798180..3798180 100644
--- a/chrome/browser/views/tabs/dragged_tab_controller.cc
+++ b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
diff --git a/chrome/browser/ui/views/tabs/dragged_tab_controller.h b/chrome/browser/ui/views/tabs/dragged_tab_controller.h
new file mode 100644
index 0000000..d0c4480
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/dragged_tab_controller.h
@@ -0,0 +1,339 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TABS_DRAGGED_TAB_CONTROLLER_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_DRAGGED_TAB_CONTROLLER_H_
+#pragma once
+
+#include "base/message_loop.h"
+#include "base/scoped_ptr.h"
+#include "base/timer.h"
+#include "chrome/browser/dock_info.h"
+#include "chrome/browser/tab_contents/tab_contents_delegate.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "gfx/rect.h"
+
+namespace views {
+class View;
+}
+class BaseTab;
+class BaseTabStrip;
+class DraggedTabView;
+class NativeViewPhotobooth;
+class TabStripModel;
+
+struct TabRendererData;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// DraggedTabController
+//
+// An object that handles a drag session for an individual Tab within a
+// TabStrip. This object is created whenever the mouse is pressed down on a
+// Tab and destroyed when the mouse is released or the drag operation is
+// aborted. The Tab that the user dragged (the "source tab") owns this object
+// and must be the only one to destroy it (via |DestroyDragController|).
+//
+///////////////////////////////////////////////////////////////////////////////
+class DraggedTabController : public TabContentsDelegate,
+ public NotificationObserver,
+ public MessageLoopForUI::Observer {
+ public:
+ DraggedTabController(BaseTab* source_tab,
+ BaseTabStrip* source_tabstrip);
+ virtual ~DraggedTabController();
+
+ // Returns true if there is a drag underway and the drag is attached to
+ // |tab_strip|.
+ // NOTE: this returns false if the dragged tab controller is in the process
+ // of finishing the drag.
+ static bool IsAttachedTo(BaseTabStrip* tab_strip);
+
+ // Capture information needed to be used during a drag session for this
+ // controller's associated source tab and BaseTabStrip. |mouse_offset| is the
+ // distance of the mouse pointer from the tab's origin.
+ void CaptureDragInfo(views::View* tab, 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.
+ void EndDrag(bool canceled);
+
+ TabContents* dragged_contents() { return dragged_contents_; }
+
+ // Returns true if a drag started.
+ bool started_drag() const { return started_drag_; }
+
+ private:
+ class DockDisplayer;
+ friend class DockDisplayer;
+
+ typedef std::set<gfx::NativeView> DockWindows;
+
+ // 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 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);
+
+ // Overridden from MessageLoop::Observer:
+#if defined(OS_WIN)
+ virtual void WillProcessMessage(const MSG& msg);
+ virtual void DidProcessMessage(const MSG& msg);
+#else
+ virtual void WillProcessEvent(GdkEvent* event);
+ virtual void DidProcessEvent(GdkEvent* event);
+#endif
+
+ // Initialize the offset used to calculate the position to create windows
+ // in |GetWindowCreatePoint|. This should only be invoked from
+ // |CaptureDragInfo|.
+ void InitWindowCreatePoint();
+
+ // Updates the window create point from |mouse_offset_|.
+ void UpdateWindowCreatePoint();
+
+ // Returns the point where a detached window should be created given the
+ // current mouse position.
+ gfx::Point GetWindowCreatePoint() const;
+
+ void UpdateDockInfo(const gfx::Point& screen_point);
+
+ // Sets the TabContents being dragged with the specified |new_contents|.
+ void SetDraggedContents(TabContents* new_contents);
+
+ // Saves focus in the window that the drag initiated from. Focus will be
+ // restored appropriately if the drag ends within this same window.
+ void SaveFocus();
+
+ // Restore focus to the View that had focus before the drag was started, if
+ // the drag ends within the same Window as it began.
+ void RestoreFocus();
+
+ // Tests whether the position of the mouse is past a minimum elasticity
+ // threshold required to start a drag.
+ bool CanStartDrag() const;
+
+ // Move the DraggedTabView according to the current mouse screen position,
+ // potentially updating the source and other TabStrips.
+ void ContinueDragging();
+
+ // Handles dragging a tab while the tab is attached.
+ void MoveAttachedTab(const gfx::Point& screen_point);
+
+ // Handles dragging while the tab is detached.
+ void MoveDetachedTab(const gfx::Point& screen_point);
+
+ // Returns the compatible TabStrip that is under the specified point (screen
+ // coordinates), or NULL if there is none.
+ BaseTabStrip* GetTabStripForPoint(const gfx::Point& screen_point);
+
+ DockInfo GetDockInfoAtPoint(const gfx::Point& screen_point);
+
+ // Returns the specified |tabstrip| if it contains the specified point
+ // (screen coordinates), NULL if it does not.
+ BaseTabStrip* GetTabStripIfItContains(BaseTabStrip* tabstrip,
+ const gfx::Point& screen_point) const;
+
+ // Attach the dragged Tab to the specified TabStrip.
+ void Attach(BaseTabStrip* attached_tabstrip, const gfx::Point& screen_point);
+
+ // Detach the dragged Tab from the current TabStrip.
+ void Detach();
+
+ // 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;
+
+ // Retrieve the bounds of the DraggedTabView, relative to the attached
+ // TabStrip, given location of the dragged tab in screen coordinates.
+ gfx::Rect GetDraggedViewTabStripBounds(const gfx::Point& screen_point);
+
+ // Get the position of the dragged tab view relative to the attached tab
+ // strip.
+ gfx::Point GetAttachedTabDragPoint(const gfx::Point& screen_point);
+
+ // Finds the Tab within the specified TabStrip that corresponds to the
+ // dragged TabContents.
+ BaseTab* GetTabMatchingDraggedContents(BaseTabStrip* tabstrip) const;
+
+ // Does the work for EndDrag. If we actually started a drag and |how_end| is
+ // not TAB_DESTROYED then one of EndDrag or RevertDrag is invoked.
+ void EndDragImpl(EndDragType how_end);
+
+ // Reverts a cancelled drag operation.
+ void RevertDrag();
+
+ // Finishes a succesful drag operation.
+ void CompleteDrag();
+
+ // Create the DraggedTabView, if it does not yet exist.
+ void EnsureDraggedView(const TabRendererData& data);
+
+ // Utility for getting the mouse position in screen coordinates.
+ gfx::Point GetCursorScreenPoint() const;
+
+ // Returns the bounds (in screen coordinates) of the specified View.
+ gfx::Rect GetViewScreenBounds(views::View* tabstrip) const;
+
+ // Utility to convert the specified TabStripModel index to something valid
+ // for the attached TabStrip.
+ int NormalizeIndexToAttachedTabStrip(int index) const;
+
+ // Hides the frame for the window that contains the TabStrip the current
+ // drag session was initiated from.
+ void HideFrame();
+
+ // Closes a hidden frame at the end of a drag session.
+ void CleanUpHiddenFrame();
+
+ void DockDisplayerDestroyed(DockDisplayer* controller);
+
+ void BringWindowUnderMouseToFront();
+
+ // Returns the TabStripModel for the specified tabstrip.
+ TabStripModel* GetModel(BaseTabStrip* tabstrip) const;
+
+ // Handles registering for notifications.
+ NotificationRegistrar registrar_;
+
+ // The TabContents being dragged.
+ TabContents* 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 TabStrip |source_tab_| originated from.
+ BaseTabStrip* 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.
+ BaseTabStrip* attached_tabstrip_;
+
+ // If attached this is the tab we're dragging.
+ BaseTab* attached_tab_;
+
+ // The visual representation of the dragged Tab.
+ scoped_ptr<DraggedTabView> view_;
+
+ // The photo-booth the TabContents sits in when the Tab is detached, to
+ // obtain screen shots.
+ scoped_ptr<NativeViewPhotobooth> photobooth_;
+
+ // 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_;
+
+ // Ratio of the x-coordinate of the mouse offset to the width of the tab.
+ float offset_to_width_ratio_;
+
+ // 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_;
+
+ // Location of the first tab in the source tabstrip in screen coordinates.
+ // This is used to calculate window_create_point_.
+ gfx::Point first_source_tab_point_;
+
+ // The bounds of the browser window before the last Tab was detached. When
+ // the last Tab is detached, rather than destroying the frame (which would
+ // abort the drag session), the frame is moved off-screen. If the drag is
+ // aborted (e.g. by the user pressing Esc, or capture being lost), the Tab is
+ // attached to the hidden frame and the frame moved back to these bounds.
+ gfx::Rect restore_bounds_;
+
+ // The last view that had focus in the window containing |source_tab_|. This
+ // is saved so that focus can be restored properly when a drag begins and
+ // ends within this same window.
+ views::View* old_focused_view_;
+
+ // The position along the major axis of the mouse cursor in screen coordinates
+ // at the time of the last re-order event.
+ int last_move_screen_loc_;
+
+ DockInfo dock_info_;
+
+ DockWindows dock_windows_;
+
+ std::vector<DockDisplayer*> dock_controllers_;
+
+ // 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<DraggedTabController> bring_to_front_timer_;
+
+ // Did the mouse move enough that we started a drag?
+ bool started_drag_;
+
+ // Is the drag active?
+ bool active_;
+
+ DISALLOW_COPY_AND_ASSIGN(DraggedTabController);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_DRAGGED_TAB_CONTROLLER_H_
diff --git a/chrome/browser/views/tabs/dragged_tab_view.cc b/chrome/browser/ui/views/tabs/dragged_tab_view.cc
index 8f77a87..8f77a87 100644
--- a/chrome/browser/views/tabs/dragged_tab_view.cc
+++ b/chrome/browser/ui/views/tabs/dragged_tab_view.cc
diff --git a/chrome/browser/ui/views/tabs/dragged_tab_view.h b/chrome/browser/ui/views/tabs/dragged_tab_view.h
new file mode 100644
index 0000000..e36cd03
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/dragged_tab_view.h
@@ -0,0 +1,103 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TABS_DRAGGED_TAB_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_DRAGGED_TAB_VIEW_H_
+#pragma once
+
+#include "build/build_config.h"
+#include "gfx/point.h"
+#include "gfx/size.h"
+#include "views/view.h"
+
+namespace views {
+#if defined(OS_WIN)
+class WidgetWin;
+#elif defined(OS_LINUX)
+class WidgetGtk;
+#endif
+}
+namespace gfx {
+class Point;
+}
+class NativeViewPhotobooth;
+class Tab;
+class TabRenderer;
+
+class DraggedTabView : public views::View {
+ public:
+ // Creates a new DraggedTabView using |renderer| as the View. DraggedTabView
+ // takes ownership of |renderer|.
+ DraggedTabView(views::View* renderer,
+ const gfx::Point& mouse_tab_offset,
+ const gfx::Size& contents_size,
+ const gfx::Size& min_size);
+ virtual ~DraggedTabView();
+
+ // Moves the DraggedTabView 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;
+ }
+
+ // Sets the width of the dragged tab and updates the dragged image.
+ void SetTabWidthAndUpdate(int width, NativeViewPhotobooth* photobooth);
+
+ // Notifies the DraggedTabView that it should update itself.
+ void Update();
+
+ private:
+ // Overridden from views::View:
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual void Layout();
+ virtual gfx::Size GetPreferredSize();
+
+ // Paint the view, when it's not attached to any TabStrip.
+ void PaintDetachedView(gfx::Canvas* canvas);
+
+ // Paint the view, when "Show window contents while dragging" is disabled.
+ void PaintFocusRect(gfx::Canvas* canvas);
+
+ // 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);
+
+ // The window that contains the DraggedTabView.
+#if defined(OS_WIN)
+ scoped_ptr<views::WidgetWin> container_;
+#elif defined(OS_LINUX)
+ scoped_ptr<views::WidgetGtk> container_;
+#endif
+
+ // The renderer that paints the Tab shape.
+ scoped_ptr<views::View> renderer_;
+
+ // True if "Show window contents while dragging" is enabled.
+ bool show_contents_on_drag_;
+
+ // 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.
+ gfx::Size tab_size_;
+
+ // A handle to the DIB containing the current screenshot of the TabContents
+ // we are dragging.
+ NativeViewPhotobooth* photobooth_;
+
+ // Size of the TabContents being dragged.
+ gfx::Size contents_size_;
+
+ DISALLOW_COPY_AND_ASSIGN(DraggedTabView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_DRAGGED_TAB_VIEW_H_
diff --git a/chrome/browser/ui/views/tabs/native_view_photobooth.h b/chrome/browser/ui/views/tabs/native_view_photobooth.h
new file mode 100644
index 0000000..b0bfea8
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/native_view_photobooth.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2006-2008 The Chromium 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_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_H_
+#pragma once
+
+#include "gfx/native_widget_types.h"
+
+namespace gfx {
+class Canvas;
+class Rect;
+}
+///////////////////////////////////////////////////////////////////////////////
+// NativeViewPhotobooth
+//
+// An object that a NativeView "steps into" to have its picture taken. This is
+// used to generate a full size screen shot of the contents of a NativeView
+// including any child windows.
+//
+// Implementation note: This causes the NativeView to be re-parented to a
+// mostly off-screen layered window.
+//
+class NativeViewPhotobooth {
+ public:
+ // Creates the photo booth. Constructs a nearly off-screen window, parents
+ // the view, then shows it. The caller is responsible for destroying this
+ // photo-booth, since the photo-booth will detach it before it is destroyed.
+ static NativeViewPhotobooth* Create(gfx::NativeView initial_view);
+
+ // Destroys the photo booth window.
+ virtual ~NativeViewPhotobooth() {}
+
+ // Replaces the view in the photo booth with the specified one.
+ virtual void Replace(gfx::NativeView new_view) = 0;
+
+ // Paints the current display image of the window into |canvas|, clipped to
+ // |target_bounds|.
+ virtual void PaintScreenshotIntoCanvas(gfx::Canvas* canvas,
+ const gfx::Rect& target_bounds) = 0;
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_H_
diff --git a/chrome/browser/views/tabs/native_view_photobooth_gtk.cc b/chrome/browser/ui/views/tabs/native_view_photobooth_gtk.cc
index a307112..a307112 100644
--- a/chrome/browser/views/tabs/native_view_photobooth_gtk.cc
+++ b/chrome/browser/ui/views/tabs/native_view_photobooth_gtk.cc
diff --git a/chrome/browser/ui/views/tabs/native_view_photobooth_gtk.h b/chrome/browser/ui/views/tabs/native_view_photobooth_gtk.h
new file mode 100644
index 0000000..8764e89
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/native_view_photobooth_gtk.h
@@ -0,0 +1,30 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_GTK_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_GTK_H_
+#pragma once
+
+#include "chrome/browser/views/tabs/native_view_photobooth.h"
+
+class NativeViewPhotoboothGtk : public NativeViewPhotobooth {
+ public:
+ explicit NativeViewPhotoboothGtk(gfx::NativeView new_view);
+
+ // Destroys the photo booth window.
+ virtual ~NativeViewPhotoboothGtk();
+
+ // Replaces the view in the photo booth with the specified one.
+ virtual void Replace(gfx::NativeView new_view);
+
+ // Paints the current display image of the window into |canvas|, clipped to
+ // |target_bounds|.
+ virtual void PaintScreenshotIntoCanvas(gfx::Canvas* canvas,
+ const gfx::Rect& target_bounds);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NativeViewPhotoboothGtk);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_GTK_H_
diff --git a/chrome/browser/views/tabs/native_view_photobooth_win.cc b/chrome/browser/ui/views/tabs/native_view_photobooth_win.cc
index d749ea0..d749ea0 100644
--- a/chrome/browser/views/tabs/native_view_photobooth_win.cc
+++ b/chrome/browser/ui/views/tabs/native_view_photobooth_win.cc
diff --git a/chrome/browser/ui/views/tabs/native_view_photobooth_win.h b/chrome/browser/ui/views/tabs/native_view_photobooth_win.h
new file mode 100644
index 0000000..5797910
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/native_view_photobooth_win.h
@@ -0,0 +1,58 @@
+// Copyright (c) 2006-2008 The Chromium 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_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_WIN_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_WIN_H_
+#pragma once
+
+#include "chrome/browser/views/tabs/native_view_photobooth.h"
+
+namespace views {
+class WidgetWin;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// HWNDPhotobooth
+//
+// An object that a HWND "steps into" to have its picture taken. This is used
+// to generate a full size screen shot of the contents of a HWND including
+// any child windows.
+//
+// Implementation note: This causes the HWND to be re-parented to a mostly
+// off-screen layered window.
+//
+class NativeViewPhotoboothWin : public NativeViewPhotobooth {
+ public:
+ // Creates the photo booth. Constructs a nearly off-screen window, parents
+ // the HWND, then shows it. The caller is responsible for destroying this
+ // window, since the photo-booth will detach it before it is destroyed.
+ // |canvas| is a canvas to paint the contents into, and dest_bounds is the
+ // target area in |canvas| to which painted contents will be clipped.
+ explicit NativeViewPhotoboothWin(gfx::NativeView initial_view);
+
+ // Destroys the photo booth window.
+ virtual ~NativeViewPhotoboothWin();
+
+ // Replaces the view in the photo booth with the specified one.
+ virtual void Replace(gfx::NativeView new_view);
+
+ // Paints the current display image of the window into |canvas|, clipped to
+ // |target_bounds|.
+ virtual void PaintScreenshotIntoCanvas(gfx::Canvas* canvas,
+ const gfx::Rect& target_bounds);
+
+ private:
+ // Creates a mostly off-screen window to contain the HWND to be captured.
+ void CreateCaptureWindow(HWND initial_hwnd);
+
+ // The nearly off-screen photo-booth layered window used to hold the HWND.
+ views::WidgetWin* capture_window_;
+
+ // The current HWND being captured.
+ HWND current_hwnd_;
+
+ DISALLOW_COPY_AND_ASSIGN(NativeViewPhotoboothWin);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_WIN_H_
diff --git a/chrome/browser/views/tabs/side_tab.cc b/chrome/browser/ui/views/tabs/side_tab.cc
index b42bca0..b42bca0 100644
--- a/chrome/browser/views/tabs/side_tab.cc
+++ b/chrome/browser/ui/views/tabs/side_tab.cc
diff --git a/chrome/browser/ui/views/tabs/side_tab.h b/chrome/browser/ui/views/tabs/side_tab.h
new file mode 100644
index 0000000..c82f5c9
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/side_tab.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TABS_SIDE_TAB_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_SIDE_TAB_H_
+#pragma once
+
+#include "chrome/browser/views/tabs/base_tab.h"
+#include "gfx/font.h"
+
+class SideTab;
+class TabStripController;
+
+class SideTab : public BaseTab {
+ public:
+ explicit SideTab(TabController* controller);
+ virtual ~SideTab();
+
+ // Returns the preferred height of side tabs.
+ static int GetPreferredHeight();
+
+ // views::View Overrides:
+ virtual void Layout();
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual gfx::Size GetPreferredSize();
+
+ protected:
+ virtual const gfx::Rect& title_bounds() const { return title_bounds_; }
+
+ // Returns true if the selected highlight should be rendered.
+ virtual bool ShouldPaintHighlight() const;
+
+ private:
+ // Returns true if the icon should be shown.
+ bool ShouldShowIcon() const;
+
+ gfx::Rect icon_bounds_;
+ gfx::Rect title_bounds_;
+
+ DISALLOW_COPY_AND_ASSIGN(SideTab);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_SIDE_TAB_H_
diff --git a/chrome/browser/views/tabs/side_tab_strip.cc b/chrome/browser/ui/views/tabs/side_tab_strip.cc
index 84e8082..84e8082 100644
--- a/chrome/browser/views/tabs/side_tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/side_tab_strip.cc
diff --git a/chrome/browser/ui/views/tabs/side_tab_strip.h b/chrome/browser/ui/views/tabs/side_tab_strip.h
new file mode 100644
index 0000000..53d48a7
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/side_tab_strip.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TABS_SIDE_TAB_STRIP_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_SIDE_TAB_STRIP_H_
+#pragma once
+
+#include "chrome/browser/views/tabs/base_tab_strip.h"
+
+struct TabRendererData;
+
+class SideTabStrip : public BaseTabStrip {
+ public:
+ // The tabs are inset by this much along all axis.
+ static const int kTabStripInset;
+
+ explicit SideTabStrip(TabStripController* controller);
+ virtual ~SideTabStrip();
+
+ // BaseTabStrip implementation:
+ virtual int GetPreferredHeight();
+ virtual void SetBackgroundOffset(const gfx::Point& offset);
+ virtual bool IsPositionInWindowCaption(const gfx::Point& point);
+ virtual void SetDraggedTabBounds(int tab_index,
+ const gfx::Rect& tab_bounds);
+ virtual TabStrip* AsTabStrip();
+
+ virtual void StartHighlight(int model_index);
+ virtual void StopAllHighlighting();
+ virtual BaseTab* CreateTabForDragging();
+ virtual void RemoveTabAt(int model_index);
+ virtual void SelectTabAt(int old_model_index, int new_model_index);
+ virtual void TabTitleChangedNotLoading(int model_index);
+
+ // views::View overrides:
+ virtual gfx::Size GetPreferredSize();
+ virtual void PaintChildren(gfx::Canvas* canvas);
+
+ protected:
+ // BaseTabStrip overrides:
+ virtual BaseTab* CreateTab();
+ virtual void GenerateIdealBounds();
+ virtual void StartInsertTabAnimation(int model_index, bool foreground);
+ virtual void StartMoveTabAnimation();
+ virtual void StopAnimating(bool layout);
+ virtual void AnimateToIdealBounds();
+ virtual void DoLayout();
+
+ private:
+ // The "New Tab" button.
+ views::View* newtab_button_;
+
+ // Ideal bounds of the new tab button.
+ gfx::Rect newtab_button_bounds_;
+
+ // Separator between mini-tabs and the new tab button. The separator is
+ // positioned above the visible area if there are no mini-tabs.
+ views::View* separator_;
+
+ // Bounds of the sepatator.
+ gfx::Rect separator_bounds_;
+
+ DISALLOW_COPY_AND_ASSIGN(SideTabStrip);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_SIDE_TAB_STRIP_H_
diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc
index dda22fb..dda22fb 100644
--- a/chrome/browser/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
diff --git a/chrome/browser/ui/views/tabs/tab.h b/chrome/browser/ui/views/tabs/tab.h
new file mode 100644
index 0000000..1394e4b
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/tab.h
@@ -0,0 +1,141 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TABS_TAB_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_
+#pragma once
+
+#include <string>
+
+#include "base/scoped_ptr.h"
+#include "chrome/browser/views/tabs/base_tab.h"
+#include "gfx/point.h"
+
+class MultiAnimation;
+class SlideAnimation;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// TabRenderer
+//
+// A View that renders a Tab, either in a TabStrip or in a DraggedTabView.
+//
+///////////////////////////////////////////////////////////////////////////////
+class Tab : public BaseTab {
+ public:
+ // The menu button's class name.
+ static const char kViewClassName[];
+
+ explicit Tab(TabController* controller);
+ virtual ~Tab();
+
+ // Start/stop the mini-tab title animation.
+ void StartMiniTabTitleAnimation();
+ void StopMiniTabTitleAnimation();
+
+ // Set the background offset used to match the image in the inactive tab
+ // to the frame image.
+ void SetBackgroundOffset(const gfx::Point& offset) {
+ background_offset_ = offset;
+ }
+
+ // Paints the icon. Most of the time you'll want to invoke Paint directly, but
+ // in certain situations this invoked outside of Paint.
+ void PaintIcon(gfx::Canvas* canvas);
+
+ // 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();
+
+ protected:
+ virtual const gfx::Rect& title_bounds() const { return title_bounds_; }
+
+ // BaseTab overrides:
+ virtual void DataChanged(const TabRendererData& old);
+
+ private:
+ // Overridden from views::View:
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual void Layout();
+ virtual void OnThemeChanged();
+ virtual std::string GetClassName() const { return kViewClassName; }
+ virtual bool HasHitTestMask() const;
+ virtual void GetHitTestMask(gfx::Path* path) const;
+ virtual bool GetTooltipTextOrigin(const gfx::Point& p, gfx::Point* origin);
+
+ // Paint various portions of the Tab
+ void PaintTabBackground(gfx::Canvas* canvas);
+ void PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas);
+ void PaintInactiveTabBackground(gfx::Canvas* canvas);
+ void PaintActiveTabBackground(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 favicon.
+ bool ShouldShowIcon() const;
+
+ // Returns whether the Tab should display a close button.
+ bool ShouldShowCloseBox() const;
+
+ // 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,
+ // mini tab title change and pulsing.
+ double GetThrobValue();
+
+ // The bounds of various sections of the display.
+ gfx::Rect favicon_bounds_;
+ gfx::Rect title_bounds_;
+
+ // The offset used to paint the inactive background image.
+ gfx::Point background_offset_;
+
+ // Hover animation.
+ scoped_ptr<SlideAnimation> hover_animation_;
+
+ // Animation used when the title of an inactive mini tab changes.
+ scoped_ptr<MultiAnimation> mini_title_animation_;
+
+ struct TabImage {
+ SkBitmap* image_l;
+ SkBitmap* image_c;
+ SkBitmap* image_r;
+ int l_width;
+ int r_width;
+ int y_offset;
+ };
+ static TabImage tab_active;
+ static TabImage tab_inactive;
+ static TabImage tab_alpha;
+
+ // 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 current color of the close button.
+ SkColor close_button_color_;
+
+ static bool initialized_;
+
+ DISALLOW_COPY_AND_ASSIGN(Tab);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_
diff --git a/chrome/browser/ui/views/tabs/tab_controller.h b/chrome/browser/ui/views/tabs/tab_controller.h
new file mode 100644
index 0000000..c876346
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/tab_controller.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TABS_TAB_CONTROLLER_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_TAB_CONTROLLER_H_
+#pragma once
+
+class BaseTab;
+
+namespace gfx {
+class Point;
+}
+namespace views {
+class MouseEvent;
+}
+
+// Controller for tabs.
+class TabController {
+ public:
+ // Selects the tab.
+ virtual void SelectTab(BaseTab* tab) = 0;
+
+ // Closes the tab.
+ virtual void CloseTab(BaseTab* tab) = 0;
+
+ // Shows a context menu for the tab at the specified point in screen coords.
+ virtual void ShowContextMenu(BaseTab* tab, const gfx::Point& p) = 0;
+
+ // Returns true if the specified Tab is selected.
+ virtual bool IsTabSelected(const BaseTab* tab) const = 0;
+
+ // Returns true if the specified Tab is pinned.
+ virtual bool IsTabPinned(const BaseTab* tab) const = 0;
+
+ // Returns true if the specified Tab is closeable.
+ virtual bool IsTabCloseable(const BaseTab* tab) const = 0;
+
+ // Potentially starts a drag for the specified Tab.
+ virtual void MaybeStartDrag(BaseTab* tab, const views::MouseEvent& event) = 0;
+
+ // Continues dragging a Tab.
+ virtual void ContinueDrag(const views::MouseEvent& event) = 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 the tab that contains the specified coordinates, in terms of |tab|,
+ // or NULL if there is no tab that contains the specified point.
+ virtual BaseTab* GetTabAt(BaseTab* tab,
+ const gfx::Point& tab_in_tab_coordinates) = 0;
+
+ protected:
+ virtual ~TabController() {}
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_CONTROLLER_H_
diff --git a/chrome/browser/views/tabs/tab_dragging_test.cc b/chrome/browser/ui/views/tabs/tab_dragging_test.cc
index 2cb0171..2cb0171 100644
--- a/chrome/browser/views/tabs/tab_dragging_test.cc
+++ b/chrome/browser/ui/views/tabs/tab_dragging_test.cc
diff --git a/chrome/browser/ui/views/tabs/tab_renderer_data.h b/chrome/browser/ui/views/tabs/tab_renderer_data.h
new file mode 100644
index 0000000..3099e38
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/tab_renderer_data.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TABS_TAB_RENDERER_DATA_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_TAB_RENDERER_DATA_H_
+#pragma once
+
+#include "base/string16.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+
+// Wraps the state needed by the renderers.
+struct TabRendererData {
+ // Different types of network activity for a tab. The NetworkState of a tab
+ // may be used to alter the UI (e.g. show different kinds of loading
+ // animations).
+ enum NetworkState {
+ NETWORK_STATE_NONE, // no network activity.
+ NETWORK_STATE_WAITING, // waiting for a connection.
+ NETWORK_STATE_LOADING, // connected, transferring data.
+ };
+
+ TabRendererData()
+ : network_state(NETWORK_STATE_NONE),
+ loading(false),
+ crashed(false),
+ off_the_record(false),
+ show_icon(true),
+ mini(false),
+ blocked(false),
+ app(false) {
+ }
+
+ SkBitmap favicon;
+ NetworkState network_state;
+ string16 title;
+ bool loading;
+ bool crashed;
+ bool off_the_record;
+ bool show_icon;
+ bool mini;
+ bool blocked;
+ bool app;
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_RENDERER_DATA_H_
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc
index 9b25dfa..9b25dfa 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
diff --git a/chrome/browser/ui/views/tabs/tab_strip.h b/chrome/browser/ui/views/tabs/tab_strip.h
new file mode 100644
index 0000000..4978a5c
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/tab_strip.h
@@ -0,0 +1,287 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TABS_TAB_STRIP_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_
+#pragma once
+
+#include "app/animation_container.h"
+#include "base/ref_counted.h"
+#include "base/timer.h"
+#include "chrome/browser/views/tabs/base_tab_strip.h"
+#include "gfx/point.h"
+#include "gfx/rect.h"
+#include "views/controls/button/image_button.h"
+#include "views/mouse_watcher.h"
+
+class Tab;
+
+namespace views {
+class ImageView;
+#if defined(OS_LINUX)
+class WidgetGtk;
+#elif defined(OS_WIN)
+class WidgetWin;
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// TabStrip
+//
+// A View that represents the TabStripModel. The TabStrip has the
+// following responsibilities:
+// - It implements the TabStripModelObserver interface, and acts as a
+// container for Tabs, and is also responsible for creating them.
+// - It takes part in Tab Drag & Drop with Tab, TabDragHelper and
+// DraggedTab, focusing on tasks that require reshuffling other tabs
+// in response to dragged tabs.
+//
+///////////////////////////////////////////////////////////////////////////////
+class TabStrip : public BaseTabStrip,
+ public views::ButtonListener,
+ public views::MouseWatcherListener {
+ public:
+ explicit TabStrip(TabStripController* controller);
+ virtual ~TabStrip();
+
+ // Creates the new tab button.
+ void InitTabStripButtons();
+
+ // Returns the bounds of the new tab button.
+ gfx::Rect GetNewTabButtonBounds();
+
+ // MouseWatcherListener overrides:
+ virtual void MouseMovedOutOfView();
+
+ // BaseTabStrip implementation:
+ virtual int GetPreferredHeight();
+ virtual void SetBackgroundOffset(const gfx::Point& offset);
+ virtual bool IsPositionInWindowCaption(const gfx::Point& point);
+ virtual void SetDraggedTabBounds(int tab_index,
+ const gfx::Rect& tab_bounds);
+ virtual TabStrip* AsTabStrip();
+ virtual void PrepareForCloseAt(int model_index);
+ virtual void RemoveTabAt(int model_index);
+ virtual void SelectTabAt(int old_model_index, int new_model_index);
+ virtual void TabTitleChangedNotLoading(int model_index);
+ virtual void StartHighlight(int model_index);
+ virtual void StopAllHighlighting();
+ virtual BaseTab* CreateTabForDragging();
+
+ // views::View overrides:
+ virtual void PaintChildren(gfx::Canvas* canvas);
+ virtual views::View* GetViewByID(int id) const;
+ virtual gfx::Size GetPreferredSize();
+ // NOTE: the drag and drop methods are invoked from FrameView. This is done to
+ // allow for a drop region that extends outside the bounds of the TabStrip.
+ virtual void OnDragEntered(const views::DropTargetEvent& event);
+ virtual int OnDragUpdated(const views::DropTargetEvent& event);
+ virtual void OnDragExited();
+ virtual int OnPerformDrop(const views::DropTargetEvent& event);
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+ virtual views::View* GetViewForPoint(const gfx::Point& point);
+ virtual void OnThemeChanged();
+
+ protected:
+ // BaseTabStrip overrides:
+ virtual BaseTab* CreateTab();
+ virtual void StartInsertTabAnimation(int model_index, bool foreground);
+ virtual void StartMoveTabAnimation();
+ virtual void AnimateToIdealBounds();
+ virtual bool ShouldHighlightCloseButtonAfterRemove();
+ virtual void DoLayout();
+
+ // views::View implementation:
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child);
+
+ // TabController overrides.
+ virtual bool IsTabSelected(const BaseTab* btr) const;
+
+ // views::ButtonListener implementation:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Horizontal gap between mini and non-mini-tabs.
+ static const int mini_to_non_mini_gap_;
+
+ private:
+ friend class DraggedTabController;
+
+ // 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.
+ struct DropInfo {
+ DropInfo(int index, bool drop_before, bool paint_down);
+ ~DropInfo();
+
+ // 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;
+
+ // Renders the drop indicator.
+ // TODO(beng): should be views::Widget.
+#if defined(OS_WIN)
+ views::WidgetWin* arrow_window;
+#else
+ views::WidgetGtk* arrow_window;
+#endif
+ views::ImageView* arrow_view;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DropInfo);
+ };
+
+ void Init();
+
+ // Set the images for the new tab button.
+ void LoadNewTabButtonImage();
+
+ // Retrieves the Tab at the specified index. Remember, the specified index
+ // is in terms of tab_data, *not* the model.
+ Tab* GetTabAtTabDataIndex(int tab_data_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 GetTabAtTabDataIndex if the index comes from the model.
+ Tab* GetTabAtModelIndex(int model_index) const;
+
+ // Returns the number of mini-tabs.
+ int GetMiniTabCount() const;
+
+ // -- Tab Resize Layout -----------------------------------------------------
+
+ // 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;
+
+ // Perform an animated resize-relayout of the TabStrip immediately.
+ void ResizeLayoutTabs();
+
+ // 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();
+
+ // -- 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(const views::DropTargetEvent& event);
+
+ // Sets the location of the drop, repainting as necessary.
+ void SetDropIndex(int tab_data_index, bool drop_before);
+
+ // Returns the drop effect for dropping a URL on the tab strip. This does
+ // not query the data in anyway, it only looks at the source operations.
+ int GetDropEffect(const views::DropTargetEvent& event);
+
+ // Returns the image to use for indicating a drop on a tab. If is_down is
+ // true, this returns an arrow pointing down.
+ static SkBitmap* GetDropArrowImage(bool is_down);
+
+ // -- Animations ------------------------------------------------------------
+
+ // 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();
+
+ // Starts various types of TabStrip animations.
+ void StartResizeLayoutAnimation();
+ void StartMoveTabAnimation(int from_model_index,
+ int to_model_index);
+ void StartMiniTabAnimation();
+ void StartMouseInitiatedRemoveTabAnimation(int model_index);
+
+ // Stops any ongoing animations. If |layout| is true and an animation is
+ // ongoing this does a layout.
+ virtual void StopAnimating(bool layout);
+
+ // Calculates the available width for tabs, assuming a Tab is to be closed.
+ int GetAvailableWidthForTabs(Tab* last_tab) const;
+
+ // Returns true if the specified point in TabStrip coords is within the
+ // hit-test region of the specified Tab.
+ bool IsPointInTab(Tab* tab, const gfx::Point& point_in_tabstrip_coords);
+
+ // -- Member Variables ------------------------------------------------------
+
+ // The "New Tab" button.
+ views::ImageButton* newtab_button_;
+
+ // Ideal bounds of the new tab button.
+ gfx::Rect newtab_button_bounds_;
+
+ // 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 PrepareForCloseAt has been invoked. When true remove animations
+ // preserve current tab bounds.
+ bool in_tab_close_;
+
+ // The size of the new tab button must be hardcoded because we need to be
+ // able to lay it out before we are able to get its image from the
+ // ThemeProvider. It also makes sense to do this, because the size of the
+ // new tab button should not need to be calculated dynamically.
+ static const int kNewTabButtonWidth = 28;
+ static const int kNewTabButtonHeight = 18;
+
+ // Valid for the lifetime of a drag over us.
+ scoped_ptr<DropInfo> drop_info_;
+
+ // To ensure all tabs pulse at the same time they share the same animation
+ // container. This is that animation container.
+ scoped_refptr<AnimationContainer> animation_container_;
+
+ // Used for stage 1 of new tab animation.
+ base::OneShotTimer<TabStrip> new_tab_timer_;
+
+ scoped_ptr<views::MouseWatcher> mouse_watcher_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabStrip);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_
diff --git a/chrome/browser/ui/views/tabs/tab_strip_controller.h b/chrome/browser/ui/views/tabs/tab_strip_controller.h
new file mode 100644
index 0000000..ca4bd10
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/tab_strip_controller.h
@@ -0,0 +1,73 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TABS_TAB_STRIP_CONTROLLER_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_CONTROLLER_H_
+#pragma once
+
+class BaseTab;
+class BaseTabStrip;
+class GURL;
+
+namespace gfx {
+class Point;
+}
+
+// Model/Controller for the TabStrip.
+// NOTE: All indices used by this class are in model coordinates.
+class TabStripController {
+ public:
+ virtual ~TabStripController() {}
+
+ // Returns the number of tabs in the model.
+ virtual int GetCount() const = 0;
+
+ // Returns true if |index| is a valid model index.
+ virtual bool IsValidIndex(int index) const = 0;
+
+ // Returns the selected index, in terms of the model.
+ virtual int GetSelectedIndex() const = 0;
+
+ // Returns true if the selected index is selected.
+ virtual bool IsTabSelected(int index) const = 0;
+
+ // Returns true if the selected index is pinned.
+ virtual bool IsTabPinned(int index) const = 0;
+
+ // Returns true if the selected index is closeable.
+ virtual bool IsTabCloseable(int index) const = 0;
+
+ // Returns true if the selected index is the new tab page.
+ virtual bool IsNewTabPage(int index) const = 0;
+
+ // Select the tab at the specified index in the model.
+ virtual void SelectTab(int index) = 0;
+
+ // Closes the tab at the specified index in the model.
+ virtual void CloseTab(int index) = 0;
+
+ // Shows a context menu for the tab at the specified point in screen coords.
+ virtual void ShowContextMenu(BaseTab* tab, const gfx::Point& p) = 0;
+
+ // Updates the loading animations of all the tabs.
+ virtual void UpdateLoadingAnimations() = 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 int HasAvailableDragActions() const = 0;
+
+ // Performans a drop at the specified location.
+ virtual void PerformDrop(bool drop_before, int index, const GURL& url) = 0;
+
+ // Return true if this tab strip is compatible with the provided tab strip.
+ // Compatible tab strips can transfer tabs during drag and drop.
+ virtual bool IsCompatibleWith(BaseTabStrip* other) const = 0;
+
+ // Creates the new tab.
+ virtual void CreateNewTab() = 0;
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_CONTROLLER_H_
diff --git a/chrome/browser/views/task_manager_view.cc b/chrome/browser/ui/views/task_manager_view.cc
index f8432d4..f8432d4 100644
--- a/chrome/browser/views/task_manager_view.cc
+++ b/chrome/browser/ui/views/task_manager_view.cc
diff --git a/chrome/browser/views/textfield_views.cc b/chrome/browser/ui/views/textfield_views.cc
index f15be68..f15be68 100644
--- a/chrome/browser/views/textfield_views.cc
+++ b/chrome/browser/ui/views/textfield_views.cc
diff --git a/chrome/browser/ui/views/textfield_views.h b/chrome/browser/ui/views/textfield_views.h
new file mode 100644
index 0000000..10fe0a1
--- /dev/null
+++ b/chrome/browser/ui/views/textfield_views.h
@@ -0,0 +1,27 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TEXTFIELD_VIEWS_H_
+#define CHROME_BROWSER_UI_VIEWS_TEXTFIELD_VIEWS_H_
+#pragma once
+
+#include <string>
+
+#include "chrome/browser/views/dom_view.h"
+
+class TextfieldsUI;
+
+class TextfieldViews : public DOMView {
+ public:
+ TextfieldViews();
+ std::wstring GetText();
+ void SetText(const std::wstring& text);
+
+ private:
+ TextfieldsUI* dom_ui();
+
+ DISALLOW_COPY_AND_ASSIGN(TextfieldViews);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TEXTFIELD_VIEWS_H_
diff --git a/chrome/browser/views/theme_background.cc b/chrome/browser/ui/views/theme_background.cc
index ad8d2ed..ad8d2ed 100644
--- a/chrome/browser/views/theme_background.cc
+++ b/chrome/browser/ui/views/theme_background.cc
diff --git a/chrome/browser/ui/views/theme_background.h b/chrome/browser/ui/views/theme_background.h
new file mode 100644
index 0000000..6e32b1a7
--- /dev/null
+++ b/chrome/browser/ui/views/theme_background.h
@@ -0,0 +1,41 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_THEME_BACKGROUND_H_
+#define CHROME_BROWSER_UI_VIEWS_THEME_BACKGROUND_H_
+#pragma once
+
+#include "views/background.h"
+
+class BrowserView;
+
+namespace views {
+class View;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// ThemeBackground class.
+//
+// A ThemeBackground is used to paint the background theme image in a
+// view in such a way that it's consistent with the frame's theme
+// image. It takes care of active/inactive state, incognito state and
+// the offset from the frame view.
+//
+////////////////////////////////////////////////////////////////////////////////
+class ThemeBackground : public views::Background {
+ public:
+ explicit ThemeBackground(BrowserView* browser);
+ virtual ~ThemeBackground() {}
+
+ // Overridden from views:;Background.
+ virtual void Paint(gfx::Canvas* canvas, views::View* view) const;
+
+ private:
+ BrowserView* browser_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(ThemeBackground);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_THEME_BACKGROUND_H_
diff --git a/chrome/browser/views/theme_helpers.cc b/chrome/browser/ui/views/theme_helpers.cc
index 41f6db5..41f6db5 100644
--- a/chrome/browser/views/theme_helpers.cc
+++ b/chrome/browser/ui/views/theme_helpers.cc
diff --git a/chrome/browser/ui/views/theme_helpers.h b/chrome/browser/ui/views/theme_helpers.h
new file mode 100644
index 0000000..3c5260b
--- /dev/null
+++ b/chrome/browser/ui/views/theme_helpers.h
@@ -0,0 +1,30 @@
+// Copyright (c) 2006-2008 The Chromium 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_VIEWS_THEME_HELPERS_H__
+#define CHROME_BROWSER_UI_VIEWS_THEME_HELPERS_H__
+#pragma once
+
+#include <windows.h>
+
+#include "third_party/skia/include/core/SkColor.h"
+
+// Get the colors at two points on a Rebar background gradient. This is for
+// drawing Rebar like backgrounds in Views. The reason not to just use
+// DrawThemeBackground is that it only draws horizontally, but by extracting
+// the colors at two points on the X axis of a background drawn
+// by DrawThemeBackground, we can construct a LinearGradientBrush and draw
+// such a gradient in any direction.
+//
+// The width parameter is the width of horizontal gradient that will be
+// created to calculate the two colors. x1 and x2 are the two pixel positions
+// along the X axis.
+void GetRebarGradientColors(int width, int x1, int x2,
+ SkColor* c1, SkColor* c2);
+
+
+// Gets the color used to draw dark (inset beveled) lines.
+void GetDarkLineColor(SkColor* dark_color);
+
+#endif // CHROME_BROWSER_UI_VIEWS_THEME_HELPERS_H__
diff --git a/chrome/browser/views/theme_install_bubble_view.cc b/chrome/browser/ui/views/theme_install_bubble_view.cc
index 7593fc7..7593fc7 100644
--- a/chrome/browser/views/theme_install_bubble_view.cc
+++ b/chrome/browser/ui/views/theme_install_bubble_view.cc
diff --git a/chrome/browser/ui/views/theme_install_bubble_view.h b/chrome/browser/ui/views/theme_install_bubble_view.h
new file mode 100644
index 0000000..f0460b9
--- /dev/null
+++ b/chrome/browser/ui/views/theme_install_bubble_view.h
@@ -0,0 +1,79 @@
+// Copyright (c) 2009 The Chromium 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_VIEWS_THEME_INSTALL_BUBBLE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_THEME_INSTALL_BUBBLE_VIEW_H_
+#pragma once
+
+#include <string>
+
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "chrome/common/notification_service.h"
+#include "gfx/canvas.h"
+#include "views/controls/label.h"
+
+class TabContents;
+
+namespace views {
+class Widget;
+}
+
+// ThemeInstallBubbleView is a view that provides a "Loading..." bubble in the
+// center of a browser window for use when an extension or theme is loaded.
+// (The Browser class only calls it to install itself into the currently active
+// browser window.) If an extension is being applied, the bubble goes away
+// immediately. If a theme is being applied, it disappears when the theme has
+// been loaded. The purpose of this bubble is to warn the user that the browser
+// may be unresponsive while the theme is being installed.
+//
+// Edge case: note that if one installs a theme in one window and then switches
+// rapidly to another window to install a theme there as well (in the short time
+// between install begin and theme caching seizing the UI thread), the loading
+// bubble will only appear over the first window, as there is only ever one
+// instance of the bubble.
+class ThemeInstallBubbleView : public NotificationObserver,
+ public views::Label {
+ public:
+ ~ThemeInstallBubbleView();
+
+ // NotificationObserver
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Show the loading bubble.
+ static void Show(TabContents* tab_contents);
+
+ private:
+ explicit ThemeInstallBubbleView(TabContents* tab_contents);
+
+ // Put the popup in the correct place on the tab.
+ void Reposition();
+
+ // Inherited from views.
+ gfx::Size GetPreferredSize();
+
+ // Shut down the popup and remove our notifications.
+ void Close();
+
+ virtual void Paint(gfx::Canvas* canvas);
+
+ // The content area at the start of the animation.
+ gfx::Rect tab_contents_bounds_;
+
+ // Widget containing us.
+ views::Widget* popup_;
+
+ // Text to show warning that theme is being installed.
+ std::wstring text_;
+
+ // A scoped container for notification registries.
+ NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(ThemeInstallBubbleView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_THEME_INSTALL_BUBBLE_VIEW_H_
+
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc
index cc82cdcd..cc82cdcd 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar_view.cc
diff --git a/chrome/browser/ui/views/toolbar_view.h b/chrome/browser/ui/views/toolbar_view.h
new file mode 100644
index 0000000..2bcaeed
--- /dev/null
+++ b/chrome/browser/ui/views/toolbar_view.h
@@ -0,0 +1,236 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_TOOLBAR_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_
+#pragma once
+
+#include <vector>
+
+#include "app/menus/accelerator.h"
+#include "app/slide_animation.h"
+#include "base/ref_counted.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/back_forward_menu_model.h"
+#include "chrome/browser/command_updater.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/browser/views/accessible_pane_view.h"
+#include "chrome/browser/views/location_bar/location_bar_view.h"
+#include "chrome/browser/views/reload_button.h"
+#include "views/controls/button/menu_button.h"
+#include "views/controls/menu/menu.h"
+#include "views/controls/menu/menu_wrapper.h"
+#include "views/controls/menu/view_menu_delegate.h"
+#include "views/view.h"
+
+class BrowserActionsContainer;
+class Browser;
+class Profile;
+#if defined(OS_CHROMEOS)
+namespace views {
+class Menu2;
+} // namespace views
+#endif
+class WrenchMenu;
+
+// The Browser Window's toolbar.
+class ToolbarView : public AccessiblePaneView,
+ public views::ViewMenuDelegate,
+ public menus::AcceleratorProvider,
+ public LocationBarView::Delegate,
+ public AnimationDelegate,
+ public NotificationObserver,
+ public CommandUpdater::CommandObserver,
+ public views::ButtonListener {
+ public:
+ explicit ToolbarView(Browser* browser);
+ virtual ~ToolbarView();
+
+ // Create the contents of the Browser Toolbar
+ void Init(Profile* profile);
+
+ // Sets the profile which is active on the currently-active tab.
+ void SetProfile(Profile* profile);
+ Profile* profile() { return profile_; }
+
+ // Updates the toolbar (and transitively the location bar) with the states of
+ // the specified |tab|. If |should_restore_state| is true, we're switching
+ // (back?) to this tab and should restore any previous location bar state
+ // (such as user editing) as well.
+ void Update(TabContents* tab, bool should_restore_state);
+
+ // Set focus to the toolbar with complete keyboard access, with the
+ // focus initially set to the location bar. Focus will be restored
+ // to the ViewStorage with id |view_storage_id| if the user escapes.
+ void SetPaneFocusAndFocusLocationBar(int view_storage_id);
+
+ // Set focus to the toolbar with complete keyboard access, with the
+ // focus initially set to the app menu. Focus will be restored
+ // to the ViewStorage with id |view_storage_id| if the user escapes.
+ void SetPaneFocusAndFocusAppMenu(int view_storage_id);
+
+ // Returns true if the app menu is focused.
+ bool IsAppMenuFocused();
+
+ // Add a listener to receive a callback when the menu opens.
+ void AddMenuListener(views::MenuListener* listener);
+
+ // Remove a menu listener.
+ void RemoveMenuListener(views::MenuListener* listener);
+
+ // Accessors...
+ Browser* browser() const { return browser_; }
+ BrowserActionsContainer* browser_actions() const { return browser_actions_; }
+ ReloadButton* reload_button() const { return reload_; }
+ LocationBarView* location_bar() const { return location_bar_; }
+ views::MenuButton* app_menu() const { return app_menu_; }
+
+ // Overridden from AccessiblePaneView
+ virtual bool SetPaneFocus(int view_storage_id, View* initial_focus);
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+
+ // Overridden from Menu::BaseControllerDelegate:
+ virtual bool GetAcceleratorInfo(int id, menus::Accelerator* accel);
+
+ // Overridden from views::MenuDelegate:
+ virtual void RunMenu(views::View* source, const gfx::Point& pt);
+
+ // Overridden from LocationBarView::Delegate:
+ virtual TabContents* GetTabContents();
+ virtual InstantController* GetInstant();
+ virtual void OnInputInProgress(bool in_progress);
+
+ // Overridden from AnimationDelegate:
+ virtual void AnimationProgressed(const Animation* animation);
+
+ // Overridden from CommandUpdater::CommandObserver:
+ virtual void EnabledStateChangedForCommand(int id, bool enabled);
+
+ // Overridden from views::BaseButton::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Overridden from menus::AcceleratorProvider:
+ virtual bool GetAcceleratorForCommandId(int command_id,
+ menus::Accelerator* accelerator);
+
+ // Overridden from views::View:
+ virtual gfx::Size GetPreferredSize();
+ virtual void Layout();
+ virtual void Paint(gfx::Canvas* canvas);
+ virtual void OnThemeChanged();
+
+ // The apparent horizontal space between most items, and the vertical padding
+ // above and below them.
+ static const int kStandardSpacing;
+ // The top of the toolbar has an edge we have to skip over in addition to the
+ // standard spacing.
+ static const int kVertSpacing;
+
+ protected:
+
+ // Overridden from AccessiblePaneView
+ virtual views::View* GetDefaultFocusableChild();
+ virtual void RemovePaneFocus();
+
+ private:
+ // Returns true if we should show the upgrade recommended dot.
+ bool IsUpgradeRecommended();
+
+ // Returns true if we should show the warning for incompatible software.
+ bool ShouldShowIncompatibilityWarning();
+
+ // Returns the number of pixels above the location bar in non-normal display.
+ int PopupTopSpacing() const;
+
+ // Loads the images for all the child views.
+ void LoadImages();
+
+ // Types of display mode this toolbar can have.
+ enum DisplayMode {
+ DISPLAYMODE_NORMAL, // Normal toolbar with buttons, etc.
+ DISPLAYMODE_LOCATION // Slimline toolbar showing only compact location
+ // bar, used for popups.
+ };
+ bool IsDisplayModeNormal() const {
+ return display_mode_ == DISPLAYMODE_NORMAL;
+ }
+
+ // Starts the recurring timer that periodically asks the notification dot
+ // to pulsate.
+ void ShowNotificationDot();
+
+ // Show the reminder, tempting the user to take a look.
+ void PulsateNotificationDot();
+
+ // Gets a canvas with the icon for the app menu. It will possibly contain
+ // an overlaid badge if an update is recommended.
+ SkBitmap GetAppMenuIcon(views::CustomButton::ButtonState state);
+
+ scoped_ptr<BackForwardMenuModel> back_menu_model_;
+ scoped_ptr<BackForwardMenuModel> forward_menu_model_;
+
+ // The model that contains the security level, text, icon to display...
+ ToolbarModel* model_;
+
+ // Controls
+ views::ImageButton* back_;
+ views::ImageButton* forward_;
+ ReloadButton* reload_;
+ views::ImageButton* home_;
+ LocationBarView* location_bar_;
+ BrowserActionsContainer* browser_actions_;
+ views::MenuButton* app_menu_;
+ Profile* profile_;
+ Browser* browser_;
+
+ // Contents of the profiles menu to populate with profile names.
+ scoped_ptr<menus::SimpleMenuModel> profiles_menu_contents_;
+
+ // Controls whether or not a home button should be shown on the toolbar.
+ BooleanPrefMember show_home_button_;
+
+ // The display mode used when laying out the toolbar.
+ DisplayMode display_mode_;
+
+ // The contents of the wrench menu.
+ scoped_ptr<menus::SimpleMenuModel> wrench_menu_model_;
+
+#if defined(OS_CHROMEOS)
+ // Wrench menu using domui menu.
+ // MenuLister is managed by Menu2.
+ scoped_ptr<views::Menu2> wrench_menu_2_;
+#endif
+
+ // Wrench menu.
+ scoped_refptr<WrenchMenu> wrench_menu_;
+
+ // Vector of listeners to receive callbacks when the menu opens.
+ std::vector<views::MenuListener*> menu_listeners_;
+
+ // The animation that makes the notification dot pulse.
+ scoped_ptr<SlideAnimation> notification_dot_animation_;
+
+ // We periodically restart the animation after it has been showed
+ // once, to create a pulsating effect.
+ base::RepeatingTimer<ToolbarView> notification_dot_pulse_timer_;
+
+ // Used to post tasks to switch to the next/previous menu.
+ ScopedRunnableMethodFactory<ToolbarView> method_factory_;
+
+ NotificationRegistrar registrar_;
+
+ // If non-null the destructor sets this to true. This is set to a non-null
+ // while the menu is showing and used to detect if the menu was deleted while
+ // running.
+ bool* destroyed_flag_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_
diff --git a/chrome/browser/views/unhandled_keyboard_event_handler.cc b/chrome/browser/ui/views/unhandled_keyboard_event_handler.cc
index 9da60ee2..9da60ee2 100644
--- a/chrome/browser/views/unhandled_keyboard_event_handler.cc
+++ b/chrome/browser/ui/views/unhandled_keyboard_event_handler.cc
diff --git a/chrome/browser/ui/views/unhandled_keyboard_event_handler.h b/chrome/browser/ui/views/unhandled_keyboard_event_handler.h
new file mode 100644
index 0000000..de82294
--- /dev/null
+++ b/chrome/browser/ui/views/unhandled_keyboard_event_handler.h
@@ -0,0 +1,40 @@
+// Copyright (c) 2006-2010 The Chromium 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_VIEWS_UNHANDLED_KEYBOARD_EVENT_HANDLER_H_
+#define CHROME_BROWSER_UI_VIEWS_UNHANDLED_KEYBOARD_EVENT_HANDLER_H_
+#pragma once
+
+#include "views/view.h"
+#include "chrome/common/native_web_keyboard_event.h"
+
+namespace views {
+class FocusManager;
+} // namespace views
+
+// This class handles unhandled keyboard messages coming back from the renderer
+// process.
+class UnhandledKeyboardEventHandler {
+ public:
+ UnhandledKeyboardEventHandler();
+ ~UnhandledKeyboardEventHandler();
+
+ void HandleKeyboardEvent(const NativeWebKeyboardEvent& event,
+ views::FocusManager* focus_manager);
+
+ private:
+#if defined(OS_WIN)
+ // Whether to ignore the next Char keyboard event.
+ // If a RawKeyDown event was handled as a shortcut key, then we're done
+ // handling it and should eat any Char event that the translate phase may
+ // have produced from it. (Handling this event may cause undesirable effects,
+ // such as a beep if DefWindowProc() has no default handling for the given
+ // Char.)
+ bool ignore_next_char_event_;
+#endif
+
+ DISALLOW_COPY_AND_ASSIGN(UnhandledKeyboardEventHandler);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_UNHANDLED_KEYBOARD_EVENT_HANDLER_H_
diff --git a/chrome/browser/views/uninstall_view.cc b/chrome/browser/ui/views/uninstall_view.cc
index a7535b0..a7535b0 100644
--- a/chrome/browser/views/uninstall_view.cc
+++ b/chrome/browser/ui/views/uninstall_view.cc
diff --git a/chrome/browser/ui/views/uninstall_view.h b/chrome/browser/ui/views/uninstall_view.h
new file mode 100644
index 0000000..23aad8c
--- /dev/null
+++ b/chrome/browser/ui/views/uninstall_view.h
@@ -0,0 +1,62 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_UNINSTALL_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_UNINSTALL_VIEW_H_
+#pragma once
+
+#include "app/combobox_model.h"
+#include "base/string16.h"
+#include "views/controls/combobox/combobox.h"
+#include "views/window/dialog_delegate.h"
+
+namespace views {
+class Checkbox;
+class Label;
+}
+
+// UninstallView implements the dialog that confirms Chrome uninstallation
+// and asks whether to delete Chrome profile. Also if currently Chrome is set
+// as default browser, it asks users whether to set another browser as default.
+class UninstallView : public views::View,
+ public views::ButtonListener,
+ public views::DialogDelegate,
+ public ComboboxModel {
+ public:
+ explicit UninstallView(int& user_selection);
+ virtual ~UninstallView();
+
+ // Overridden from views::DialogDelegate:
+ virtual bool Accept();
+ virtual bool Cancel();
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+
+ // Overridden form views::ButtonListener.
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Overridden from views::WindowDelegate:
+ virtual std::wstring GetWindowTitle() const;
+ virtual views::View* GetContentsView();
+
+ // Overridden from views::Combobox::Model.
+ virtual int GetItemCount();
+ virtual string16 GetItemAt(int index);
+
+ private:
+ // Initializes the controls on the dialog.
+ void SetupControls();
+
+ views::Label* confirm_label_;
+ views::Checkbox* delete_profile_;
+ views::Checkbox* change_default_browser_;
+ views::Combobox* browsers_combo_;
+ typedef std::map<std::wstring, std::wstring> BrowsersMap;
+ scoped_ptr<BrowsersMap> browsers_;
+ int& user_selection_;
+
+ DISALLOW_COPY_AND_ASSIGN(UninstallView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_UNINSTALL_VIEW_H_
diff --git a/chrome/browser/views/update_recommended_message_box.cc b/chrome/browser/ui/views/update_recommended_message_box.cc
index baf69ab..baf69ab 100644
--- a/chrome/browser/views/update_recommended_message_box.cc
+++ b/chrome/browser/ui/views/update_recommended_message_box.cc
diff --git a/chrome/browser/ui/views/update_recommended_message_box.h b/chrome/browser/ui/views/update_recommended_message_box.h
new file mode 100644
index 0000000..0e115d05
--- /dev/null
+++ b/chrome/browser/ui/views/update_recommended_message_box.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_UPDATE_RECOMMENDED_MESSAGE_BOX_H_
+#define CHROME_BROWSER_UI_VIEWS_UPDATE_RECOMMENDED_MESSAGE_BOX_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "gfx/native_widget_types.h"
+#include "views/window/dialog_delegate.h"
+
+class MessageBoxView;
+
+// A dialog box that tells the user that an update is recommended in order for
+// the latest version to be put to use.
+class UpdateRecommendedMessageBox : public views::DialogDelegate {
+ public:
+ // This box is modal to |parent_window|.
+ static void ShowMessageBox(gfx::NativeWindow parent_window);
+
+ // Overridden from views::DialogDelegate:
+ virtual bool Accept();
+
+ protected:
+ // Overridden from views::DialogDelegate:
+ virtual int GetDialogButtons() const;
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual std::wstring GetWindowTitle() const;
+
+ // Overridden from views::WindowDelegate:
+ virtual void DeleteDelegate();
+ virtual bool IsModal() const;
+ virtual views::View* GetContentsView();
+
+ private:
+ explicit UpdateRecommendedMessageBox(gfx::NativeWindow parent_window);
+ virtual ~UpdateRecommendedMessageBox();
+
+ MessageBoxView* message_box_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(UpdateRecommendedMessageBox);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_UPDATE_RECOMMENDED_MESSAGE_BOX_H_
diff --git a/chrome/browser/views/url_picker.cc b/chrome/browser/ui/views/url_picker.cc
index 4051e63..4051e63 100644
--- a/chrome/browser/views/url_picker.cc
+++ b/chrome/browser/ui/views/url_picker.cc
diff --git a/chrome/browser/ui/views/url_picker.h b/chrome/browser/ui/views/url_picker.h
new file mode 100644
index 0000000..63b9068
--- /dev/null
+++ b/chrome/browser/ui/views/url_picker.h
@@ -0,0 +1,110 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_URL_PICKER_H_
+#define CHROME_BROWSER_UI_VIEWS_URL_PICKER_H_
+#pragma once
+
+#include "views/controls/button/native_button.h"
+#include "views/controls/table/table_view_observer.h"
+#include "views/controls/textfield/textfield.h"
+#include "views/view.h"
+#include "views/window/dialog_delegate.h"
+#include "views/window/window.h"
+
+namespace views {
+class Button;
+class Label;
+class TableView;
+}
+
+class PossibleURLModel;
+class Profile;
+class UrlPicker;
+
+// UrlPicker delegate. Notified when the user accepts the entry.
+class UrlPickerDelegate {
+ public:
+ virtual ~UrlPickerDelegate();
+
+ virtual void AddBookmark(UrlPicker* dialog,
+ const std::wstring& title,
+ const GURL& url) = 0;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// This class implements the dialog that let the user add a bookmark or page
+// to the list of urls to open on startup.
+// UrlPicker deletes itself when the dialog is closed.
+//
+////////////////////////////////////////////////////////////////////////////////
+class UrlPicker : public views::View,
+ public views::DialogDelegate,
+ public views::Textfield::Controller,
+ public views::TableViewObserver {
+ public:
+ UrlPicker(UrlPickerDelegate* delegate,
+ Profile* profile);
+ virtual ~UrlPicker();
+
+ // Show the dialog on the provided contents.
+ virtual void Show(HWND parent);
+
+ // Closes the dialog.
+ void Close();
+
+ // DialogDelegate.
+ virtual std::wstring GetWindowTitle() const;
+ virtual bool IsModal() const;
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual bool Accept();
+ virtual int GetDefaultDialogButton() const;
+ virtual bool IsDialogButtonEnabled(
+ MessageBoxFlags::DialogButton button) const;
+ virtual views::View* GetContentsView();
+
+ // TextField::Controller.
+ virtual void ContentsChanged(views::Textfield* sender,
+ const std::wstring& new_contents);
+ virtual bool HandleKeystroke(views::Textfield* sender,
+ const views::Textfield::Keystroke& key) {
+ return false;
+ }
+
+ // Overridden from View.
+ virtual gfx::Size GetPreferredSize();
+ virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
+
+ // TableViewObserver.
+ virtual void OnSelectionChanged();
+ virtual void OnDoubleClick();
+
+ private:
+ // Modify the model from the user interface.
+ void PerformModelChange();
+
+ // Returns the URL the user has typed.
+ GURL GetInputURL() const;
+
+ // Profile.
+ Profile* profile_;
+
+ // URL Field.
+ views::Textfield* url_field_;
+
+ // The table model.
+ scoped_ptr<PossibleURLModel> url_table_model_;
+
+ // The table of visited urls.
+ views::TableView* url_table_;
+
+ // The delegate.
+ UrlPickerDelegate* delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(UrlPicker);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_URL_PICKER_H_
diff --git a/chrome/browser/views/user_data_dir_dialog.cc b/chrome/browser/ui/views/user_data_dir_dialog.cc
index 59a8a8a..59a8a8a 100644
--- a/chrome/browser/views/user_data_dir_dialog.cc
+++ b/chrome/browser/ui/views/user_data_dir_dialog.cc
diff --git a/chrome/browser/ui/views/user_data_dir_dialog.h b/chrome/browser/ui/views/user_data_dir_dialog.h
new file mode 100644
index 0000000..9120e49b
--- /dev/null
+++ b/chrome/browser/ui/views/user_data_dir_dialog.h
@@ -0,0 +1,72 @@
+// Copyright (c) 2006-2008 The Chromium 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 dialog box that tells the user that we can't write to the specified user
+// data directory. Provides the user a chance to pick a different directory.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_USER_DATA_DIR_DIALOG_H_
+#define CHROME_BROWSER_UI_VIEWS_USER_DATA_DIR_DIALOG_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/message_loop.h"
+#include "chrome/browser/shell_dialogs.h"
+#include "views/window/dialog_delegate.h"
+
+class FilePath;
+class MessageBoxView;
+namespace views {
+class Window;
+}
+
+class UserDataDirDialog : public views::DialogDelegate,
+ public MessageLoopForUI::Dispatcher,
+ public SelectFileDialog::Listener {
+ public:
+ // Creates and runs a user data directory picker dialog. The method blocks
+ // while the dialog is showing. If the user picks a directory, this method
+ // returns the chosen directory. |user_data_dir| is the value of the
+ // directory we were not able to use.
+ static FilePath RunUserDataDirDialog(const FilePath& user_data_dir);
+ virtual ~UserDataDirDialog();
+
+ FilePath user_data_dir() const { return user_data_dir_; }
+
+ // views::DialogDelegate Methods:
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual void DeleteDelegate();
+ virtual bool Accept();
+ virtual bool Cancel();
+
+ // views::WindowDelegate Methods:
+ virtual bool IsAlwaysOnTop() const { return false; }
+ virtual bool IsModal() const { return false; }
+ virtual views::View* GetContentsView();
+
+ // MessageLoop::Dispatcher Method:
+ virtual bool Dispatch(const MSG& msg);
+
+ // SelectFileDialog::Listener Methods:
+ virtual void FileSelected(const FilePath& path, int index, void* params);
+ virtual void FileSelectionCanceled(void* params);
+
+ private:
+ explicit UserDataDirDialog(const FilePath& user_data_dir);
+
+ // Empty until the user picks a directory.
+ FilePath user_data_dir_;
+
+ MessageBoxView* message_box_view_;
+ scoped_refptr<SelectFileDialog> select_file_dialog_;
+
+ // Used to keep track of whether or not to block the message loop (still
+ // waiting for the user to dismiss the dialog).
+ bool is_blocking_;
+
+ DISALLOW_COPY_AND_ASSIGN(UserDataDirDialog);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_USER_DATA_DIR_DIALOG_H_
diff --git a/chrome/browser/views/window.cc b/chrome/browser/ui/views/window.cc
index ae28ce4..ae28ce4 100644
--- a/chrome/browser/views/window.cc
+++ b/chrome/browser/ui/views/window.cc
diff --git a/chrome/browser/ui/views/window.h b/chrome/browser/ui/views/window.h
new file mode 100644
index 0000000..56056ed
--- /dev/null
+++ b/chrome/browser/ui/views/window.h
@@ -0,0 +1,29 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_WINDOW_H_
+#define CHROME_BROWSER_UI_VIEWS_WINDOW_H_
+#pragma once
+
+#include "gfx/native_widget_types.h"
+
+namespace gfx {
+class Rect;
+}
+
+namespace views {
+class Window;
+class WindowDelegate;
+}
+
+namespace browser {
+
+// Create a window for given |delegate| using default frame view.
+views::Window* CreateViewsWindow(gfx::NativeWindow parent,
+ const gfx::Rect& bounds,
+ views::WindowDelegate* delegate);
+
+} // namespace browser
+
+#endif // CHROME_BROWSER_UI_VIEWS_WINDOW_H_
diff --git a/chrome/browser/views/wrench_menu.cc b/chrome/browser/ui/views/wrench_menu.cc
index 4ad20f0..4ad20f0 100644
--- a/chrome/browser/views/wrench_menu.cc
+++ b/chrome/browser/ui/views/wrench_menu.cc
diff --git a/chrome/browser/ui/views/wrench_menu.h b/chrome/browser/ui/views/wrench_menu.h
new file mode 100644
index 0000000..6efaaa8
--- /dev/null
+++ b/chrome/browser/ui/views/wrench_menu.h
@@ -0,0 +1,92 @@
+// Copyright (c) 2010 The Chromium 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_VIEWS_WRENCH_MENU_H_
+#define CHROME_BROWSER_UI_VIEWS_WRENCH_MENU_H_
+#pragma once
+
+#include <map>
+#include <utility>
+
+#include "app/menus/menu_model.h"
+#include "base/ref_counted.h"
+#include "base/scoped_ptr.h"
+#include "views/controls/menu/menu_delegate.h"
+
+class Browser;
+
+namespace views {
+class MenuButton;
+class MenuItemView;
+class View;
+} // namespace views
+
+// WrenchMenu adapts the WrenchMenuModel to view's menu related classes.
+class WrenchMenu : public base::RefCounted<WrenchMenu>,
+ public views::MenuDelegate {
+ public:
+ explicit WrenchMenu(Browser* browser);
+
+ void Init(menus::MenuModel* model);
+
+ // Shows the menu relative to the specified view.
+ void RunMenu(views::MenuButton* host);
+
+ // MenuDelegate overrides:
+ virtual bool IsItemChecked(int id) const;
+ virtual bool IsCommandEnabled(int id) const;
+ virtual void ExecuteCommand(int id);
+ virtual bool GetAccelerator(int id, views::Accelerator* accelerator);
+
+ private:
+ friend class base::RefCounted<WrenchMenu>;
+
+ class CutCopyPasteView;
+ class ZoomView;
+
+ typedef std::pair<menus::MenuModel*,int> Entry;
+ typedef std::map<int,Entry> IDToEntry;
+
+ ~WrenchMenu();
+
+ // Populates |parent| with all the child menus in |model|. Recursively invokes
+ // |PopulateMenu| for any submenu. |next_id| is incremented for every menu
+ // that is created.
+ void PopulateMenu(views::MenuItemView* parent,
+ menus::MenuModel* model,
+ int* next_id);
+
+ // Adds a new menu to |parent| to represent the MenuModel/index pair passed
+ // in.
+ views::MenuItemView* AppendMenuItem(views::MenuItemView* parent,
+ menus::MenuModel* model,
+ int index,
+ menus::MenuModel::ItemType menu_type,
+ int* next_id);
+
+ // Invoked from the cut/copy/paste menus. Cancels the current active menu and
+ // activates the menu item in |model| at |index|.
+ void CancelAndEvaluate(menus::MenuModel* model, int index);
+
+ // The views menu.
+ scoped_ptr<views::MenuItemView> root_;
+
+ // Maps from the ID as understood by MenuItemView to the model/index pair the
+ // item came from.
+ IDToEntry id_to_entry_;
+
+ // Browser the menu is being shown for.
+ Browser* browser_;
+
+ // |CancelAndEvaluate| sets |selected_menu_model_| and |selected_index_|.
+ // If |selected_menu_model_| is non-null after the menu completes
+ // ActivatedAt is invoked. This is done so that ActivatedAt isn't invoked
+ // while the message loop is nested.
+ menus::MenuModel* selected_menu_model_;
+ int selected_index_;
+
+ DISALLOW_COPY_AND_ASSIGN(WrenchMenu);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_WRENCH_MENU_H_
diff --git a/chrome/browser/views/about_chrome_view.h b/chrome/browser/views/about_chrome_view.h
index 828c4e6..cb2a7dd6 100644
--- a/chrome/browser/views/about_chrome_view.h
+++ b/chrome/browser/views/about_chrome_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,168 +6,8 @@
#define CHROME_BROWSER_VIEWS_ABOUT_CHROME_VIEW_H_
#pragma once
-#include "views/controls/image_view.h"
-#include "views/controls/label.h"
-#include "views/controls/link.h"
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
-
-#if defined(OS_WIN) || defined(OS_CHROMEOS)
-#include "chrome/browser/google/google_update.h"
-#endif
-#if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/version_loader.h"
-#endif
-
-namespace views {
-class Textfield;
-class Throbber;
-class Window;
-}
-
-class AccessibleViewHelper;
-class Profile;
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// The AboutChromeView class is responsible for drawing the UI controls of the
-// About Chrome dialog that allows the user to see what version is installed
-// and check for updates.
-//
-////////////////////////////////////////////////////////////////////////////////
-class AboutChromeView : public views::View,
- public views::DialogDelegate,
- public views::LinkController
-#if defined(OS_WIN) || defined(OS_CHROMEOS)
- , public GoogleUpdateStatusListener
-#endif
- {
- public:
- explicit AboutChromeView(Profile* profile);
- virtual ~AboutChromeView();
-
- // Initialize the controls on the dialog.
- void Init();
-
- // Overridden from views::View:
- virtual gfx::Size GetPreferredSize();
- virtual void Layout();
- virtual void Paint(gfx::Canvas* canvas);
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
-
- // Overridden from views::DialogDelegate:
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual bool IsDialogButtonEnabled(
- MessageBoxFlags::DialogButton button) const;
- virtual bool IsDialogButtonVisible(
- MessageBoxFlags::DialogButton button) const;
- virtual int GetDefaultDialogButton() const;
- virtual bool CanResize() const;
- virtual bool CanMaximize() const;
- virtual bool IsAlwaysOnTop() const;
- virtual bool HasAlwaysOnTopMenu() const;
- virtual bool IsModal() const;
- virtual std::wstring GetWindowTitle() const;
- virtual bool Accept();
- virtual views::View* GetContentsView();
-
- // Overridden from views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
-#if defined(OS_WIN) || defined(OS_CHROMEOS)
- // Overridden from GoogleUpdateStatusListener:
- virtual void OnReportResults(GoogleUpdateUpgradeResult result,
- GoogleUpdateErrorCode error_code,
- const std::wstring& version);
-#endif
-
- private:
-#if defined(OS_WIN) || defined(OS_CHROMEOS)
- // Update the UI to show the status of the upgrade.
- void UpdateStatus(GoogleUpdateUpgradeResult result,
- GoogleUpdateErrorCode error_code);
-#endif
-
-#if defined(OS_CHROMEOS)
- // Callback from chromeos::VersionLoader giving the version.
- void OnOSVersion(chromeos::VersionLoader::Handle handle,
- std::string version);
-#endif
-
-
- Profile* profile_;
-
- // UI elements on the dialog.
- views::ImageView* about_dlg_background_logo_;
- views::Label* about_title_label_;
- views::Textfield* version_label_;
-#if defined(OS_CHROMEOS)
- views::Textfield* os_version_label_;
-#endif
- views::Label* copyright_label_;
- views::Label* main_text_label_;
- int main_text_label_height_;
- views::Link* chromium_url_;
- gfx::Rect chromium_url_rect_;
- views::Link* open_source_url_;
- gfx::Rect open_source_url_rect_;
- views::Link* terms_of_service_url_;
- gfx::Rect terms_of_service_url_rect_;
- // UI elements we add to the parent view.
- scoped_ptr<views::Throbber> throbber_;
- views::ImageView success_indicator_;
- views::ImageView update_available_indicator_;
- views::ImageView timeout_indicator_;
- views::Label update_label_;
-
- // The dialog dimensions.
- gfx::Size dialog_dimensions_;
-
- // Keeps track of the visible state of the Restart Now button.
- bool restart_button_visible_;
-
- // The text to display as the main label of the About box. We draw this text
- // word for word with the help of the WordIterator, and make room for URLs
- // which are drawn using views::Link. See also |url_offsets_|.
- std::wstring main_label_chunk1_;
- std::wstring main_label_chunk2_;
- std::wstring main_label_chunk3_;
- std::wstring main_label_chunk4_;
- std::wstring main_label_chunk5_;
- // Determines the order of the two links we draw in the main label.
- bool chromium_url_appears_first_;
-
-#if defined(OS_WIN) || defined(OS_CHROMEOS)
- // The class that communicates with Google Update to find out if an update is
- // available and asks it to start an upgrade.
- scoped_refptr<GoogleUpdate> google_updater_;
-#endif
-
- // Our current version.
- std::wstring current_version_;
-
- // Additional information about the version (channel and build number).
- std::wstring version_details_;
-
- // The version Google Update reports is available to us.
- std::wstring new_version_available_;
-
- // Whether text direction is left-to-right or right-to-left.
- bool text_direction_is_rtl_;
-
-#if defined(OS_CHROMEOS)
- // Handles asynchronously loading the version.
- chromeos::VersionLoader loader_;
-
- // Used to request the version.
- CancelableRequestConsumer consumer_;
-#endif
-
- scoped_ptr<AccessibleViewHelper> accessible_view_helper_;
-
- DISALLOW_COPY_AND_ASSIGN(AboutChromeView);
-};
+#include "chrome/browser/ui/views/about_chrome_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_ABOUT_CHROME_VIEW_H_
+
diff --git a/chrome/browser/views/about_ipc_dialog.h b/chrome/browser/views/about_ipc_dialog.h
index 9594c8b..13c1255 100644
--- a/chrome/browser/views/about_ipc_dialog.h
+++ b/chrome/browser/views/about_ipc_dialog.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,74 +6,8 @@
#define CHROME_BROWSER_VIEWS_ABOUT_IPC_DIALOG_H_
#pragma once
-#if defined(OS_WIN) && defined(IPC_MESSAGE_LOG_ENABLED)
-
-#include <atlbase.h>
-#include <atlapp.h>
-#include <atlwin.h>
-#include <atlctrls.h>
-
-#include "base/singleton.h"
-#include "ipc/ipc_logging.h"
-#include "views/controls/button/button.h"
-#include "views/controls/table/table_view.h"
-#include "views/window/dialog_delegate.h"
-
-
-class Profile;
-namespace views {
-class NativeViewHost;
-class TextButton;
-} // namespace views
-
-class AboutIPCDialog : public views::DialogDelegate,
- public views::ButtonListener,
- public IPC::Logging::Consumer,
- public views::View {
- public:
- // This dialog is a singleton. If the dialog is already opened, it won't do
- // anything, so you can just blindly call this function all you want.
- static void RunDialog();
-
- virtual ~AboutIPCDialog();
-
- private:
- friend struct DefaultSingletonTraits<AboutIPCDialog>;
-
- AboutIPCDialog();
-
- // Sets up all UI controls for the dialog.
- void SetupControls();
-
- // views::View overrides.
- virtual gfx::Size GetPreferredSize();
- virtual views::View* GetContentsView();
- virtual int GetDialogButtons() const;
- virtual std::wstring GetWindowTitle() const;
- virtual void Layout();
-
- // IPC::Logging::Consumer implementation.
- virtual void Log(const IPC::LogData& data);
-
- // views::WindowDelegate (via view::DialogDelegate).
- virtual bool CanResize() const;
-
- // views::ButtonListener.
- virtual void ButtonPressed(views::Button* button, const views::Event& event);
-
- WTL::CListViewCtrl message_list_;
-
- views::TextButton* track_toggle_;
- views::TextButton* clear_button_;
- views::TextButton* filter_button_;
- views::NativeViewHost* table_;
-
- // Set to true when we're tracking network status.
- bool tracking_;
-
- DISALLOW_COPY_AND_ASSIGN(AboutIPCDialog);
-};
-
-#endif // OS_WIN && IPC_MESSAGE_LOG_ENABLED
+#include "chrome/browser/ui/views/about_ipc_dialog.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_ABOUT_IPC_DIALOG_H_
+
diff --git a/chrome/browser/views/accelerator_table_gtk.h b/chrome/browser/views/accelerator_table_gtk.h
index bbab634..1b3a20a 100644
--- a/chrome/browser/views/accelerator_table_gtk.h
+++ b/chrome/browser/views/accelerator_table_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,27 +6,8 @@
#define CHROME_BROWSER_VIEWS_ACCELERATOR_TABLE_GTK_H_
#pragma once
-#include <stdio.h>
-
-#include "app/keyboard_codes.h"
-
-// This contains the list of accelerators for the Linux toolkit_view
-// implementation.
-namespace browser {
-
- struct AcceleratorMapping {
- app::KeyboardCode keycode;
- bool shift_pressed;
- bool ctrl_pressed;
- bool alt_pressed;
- int command_id;
- };
-
- // The list of accelerators.
- extern const AcceleratorMapping kAcceleratorMap[];
-
- // The numbers of elements in kAcceleratorMap.
- extern const size_t kAcceleratorMapLength;
-}
+#include "chrome/browser/ui/views/accelerator_table_gtk.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_ACCELERATOR_TABLE_GTK_H_
+
diff --git a/chrome/browser/views/accessibility_event_router_views.h b/chrome/browser/views/accessibility_event_router_views.h
index 8e2b7b5..e3850b2 100644
--- a/chrome/browser/views/accessibility_event_router_views.h
+++ b/chrome/browser/views/accessibility_event_router_views.h
@@ -6,149 +6,8 @@
#define CHROME_BROWSER_VIEWS_ACCESSIBILITY_EVENT_ROUTER_VIEWS_H_
#pragma once
-#include <string>
-
-#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"
-#include "views/accessibility/accessibility_types.h"
-
-class Profile;
-namespace views {
-class View;
-}
-
-// Allows us to use (View*) in a hash_map with gcc.
-#if defined(COMPILER_GCC)
-namespace __gnu_cxx {
-template<>
-struct hash<views::View*> {
- size_t operator()(views::View* view) const {
- return reinterpret_cast<size_t>(view);
- }
-};
-} // namespace __gnu_cxx
-#endif // defined(COMPILER_GCC)
-
-// 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 listeners to many views, then sends an
-// accessibility notification whenever a relevant event occurs in an
-// accessible view.
-//
-// Views 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 AccessibilityEventRouterViews {
- public:
- // Internal information about a particular view to override the
- // information we get directly from the view.
- struct ViewInfo {
- ViewInfo() : ignore(false) {}
-
- // If nonempty, will use this name instead of the view's label.
- std::string name;
-
- // If true, will ignore this widget and not send accessibility events.
- bool ignore;
- };
-
- // Get the single instance of this class.
- static AccessibilityEventRouterViews* GetInstance();
-
- // Start sending accessibility events for this view and all of its
- // descendants. Notifications will go to the specified profile.
- // Returns true on success, false if "view" was already registered.
- // It is the responsibility of the caller to call RemoveViewTree if
- // this view is ever deleted; consider using AccessibleViewHelper.
- bool AddViewTree(views::View* view, Profile* profile);
-
- // Stop sending accessibility events for this view and all of its
- // descendants.
- void RemoveViewTree(views::View* view);
-
- // Don't send any events for this view.
- void IgnoreView(views::View* view);
-
- // Use the following string as the name of this view, instead of the
- // gtk label associated with the view.
- void SetViewName(views::View* view, std::string name);
-
- // Forget all information about this view.
- void RemoveView(views::View* view);
-
- // Handle an accessibility event generated by a view.
- void HandleAccessibilityEvent(
- views::View* view, AccessibilityTypes::Event event_type);
-
- private:
- AccessibilityEventRouterViews();
- virtual ~AccessibilityEventRouterViews();
-
- friend struct DefaultSingletonTraits<AccessibilityEventRouterViews>;
- FRIEND_TEST_ALL_PREFIXES(AccessibilityEventRouterViewsTest,
- TestFocusNotification);
-
- // Given a view, determine if it's part of a view tree that's mapped to
- // a profile and if so, if it's marked as accessible.
- void FindView(views::View* view, Profile** profile, bool* is_accessible);
-
- // Checks the type of the view and calls one of the more specific
- // Send*Notification methods, below.
- void DispatchAccessibilityNotification(
- views::View* view, NotificationType type);
-
- // Return the name of a view.
- std::string GetViewName(views::View* view);
-
- // Each of these methods constructs an AccessibilityControlInfo object
- // and sends a notification of a specific accessibility event.
- void SendButtonNotification(
- views::View* view, NotificationType type, Profile* profile);
- void SendLinkNotification(
- views::View* view, NotificationType type, Profile* profile);
- void SendMenuNotification(
- views::View* view, NotificationType type, Profile* profile);
- void SendMenuItemNotification(
- views::View* view, NotificationType type, Profile* profile);
- void SendLocationBarNotification(
- views::View* view, NotificationType type, Profile* profile);
-
- // Return true if it's an event on a menu.
- bool IsMenuEvent(views::View* view, NotificationType type);
-
- // Recursively explore all menu items of |menu| and return in |count|
- // the total number of items, and in |index| the 0-based index of
- // |item|, if found. Initialize |count| to zero before calling this
- // method. |index| will be unchanged if the item is not found, so
- // initialize it to -1 to detect this case.
- void RecursiveGetMenuItemIndexAndCount(
- views::View* menu, views::View* item, int* index, int* count);
-
- // The set of all view tree roots; only descendants of these will generate
- // accessibility notifications.
- base::hash_map<views::View*, Profile*> view_tree_profile_map_;
-
- // Extra information about specific views.
- base::hash_map<views::View*, ViewInfo> view_info_map_;
-
- // 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_;
-
- // Used to defer handling of some events until the next time
- // through the event loop.
- ScopedRunnableMethodFactory<AccessibilityEventRouterViews> method_factory_;
-};
+#include "chrome/browser/ui/views/accessibility_event_router_views.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_ACCESSIBILITY_EVENT_ROUTER_VIEWS_H_
+
diff --git a/chrome/browser/views/accessible_pane_view.h b/chrome/browser/views/accessible_pane_view.h
index f31f59b..8a2ebb1 100644
--- a/chrome/browser/views/accessible_pane_view.h
+++ b/chrome/browser/views/accessible_pane_view.h
@@ -6,95 +6,8 @@
#define CHROME_BROWSER_VIEWS_ACCESSIBLE_PANE_VIEW_H_
#pragma once
-#include "base/hash_tables.h"
-#include "base/scoped_ptr.h"
-#include "base/task.h"
-#include "views/focus/focus_manager.h"
-#include "views/view.h"
-
-namespace views {
-class FocusSearch;
-}
-
-// This class provides keyboard access to any view that extends it, typically
-// a toolbar. The user sets focus to a control in this view by pressing
-// F6 to traverse all panes, or by pressing a shortcut that jumps directly
-// to this pane.
-class AccessiblePaneView : public views::View,
- public views::FocusChangeListener,
- public views::FocusTraversable {
- public:
- AccessiblePaneView();
- virtual ~AccessiblePaneView();
-
- // Set focus to the pane with complete keyboard access.
- // Focus will be restored to the ViewStorage with id |view_storage_id|
- // if the user escapes. If |initial_focus| is not NULL, that control will get
- // the initial focus, if it's enabled and focusable. Returns true if
- // the pane was able to receive focus.
- virtual bool SetPaneFocus(int view_storage_id, View* initial_focus);
-
- // Set focus to the pane with complete keyboard access, with the
- // focus initially set to the default child. Focus will be restored
- // to the ViewStorage with id |view_storage_id| if the user escapes.
- // Returns true if the pane was able to receive focus.
- virtual bool SetPaneFocusAndFocusDefault(int view_storage_id);
-
- // Overridden from views::View:
- virtual FocusTraversable* GetPaneFocusTraversable();
- virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
- virtual void SetVisible(bool flag);
- virtual AccessibilityTypes::Role GetAccessibleRole();
-
- // Overridden from views::FocusChangeListener:
- virtual void FocusWillChange(View* focused_before,
- View* focused_now);
-
- // Overridden from views::FocusTraversable:
- virtual views::FocusSearch* GetFocusSearch();
- virtual FocusTraversable* GetFocusTraversableParent();
- virtual View* GetFocusTraversableParentView();
-
- protected:
- // A subclass can override this to provide a default focusable child
- // other than the first focusable child.
- virtual views::View* GetDefaultFocusableChild() { return NULL; }
-
- // Remove pane focus.
- virtual void RemovePaneFocus();
-
- // Select all text in the location bar
- virtual void LocationBarSelectAll();
-
- void RestoreLastFocusedView();
-
- View* GetFirstFocusableChild();
- View* GetLastFocusableChild();
-
- bool pane_has_focus_;
-
- ScopedRunnableMethodFactory<AccessiblePaneView> method_factory_;
-
- // Save the focus manager rather than calling GetFocusManager(),
- // so that we can remove focus listeners in the destructor.
- views::FocusManager* focus_manager_;
-
- // Our custom focus search implementation that traps focus in this
- // pane and traverses all views that are focusable for accessibility,
- // not just those that are normally focusable.
- scoped_ptr<views::FocusSearch> focus_search_;
-
- // Registered accelerators
- views::Accelerator home_key_;
- views::Accelerator end_key_;
- views::Accelerator escape_key_;
- views::Accelerator left_key_;
- views::Accelerator right_key_;
-
- // Last focused view that issued this traversal.
- int last_focused_view_storage_id_;
-
- DISALLOW_COPY_AND_ASSIGN(AccessiblePaneView);
-};
+#include "chrome/browser/ui/views/accessible_pane_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_ACCESSIBLE_PANE_VIEW_H_
+
diff --git a/chrome/browser/views/accessible_view_helper.h b/chrome/browser/views/accessible_view_helper.h
index 3309c0f..e02fde1 100644
--- a/chrome/browser/views/accessible_view_helper.h
+++ b/chrome/browser/views/accessible_view_helper.h
@@ -6,78 +6,8 @@
#define CHROME_BROWSER_VIEWS_ACCESSIBLE_VIEW_HELPER_H_
#pragma once
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "base/singleton.h"
-#include "chrome/browser/accessibility_events.h"
-#include "gfx/native_widget_types.h"
-
-#if defined(OS_LINUX)
-#include "chrome/browser/gtk/accessible_widget_helper_gtk.h"
-#endif
-
-class AccessibilityEventRouterViews;
-class Profile;
-namespace views {
-class View;
-}
-
-// 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 a
-// view and all of its descendants. Create an instance of this class for
-// the root of a tree of views (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 ignore a particular
-// view or change its details.
-//
-// All of the information managed by this class is registered with the
-// (global) AccessibilityEventRouterViews and unregistered when this object is
-// destroyed.
-class AccessibleViewHelper {
- public:
- // Constructs an AccessibleViewHelper that makes the given view and all
- // of its descendants accessible for the lifetime of this object,
- // sending accessibility notifications to the given profile.
- AccessibleViewHelper(views::View* view_tree, Profile* profile);
-
- virtual ~AccessibleViewHelper();
-
- // Sends 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);
-
- // Uses the following string as the name of this view, instead of
- // view->GetAccessibleName().
- void SetViewName(views::View* view, std::string name);
-
- // Uses the following string id as the name of this view, instead of
- // view->GetAccessibleName().
- void SetViewName(views::View* view, int string_id);
-
- private:
- // Returns a native view if the given view has a native view in it.
- gfx::NativeView GetNativeView(views::View* view) const;
-
- AccessibilityEventRouterViews* accessibility_event_router_;
- Profile* profile_;
- views::View* view_tree_;
- std::string window_title_;
- std::vector<views::View*> managed_views_;
-
-#if defined(OS_LINUX)
- scoped_ptr<AccessibleWidgetHelper> widget_helper_;
-#endif
-
- DISALLOW_COPY_AND_ASSIGN(AccessibleViewHelper);
-};
+#include "chrome/browser/ui/views/accessible_view_helper.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_ACCESSIBLE_VIEW_HELPER_H_
+
diff --git a/chrome/browser/views/appcache_info_view.h b/chrome/browser/views/appcache_info_view.h
index e943425..991b819 100644
--- a/chrome/browser/views/appcache_info_view.h
+++ b/chrome/browser/views/appcache_info_view.h
@@ -6,19 +6,8 @@
#define CHROME_BROWSER_VIEWS_APPCACHE_INFO_VIEW_H_
#pragma once
-#include "chrome/browser/views/generic_info_view.h"
-#include "chrome/browser/browsing_data_appcache_helper.h"
-
-// AppCacheInfoView
-// Displays a tabular grid of AppCache information.
-class AppCacheInfoView : public GenericInfoView {
- public:
- AppCacheInfoView();
- void SetAppCacheInfo(const appcache::AppCacheInfo* info);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(AppCacheInfoView);
-};
+#include "chrome/browser/ui/views/appcache_info_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_APPCACHE_INFO_VIEW_H_
diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h
index 9a3e2bc..770818d 100644
--- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h
+++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h
@@ -6,172 +6,8 @@
#define CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_
#pragma once
-#include "app/slide_animation.h"
-#include "chrome/browser/autocomplete/autocomplete.h"
-#include "chrome/browser/autocomplete/autocomplete_popup_model.h"
-#include "chrome/browser/autocomplete/autocomplete_popup_view.h"
-#include "gfx/font.h"
-#include "views/view.h"
-#include "webkit/glue/window_open_disposition.h"
-
-#if defined(OS_WIN)
-#include "chrome/browser/views/autocomplete/autocomplete_popup_win.h"
-#else
-#include "chrome/browser/views/autocomplete/autocomplete_popup_gtk.h"
-#endif
-
-class AutocompleteEditModel;
-class AutocompleteEditViewWin;
-struct AutocompleteMatch;
-class BubbleBorder;
-class Profile;
-
-// An interface implemented by an object that provides data to populate
-// individual result views.
-class AutocompleteResultViewModel {
- public:
- // Returns true if the index is selected.
- virtual bool IsSelectedIndex(size_t index) const = 0;
-
- // Returns true if the index is hovered.
- virtual bool IsHoveredIndex(size_t index) const = 0;
-
- // Returns the special-case icon we should use for the given index, or NULL
- // if we should use the default icon.
- virtual const SkBitmap* GetSpecialIcon(size_t index) const = 0;
-};
-
-// A view representing the contents of the autocomplete popup.
-class AutocompletePopupContentsView : public views::View,
- public AutocompleteResultViewModel,
- public AutocompletePopupView,
- public AnimationDelegate {
- public:
- AutocompletePopupContentsView(const gfx::Font& font,
- AutocompleteEditView* edit_view,
- AutocompleteEditModel* edit_model,
- Profile* profile,
- const views::View* location_bar);
- virtual ~AutocompletePopupContentsView();
-
- // Returns the bounds the popup should be shown at. This is the display bounds
- // and includes offsets for the dropshadow which this view's border renders.
- gfx::Rect GetPopupBounds() const;
-
- // Overridden from AutocompletePopupView:
- virtual bool IsOpen() const;
- virtual void InvalidateLine(size_t line);
- virtual void UpdatePopupAppearance();
- virtual gfx::Rect GetTargetBounds();
- virtual void PaintUpdatesNow();
- virtual void OnDragCanceled();
- virtual AutocompletePopupModel* GetModel();
-
- // Overridden from AutocompleteResultViewModel:
- virtual bool IsSelectedIndex(size_t index) const;
- virtual bool IsHoveredIndex(size_t index) const;
- virtual const SkBitmap* GetSpecialIcon(size_t index) const;
-
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
-
- // Overridden from views::View:
- virtual void Paint(gfx::Canvas* canvas);
- virtual void PaintChildren(gfx::Canvas* canvas) {
- // We paint our children inside Paint().
- }
- virtual void Layout();
- virtual void OnMouseEntered(const views::MouseEvent& event);
- virtual void OnMouseMoved(const views::MouseEvent& event);
- virtual void OnMouseExited(const views::MouseEvent& event);
- virtual bool OnMousePressed(const views::MouseEvent& event);
- virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
- virtual bool OnMouseDragged(const views::MouseEvent& event);
- virtual views::View* GetViewForPoint(const gfx::Point& point);
-
- private:
-#if defined(OS_WIN)
- typedef AutocompletePopupWin AutocompletePopupClass;
-#else
- typedef AutocompletePopupGtk AutocompletePopupClass;
-#endif
- class InstantOptInView;
-
- // Returns true if the model has a match at the specified index.
- bool HasMatchAt(size_t index) const;
-
- // Returns the match at the specified index within the popup model.
- const AutocompleteMatch& GetMatchAtIndex(size_t index) const;
-
- // Fill a path for the contents' roundrect. |bounding_rect| is the rect that
- // bounds the path.
- void MakeContentsPath(gfx::Path* path, const gfx::Rect& bounding_rect);
-
- // Updates the window's blur region for the current size.
- void UpdateBlurRegion();
-
- // Makes the contents of the canvas slightly transparent.
- void MakeCanvasTransparent(gfx::Canvas* canvas);
-
- // Called when the line at the specified index should be opened with the
- // provided disposition.
- void OpenIndex(size_t index, WindowOpenDisposition disposition);
-
- // Find the index of the match under the given |point|, specified in window
- // coordinates. Returns AutocompletePopupModel::kNoMatch if there isn't a
- // match at the specified point.
- size_t GetIndexForPoint(const gfx::Point& point);
-
- // Returns the target bounds given the specified content height.
- gfx::Rect CalculateTargetBounds(int h);
-
- // Invoked if the user clicks on one of the opt-in buttons. Removes the opt-in
- // view.
- void UserPressedOptIn(bool opt_in);
-
- // The popup that contains this view. We create this, but it deletes itself
- // when its window is destroyed. This is a WeakPtr because it's possible for
- // the OS to destroy the window and thus delete this object before we're
- // deleted, or without our knowledge.
- base::WeakPtr<AutocompletePopupClass> popup_;
-
- // The provider of our result set.
- scoped_ptr<AutocompletePopupModel> model_;
-
- // The edit view that invokes us.
- AutocompleteEditView* edit_view_;
-
- // An object that the popup positions itself against.
- const views::View* location_bar_;
-
- // Our border, which can compute our desired bounds.
- const BubbleBorder* bubble_border_;
-
- // The font that we should use for result rows. This is based on the font used
- // by the edit that created us.
- gfx::Font result_font_;
-
- // The font used for portions that match the input.
- gfx::Font result_bold_font_;
-
- // If the user cancels a dragging action (i.e. by pressing ESC), we don't have
- // a convenient way to release mouse capture. Instead we use this flag to
- // simply ignore all remaining drag events, and the eventual mouse release
- // event. Since OnDragCanceled() can be called when we're not dragging, this
- // flag is reset to false on a mouse pressed event, to make sure we don't
- // erroneously ignore the next drag.
- bool ignore_mouse_drag_;
-
- // The popup sizes vertically using an animation when the popup is getting
- // shorter (not larger, that makes it look "slow").
- SlideAnimation size_animation_;
- gfx::Rect start_bounds_;
- gfx::Rect target_bounds_;
-
- // If non-NULL the instant opt-in-view is visible.
- views::View* opt_in_view_;
-
- DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView);
-};
+#include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_
+
diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_gtk.h b/chrome/browser/views/autocomplete/autocomplete_popup_gtk.h
index 461420a..f3a156f 100644
--- a/chrome/browser/views/autocomplete/autocomplete_popup_gtk.h
+++ b/chrome/browser/views/autocomplete/autocomplete_popup_gtk.h
@@ -6,23 +6,8 @@
#define CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_GTK_H_
#pragma once
-#include "base/weak_ptr.h"
-#include "views/widget/widget_gtk.h"
-
-class AutocompleteEditView;
-class AutocompletePopupContentsView;
-
-class AutocompletePopupGtk
- : public views::WidgetGtk,
- public base::SupportsWeakPtr<AutocompletePopupGtk> {
- public:
- // Creates the popup and shows it. |edit_view| is the edit that created us.
- AutocompletePopupGtk(AutocompleteEditView* edit_view,
- AutocompletePopupContentsView* contents);
- virtual ~AutocompletePopupGtk();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(AutocompletePopupGtk);
-};
+#include "chrome/browser/ui/views/autocomplete/autocomplete_popup_gtk.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_GTK_H_
+
diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_win.h b/chrome/browser/views/autocomplete/autocomplete_popup_win.h
index cf6a364..68fa02c 100644
--- a/chrome/browser/views/autocomplete/autocomplete_popup_win.h
+++ b/chrome/browser/views/autocomplete/autocomplete_popup_win.h
@@ -6,28 +6,8 @@
#define CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_WIN_H_
#pragma once
-#include "base/weak_ptr.h"
-#include "views/widget/widget_win.h"
-
-class AutocompleteEditView;
-class AutocompletePopupContentsView;
-
-class AutocompletePopupWin
- : public views::WidgetWin,
- public base::SupportsWeakPtr<AutocompletePopupWin> {
- public:
- // Creates the popup and shows it. |edit_view| is the edit that created us.
- AutocompletePopupWin(AutocompleteEditView* edit_view,
- AutocompletePopupContentsView* contents);
- virtual ~AutocompletePopupWin();
-
- private:
- // Overridden from WidgetWin:
- virtual LRESULT OnMouseActivate(HWND window,
- UINT hit_test,
- UINT mouse_message);
-
- DISALLOW_COPY_AND_ASSIGN(AutocompletePopupWin);
-};
+#include "chrome/browser/ui/views/autocomplete/autocomplete_popup_win.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_WIN_H_
+
diff --git a/chrome/browser/views/autofill_profiles_view_win.h b/chrome/browser/views/autofill_profiles_view_win.h
index efeaf59..5768e9f 100644
--- a/chrome/browser/views/autofill_profiles_view_win.h
+++ b/chrome/browser/views/autofill_profiles_view_win.h
@@ -6,435 +6,8 @@
#define CHROME_BROWSER_VIEWS_AUTOFILL_PROFILES_VIEW_WIN_H_
#pragma once
-#include <list>
-#include <map>
-#include <vector>
-
-#include "app/combobox_model.h"
-#include "app/table_model.h"
-#include "base/string16.h"
-#include "chrome/browser/autofill/autofill_dialog.h"
-#include "chrome/browser/autofill/autofill_profile.h"
-#include "chrome/browser/autofill/personal_data_manager.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/common/notification_observer.h"
-#include "views/controls/combobox/combobox.h"
-#include "views/controls/link.h"
-#include "views/controls/table/table_view_observer.h"
-#include "views/controls/textfield/textfield.h"
-#include "views/focus/focus_manager.h"
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
-
-namespace views {
-class Checkbox;
-class GridLayout;
-class ImageButton;
-class Label;
-class RadioButton;
-class TableView;
-class TextButton;
-} // namespace views
-
-class PrefService;
-class SkBitmap;
-
-///////////////////////////////////////////////////////////////////////////////
-// AutoFillProfilesView
-//
-// The contents of the "AutoFill profiles" dialog window.
-//
-// Overview: has following sub-views:
-// EditableSetViewContents - set of displayed fields for address or credit card,
-// has iterator to std::vector<EditableSetInfo> vector so data could be
-// updated or notifications passes to the dialog view.
-// PhoneSubView - support view for the phone fields sets. used in
-// ScrollViewContents.
-// And there is a support data structure EditableSetInfo which encapsulates
-// editable set (address or credit card) and allows for quick addition and
-// deletion.
-class AutoFillProfilesView : public views::View,
- public views::DialogDelegate,
- public views::ButtonListener,
- public views::LinkController,
- public views::FocusChangeListener,
- public views::TableViewObserver,
- public PersonalDataManager::Observer,
- public NotificationObserver {
- public:
- virtual ~AutoFillProfilesView();
-
- static int Show(gfx::NativeWindow parent,
- AutoFillDialogObserver* observer,
- PersonalDataManager* personal_data_manager,
- Profile* profile,
- PrefService* preferences,
- AutoFillProfile* imported_profile,
- CreditCard* imported_credit_card);
-
- protected:
- // Forward declaration. This struct defined further down.
- struct EditableSetInfo;
- // Called when 'Add Address' (|group_type| is
- // ContentListTableModel::kAddressGroup) or 'Add Credit Card' (|group_type| is
- // ContentListTableModel::kCreditCardGroup) is clicked.
- void AddClicked(int group_type);
- // Called when 'Edit...' is clicked.
- void EditClicked();
- // Called when 'Remove' is clicked.
- void DeleteClicked();
- // Called when 'Edit' dialog is accepted.
- void EditAccepted(EditableSetInfo* data, bool new_item);
-
- // Updates state of the buttons.
- void UpdateWidgetState();
-
- // Following two functions are called from opened child dialog to
- // disable/enable buttons.
- void ChildWindowOpened();
- void ChildWindowClosed();
-
- // Returns warning bitmap to set on warning indicator. If |good| is true it
- // returns the bitmap idicating validity, if false - indicating error.
- // Caller owns the bitmap after the call.
- SkBitmap* GetWarningBitmap(bool good);
-
- // views::View methods:
- virtual void Layout();
- virtual gfx::Size GetPreferredSize();
- virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
- views::View* child);
-
- // views::DialogDelegate methods:
- virtual int GetDialogButtons() const;
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual View* GetExtraView();
- virtual bool IsDialogButtonEnabled(
- MessageBoxFlags::DialogButton button) const;
- virtual bool CanResize() const { return true; }
- virtual bool CanMaximize() const { return false; }
- virtual bool IsAlwaysOnTop() const { return false; }
- virtual bool HasAlwaysOnTopMenu() const { return false; }
- virtual std::wstring GetWindowTitle() const;
- virtual void WindowClosing();
- virtual views::View* GetContentsView();
- virtual bool Cancel();
- virtual bool Accept();
-
- // views::ButtonListener methods:
- virtual void ButtonPressed(views::Button* sender,
- const views::Event& event);
-
- // views::LinkController methods:
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- // views::FocusChangeListener methods:
- virtual void FocusWillChange(views::View* focused_before,
- views::View* focused_now);
-
- // views::TableViewObserver methods:
- virtual void OnSelectionChanged();
- virtual void OnDoubleClick();
-
- // PersonalDataManager::Observer methods:
- virtual void OnPersonalDataLoaded();
- virtual void OnPersonalDataChanged();
-
- // NotificationObserver methods:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Helper structure to keep info on one address or credit card.
- // Keeps info on one item in EditableSetViewContents.
- // Also keeps info on opened status. Allows to quickly add and delete items,
- // and then rebuild EditableSetViewContents.
- struct EditableSetInfo {
- bool is_address;
- // If |is_address| is true |address| has some data and |credit_card|
- // is empty, and vice versa
- AutoFillProfile address;
- CreditCard credit_card;
-
- explicit EditableSetInfo(const AutoFillProfile* input_address)
- : address(*input_address),
- is_address(true) {
- }
- explicit EditableSetInfo(const CreditCard* input_credit_card)
- : credit_card(*input_credit_card),
- is_address(false) {
- }
-
- std::string guid() const {
- if (is_address)
- return address.guid();
- else
- return credit_card.guid();
- }
- };
-
- private:
- // Indicates that there was no item focused. After re-building of the lists
- // first item will be focused.
- static const int kNoItemFocused = -1;
-
- struct FocusedItem {
- int group;
- int item;
- FocusedItem() : group(kNoItemFocused), item(kNoItemFocused) {}
- FocusedItem(int g, int i) : group(g), item(i) {}
- };
-
- AutoFillProfilesView(AutoFillDialogObserver* observer,
- PersonalDataManager* personal_data_manager,
- Profile* profile,
- PrefService* preferences,
- AutoFillProfile* imported_profile,
- CreditCard* imported_credit_card);
- void Init();
-
- void GetData();
- bool IsDataReady() const;
- void SaveData();
-
- // Rebuilds the view by deleting and re-creating sub-views
- void RebuildView(const FocusedItem& new_focus_index);
-
- // PhoneSubView encapsulates three phone fields (country, area, and phone)
- // and label above them, so they could be used together in one grid cell.
- class PhoneSubView : public views::View,
- public views::ButtonListener {
- public:
- PhoneSubView(AutoFillProfilesView* autofill_view,
- views::Label* label,
- views::Textfield* text_phone);
- virtual ~PhoneSubView() {}
-
- virtual void ContentsChanged(views::Textfield* sender,
- const string16& new_contents);
-
- bool IsValid() const;
-
- views::Textfield* text_phone() { return text_phone_; }
-
- protected:
- // views::View methods:
- virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
- views::View* child);
-
- // public views::ButtonListener method:
- virtual void ButtonPressed(views::Button* sender,
- const views::Event& event) {
- // Only stub is needed, it is never called.
- NOTREACHED();
- }
-
- private:
- void UpdateButtons();
- AutoFillProfilesView* autofill_view_;
- views::Label* label_;
- views::Textfield* text_phone_;
- views::ImageButton* phone_warning_button_;
- bool last_state_;
-
- DISALLOW_COPY_AND_ASSIGN(PhoneSubView);
- };
-
- // Forward declaration.
- class StringVectorComboboxModel;
-
- // Sub-view for editing/adding a credit card or address.
- class EditableSetViewContents : public views::View,
- public views::DialogDelegate,
- public views::ButtonListener,
- public views::Textfield::Controller,
- public views::Combobox::Listener {
- public:
- EditableSetViewContents(AutoFillProfilesView* observer,
- bool new_item,
- const EditableSetInfo& field_set);
- virtual ~EditableSetViewContents() {}
-
- protected:
- // views::View methods:
- virtual void Layout();
- virtual gfx::Size GetPreferredSize();
- virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
- views::View* child);
-
- // views::DialogDelegate methods:
- virtual int GetDialogButtons() const;
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual bool IsDialogButtonEnabled(
- MessageBoxFlags::DialogButton button) const;
- virtual bool CanResize() const { return false; }
- virtual bool CanMaximize() const { return false; }
- virtual bool IsModal() const { return true; }
- virtual bool HasAlwaysOnTopMenu() const { return false; }
- virtual std::wstring GetWindowTitle() const;
- virtual void WindowClosing();
- virtual views::View* GetContentsView();
- virtual bool Cancel();
- virtual bool Accept();
-
- // views::ButtonListener methods:
- virtual void ButtonPressed(views::Button* sender,
- const views::Event& event);
-
- // views::Textfield::Controller methods:
- virtual void ContentsChanged(views::Textfield* sender,
- const string16& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& keystroke);
-
- // views::Combobox::Listener methods:
- virtual void ItemChanged(views::Combobox* combo_box,
- int prev_index,
- int new_index);
- private:
- enum TextFields {
- TEXT_FULL_NAME,
- TEXT_COMPANY,
- TEXT_EMAIL,
- TEXT_ADDRESS_LINE_1,
- TEXT_ADDRESS_LINE_2,
- TEXT_ADDRESS_CITY,
- TEXT_ADDRESS_STATE,
- TEXT_ADDRESS_ZIP,
- TEXT_ADDRESS_COUNTRY,
- TEXT_PHONE_PHONE,
- TEXT_FAX_PHONE,
- TEXT_CC_NAME,
- TEXT_CC_NUMBER,
- // Must be last.
- MAX_TEXT_FIELD
- };
-
- void InitAddressFields(views::GridLayout* layout);
- void InitCreditCardFields(views::GridLayout* layout);
- void InitLayoutGrid(views::GridLayout* layout);
- views::Label* CreateLeftAlignedLabel(int label_id);
-
- void UpdateButtons();
-
- // If |field| is a phone or fax ContentsChanged is passed to the
- // PhoneSubView, the appropriate fields in |temporary_info_| are updated and
- // true is returned. Otherwise false is returned.
- bool UpdateContentsPhoneViews(TextFields field,
- views::Textfield* sender,
- const string16& new_contents);
-
- views::Textfield* text_fields_[MAX_TEXT_FIELD];
- EditableSetInfo temporary_info_;
- bool has_credit_card_number_been_edited_;
- AutoFillProfilesView* observer_;
- scoped_ptr<StringVectorComboboxModel> combo_box_model_month_;
- views::Combobox* combo_box_month_;
- scoped_ptr<StringVectorComboboxModel> combo_box_model_year_;
- views::Combobox* combo_box_year_;
- bool new_item_;
- std::vector<PhoneSubView*> phone_sub_views_;
-
- struct TextFieldToAutoFill {
- TextFields text_field;
- AutoFillFieldType type;
- };
-
- static TextFieldToAutoFill address_fields_[];
- static TextFieldToAutoFill credit_card_fields_[];
-
- static const int double_column_fill_view_set_id_ = 0;
- static const int double_column_leading_view_set_id_ = 1;
- static const int triple_column_fill_view_set_id_ = 2;
- static const int triple_column_leading_view_set_id_ = 3;
- static const int four_column_city_state_zip_set_id_ = 4;
- static const int double_column_ccnumber_cvc_ = 5;
- static const int three_column_header_ = 6;
- static const int double_column_ccexpiration_ = 7;
-
- DISALLOW_COPY_AND_ASSIGN(EditableSetViewContents);
- };
-
- class StringVectorComboboxModel : public ComboboxModel {
- public:
- StringVectorComboboxModel() {}
- virtual ~StringVectorComboboxModel() {}
-
- // Sets the vector of the strings for the combobox. Swaps content with
- // |source|.
- void set_cb_strings(std::vector<std::wstring> *source);
-
- // Overridden from ComboboxModel:
- virtual int GetItemCount();
- virtual string16 GetItemAt(int index);
-
- // Find an index of the item in the model, -1 if not present.
- int GetIndex(const std::wstring& value);
-
- private:
- std::vector<std::wstring> cb_strings_;
-
- DISALLOW_COPY_AND_ASSIGN(StringVectorComboboxModel);
- };
-
- // Model for scrolling credit cards and addresses.
- class ContentListTableModel : public TableModel {
- public:
- ContentListTableModel(std::vector<EditableSetInfo>* profiles,
- std::vector<EditableSetInfo>* credit_cards);
- virtual ~ContentListTableModel() {}
-
- // Two constants defined for indexes of groups. The first one is index
- // of Add Address button, the second one is the index of Add Credit Card
- // button.
- static const int kAddressGroup = 1;
- static const int kCreditCardGroup = 2;
-
- void Refresh();
- void AddItem(int index);
- void RemoveItem(int index);
- void UpdateItem(int index);
-
- // TableModel members:
- virtual int RowCount();
- virtual std::wstring GetText(int row, int column_id);
- virtual bool HasGroups() { return true; }
- virtual TableModel::Groups GetGroups();
- virtual int GetGroupID(int row);
- virtual void SetObserver(TableModelObserver* observer);
-
- private:
- std::vector<EditableSetInfo>* profiles_;
- std::vector<EditableSetInfo>* credit_cards_;
- TableModelObserver* observer_;
-
- DISALLOW_COPY_AND_ASSIGN(ContentListTableModel);
- };
-
- AutoFillDialogObserver* observer_;
- PersonalDataManager* personal_data_manager_;
- Profile* profile_;
- PrefService* preferences_;
- std::vector<EditableSetInfo> profiles_set_;
- std::vector<EditableSetInfo> credit_card_set_;
-
- BooleanPrefMember enable_auto_fill_;
-
- views::Checkbox* enable_auto_fill_button_;
- views::Button* add_address_button_;
- views::Button* add_credit_card_button_;
- views::Button* edit_button_;
- views::Button* remove_button_;
- views::TableView* scroll_view_;
- scoped_ptr<ContentListTableModel> table_model_;
- views::FocusManager* focus_manager_;
- bool child_dialog_opened_;
-
- static AutoFillProfilesView* instance_;
-
- DISALLOW_COPY_AND_ASSIGN(AutoFillProfilesView);
-};
+#include "chrome/browser/ui/views/autofill_profiles_view_win.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_AUTOFILL_PROFILES_VIEW_WIN_H_
+
diff --git a/chrome/browser/views/bookmark_bar_instructions_view.h b/chrome/browser/views/bookmark_bar_instructions_view.h
index 2156bf8..599ad78 100644
--- a/chrome/browser/views/bookmark_bar_instructions_view.h
+++ b/chrome/browser/views/bookmark_bar_instructions_view.h
@@ -6,63 +6,8 @@
#define CHROME_BROWSER_VIEWS_BOOKMARK_BAR_INSTRUCTIONS_VIEW_H_
#pragma once
-#include "views/view.h"
-#include "views/controls/link.h"
-
-namespace views {
-class Label;
-class Link;
-}
-
-// BookmarkBarInstructionsView is a child of the bookmark bar that is visible
-// when the user has no bookmarks on the bookmark bar.
-// BookmarkBarInstructionsView shows a description of the bookmarks bar along
-// with a link to import bookmarks. Clicking the link results in notifying the
-// delegate.
-class BookmarkBarInstructionsView : public views::View,
- public views::LinkController {
- 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 BookmarkBarInstructionsView(Delegate* delegate);
-
- // View overrides.
- virtual gfx::Size GetPreferredSize();
- virtual void Layout();
- virtual void OnThemeChanged();
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
- virtual AccessibilityTypes::Role GetAccessibleRole();
-
- // LinkController.
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- private:
- void UpdateColors();
-
- Delegate* delegate_;
-
- views::Label* instructions_;
- views::Link* import_link_;
-
- // The baseline of the child views. This is -1 if none of the views support a
- // baseline.
- int baseline_;
-
- // Have the colors of the child views been updated? This is initially false
- // and set to true once we have a valid ThemeProvider.
- bool updated_colors_;
-
- DISALLOW_COPY_AND_ASSIGN(BookmarkBarInstructionsView);
-};
+#include "chrome/browser/ui/views/bookmark_bar_instructions_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_BOOKMARK_BAR_INSTRUCTIONS_VIEW_H_
+
diff --git a/chrome/browser/views/bookmark_bar_view.h b/chrome/browser/views/bookmark_bar_view.h
index 37b606f..7dea837 100644
--- a/chrome/browser/views/bookmark_bar_view.h
+++ b/chrome/browser/views/bookmark_bar_view.h
@@ -6,503 +6,8 @@
#define CHROME_BROWSER_VIEWS_BOOKMARK_BAR_VIEW_H_
#pragma once
-#include <set>
-
-#include "app/slide_animation.h"
-#include "chrome/browser/bookmarks/bookmark_drag_data.h"
-#include "chrome/browser/bookmarks/bookmark_model_observer.h"
-#include "chrome/browser/sync/profile_sync_service.h"
-#include "chrome/browser/views/bookmark_bar_instructions_view.h"
-#include "chrome/browser/views/bookmark_menu_controller_views.h"
-#include "chrome/browser/views/detachable_toolbar_view.h"
-#include "chrome/common/notification_registrar.h"
-#include "views/controls/button/button.h"
-#include "views/controls/menu/view_menu_delegate.h"
-
-class Browser;
-class PageNavigator;
-class PrefService;
-
-namespace views {
-class CustomButton;
-class MenuButton;
-class MenuItemView;
-class TextButton;
-}
-
-// BookmarkBarView renders the BookmarkModel. Each starred entry on the
-// BookmarkBar is rendered as a MenuButton. An additional MenuButton aligned to
-// the right allows the user to quickly see recently starred entries.
-//
-// BookmarkBarView shows the bookmarks from a specific Profile. BookmarkBarView
-// waits until the HistoryService for the profile has been loaded before
-// creating the BookmarkModel.
-class BookmarkBarView : public DetachableToolbarView,
- public ProfileSyncServiceObserver,
- public BookmarkModelObserver,
- public views::ViewMenuDelegate,
- public views::ButtonListener,
- public NotificationObserver,
- public views::ContextMenuController,
- public views::DragController,
- public AnimationDelegate,
- public BookmarkMenuController::Observer,
- public BookmarkBarInstructionsView::Delegate {
- friend class ShowFolderMenuTask;
-
- public:
- // Constants used in Browser View, as well as here.
- // How inset the bookmarks bar is when displayed on the new tab page.
- static const int kNewtabHorizontalPadding;
- static const int kNewtabVerticalPadding;
-
- // Maximum size of buttons on the bookmark bar.
- static const int kMaxButtonWidth;
-
- // Interface implemented by controllers/views that need to be notified any
- // time the model changes, typically to cancel an operation that is showing
- // data from the model such as a menu. This isn't intended as a general
- // way to be notified of changes, rather for cases where a controller/view is
- // showing data from the model in a modal like setting and needs to cleanly
- // exit the modal loop if the model changes out from under it.
- //
- // A controller/view that needs this notification should install itself as the
- // ModelChangeListener via the SetModelChangedListener method when shown and
- // reset the ModelChangeListener of the BookmarkBarView when it closes by way
- // of either the SetModelChangedListener method or the
- // ClearModelChangedListenerIfEquals method.
- class ModelChangedListener {
- public:
- virtual ~ModelChangedListener() {}
-
- // Invoked when the model changes. Should cancel the edit and close any
- // dialogs.
- virtual void ModelChanged() = 0;
- };
-
- static const int kNewtabBarHeight;
-
- BookmarkBarView(Profile* profile, Browser* browser);
- virtual ~BookmarkBarView();
-
- // 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_; }
-
- // Sets the PageNavigator that is used when the user selects an entry on
- // the bookmark bar.
- void SetPageNavigator(PageNavigator* navigator);
-
- // Sets whether the containing browser is showing an infobar. This affects
- // layout during animation.
- void set_infobar_visible(bool infobar_visible) {
- infobar_visible_ = infobar_visible;
- }
-
- // DetachableToolbarView methods:
- virtual bool IsDetached() const;
- virtual bool IsOnTop() const;
- virtual double GetAnimationValue() const {
- return size_animation_->GetCurrentValue();
- }
- virtual int GetToolbarOverlap() const {
- return GetToolbarOverlap(false);
- }
-
- // View methods:
- virtual gfx::Size GetPreferredSize();
- virtual gfx::Size GetMinimumSize();
- virtual void Layout();
- virtual void DidChangeBounds(const gfx::Rect& previous,
- const gfx::Rect& current);
- virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
- virtual void PaintChildren(gfx::Canvas* canvas);
- virtual bool GetDropFormats(
- int* formats,
- std::set<OSExchangeData::CustomFormat>* custom_formats);
- virtual bool AreDropTypesRequired();
- virtual bool CanDrop(const OSExchangeData& data);
- virtual void OnDragEntered(const views::DropTargetEvent& event);
- virtual int OnDragUpdated(const views::DropTargetEvent& event);
- virtual void OnDragExited();
- virtual int OnPerformDrop(const views::DropTargetEvent& event);
- virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture);
-
- // AccessiblePaneView methods:
- virtual bool IsAccessibleViewTraversable(views::View* view);
- virtual AccessibilityTypes::Role GetAccessibleRole();
-
- // ProfileSyncServiceObserver method.
- virtual void OnStateChanged();
-
- // Called when fullscreen mode toggles on or off; this affects our layout.
- void OnFullscreenToggled(bool fullscreen);
-
- // Sets the model change listener to listener.
- void SetModelChangedListener(ModelChangedListener* listener) {
- model_changed_listener_ = listener;
- }
-
- // If the ModelChangedListener is listener, ModelChangeListener is set to
- // NULL.
- void ClearModelChangedListenerIfEquals(ModelChangedListener* listener) {
- if (model_changed_listener_ == listener)
- model_changed_listener_ = NULL;
- }
-
- // Returns the model change listener.
- ModelChangedListener* GetModelChangedListener() {
- return model_changed_listener_;
- }
-
- // Returns the page navigator.
- PageNavigator* GetPageNavigator() { return page_navigator_; }
-
- // Returns the model.
- BookmarkModel* GetModel() { return model_; }
-
- // Returns true if the bookmarks bar preference is set to 'always show'.
- bool IsAlwaysShown() const;
-
- // True if we're on a page where the bookmarks bar is always visible.
- bool OnNewTabPage() const;
-
- // How much we want the bookmark bar to overlap the toolbar. If |return_max|
- // is true, we return the maximum overlap rather than the current overlap.
- int GetToolbarOverlap(bool return_max) const;
-
- // Whether or not we are animating.
- bool is_animating() { return size_animation_->is_animating(); }
-
- // SlideAnimationDelegate implementation.
- void AnimationProgressed(const Animation* animation);
- void AnimationEnded(const Animation* animation);
-
- // BookmarkMenuController::Observer
- virtual void BookmarkMenuDeleted(BookmarkMenuController* controller);
-
- // Returns the button at the specified index.
- views::TextButton* GetBookmarkButton(int index);
-
- // Returns the button responsible for showing bookmarks in the other bookmark
- // folder.
- views::MenuButton* other_bookmarked_button() const {
- return other_bookmarked_button_;
- }
-
- // Returns the active MenuItemView, or NULL if a menu isn't showing.
- views::MenuItemView* GetMenu();
-
- // Returns the drop MenuItemView, or NULL if a menu isn't showing.
- views::MenuItemView* GetDropMenu();
-
- // Returns the context menu, or null if one isn't showing.
- views::MenuItemView* GetContextMenu();
-
- // Returns the button used when not all the items on the bookmark bar fit.
- views::MenuButton* overflow_button() const { return overflow_button_; }
-
- // If |loc| is over a bookmark button the node is returned corresponding
- // to the button and |start_index| is set to 0. If a overflow button is
- // showing and |loc| is over the overflow button, the bookmark bar node is
- // returned and |start_index| is set to the index of the first node
- // contained in the overflow menu.
- const BookmarkNode* GetNodeForButtonAt(const gfx::Point& loc,
- int* start_index);
-
- // Returns the MenuButton for node.
- views::MenuButton* GetMenuButtonForNode(const BookmarkNode* node);
-
- // Returns the position to anchor the menu for |button| at, the index of the
- // first child of the node to build the menu from.
- void GetAnchorPositionAndStartIndexForButton(
- views::MenuButton* button,
- views::MenuItemView::AnchorPosition* anchor,
- int* start_index);
-
- // BookmarkBarInstructionsView::Delegate.
- virtual void ShowImportDialog();
-
- // If a button is currently throbbing, it is stopped. If immediate is true
- // the throb stops immediately, otherwise it stops after a couple more
- // throbs.
- void StopThrobbing(bool immediate);
-
- // 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();
-
- // If true we're running tests. This short circuits a couple of animations.
- static bool testing_;
-
- private:
- class ButtonSeparatorView;
- struct DropInfo;
-
- // Task that invokes ShowDropFolderForNode when run. ShowFolderDropMenuTask
- // deletes itself once run.
- class ShowFolderDropMenuTask : public Task {
- public:
- ShowFolderDropMenuTask(BookmarkBarView* view, const BookmarkNode* node)
- : view_(view),
- node_(node) {
- }
-
- void Cancel() {
- view_->show_folder_drop_menu_task_ = NULL;
- view_ = NULL;
- }
-
- virtual void Run() {
- if (view_) {
- view_->show_folder_drop_menu_task_ = NULL;
- view_->ShowDropFolderForNode(node_);
- }
- // MessageLoop deletes us.
- }
-
- private:
- BookmarkBarView* view_;
- const BookmarkNode* node_;
-
- DISALLOW_COPY_AND_ASSIGN(ShowFolderDropMenuTask);
- };
-
- // Creates recent bookmark button and when visible button as well as
- // calculating the preferred height.
- void Init();
-
- // Creates the button showing the other bookmarked items.
- views::MenuButton* CreateOtherBookmarkedButton();
-
- // Creates the button used when not all bookmark buttons fit.
- views::MenuButton* CreateOverflowButton();
-
- // Invoked when the bookmark bar 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);
-
- // Invokes added followed by removed.
- virtual void BookmarkNodeMoved(BookmarkModel* model,
- const BookmarkNode* old_parent,
- int old_index,
- const BookmarkNode* new_parent,
- int new_index);
-
- // Notifies ModelChangeListener of change.
- // If the node was added to the root node, a button is created and added to
- // this bookmark bar view.
- virtual void BookmarkNodeAdded(BookmarkModel* model,
- const BookmarkNode* parent,
- int index);
-
- // Implementation for BookmarkNodeAddedImpl.
- void BookmarkNodeAddedImpl(BookmarkModel* model,
- const BookmarkNode* parent,
- int index);
-
- // Notifies ModelChangeListener of change.
- // If the node was a child of the root node, the button corresponding to it
- // is removed.
- virtual void BookmarkNodeRemoved(BookmarkModel* model,
- const BookmarkNode* parent,
- int old_index,
- const BookmarkNode* node);
-
- // Implementation for BookmarkNodeRemoved.
- void BookmarkNodeRemovedImpl(BookmarkModel* model,
- const BookmarkNode* parent,
- int index);
-
- // Notifies ModelChangedListener and invokes BookmarkNodeChangedImpl.
- virtual void BookmarkNodeChanged(BookmarkModel* model,
- const BookmarkNode* node);
-
- // If the node is a child of the root node, the button is updated
- // appropriately.
- void BookmarkNodeChangedImpl(BookmarkModel* model, const BookmarkNode* node);
-
- virtual void BookmarkNodeChildrenReordered(BookmarkModel* model,
- const BookmarkNode* node);
-
- // Invoked when the favicon is available. If the node is a child of the
- // root node, the appropriate button is updated. If a menu is showing, the
- // call is forwarded to the menu to allow for it to update the icon.
- virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model,
- const BookmarkNode* node);
-
- // DragController method. Determines the node representing sender and invokes
- // WriteDragData to write the actual data.
- virtual void WriteDragData(views::View* sender,
- const gfx::Point& press_pt,
- OSExchangeData* data);
-
- virtual int GetDragOperations(views::View* sender, const gfx::Point& p);
-
- virtual bool CanStartDrag(views::View* sender,
- const gfx::Point& press_pt,
- const gfx::Point& p);
-
- // Writes a BookmarkDragData for node to data.
- void WriteDragData(const BookmarkNode* node, OSExchangeData* data);
-
- // ViewMenuDelegate method. Ends up creating a BookmarkMenuController to
- // show the menu.
- virtual void RunMenu(views::View* view, const gfx::Point& pt);
-
- // Invoked when a star entry corresponding to a URL on the bookmark bar is
- // pressed. Forwards to the PageNavigator to open the URL.
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Invoked for this View, one of the buttons or the 'other' button. Shows the
- // appropriate context menu.
- virtual void ShowContextMenu(views::View* source,
- const gfx::Point& p,
- bool is_mouse_gesture);
-
- // Creates the button for rendering the specified bookmark node.
- views::View* CreateBookmarkButton(const BookmarkNode* node);
-
- // COnfigures the button from the specified node. This sets the text,
- // and icon.
- void ConfigureButton(const BookmarkNode* node, views::TextButton* button);
-
- // Used when showing the menu allowing the user to choose when the bar is
- // visible. Return value corresponds to the users preference for when the
- // bar is visible.
- virtual bool IsItemChecked(int id) const;
-
- // Used when showing the menu allowing the user to choose when the bar is
- // visible. Updates the preferences to match the users choice as appropriate.
- virtual void ExecuteCommand(int id);
-
- // NotificationService method.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Overridden from views::View.
- virtual void OnThemeChanged();
-
- // If the ModelChangedListener is non-null, ModelChanged is invoked on it.
- void NotifyModelChanged();
-
- // Shows the menu used during drag and drop for the specified node.
- void ShowDropFolderForNode(const BookmarkNode* node);
-
- // Cancels the timer used to show a drop menu.
- void StopShowFolderDropMenuTimer();
-
- // Stars the timer used to show a drop menu for node.
- void StartShowFolderDropMenuTimer(const BookmarkNode* node);
-
- // Returns the drop operation and index for the drop based on the event
- // and data. Returns DragDropTypes::DRAG_NONE if not a valid location.
- int CalculateDropOperation(const views::DropTargetEvent& event,
- const BookmarkDragData& data,
- int* index,
- bool* drop_on,
- bool* is_over_overflow,
- bool* is_over_other);
-
- // Returns the index of the first hidden bookmark button. If all buttons are
- // visible, this returns GetBookmarkButtonCount().
- int GetFirstHiddenNodeIndex();
-
- // This determines which view should throb and starts it
- // throbbing (e.g when the bookmark bubble is showing).
- // If |overflow_only| is true, start throbbing only if |node| is hidden in
- // the overflow menu.
- void StartThrobbing(const BookmarkNode* node, bool overflow_only);
-
- // Updates the colors for all the child objects in the bookmarks bar.
- void UpdateColors();
-
- // This method computes the bounds for the bookmark bar items. If
- // |compute_bounds_only| = TRUE, the bounds for the items are just computed,
- // but are not set. This mode is used by GetPreferredSize() to obtain the
- // desired bounds. If |compute_bounds_only| = FALSE, the bounds are set.
- gfx::Size LayoutItems(bool compute_bounds_only);
-
- // Creates the sync error button and adds it as a child view.
- views::TextButton* CreateSyncErrorButton();
-
- NotificationRegistrar registrar_;
-
- Profile* profile_;
-
- // Used for opening urls.
- PageNavigator* page_navigator_;
-
- // Model providing details as to the starred entries/groups that should be
- // shown. This is owned by the Profile.
- BookmarkModel* model_;
-
- // Used to manage showing a Menu, either for the most recently bookmarked
- // entries, or for the a starred group.
- BookmarkMenuController* bookmark_menu_;
-
- // Used when showing a menu for drag and drop. That is, if the user drags
- // over a group this becomes non-null and manages the menu showing the
- // contents of the node.
- BookmarkMenuController* bookmark_drop_menu_;
-
- // Shows the other bookmark entries.
- views::MenuButton* other_bookmarked_button_;
-
- // ModelChangeListener.
- ModelChangedListener* model_changed_listener_;
-
- // Task used to delay showing of the drop menu.
- ShowFolderDropMenuTask* show_folder_drop_menu_task_;
-
- // Used to track drops on the bookmark bar view.
- scoped_ptr<DropInfo> drop_info_;
-
- // The sync re-login indicator which appears when the user needs to re-enter
- // credentials in order to continue syncing.
- views::TextButton* sync_error_button_;
-
- // A pointer to the ProfileSyncService instance if one exists.
- ProfileSyncService* sync_service_;
-
- // Visible if not all the bookmark buttons fit.
- views::MenuButton* overflow_button_;
-
- // BookmarkBarInstructionsView that is visible if there are no bookmarks on
- // the bookmark bar.
- views::View* instructions_;
-
- ButtonSeparatorView* bookmarks_separator_view_;
-
- // Owning browser. This is NULL during testing.
- Browser* browser_;
-
- // True if the owning browser is showing an infobar.
- bool infobar_visible_;
-
- // Animation controlling showing and hiding of the bar.
- scoped_ptr<SlideAnimation> size_animation_;
-
- // If the bookmark bubble is showing, this is the visible ancestor of the URL.
- // The visible ancestor is either the other_bookmarked_button_,
- // overflow_button_ or a button on the bar.
- views::CustomButton* throbbing_view_;
-
- // Background for extension toolstrips.
- SkBitmap toolstrip_background_;
-
- DISALLOW_COPY_AND_ASSIGN(BookmarkBarView);
-};
+#include "chrome/browser/ui/views/bookmark_bar_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_BOOKMARK_BAR_VIEW_H_
+
diff --git a/chrome/browser/views/bookmark_bubble_view.h b/chrome/browser/views/bookmark_bubble_view.h
index 32a928f..cd35459 100644
--- a/chrome/browser/views/bookmark_bubble_view.h
+++ b/chrome/browser/views/bookmark_bubble_view.h
@@ -6,157 +6,8 @@
#define CHROME_BROWSER_VIEWS_BOOKMARK_BUBBLE_VIEW_H_
#pragma once
-#include "base/string16.h"
-#include "chrome/browser/bookmarks/recently_used_folders_combo_model.h"
-#include "chrome/browser/views/info_bubble.h"
-#include "gfx/rect.h"
-#include "googleurl/src/gurl.h"
-#include "views/controls/button/button.h"
-#include "views/controls/combobox/combobox.h"
-#include "views/controls/link.h"
-#include "views/view.h"
-
-class Profile;
-
-class BookmarkModel;
-class BookmarkNode;
-
-namespace views {
-class NativeButton;
-class Textfield;
-}
-
-// BookmarkBubbleView is a view intended to be used as the content of an
-// InfoBubble. BookmarkBubbleView provides views for unstarring and editting
-// the bookmark it is created with. Don't create a BookmarkBubbleView directly,
-// instead use the static Show method.
-class BookmarkBubbleView : public views::View,
- public views::LinkController,
- public views::ButtonListener,
- public views::Combobox::Listener,
- public InfoBubbleDelegate {
- public:
- static void Show(views::Window* window,
- const gfx::Rect& bounds,
- InfoBubbleDelegate* delegate,
- Profile* profile,
- const GURL& url,
- bool newly_bookmarked);
-
- static bool IsShowing();
-
- static void Hide();
-
- virtual ~BookmarkBubbleView();
-
- void set_info_bubble(InfoBubble* info_bubble) { info_bubble_ = info_bubble; }
-
- // Overridden to force a layout.
- virtual void DidChangeBounds(const gfx::Rect& previous,
- const gfx::Rect& current);
-
- // Invoked after the bubble has been shown.
- virtual void BubbleShown();
-
- // Override to close on return.
- virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
-
- virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
-
- private:
- // Creates a BookmarkBubbleView.
- // |title| is the title of the page. If newly_bookmarked is false, title is
- // ignored and the title of the bookmark is fetched from the database.
- BookmarkBubbleView(InfoBubbleDelegate* delegate,
- Profile* profile,
- const GURL& url,
- bool newly_bookmarked);
- // Creates the child views.
- void Init();
-
- // Returns the title to display.
- string16 GetTitle();
-
- // LinkController method, either unstars the item or shows the bookmark
- // editor (depending upon which link was clicked).
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- // ButtonListener method, closes the bubble or opens the edit dialog.
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Combobox::Listener method. Changes the parent of the bookmark.
- virtual void ItemChanged(views::Combobox* combobox,
- int prev_index,
- int new_index);
-
- // InfoBubbleDelegate methods. These forward to the InfoBubbleDelegate
- // supplied in the constructor as well as sending out the necessary
- // notification.
- virtual void InfoBubbleClosing(InfoBubble* info_bubble,
- bool closed_by_escape);
- virtual bool CloseOnEscape();
- virtual bool FadeInOnShow() { return false; }
- virtual std::wstring accessible_name();
-
- // Closes the bubble.
- void Close();
-
- // Handle the message when the user presses a button.
- void HandleButtonPressed(views::Button* sender);
-
- // Shows the BookmarkEditor.
- void ShowEditor();
-
- // Sets the title and parent of the node.
- void ApplyEdits();
-
- // The bookmark bubble, if we're showing one.
- static BookmarkBubbleView* bubble_;
-
- // The InfoBubble showing us.
- InfoBubble* info_bubble_;
-
- // Delegate for the bubble, may be null.
- InfoBubbleDelegate* delegate_;
-
- // The profile.
- Profile* profile_;
-
- // The bookmark URL.
- const GURL url_;
-
- // Title of the bookmark. This is initially the title supplied to the
- // constructor, which is typically the title of the page.
- std::wstring title_;
-
- // If true, the page was just bookmarked.
- const bool newly_bookmarked_;
-
- RecentlyUsedFoldersComboModel parent_model_;
-
- // Link for removing/unstarring the bookmark.
- views::Link* remove_link_;
-
- // Button to bring up the editor.
- views::NativeButton* edit_button_;
-
- // Button to close the window.
- views::NativeButton* close_button_;
-
- // Textfield showing the title of the bookmark.
- views::Textfield* title_tf_;
-
- // Combobox showing a handful of folders the user can choose from, including
- // the current parent.
- views::Combobox* parent_combobox_;
-
- // When the destructor is invoked should the bookmark be removed?
- bool remove_bookmark_;
-
- // When the destructor is invoked should edits be applied?
- bool apply_edits_;
-
- DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView);
-};
+#include "chrome/browser/ui/views/bookmark_bubble_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_BOOKMARK_BUBBLE_VIEW_H_
+
diff --git a/chrome/browser/views/bookmark_context_menu.h b/chrome/browser/views/bookmark_context_menu.h
index 2a50195..1f6f2f2 100644
--- a/chrome/browser/views/bookmark_context_menu.h
+++ b/chrome/browser/views/bookmark_context_menu.h
@@ -6,71 +6,8 @@
#define CHROME_BROWSER_VIEWS_BOOKMARK_CONTEXT_MENU_H_
#pragma once
-#include "chrome/browser/views/bookmark_context_menu_controller_views.h"
-#include "views/controls/menu/menu_delegate.h"
-
-// Observer for the BookmarkContextMenu.
-class BookmarkContextMenuObserver {
- public:
- // Invoked before the specified items are removed from the bookmark model.
- virtual void WillRemoveBookmarks(
- const std::vector<const BookmarkNode*>& bookmarks) = 0;
-
- // Invoked after the items have been removed from the model.
- virtual void DidRemoveBookmarks() = 0;
-
- protected:
- virtual ~BookmarkContextMenuObserver() {}
-};
-
-class BookmarkContextMenu : public BookmarkContextMenuControllerViewsDelegate,
- public views::MenuDelegate {
- public:
- BookmarkContextMenu(
- gfx::NativeWindow parent_window,
- Profile* profile,
- PageNavigator* page_navigator,
- const BookmarkNode* parent,
- const std::vector<const BookmarkNode*>& selection);
- virtual ~BookmarkContextMenu();
-
- // Shows the context menu at the specified point.
- void RunMenuAt(const gfx::Point& point);
-
- views::MenuItemView* menu() const { return menu_.get(); }
-
- void set_observer(BookmarkContextMenuObserver* observer) {
- observer_ = observer;
- }
-
- // Overridden from views::MenuDelegate:
- virtual void ExecuteCommand(int command_id);
- virtual bool IsItemChecked(int command_id) const;
- virtual bool IsCommandEnabled(int command_id) const;
- virtual bool ShouldCloseAllMenusOnExecute(int id);
-
- // Overridden from BookmarkContextMenuControllerViewsDelegate:
- virtual void CloseMenu();
- virtual void AddItem(int command_id);
- virtual void AddItemWithStringId(int command_id, int string_id);
- virtual void AddSeparator();
- virtual void AddCheckboxItem(int command_id);
- virtual void WillRemoveBookmarks(
- const std::vector<const BookmarkNode*>& bookmarks);
- virtual void DidRemoveBookmarks();
-
- private:
- scoped_ptr<BookmarkContextMenuControllerViews> controller_;
-
- // The parent of dialog boxes opened from the context menu.
- gfx::NativeWindow parent_window_;
-
- // The menu itself.
- scoped_ptr<views::MenuItemView> menu_;
-
- BookmarkContextMenuObserver* observer_;
-
- DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenu);
-};
+#include "chrome/browser/ui/views/bookmark_context_menu.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_BOOKMARK_CONTEXT_MENU_H_
+
diff --git a/chrome/browser/views/bookmark_context_menu_controller_views.h b/chrome/browser/views/bookmark_context_menu_controller_views.h
index 16b3dd2..73b54e6 100644
--- a/chrome/browser/views/bookmark_context_menu_controller_views.h
+++ b/chrome/browser/views/bookmark_context_menu_controller_views.h
@@ -6,88 +6,8 @@
#define CHROME_BROWSER_VIEWS_BOOKMARK_CONTEXT_MENU_CONTROLLER_VIEWS_H_
#pragma once
-#include <vector>
-
-#include "base/basictypes.h"
-#include "chrome/browser/bookmarks/base_bookmark_model_observer.h"
-#include "gfx/native_widget_types.h"
-
-class Browser;
-class PageNavigator;
-class Profile;
-
-// An interface implemented by an object that performs actions on the actual
-// menu for the controller.
-class BookmarkContextMenuControllerViewsDelegate {
- public:
- virtual ~BookmarkContextMenuControllerViewsDelegate() {}
-
- // Closes the bookmark context menu.
- virtual void CloseMenu() = 0;
-
- // Methods that add items to the underlying menu.
- virtual void AddItem(int command_id) = 0;
- virtual void AddItemWithStringId(int command_id, int string_id) = 0;
- virtual void AddSeparator() = 0;
- virtual void AddCheckboxItem(int command_id) = 0;
-
- // Sent before bookmarks are removed.
- virtual void WillRemoveBookmarks(
- const std::vector<const BookmarkNode*>& bookmarks) {}
-
- // Sent after bookmarks have been removed.
- virtual void DidRemoveBookmarks() {}
-};
-
-// BookmarkContextMenuControllerViews creates and manages state for the context
-// menu shown for any bookmark item.
-class BookmarkContextMenuControllerViews : public BaseBookmarkModelObserver {
- public:
- // Creates the bookmark context menu.
- // |profile| is used for opening urls as well as enabling 'open incognito'.
- // |browser| is used to determine the PageNavigator and may be null.
- // |navigator| is used if |browser| is null, and is provided for testing.
- // |parent| is the parent for newly created nodes if |selection| is empty.
- // |selection| is the nodes the context menu operates on and may be empty.
- BookmarkContextMenuControllerViews(
- gfx::NativeWindow parent_window,
- BookmarkContextMenuControllerViewsDelegate* delegate,
- Profile* profile,
- PageNavigator* navigator,
- const BookmarkNode* parent,
- const std::vector<const BookmarkNode*>& selection);
- virtual ~BookmarkContextMenuControllerViews();
-
- void BuildMenu();
-
- void ExecuteCommand(int id);
- bool IsItemChecked(int id) const;
- bool IsCommandEnabled(int id) const;
-
- // Accessors:
- Profile* profile() const { return profile_; }
- PageNavigator* navigator() const { return navigator_; }
-
- private:
- // Overridden from BaseBookmarkModelObserver:
- // Any change to the model results in closing the menu.
- virtual void BookmarkModelChanged();
-
- // Removes the observer from the model and NULLs out model_.
- BookmarkModel* RemoveModelObserver();
-
- // Returns true if selection_ has at least one bookmark of type url.
- bool HasURLs() const;
-
- gfx::NativeWindow parent_window_;
- BookmarkContextMenuControllerViewsDelegate* delegate_;
- Profile* profile_;
- PageNavigator* navigator_;
- const BookmarkNode* parent_;
- std::vector<const BookmarkNode*> selection_;
- BookmarkModel* model_;
-
- DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenuControllerViews);
-};
+#include "chrome/browser/ui/views/bookmark_context_menu_controller_views.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_BOOKMARK_CONTEXT_MENU_CONTROLLER_VIEWS_H_
+
diff --git a/chrome/browser/views/bookmark_editor_view.h b/chrome/browser/views/bookmark_editor_view.h
index 6b11439..fca0aab 100644
--- a/chrome/browser/views/bookmark_editor_view.h
+++ b/chrome/browser/views/bookmark_editor_view.h
@@ -6,260 +6,8 @@
#define CHROME_BROWSER_VIEWS_BOOKMARK_EDITOR_VIEW_H_
#pragma once
-#include "app/menus/simple_menu_model.h"
-#include "app/tree_node_model.h"
-#include "base/string16.h"
-#include "chrome/browser/bookmarks/bookmark_editor.h"
-#include "chrome/browser/bookmarks/bookmark_model_observer.h"
-#include "views/controls/button/button.h"
-#include "views/controls/textfield/textfield.h"
-#include "views/controls/tree/tree_view.h"
-#include "views/window/dialog_delegate.h"
-#include "testing/gtest/include/gtest/gtest_prod.h"
-
-namespace views {
-class Label;
-class Menu2;
-class NativeButton;
-class Window;
-}
-
-class BookmarkEditorViewTest;
-class GURL;
-class Menu;
-class Profile;
-
-// View that allows the user to edit a bookmark/starred URL. The user can
-// change the URL, title and where the bookmark appears as well as adding
-// new groups and changing the name of other groups. The editor is used for
-// both editing a url bookmark, as well as editing a folder bookmark when
-// created from 'Bookmark all tabs'.
-//
-// Edits are applied to the BookmarkModel when the user presses 'OK'.
-//
-// To use BookmarkEditorView invoke the static show method.
-
-class BookmarkEditorView : public BookmarkEditor,
- public views::View,
- public views::ButtonListener,
- public views::TreeViewController,
- public views::DialogDelegate,
- public views::Textfield::Controller,
- public views::ContextMenuController,
- public menus::SimpleMenuModel::Delegate,
- public BookmarkModelObserver {
- public:
- // Type of node in the tree. Public purely for testing.
- typedef TreeNodeWithValue<int64> EditorNode;
-
- // Model for the TreeView. Trivial subclass that doesn't allow titles with
- // empty strings. Public purely for testing.
- class EditorTreeModel : public TreeNodeModel<EditorNode> {
- public:
- explicit EditorTreeModel(EditorNode* root)
- : TreeNodeModel<EditorNode>(root) {}
-
- virtual void SetTitle(TreeModelNode* node,
- const string16& title) {
- if (!title.empty())
- TreeNodeModel::SetTitle(node, title);
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(EditorTreeModel);
- };
-
- BookmarkEditorView(Profile* profile,
- const BookmarkNode* parent,
- const EditDetails& details,
- BookmarkEditor::Configuration configuration);
-
- virtual ~BookmarkEditorView();
-
- // DialogDelegate methods:
- virtual bool IsDialogButtonEnabled(
- MessageBoxFlags::DialogButton button) const;
- virtual bool IsModal() const;
- virtual std::wstring GetWindowTitle() const;
- virtual bool Accept();
- virtual bool AreAcceleratorsEnabled(MessageBoxFlags::DialogButton button);
- virtual views::View* GetContentsView();
-
- // View methods.
- virtual void Layout();
- virtual gfx::Size GetPreferredSize();
- virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
- views::View* child);
-
- // TreeViewObserver methods.
- virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view);
- virtual bool CanEdit(views::TreeView* tree_view, TreeModelNode* node);
-
- // Textfield::Controller methods.
- virtual void ContentsChanged(views::Textfield* sender,
- const std::wstring& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke&) {
- return false;
- }
-
- // NativeButton.
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // menus::SimpleMenuModel::Delegate.
- 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);
-
- // Creates a Window and adds the BookmarkEditorView to it. When the window is
- // closed the BookmarkEditorView is deleted.
- void Show(HWND parent_hwnd);
-
- // Closes the dialog.
- void Close();
-
- // Shows the context menu.
- virtual void ShowContextMenu(View* source,
- const gfx::Point& p,
- bool is_mouse_gesture);
-
- private:
- friend class BookmarkEditorViewTest;
-
- // Creates the necessary sub-views, configures them, adds them to the layout,
- // and requests the entries to display from the database.
- void Init();
-
- // 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 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();
-
- // Expands all the nodes in the tree and selects the parent node of the
- // url we're editing or the most recent parent if the url being editted isn't
- // starred.
- void ExpandAndSelect();
-
- // Creates a returns the new root node. This invokes CreateNodes to do
- // the real work.
- EditorNode* CreateRootNode();
-
- // Adds and creates a child node in b_node for all children of bb_node that
- // are groups.
- void CreateNodes(const BookmarkNode* bb_node, EditorNode* b_node);
-
- // Returns the node with the specified id, or NULL if one can't be found.
- EditorNode* FindNodeWithID(BookmarkEditorView::EditorNode* node, int64 id);
-
- // Invokes ApplyEdits with the selected node.
- void ApplyEdits();
-
- // Applies the edits done by the user. |parent| gives the parent of the URL
- // being edited.
- void ApplyEdits(EditorNode* parent);
-
- // Recursively adds newly created groups and sets the title of nodes to
- // match the user edited title.
- //
- // bb_node gives the BookmarkNode the edits are to be applied to, with b_node
- // the source of the edits.
- //
- // If b_node == parent_b_node, parent_bb_node is set to bb_node. This is
- // used to determine the new BookmarkNode parent based on the EditorNode
- // parent.
- void ApplyNameChangesAndCreateNewGroups(
- const BookmarkNode* bb_node,
- BookmarkEditorView::EditorNode* b_node,
- BookmarkEditorView::EditorNode* parent_b_node,
- const BookmarkNode** parent_bb_node);
-
- // Returns the current url the user has input.
- GURL GetInputURL() const;
-
- // Returns the title the user has input.
- std::wstring GetInputTitle() const;
-
- // Invoked when the url or title has possibly changed. Updates the background
- // of Textfields and ok button appropriately.
- void UserInputChanged();
-
- // Creates a new group as a child of the selected node. If no node is
- // selected, the new group is added as a child of the bookmark node. Starts
- // editing on the new gorup as well.
- void NewGroup();
-
- // Creates a new EditorNode as the last child of parent. The new node is
- // added to the model and returned. This does NOT start editing. This is used
- // internally by NewGroup and broken into a separate method for testing.
- EditorNode* AddNewGroup(EditorNode* parent);
-
- // Profile the entry is from.
- Profile* profile_;
-
- // Model driving the TreeView.
- scoped_ptr<EditorTreeModel> tree_model_;
-
- // Displays star groups.
- views::TreeView* tree_view_;
-
- // Used to create a new group.
- scoped_ptr<views::NativeButton> new_group_button_;
-
- // The label for the url text field.
- views::Label* url_label_;
-
- // Used for editing the URL.
- views::Textfield url_tf_;
-
- // The label for the title text field.
- views::Label* title_label_;
-
- // Used for editing the title.
- views::Textfield title_tf_;
-
- // Initial parent to select. Is only used if |details_.existing_node| is
- // NULL.
- const BookmarkNode* parent_;
-
- const EditDetails details_;
-
- // The context menu.
- scoped_ptr<menus::SimpleMenuModel> context_menu_contents_;
- scoped_ptr<views::Menu2> context_menu_;
-
- // 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_;
-
- DISALLOW_COPY_AND_ASSIGN(BookmarkEditorView);
-};
+#include "chrome/browser/ui/views/bookmark_editor_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_BOOKMARK_EDITOR_VIEW_H_
+
diff --git a/chrome/browser/views/bookmark_editor_viw.h b/chrome/browser/views/bookmark_editor_viw.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/chrome/browser/views/bookmark_editor_viw.h
diff --git a/chrome/browser/views/bookmark_menu_controller_views.h b/chrome/browser/views/bookmark_menu_controller_views.h
index f71196b..2fcca0c 100644
--- a/chrome/browser/views/bookmark_menu_controller_views.h
+++ b/chrome/browser/views/bookmark_menu_controller_views.h
@@ -6,195 +6,8 @@
#define CHROME_BROWSER_VIEWS_BOOKMARK_MENU_CONTROLLER_VIEWS_H_
#pragma once
-#include <map>
-#include <set>
-
-#include "chrome/browser/bookmarks/base_bookmark_model_observer.h"
-#include "chrome/browser/bookmarks/bookmark_drag_data.h"
-#include "chrome/browser/views/bookmark_context_menu.h"
-#include "gfx/native_widget_types.h"
-#include "views/controls/menu/menu_delegate.h"
-#include "views/controls/menu/menu_item_view.h"
-
-namespace gfx {
-class Rect;
-} // namespace gfx
-
-namespace views {
-class MenuButton;
-} // namespace views
-
-class BookmarkBarView;
-class BookmarkContextMenu;
-class BookmarkNode;
-class Browser;
-class OSExchangeData;
-class PageNavigator;
-class Profile;
-
-// BookmarkMenuController is responsible for showing a menu of bookmarks,
-// each item in the menu represents a bookmark.
-// BookmarkMenuController deletes itself as necessary, although the menu can
-// be explicitly hidden by way of the Cancel method.
-class BookmarkMenuController : public BaseBookmarkModelObserver,
- public views::MenuDelegate,
- public BookmarkContextMenuObserver {
- public:
- // The observer is notified prior to the menu being deleted.
- class Observer {
- public:
- virtual void BookmarkMenuDeleted(BookmarkMenuController* controller) = 0;
-
- protected:
- virtual ~Observer() {}
- };
-
- // Creates a BookmarkMenuController showing the children of |node| starting
- // at index |start_child_index|.
- BookmarkMenuController(Browser* browser,
- Profile* profile,
- PageNavigator* page_navigator,
- gfx::NativeWindow parent,
- const BookmarkNode* node,
- int start_child_index);
-
- void RunMenuAt(BookmarkBarView* bookmark_bar, bool for_drop);
-
- // Shows the menu.
- void RunMenuAt(views::MenuButton* button,
- views::MenuItemView::AnchorPosition position,
- bool for_drop);
-
- // Hides the menu.
- void Cancel();
-
- // Returns the node the menu is showing for.
- const BookmarkNode* node() const { return node_; }
-
- // Returns the menu.
- views::MenuItemView* menu() const { return menu_; }
-
- // Returns the context menu, or NULL if the context menu isn't showing.
- views::MenuItemView* context_menu() const {
- return context_menu_.get() ? context_menu_->menu() : NULL;
- }
-
- void set_observer(Observer* observer) { observer_ = observer; }
-
- // MenuDelegate methods.
- virtual bool IsTriggerableEvent(const views::MouseEvent& e);
- virtual void ExecuteCommand(int id, int mouse_event_flags);
- virtual bool GetDropFormats(
- views::MenuItemView* menu,
- int* formats,
- std::set<OSExchangeData::CustomFormat>* custom_formats);
- virtual bool AreDropTypesRequired(views::MenuItemView* menu);
- virtual bool CanDrop(views::MenuItemView* menu, const OSExchangeData& data);
- virtual int GetDropOperation(views::MenuItemView* item,
- const views::DropTargetEvent& event,
- DropPosition* position);
- virtual int OnPerformDrop(views::MenuItemView* menu,
- DropPosition position,
- const views::DropTargetEvent& event);
- virtual bool ShowContextMenu(views::MenuItemView* source,
- int id,
- const gfx::Point& p,
- bool is_mouse_gesture);
- virtual void DropMenuClosed(views::MenuItemView* menu);
- virtual bool CanDrag(views::MenuItemView* menu);
- virtual void WriteDragData(views::MenuItemView* sender, OSExchangeData* data);
- virtual int GetDragOperations(views::MenuItemView* sender);
- virtual views::MenuItemView* GetSiblingMenu(
- views::MenuItemView* menu,
- const gfx::Point& screen_point,
- views::MenuItemView::AnchorPosition* anchor,
- bool* has_mnemonics,
- views::MenuButton** button);
- virtual int GetMaxWidthForMenu();
-
- // BookmarkModelObserver methods.
- virtual void BookmarkModelChanged();
- virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model,
- const BookmarkNode* node);
-
- // BookmarkContextMenu::Observer methods.
- virtual void WillRemoveBookmarks(
- const std::vector<const BookmarkNode*>& bookmarks);
- virtual void DidRemoveBookmarks();
-
- private:
- typedef std::map<const BookmarkNode*, int> NodeToMenuIDMap;
-
- // BookmarkMenuController deletes itself as necessary.
- virtual ~BookmarkMenuController();
-
- // Creates a menu and adds it to node_to_menu_id_map_. This uses
- // BuildMenu to recursively populate the menu.
- views::MenuItemView* CreateMenu(const BookmarkNode* parent,
- int start_child_index);
-
- // Creates an entry in menu for each child node of |parent| starting at
- // |start_child_index|.
- void BuildMenu(const BookmarkNode* parent,
- int start_child_index,
- views::MenuItemView* menu,
- int* next_menu_id);
-
- // Returns the menu whose id is |id|.
- views::MenuItemView* GetMenuByID(int id);
-
- // Does the work of processing WillRemoveBookmarks. On exit the set of removed
- // menus is added to |removed_menus|. It's up to the caller to delete the
- // the menus added to |removed_menus|.
- void WillRemoveBookmarksImpl(
- const std::vector<const BookmarkNode*>& bookmarks,
- std::set<views::MenuItemView*>* removed_menus);
-
- Browser* browser_;
-
- Profile* profile_;
-
- PageNavigator* page_navigator_;
-
- // Parent of menus.
- gfx::NativeWindow parent_;
-
- // The node we're showing the contents of.
- const BookmarkNode* node_;
-
- // Maps from menu id to BookmarkNode.
- std::map<int, const BookmarkNode*> menu_id_to_node_map_;
-
- // Mapping from node to menu id. This only contains entries for nodes of type
- // URL.
- NodeToMenuIDMap node_to_menu_id_map_;
-
- // Current menu.
- views::MenuItemView* menu_;
-
- // Data for the drop.
- BookmarkDragData drop_data_;
-
- // Used when a context menu is shown.
- scoped_ptr<BookmarkContextMenu> context_menu_;
-
- // The observer, may be null.
- Observer* observer_;
-
- // Is the menu being shown for a drop?
- bool for_drop_;
-
- // The bookmark bar. This is only non-null if we're showing a menu item
- // for a folder on the bookmark bar and not for drop.
- BookmarkBarView* bookmark_bar_;
-
- typedef std::map<const BookmarkNode*, views::MenuItemView*> NodeToMenuMap;
- NodeToMenuMap node_to_menu_map_;
-
- // ID of the next menu item.
- int next_menu_id_;
-
- DISALLOW_COPY_AND_ASSIGN(BookmarkMenuController);
-};
+#include "chrome/browser/ui/views/bookmark_menu_controller_views.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_BOOKMARK_MENU_CONTROLLER_VIEWS_H_
+
diff --git a/chrome/browser/views/browser_actions_container.h b/chrome/browser/views/browser_actions_container.h
index 0bc5fdd..0b6b094 100644
--- a/chrome/browser/views/browser_actions_container.h
+++ b/chrome/browser/views/browser_actions_container.h
@@ -6,504 +6,8 @@
#define CHROME_BROWSER_VIEWS_BROWSER_ACTIONS_CONTAINER_H_
#pragma once
-#include <set>
-#include <string>
-#include <vector>
-
-#include "app/slide_animation.h"
-#include "base/task.h"
-#include "chrome/browser/extensions/extension_context_menu_model.h"
-#include "chrome/browser/extensions/extension_toolbar_model.h"
-#include "chrome/browser/extensions/image_loading_tracker.h"
-#include "chrome/browser/views/browser_bubble.h"
-#include "chrome/browser/views/extensions/browser_action_overflow_menu_controller.h"
-#include "chrome/browser/views/extensions/extension_popup.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "views/controls/button/menu_button.h"
-#include "views/controls/menu/view_menu_delegate.h"
-#include "views/controls/resize_area.h"
-#include "views/view.h"
-
-class Browser;
-class BrowserActionsContainer;
-class BrowserActionOverflowMenuController;
-class BrowserActionsContainer;
-class Extension;
-class ExtensionAction;
-class ExtensionPopup;
-class PrefService;
-class Profile;
-
-namespace gfx {
-class CanvasSkia;
-}
-
-namespace views {
-class Menu2;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// BrowserActionButton
-
-// The BrowserActionButton is a specialization of the MenuButton class.
-// It acts on a ExtensionAction, in this case a BrowserAction and handles
-// loading the image for the button asynchronously on the file thread.
-class BrowserActionButton : public views::MenuButton,
- public views::ButtonListener,
- public ImageLoadingTracker::Observer,
- public NotificationObserver {
- public:
- BrowserActionButton(const Extension* extension,
- BrowserActionsContainer* panel);
-
- // Call this instead of delete.
- void Destroy();
-
- ExtensionAction* browser_action() const { return browser_action_; }
- const Extension* extension() { return extension_; }
-
- // Called to update the display to match the browser action's state.
- void UpdateState();
-
- // Returns the default icon, if any.
- const SkBitmap& default_icon() const { return default_icon_; }
-
- // Overridden from views::View:
- virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Overridden from ImageLoadingTracker.
- virtual void OnImageLoaded(
- SkBitmap* image, ExtensionResource resource, int index);
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // MenuButton behavior overrides. These methods all default to TextButton
- // behavior unless this button is a popup. In that case, it uses MenuButton
- // behavior. MenuButton has the notion of a child popup being shown where the
- // button will stay in the pushed state until the "menu" (a popup in this
- // case) is dismissed.
- virtual bool Activate();
- virtual bool OnMousePressed(const views::MouseEvent& e);
- virtual void OnMouseReleased(const views::MouseEvent& e, bool canceled);
- virtual bool OnKeyReleased(const views::KeyEvent& e);
- virtual void OnMouseExited(const views::MouseEvent& event);
- virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture);
-
- // Does this button's action have a popup?
- virtual bool IsPopup();
- virtual GURL GetPopupUrl();
-
- // Notifications when to set button state to pushed/not pushed (for when the
- // popup/context menu is hidden or shown by the container).
- void SetButtonPushed();
- void SetButtonNotPushed();
-
- private:
- virtual ~BrowserActionButton();
-
- // The browser action this view represents. The ExtensionAction is not owned
- // by this class.
- ExtensionAction* browser_action_;
-
- // The extension associated with the browser action we're displaying.
- const Extension* extension_;
-
- // The object that is waiting for the image loading to complete
- // asynchronously.
- ImageLoadingTracker tracker_;
-
- // Whether we are currently showing/just finished showing a context menu.
- bool showing_context_menu_;
-
- // The default icon for our browser action. This might be non-empty if the
- // browser action had a value for default_icon in the manifest.
- SkBitmap default_icon_;
-
- // The browser action shelf.
- BrowserActionsContainer* panel_;
-
- scoped_refptr<ExtensionContextMenuModel> context_menu_contents_;
- scoped_ptr<views::Menu2> context_menu_menu_;
-
- NotificationRegistrar registrar_;
-
- friend class DeleteTask<BrowserActionButton>;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserActionButton);
-};
-
-
-////////////////////////////////////////////////////////////////////////////////
-// BrowserActionView
-// A single section in the browser action container. This contains the actual
-// BrowserActionButton, as well as the logic to paint the badge.
-
-class BrowserActionView : public views::View {
- public:
- BrowserActionView(const Extension* extension, BrowserActionsContainer* panel);
- virtual ~BrowserActionView();
-
- BrowserActionButton* button() { return button_; }
-
- // Allocates a canvas object on the heap and draws into it the icon for the
- // view as well as the badge (if any). Caller is responsible for deleting the
- // returned object.
- gfx::Canvas* GetIconWithBadge();
-
- // Accessibility accessors, overridden from View.
- virtual AccessibilityTypes::Role GetAccessibleRole();
-
- private:
- virtual void Layout();
-
- // Override PaintChildren so that we can paint the badge on top of children.
- virtual void PaintChildren(gfx::Canvas* canvas);
-
- // The container for this view.
- BrowserActionsContainer* panel_;
-
- // The button this view contains.
- BrowserActionButton* button_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserActionView);
-};
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// The BrowserActionsContainer is a container view, responsible for drawing the
-// browser action icons (extensions that add icons to the toolbar).
-//
-// The container is placed flush against the omnibox and wrench menu, and its
-// layout looks like:
-// rI_I_IcCs
-// Where the letters are as follows:
-// r: An invisible resize area. This is ToolbarView::kStandardSpacing pixels
-// wide and directly adjacent to the omnibox.
-// I: An icon. This is as wide as the IDR_BROWSER_ACTION image.
-// _: kItemSpacing pixels of empty space.
-// c: kChevronSpacing pixels of empty space. Only present if C is present.
-// C: An optional chevron, visible for overflow. As wide as the
-// IDR_BROWSER_ACTIONS_OVERFLOW image.
-// s: ToolbarView::kStandardSpacing pixels of empty space (before the wrench
-// menu).
-// The reason the container contains the trailing space "s", rather than having
-// it be handled by the parent view, is so that when the chevron is invisible
-// and the user starts dragging an icon around, we have the space to draw the
-// ultimate drop indicator. (Otherwise, we'd be trying to draw it into the
-// padding beyond our right edge, and it wouldn't appear.)
-//
-// The BrowserActionsContainer follows a few rules, in terms of user experience:
-//
-// 1) The container can never grow beyond the space needed to show all icons
-// (hereby referred to as the max width).
-// 2) The container can never shrink below the space needed to show just the
-// initial padding and the chevron (ignoring the case where there are no icons
-// to show, in which case the container won't be visible anyway).
-// 3) The container snaps into place (to the pixel count that fits the visible
-// icons) to make sure there is no wasted space at the edges of the container.
-// 4) If the user adds or removes icons (read: installs/uninstalls browser
-// actions) we grow and shrink the container as needed - but ONLY if the
-// container was at max width to begin with.
-// 5) If the container is NOT at max width (has an overflow menu), we respect
-// that size when adding and removing icons and DON'T grow/shrink the container.
-// This means that new icons (which always appear at the far right) will show up
-// in the overflow menu. The install bubble for extensions points to the chevron
-// menu in this case.
-//
-// Resizing the BrowserActionsContainer:
-//
-// The ResizeArea view sends OnResize messages to the BrowserActionsContainer
-// class as the user drags it. This modifies the value for |resize_amount_|.
-// That indicates to the container that a resize is in progress and is used to
-// calculate the size in GetPreferredSize(), though that function never exceeds
-// the defined minimum and maximum size of the container.
-//
-// When the user releases the mouse (ends the resize), we calculate a target
-// size for the container (animation_target_size_), clamp that value to the
-// containers min and max and then animate from the *current* position (that the
-// user has dragged the view to) to the target size.
-//
-// Animating the BrowserActionsContainer:
-//
-// Animations are used when snapping the container to a value that fits all
-// visible icons. This can be triggered when the user finishes resizing the
-// container or when Browser Actions are added/removed.
-//
-// We always animate from the current width (container_width_) to the target
-// size (animation_target_size_), using |resize_amount| to keep track of the
-// animation progress.
-//
-// NOTE: When adding Browser Actions to a maximum width container (no overflow)
-// we make sure to suppress the chevron menu if it wasn't visible. This is
-// because we won't have enough space to show the new Browser Action until the
-// animation ends and we don't want the chevron to flash into view while we are
-// growing the container.
-//
-////////////////////////////////////////////////////////////////////////////////
-class BrowserActionsContainer
- : public views::View,
- public views::ViewMenuDelegate,
- public views::DragController,
- public views::ResizeArea::ResizeAreaDelegate,
- public AnimationDelegate,
- public ExtensionToolbarModel::Observer,
- public BrowserActionOverflowMenuController::Observer,
- public ExtensionContextMenuModel::PopupDelegate,
- public ExtensionPopup::Observer {
- public:
- BrowserActionsContainer(Browser* browser, views::View* owner_view);
- virtual ~BrowserActionsContainer();
-
- static void RegisterUserPrefs(PrefService* prefs);
-
- void Init();
-
- // Get the number of browser actions being displayed.
- int num_browser_actions() const { return browser_action_views_.size(); }
-
- // Whether we are performing resize animation on the container.
- bool animating() const { return animation_target_size_ > 0; }
-
- // Returns the chevron, if any.
- const views::View* chevron() const { return chevron_; }
-
- // Returns the profile this container is associated with.
- Profile* profile() const { return profile_; }
-
- // Returns the browser this container is associated with.
- Browser* browser() const { return browser_; }
-
- // Returns the current tab's ID, or -1 if there is no current tab.
- int GetCurrentTabId() const;
-
- // Get a particular browser action view.
- BrowserActionView* GetBrowserActionViewAt(int index) {
- return browser_action_views_[index];
- }
-
- // Retrieve the BrowserActionView for |extension|.
- BrowserActionView* GetBrowserActionView(ExtensionAction* action);
-
- // Update the views to reflect the state of the browser action icons.
- void RefreshBrowserActionViews();
-
- // Sets up the browser action view vector.
- void CreateBrowserActionViews();
-
- // Delete all browser action views.
- void DeleteBrowserActionViews();
-
- // Called when a browser action becomes visible/hidden.
- void OnBrowserActionVisibilityChanged();
-
- // Returns how many browser actions are visible.
- size_t VisibleBrowserActions() const;
-
- // Called when the user clicks on the browser action icon.
- void OnBrowserActionExecuted(BrowserActionButton* button,
- bool inspect_with_devtools);
-
- // Overridden from views::View:
- virtual gfx::Size GetPreferredSize();
- virtual void Layout();
- virtual void Paint(gfx::Canvas* canvas);
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
- virtual bool GetDropFormats(
- int* formats, std::set<OSExchangeData::CustomFormat>* custom_formats);
- virtual bool AreDropTypesRequired();
- virtual bool CanDrop(const OSExchangeData& data);
- virtual void OnDragEntered(const views::DropTargetEvent& event);
- virtual int OnDragUpdated(const views::DropTargetEvent& event);
- virtual void OnDragExited();
- virtual int OnPerformDrop(const views::DropTargetEvent& event);
- virtual void OnThemeChanged();
- virtual AccessibilityTypes::Role GetAccessibleRole();
-
- // Overridden from views::ViewMenuDelegate:
- virtual void RunMenu(View* source, const gfx::Point& pt);
-
- // Overridden from views::DragController:
- virtual void WriteDragData(View* sender,
- const gfx::Point& press_pt,
- OSExchangeData* data);
- virtual int GetDragOperations(View* sender, const gfx::Point& p);
- virtual bool CanStartDrag(View* sender,
- const gfx::Point& press_pt,
- const gfx::Point& p);
-
- // Overridden from ResizeArea::ResizeAreaDelegate:
- virtual void OnResize(int resize_amount, bool done_resizing);
-
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
-
- // Overridden from BrowserActionOverflowMenuController::Observer:
- virtual void NotifyMenuDeleted(
- BrowserActionOverflowMenuController* controller);
-
- // Overridden from ExtensionContextMenuModel::PopupDelegate
- virtual void InspectPopup(ExtensionAction* action);
-
- // Overriden from ExtensionPopup::Delegate
- virtual void ExtensionPopupIsClosing(ExtensionPopup* popup);
-
- // Moves a browser action with |id| to |new_index|.
- void MoveBrowserAction(const std::string& extension_id, size_t new_index);
-
- // Hide the current popup.
- void HidePopup();
-
- // Simulate a click on a browser action button. This should only be
- // used by unit tests.
- void TestExecuteBrowserAction(int index);
-
- // Retrieve the current popup. This should only be used by unit tests.
- ExtensionPopup* TestGetPopup() { return popup_; }
-
- // Set how many icons the container should show. This should only be used by
- // unit tests.
- void TestSetIconVisibilityCount(size_t icons);
-
- // During testing we can disable animations by setting this flag to true,
- // so that the bar resizes instantly, instead of having to poll it while it
- // animates to open/closed status.
- static bool disable_animations_during_testing_;
-
- private:
- friend class BrowserActionView; // So it can access IconHeight().
- friend class ShowFolderMenuTask;
-
- typedef std::vector<BrowserActionView*> BrowserActionViews;
-
- // Returns the width of an icon, optionally with its padding.
- static int IconWidth(bool include_padding);
-
- // Returns the height of an icon.
- static int IconHeight();
-
- // 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();
-
- void LoadImages();
-
- // Sets the initial container width.
- void SetContainerWidth();
-
- // Closes the overflow menu if open.
- void CloseOverflowMenu();
-
- // Cancels the timer for showing the drop down menu.
- void StopShowFolderDropMenuTimer();
-
- // Show the drop down folder after a slight delay.
- void StartShowFolderDropMenuTimer();
-
- // Show the overflow menu.
- void ShowDropFolder();
-
- // Sets the drop indicator position (and schedules paint if the position has
- // changed).
- void SetDropIndicator(int x_pos);
-
- // Given a number of |icons| and whether to |display_chevron|, returns the
- // amount of pixels needed to draw the entire container. For convenience,
- // callers can set |icons| to -1 to mean "all icons".
- int IconCountToWidth(int icons, bool display_chevron) const;
-
- // Given a pixel width, returns the number of icons that fit. (This
- // automatically determines whether a chevron will be needed and includes it
- // in the calculation.)
- size_t WidthToIconCount(int pixels) const;
-
- // Returns the absolute minimum size you can shrink the container down to and
- // still show it. This assumes a visible chevron because the only way we
- // would not have a chevron when shrinking down this far is if there were no
- // icons, in which case the container wouldn't be shown at all.
- int ContainerMinSize() const;
-
- // Animate to the target size (unless testing, in which case we go straight to
- // the target size). This also saves the target number of visible icons in
- // the pref if we're not off the record.
- void SaveDesiredSizeAndAnimate(Tween::Type type, size_t num_visible_icons);
-
- // 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);
-
- // The vector of browser actions (icons/image buttons for each action). Note
- // that not every BrowserAction in the ToolbarModel will necessarily be in
- // this collection. Some extensions may be disabled in incognito windows.
- BrowserActionViews browser_action_views_;
-
- Profile* profile_;
-
- // The Browser object the container is associated with.
- Browser* browser_;
-
- // The view that owns us.
- views::View* owner_view_;
-
- // The current popup and the button it came from. NULL if no popup.
- ExtensionPopup* popup_;
-
- // The button that triggered the current popup (just a reference to a button
- // from browser_action_views_).
- BrowserActionButton* popup_button_;
-
- // The model that tracks the order of the toolbar icons.
- ExtensionToolbarModel* model_;
-
- // The current width of the container.
- int container_width_;
-
- // The resize area for the container.
- views::ResizeArea* resize_area_;
-
- // The chevron for accessing the overflow items.
- views::MenuButton* chevron_;
-
- // The menu to show for the overflow button (chevron). This class manages its
- // own lifetime so that it can stay alive during drag and drop operations.
- BrowserActionOverflowMenuController* overflow_menu_;
-
- // The animation that happens when the container snaps to place.
- scoped_ptr<SlideAnimation> resize_animation_;
-
- // Don't show the chevron while animating.
- bool suppress_chevron_;
-
- // This is used while the user is resizing (and when the animations are in
- // progress) to know how wide the delta is between the current state and what
- // we should draw.
- int resize_amount_;
-
- // Keeps track of the absolute pixel width the container should have when we
- // are done animating.
- int animation_target_size_;
-
- // The x position for where to draw the drop indicator. -1 if no indicator.
- int drop_indicator_position_;
-
- ScopedRunnableMethodFactory<BrowserActionsContainer> task_factory_;
-
- // Handles delayed showing of the overflow menu when hovering.
- ScopedRunnableMethodFactory<BrowserActionsContainer> show_menu_task_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer);
-};
+#include "chrome/browser/ui/views/browser_actions_container.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_BROWSER_ACTIONS_CONTAINER_H_
+
diff --git a/chrome/browser/views/browser_bubble.h b/chrome/browser/views/browser_bubble.h
index 790c677..cc4352c 100644
--- a/chrome/browser/views/browser_bubble.h
+++ b/chrome/browser/views/browser_bubble.h
@@ -6,126 +6,8 @@
#define CHROME_BROWSER_VIEWS_BROWSER_BUBBLE_H_
#pragma once
-#include "views/view.h"
-#include "views/widget/widget.h"
-
-class BrowserBubbleHost;
-
-// A class for creating a floating window that is "attached" to a particular
-// Browser. If you don't install a delegate, the bubble will hide
-// automatically when the browser moves. The bubble is only shown manually.
-// Users are expected to delete the bubble when finished with it.
-// Class assumes that RTL related mirroring is done by the view.
-class BrowserBubble {
- public:
- // Delegate to browser bubble events.
- class Delegate {
- public:
- // Called when the Browser Window that this bubble is attached to moves.
- virtual void BubbleBrowserWindowMoved(BrowserBubble* bubble) {}
-
- // Called with the Browser Window that this bubble is attached to is
- // about to close.
- virtual void BubbleBrowserWindowClosing(BrowserBubble* bubble) {}
-
- // Called when the bubble became active / got focus.
- virtual void BubbleGotFocus(BrowserBubble* bubble) {}
-
- // Called when the bubble became inactive / lost focus.
- // |lost_focus_to_child| is true when a child window became active.
- virtual void BubbleLostFocus(BrowserBubble* bubble,
- bool lost_focus_to_child) {}
- };
-
- // Note that the bubble will size itself to the preferred size of |view|.
- // |view| is the embedded view, |frame| is widget that the bubble is being
- // positioned relative to, |origin| is the location that the bubble will
- // be positioned relative to |frame|. Pass true through |drop_shadow| to
- // surround the bubble widget with a drop-shadow.
- BrowserBubble(views::View* view, views::Widget* frame,
- const gfx::Point& origin, bool drop_shadow);
- virtual ~BrowserBubble();
-
- // Call manually if you need to detach the bubble from tracking the browser's
- // position. Note that you must call this manually before deleting this
- // object since it can't be safely called from the destructor.
- void DetachFromBrowser();
-
- // Normally called automatically during construction, but if DetachFromBrowser
- // has been called manually, then this call will reattach.
- void AttachToBrowser();
- bool attached() const { return attached_; }
-
- // Get/Set the delegate.
- Delegate* delegate() const { return delegate_; }
- void set_delegate(Delegate* del) { delegate_ = del; }
-
- // Notifications from BrowserBubbleHost.
- // With no delegate, both of these default to Hiding the bubble.
- virtual void BrowserWindowMoved();
- virtual void BrowserWindowClosing();
-
- // Show or hide the bubble.
- virtual void Show(bool activate);
- virtual void Hide();
- bool visible() const { return visible_; }
-
- // The contained view.
- views::View* view() const { return view_; }
-
- // Set the bounds of the bubble relative to the browser window.
- void SetBounds(int x, int y, int w, int h);
- void MoveTo(int x, int y);
- int width() { return bounds_.width(); }
- int height() { return bounds_.height(); }
- const gfx::Rect& bounds() const { return bounds_; }
-
- // Reposition the bubble - as we are using a WS_POPUP for the bubble,
- // we have to manually position it when the browser window moves.
- void Reposition();
-
- // Resize the bubble to fit the view.
- void ResizeToView();
-
- // Returns the NativeView containing that popup.
- gfx::NativeView native_view() const { return popup_->GetNativeView(); }
-
- protected:
- // Create the popup widget.
- virtual void InitPopup();
-
- // Move the popup to an absolute position.
- void MovePopup(int x, int y, int w, int h);
-
- // The widget that this bubble is in.
- views::Widget* popup_;
-
- // The frame that this bubble is attached to.
- views::Widget* frame_;
-
- private:
- // The view that is displayed in this bubble.
- views::View* view_;
-
- // The bounds relative to the frame.
- gfx::Rect bounds_;
-
- // Current visibility.
- bool visible_;
-
- // The delegate isn't owned by the bubble.
- Delegate* delegate_;
-
- // Is the bubble attached to a Browser window.
- bool attached_;
-
- // Does the bubble have a drop-shadow.
- bool drop_shadow_enabled_;
-
- // Non-owning pointer to the host of this bubble.
- BrowserBubbleHost* bubble_host_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserBubble);
-};
+#include "chrome/browser/ui/views/browser_bubble.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_BROWSER_BUBBLE_H_
+
diff --git a/chrome/browser/views/browser_dialogs.h b/chrome/browser/views/browser_dialogs.h
index 8affac9..ebff745 100644
--- a/chrome/browser/views/browser_dialogs.h
+++ b/chrome/browser/views/browser_dialogs.h
@@ -6,125 +6,8 @@
#define CHROME_BROWSER_VIEWS_BROWSER_DIALOGS_H_
#pragma once
-#include <string>
-
-#include "chrome/common/content_settings_types.h"
-#include "gfx/native_widget_types.h"
-
-// This file contains functions for running a variety of browser dialogs and
-// popups. The dialogs here are the ones that the caller does not need to
-// access the class of the popup. It allows us to break dependencies by
-// allowing the callers to not depend on the classes implementing the dialogs.
-
-class Browser;
-class BrowserView;
-class EditSearchEngineControllerDelegate;
-class FilePath;
-class FindBar;
-class GURL;
-class HtmlDialogUIDelegate;
-class InfoBubbleDelegate;
-class Profile;
-class TabContents;
-class TemplateURL;
-
-namespace gfx {
-class Rect;
-class Size;
-} // namespace gfx
-
-namespace views {
-class Widget;
-class Window;
-} // namespace views
-
-namespace browser {
-
-// Shows the "Report a problem with this page" dialog box. See BugReportView.
-void ShowBugReportView(views::Window* parent,
- Profile* profile,
- TabContents* tab);
-
-// Shows the "Report a problem with this page" page in a new tab
-void ShowHtmlBugReportView(views::Window* parent, Browser* browser);
-
-// Shows the "Clear browsing data" dialog box. See ClearBrowsingDataView.
-void ShowClearBrowsingDataView(gfx::NativeWindow parent,
- Profile* profile);
-
-// Shows the "Importer" dialog. See ImporterView.
-void ShowImporterView(views::Widget* parent,
- Profile* profile);
-
-// Shows or hides the global bookmark bubble for the star button.
-void ShowBookmarkBubbleView(views::Window* parent,
- const gfx::Rect& bounds,
- InfoBubbleDelegate* delegate,
- Profile* profile,
- const GURL& url,
- bool newly_bookmarked);
-void HideBookmarkBubbleView();
-bool IsBookmarkBubbleViewShowing();
-
-// Shows the bookmark manager.
-void ShowBookmarkManagerView(Profile* profile);
-
-// Shows the about dialog. See AboutChromeView.
-views::Window* ShowAboutChromeView(gfx::NativeWindow parent,
- Profile* profile);
-
-// Shows an HTML dialog. See HtmlDialogView.
-void ShowHtmlDialogView(gfx::NativeWindow parent, Profile* profile,
- HtmlDialogUIDelegate* delegate);
-
-// Creates and returns a find bar for the given browser window. See FindBarWin.
-FindBar* CreateFindBar(BrowserView* browser_view);
-
-// Shows the "Save passwords and exceptions" dialog.
-// See PasswordsExceptionsWindowView.
-void ShowPasswordsExceptionsWindowView(Profile* profile);
-
-// Shows the keyword editor. See KeywordEditorView.
-void ShowKeywordEditorView(Profile* profile);
-
-// Shows the "new profile" dialog box. See NewProfileDialog.
-void ShowNewProfileDialog();
-
-// Shows the Task Manager.
-void ShowTaskManager();
-
-#if defined(OS_CHROMEOS)
-// Shows the Login Wizard.
-void ShowLoginWizard(const std::string& start_screen, const gfx::Size& size);
-#endif
-
-// Shows a dialog box that allows a search engine to be edited. |template_url|
-// is the search engine being edited. If it is NULL, then the dialog will add a
-// new search engine with the data the user supplies. |delegate| is an object
-// to be notified when the user is done editing, or NULL. If NULL, the dialog
-// will update the model with the user's edits directly.
-void EditSearchEngine(gfx::NativeWindow parent,
- const TemplateURL* template_url,
- EditSearchEngineControllerDelegate* delegate,
- Profile* profile);
-
-// Shows the repost form confirmation dialog box.
-void ShowRepostFormWarningDialog(gfx::NativeWindow parent_window,
- TabContents* tab_contents);
-
-// Shows the content settings dialog box.
-void ShowContentSettingsWindow(gfx::NativeWindow parent_window,
- ContentSettingsType content_type,
- Profile* profile);
-
-// Shows the collected cookies dialog box.
-void ShowCollectedCookiesDialog(gfx::NativeWindow parent_window,
- TabContents* tab_contents);
-
-// Shows the create web app shortcut dialog box.
-void ShowCreateShortcutsDialog(gfx::NativeWindow parent_window,
- TabContents* tab_contents);
-
-} // namespace browser
+#include "chrome/browser/ui/views/browser_dialogs.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_BROWSER_DIALOGS_H_
+
diff --git a/chrome/browser/views/bubble_border.h b/chrome/browser/views/bubble_border.h
index 6d5191a..2d88c30 100644
--- a/chrome/browser/views/bubble_border.h
+++ b/chrome/browser/views/bubble_border.h
@@ -6,167 +6,8 @@
#define CHROME_BROWSER_VIEWS_BUBBLE_BORDER_H_
#pragma once
-#include "third_party/skia/include/core/SkColor.h"
-#include "views/background.h"
-#include "views/border.h"
-
-class SkBitmap;
-
-// Renders a border, with optional arrow, and a custom dropshadow.
-// This can be used to produce floating "bubble" objects with rounded corners.
-class BubbleBorder : public views::Border {
- public:
- // Possible locations for the (optional) arrow.
- // 0 bit specifies left or right.
- // 1 bit specifies top or bottom.
- // 2 bit specifies horizontal or vertical.
- enum ArrowLocation {
- TOP_LEFT = 0,
- TOP_RIGHT = 1,
- BOTTOM_LEFT = 2,
- BOTTOM_RIGHT = 3,
- LEFT_TOP = 4,
- RIGHT_TOP = 5,
- LEFT_BOTTOM = 6,
- RIGHT_BOTTOM = 7,
- NONE = 8, // No arrow. Positioned under the supplied rect.
- FLOAT = 9 // No arrow. Centered over the supplied rect.
- };
-
- explicit BubbleBorder(ArrowLocation arrow_location)
- : override_arrow_offset_(0),
- arrow_location_(arrow_location),
- background_color_(SK_ColorWHITE) {
- InitClass();
- }
-
- // Returns the radius of the corner of the border.
- static int GetCornerRadius() {
- // We can't safely calculate a border radius by comparing the sizes of the
- // side and corner images, because either may have been extended in various
- // directions in order to do more subtle dropshadow fading or other effects.
- // So we hardcode the most accurate value.
- return 4;
- }
-
- // Sets the location for the arrow.
- void set_arrow_location(ArrowLocation arrow_location) {
- arrow_location_ = arrow_location;
- }
- ArrowLocation arrow_location() const { return arrow_location_; }
-
- static ArrowLocation horizontal_mirror(ArrowLocation loc) {
- return loc >= NONE ? loc : static_cast<ArrowLocation>(loc ^ 1);
- }
-
- static ArrowLocation vertical_mirror(ArrowLocation loc) {
- return loc >= NONE ? loc : static_cast<ArrowLocation>(loc ^ 2);
- }
-
- static bool has_arrow(ArrowLocation loc) {
- return loc >= NONE ? false : true;
- }
-
- static bool is_arrow_on_left(ArrowLocation loc) {
- return loc >= NONE ? false : !(loc & 1);
- }
-
- static bool is_arrow_on_top(ArrowLocation loc) {
- return loc >= NONE ? false : !(loc & 2);
- }
-
- static bool is_arrow_on_horizontal(ArrowLocation loc) {
- return loc >= NONE ? false : !(loc & 4);
- }
-
- // Sets the background color for the arrow body. This is irrelevant if you do
- // not also set the arrow location to something other than NONE.
- void set_background_color(SkColor background_color) {
- background_color_ = background_color;
- }
- SkColor background_color() const { return background_color_; }
-
- // For borders with an arrow, gives the desired bounds (in screen coordinates)
- // given the rect to point to and the size of the contained contents. This
- // depends on the arrow location, so if you change that, you should call this
- // again to find out the new coordinates.
- gfx::Rect GetBounds(const gfx::Rect& position_relative_to,
- const gfx::Size& contents_size) const;
-
- // Sets a fixed offset for the arrow from the beginning of corresponding edge.
- // The arrow will still point to the same location but the bubble will shift
- // location to make that happen. Returns actuall arrow offset, in case of
- // overflow it differ from desired.
- int SetArrowOffset(int offset, const gfx::Size& contents_size);
-
- // Overridden from views::Border:
- virtual void GetInsets(gfx::Insets* insets) const;
-
- private:
- // Loads images if necessary.
- static void InitClass();
-
- virtual ~BubbleBorder() { }
-
- // Overridden from views::Border:
- virtual void Paint(const views::View& view, gfx::Canvas* canvas) const;
-
- void DrawEdgeWithArrow(gfx::Canvas* canvas,
- bool is_horizontal,
- SkBitmap* edge,
- SkBitmap* arrow,
- int start_x,
- int start_y,
- int before_arrow,
- int after_arrow,
- int offset) const;
-
- void DrawArrowInterior(gfx::Canvas* canvas,
- bool is_horizontal,
- int tip_x,
- int tip_y,
- int shift_x,
- int shift_y) const;
-
- // Border graphics.
- static SkBitmap* left_;
- static SkBitmap* top_left_;
- static SkBitmap* top_;
- static SkBitmap* top_right_;
- static SkBitmap* right_;
- static SkBitmap* bottom_right_;
- static SkBitmap* bottom_;
- static SkBitmap* bottom_left_;
- static SkBitmap* left_arrow_;
- static SkBitmap* top_arrow_;
- static SkBitmap* right_arrow_;
- static SkBitmap* bottom_arrow_;
-
- // Minimal offset of the arrow from the closet edge of bounding rect.
- static int arrow_offset_;
-
- // If specified, overrides the pre-calculated |arrow_offset_| of the arrow.
- int override_arrow_offset_;
-
- ArrowLocation arrow_location_;
- SkColor background_color_;
-
- DISALLOW_COPY_AND_ASSIGN(BubbleBorder);
-};
-
-// A Background that clips itself to the specified BubbleBorder and uses
-// the background color of the BubbleBorder.
-class BubbleBackground : public views::Background {
- public:
- explicit BubbleBackground(BubbleBorder* border) : border_(border) {}
-
- // Background overrides.
- virtual void Paint(gfx::Canvas* canvas, views::View* view) const;
-
- private:
- BubbleBorder* border_;
-
- DISALLOW_COPY_AND_ASSIGN(BubbleBackground);
-};
+#include "chrome/browser/ui/views/bubble_border.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_BUBBLE_BORDER_H_
+
diff --git a/chrome/browser/views/chrome_views_delegate.h b/chrome/browser/views/chrome_views_delegate.h
index af046d2..01144e5 100644
--- a/chrome/browser/views/chrome_views_delegate.h
+++ b/chrome/browser/views/chrome_views_delegate.h
@@ -6,34 +6,8 @@
#define CHROME_BROWSER_VIEWS_CHROME_VIEWS_DELEGATE_H_
#pragma once
-#include "base/basictypes.h"
-#include "build/build_config.h"
-#include "views/views_delegate.h"
-
-class ChromeViewsDelegate : public views::ViewsDelegate {
- public:
- ChromeViewsDelegate() {}
- virtual ~ChromeViewsDelegate() {}
-
- // Overridden from views::ViewsDelegate:
- virtual Clipboard* GetClipboard() const;
- virtual void SaveWindowPlacement(const std::wstring& window_name,
- const gfx::Rect& bounds,
- bool maximized);
- virtual bool GetSavedWindowBounds(const std::wstring& window_name,
- gfx::Rect* bounds) const;
- virtual bool GetSavedMaximizedState(const std::wstring& window_name,
- bool* maximized) const;
- virtual void NotifyAccessibilityEvent(
- views::View* view, AccessibilityTypes::Event event_type);
-#if defined(OS_WIN)
- virtual HICON GetDefaultWindowIcon() const;
-#endif
- virtual void AddRef();
- virtual void ReleaseRef();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ChromeViewsDelegate);
-};
+#include "chrome/browser/ui/views/chrome_views_delegate.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_CHROME_VIEWS_DELEGATE_H_
+
diff --git a/chrome/browser/views/clear_browsing_data.h b/chrome/browser/views/clear_browsing_data.h
index 9a3e61a..e9d8b20 100644
--- a/chrome/browser/views/clear_browsing_data.h
+++ b/chrome/browser/views/clear_browsing_data.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,123 +6,8 @@
#define CHROME_BROWSER_VIEWS_CLEAR_BROWSING_DATA_H_
#pragma once
-#include "app/combobox_model.h"
-#include "chrome/browser/browsing_data_remover.h"
-#include "views/controls/button/button.h"
-#include "views/controls/combobox/combobox.h"
-#include "views/controls/label.h"
-#include "views/controls/link.h"
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
-
-namespace views {
-class Checkbox;
-class Label;
-class Throbber;
-class Window;
-}
-
-class Profile;
-class MessageLoop;
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// The ClearBrowsingData class is responsible for drawing the UI controls of the
-// dialog that allows the user to select what to delete (history, downloads,
-// etc).
-//
-////////////////////////////////////////////////////////////////////////////////
-class ClearBrowsingDataView : public views::View,
- public views::DialogDelegate,
- public views::ButtonListener,
- public ComboboxModel,
- public views::Combobox::Listener,
- public BrowsingDataRemover::Observer,
- public views::LinkController {
- public:
- explicit ClearBrowsingDataView(Profile* profile);
- virtual ~ClearBrowsingDataView(void);
-
- // Initialize the controls on the dialog.
- void Init();
-
- // Overridden from views::View:
- virtual gfx::Size GetPreferredSize();
- virtual void Layout();
-
- // Overridden from views::DialogDelegate:
- virtual int GetDefaultDialogButton() const;
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual bool IsDialogButtonEnabled(
- MessageBoxFlags::DialogButton button) const;
- virtual bool CanResize() const;
- virtual bool CanMaximize() const;
- virtual bool IsAlwaysOnTop() const;
- virtual bool HasAlwaysOnTopMenu() const;
- virtual bool IsModal() const;
- virtual std::wstring GetWindowTitle() const;
- virtual bool Accept();
- virtual views::View* GetContentsView();
- views::ClientView* CreateClientView(views::Window* window);
- virtual views::View* GetExtraView() { return throbber_view_; }
- virtual bool GetSizeExtraViewHeightToButtons() { return true; }
- virtual views::View* GetInitiallyFocusedView();
-
- // Overridden from ComboboxModel:
- virtual int GetItemCount();
- virtual string16 GetItemAt(int index);
-
- // Overridden from views::Combobox::Listener:
- virtual void ItemChanged(views::Combobox* sender, int prev_index,
- int new_index);
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Overriden from views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- private:
- // Adds a new check-box as a child to the view.
- views::Checkbox* AddCheckbox(const std::wstring& text, bool checked);
-
- // Sets the controls on the UI to be enabled/disabled depending on whether we
- // have a delete operation in progress or not.
- void UpdateControlEnabledState();
-
- // Starts the process of deleting the browsing data depending on what the
- // user selected.
- void OnDelete();
-
- // Callback from BrowsingDataRemover. Closes the dialog.
- virtual void OnBrowsingDataRemoverDone();
-
- // UI elements we add to the parent view.
- views::View* throbber_view_;
- views::Throbber* throbber_;
- views::Label* status_label_;
- // Other UI elements.
- views::Label* delete_all_label_;
- views::Checkbox* del_history_checkbox_;
- views::Checkbox* del_downloads_checkbox_;
- views::Checkbox* del_cache_checkbox_;
- views::Checkbox* del_cookies_checkbox_;
- views::Checkbox* del_passwords_checkbox_;
- views::Checkbox* del_form_data_checkbox_;
- views::Label* time_period_label_;
- views::Combobox* time_period_combobox_;
-
- // Used to signal enabled/disabled state for controls in the UI.
- bool delete_in_progress_;
-
- Profile* profile_;
-
- // If non-null it means removal is in progress. BrowsingDataRemover takes care
- // of deleting itself when done.
- BrowsingDataRemover* remover_;
-
- DISALLOW_COPY_AND_ASSIGN(ClearBrowsingDataView);
-};
+#include "chrome/browser/ui/views/clear_browsing_data.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_CLEAR_BROWSING_DATA_H_
+
diff --git a/chrome/browser/views/clear_browsing_data_view.h b/chrome/browser/views/clear_browsing_data_view.h
index 92133b3..9911fb1 100644
--- a/chrome/browser/views/clear_browsing_data_view.h
+++ b/chrome/browser/views/clear_browsing_data_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,116 +6,8 @@
#define CHROME_BROWSER_VIEWS_CLEAR_BROWSING_DATA_VIEW_H_
#pragma once
-#include "app/combobox_model.h"
-#include "chrome/browser/browsing_data_remover.h"
-#include "chrome/browser/views/clear_data_view.h"
-#include "views/controls/button/button.h"
-#include "views/controls/combobox/combobox.h"
-#include "views/controls/label.h"
-#include "views/controls/link.h"
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
-
-namespace views {
-class Checkbox;
-class Label;
-class Throbber;
-class Window;
-}
-
-class ClearDataView;
-class Profile;
-class MessageLoop;
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// The ClearBrowsingData2 class is responsible for drawing the UI controls of
-// the dialog that allows the user to select what to delete (history,
-// downloads, etc).
-//
-// TODO(raz) Remove the 2 suffix when the mac/linux/chromeos versions are there
-//
-////////////////////////////////////////////////////////////////////////////////
-class ClearBrowsingDataView2 : public views::View,
- public views::ButtonListener,
- public ComboboxModel,
- public views::Combobox::Listener,
- public BrowsingDataRemover::Observer,
- public views::LinkController {
- public:
- ClearBrowsingDataView2(Profile* profile, ClearDataView* clear_data_view);
-
- virtual ~ClearBrowsingDataView2(void);
-
- // Initialize the controls on the dialog.
- void Init();
-
- // Overridden from ComboboxModel:
- virtual int GetItemCount();
- virtual string16 GetItemAt(int index);
-
- // Overridden from views::Combobox::Listener:
- virtual void ItemChanged(views::Combobox* sender, int prev_index,
- int new_index);
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Overriden from views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- // Enable/disable clearing from this tab
- void SetAllowClear(bool allow);
-
- private:
- // Adds a new check-box as a child to the view.
- views::Checkbox* AddCheckbox(const std::wstring& text, bool checked);
-
- // Sets the controls on the UI to be enabled/disabled depending on whether we
- // have a delete operation in progress or not.
- void UpdateControlEnabledState();
-
- // Hand off control layout to layout manger
- void InitControlLayout();
-
- // Starts the process of deleting the browsing data depending on what the
- // user selected.
- void OnDelete();
-
- // Callback from BrowsingDataRemover. Closes the dialog.
- virtual void OnBrowsingDataRemoverDone();
-
- // Parent window, used for disabling close
- ClearDataView* clear_data_parent_window_;
-
- // Allows for disabling the clear button from outside this view
- bool allow_clear_;
-
- // UI elements
- views::View* throbber_view_;
- views::Throbber* throbber_;
- views::Label* status_label_;
- views::Label* delete_all_label_;
- views::Checkbox* del_history_checkbox_;
- views::Checkbox* del_downloads_checkbox_;
- views::Checkbox* del_cache_checkbox_;
- views::Checkbox* del_cookies_checkbox_;
- views::Checkbox* del_passwords_checkbox_;
- views::Checkbox* del_form_data_checkbox_;
- views::Label* time_period_label_;
- views::Combobox* time_period_combobox_;
- views::NativeButton* clear_browsing_data_button_;
-
- // Used to signal enabled/disabled state for controls in the UI.
- bool delete_in_progress_;
-
- Profile* profile_;
-
- // If non-null it means removal is in progress. BrowsingDataRemover takes care
- // of deleting itself when done.
- BrowsingDataRemover* remover_;
-
- DISALLOW_COPY_AND_ASSIGN(ClearBrowsingDataView2);
-};
+#include "chrome/browser/ui/views/clear_browsing_data_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_CLEAR_BROWSING_DATA_VIEW_H_
+
diff --git a/chrome/browser/views/clear_data_view.h b/chrome/browser/views/clear_data_view.h
index 9481ec4..f03a941 100644
--- a/chrome/browser/views/clear_data_view.h
+++ b/chrome/browser/views/clear_data_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,94 +6,8 @@
#define CHROME_BROWSER_VIEWS_CLEAR_DATA_VIEW_H_
#pragma once
-#include "app/combobox_model.h"
-#include "chrome/browser/browsing_data_remover.h"
-#include "chrome/browser/views/clear_browsing_data_view.h"
-#include "chrome/browser/views/clear_server_data.h"
-#include "views/controls/button/button.h"
-#include "views/controls/combobox/combobox.h"
-#include "views/controls/label.h"
-#include "views/controls/link.h"
-#include "views/controls/tabbed_pane/tabbed_pane.h"
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
-
-namespace views {
-class Checkbox;
-class Label;
-class Throbber;
-class Window;
-}
-
-class ClearBrowsingDataView2;
-class ClearServerDataView;
-class Profile;
-class MessageLoop;
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// The ClearDataView class is responsible for drawing the window that allows
-// the user to select what to delete (history, downloads, etc). It has tabs
-// separating "local" data from "other" (e.g. server) data
-//
-////////////////////////////////////////////////////////////////////////////////
-class ClearDataView : public views::View,
- public views::DialogDelegate {
- public:
- explicit ClearDataView(Profile* profile);
- virtual ~ClearDataView(void) {}
-
- // Disallow the window closing while clearing either server or browsing
- // data. After clear completes, close the window.
- void StartClearingBrowsingData();
- void StopClearingBrowsingData();
-
- void StartClearingServerData();
- void SucceededClearingServerData();
- void FailedClearingServerData();
-
- // Initialize the controls on the dialog.
- void Init();
-
- // Overridden from views::View:
- virtual gfx::Size GetPreferredSize();
- virtual void Layout();
-
- // Overridden from views::DialogDelegate:
- virtual int GetDefaultDialogButton() const;
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual int GetDialogButtons() const;
- virtual bool IsDialogButtonEnabled(
- MessageBoxFlags::DialogButton button) const;
- virtual bool CanResize() const;
- virtual bool CanMaximize() const;
- virtual bool IsAlwaysOnTop() const;
- virtual bool HasAlwaysOnTopMenu() const;
- virtual bool IsModal() const;
- virtual std::wstring GetWindowTitle() const;
- virtual views::View* GetContentsView();
- virtual bool GetSizeExtraViewHeightToButtons() { return true; }
- virtual views::View* GetInitiallyFocusedView();
-
- private:
- // Sets the controls on the UI to be enabled/disabled depending on whether we
- // have a delete operation in progress or not.
- void UpdateControlEnabledState();
-
- // Currently clearing
- bool clearing_data_;
-
- views::TabbedPane* tabs_;
- ClearServerDataView* clear_server_data_tab_;
- ClearBrowsingDataView2* clear_browsing_data_tab_;
-
- Profile* profile_;
-
- DISALLOW_COPY_AND_ASSIGN(ClearDataView);
-};
-
-static const int kDialogPadding = 7;
+#include "chrome/browser/ui/views/clear_data_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_CLEAR_DATA_VIEW_H_
diff --git a/chrome/browser/views/clear_server_data.h b/chrome/browser/views/clear_server_data.h
index 647ab9a..ecce971 100644
--- a/chrome/browser/views/clear_server_data.h
+++ b/chrome/browser/views/clear_server_data.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,113 +6,8 @@
#define CHROME_BROWSER_VIEWS_CLEAR_SERVER_DATA_H_
#pragma once
-#include "app/combobox_model.h"
-#include "chrome/browser/browsing_data_remover.h"
-#include "chrome/browser/views/clear_data_view.h"
-#include "chrome/browser/views/confirm_message_box_dialog.h"
-#include "chrome/browser/sync/profile_sync_service.h"
-#include "views/controls/button/button.h"
-#include "views/controls/label.h"
-#include "views/controls/link.h"
-#include "views/grid_layout.h"
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
-
-namespace views {
-class Checkbox;
-class ColumnSet;
-class GridLayout;
-class Label;
-class Throbber;
-class Window;
-}
-
-class ClearDataView;
-class Profile;
-class MessageLoop;
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// The ClearServerData class is responsible for drawing the UI controls of the
-// dialog that allows the user to delete non-local data (e.g. Chrome Sync data)
-//
-////////////////////////////////////////////////////////////////////////////////
-class ClearServerDataView : public views::View,
- public views::ButtonListener,
- public views::LinkController,
- public ProfileSyncServiceObserver,
- public ConfirmMessageBoxObserver {
- public:
- ClearServerDataView(Profile* profile, ClearDataView* clear_data_view);
-
- virtual ~ClearServerDataView();
-
- // Initialize the controls on the dialog.
- void Init();
-
- // Overridden from views::View:
- virtual gfx::Size GetPreferredSize();
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Overriden from views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- // Disable clearing from this tab
- void SetAllowClear(bool allow);
-
- private:
- void InitControlLayout();
- void InitControlVisibility();
-
- void AddSpacing(views::GridLayout* layout,
- bool related_follows);
-
- void AddWrappingLabelRow(views::GridLayout* layout,
- views::Label* label,
- int id,
- bool related_follows);
-
- // Adds a new check-box as a child to the view.
- views::Checkbox* AddCheckbox(const std::wstring& text, bool checked);
-
- // Sets the controls on the UI to be enabled/disabled depending on whether we
- // have a delete operation in progress or not.
- void UpdateControlEnabledState();
-
- // Enables/disables the clear button as appropriate
- void UpdateClearButtonEnabledState(bool delete_in_progress);
-
- // Starts the process of deleting the browsing data depending on what the
- // user selected.
- void OnDelete();
-
- // ProfileSyncServiceObserver method.
- virtual void OnStateChanged();
-
- // ProfileSyncServiceObserver
- virtual void OnConfirmMessageAccept();
- virtual void OnConfirmMessageCancel();
-
- ClearDataView* clear_data_parent_window_;
- Profile* profile_;
- ProfileSyncService* sync_service_;
- bool allow_clear_;
-
- views::Label* flash_title_label_;
- views::Label* flash_description_label_;
- views::Label* chrome_sync_title_label_;
- views::Label* chrome_sync_description_label_;
- views::Label* dashboard_label_;
- views::Label* status_label_;
- views::Link* flash_link_;
- views::Link* dashboard_link_;
- views::NativeButton* clear_server_data_button_;
- views::Throbber* throbber_;
-
- DISALLOW_COPY_AND_ASSIGN(ClearServerDataView);
-};
+#include "chrome/browser/ui/views/clear_server_data.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_CLEAR_SERVER_DATA_H_
diff --git a/chrome/browser/views/collected_cookies_win.h b/chrome/browser/views/collected_cookies_win.h
index d9f3c16..a13b856 100644
--- a/chrome/browser/views/collected_cookies_win.h
+++ b/chrome/browser/views/collected_cookies_win.h
@@ -2,95 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// This is the Views implementation of the collected Cookies dialog.
-
#ifndef CHROME_BROWSER_VIEWS_COLLECTED_COOKIES_WIN_H_
#define CHROME_BROWSER_VIEWS_COLLECTED_COOKIES_WIN_H_
#pragma once
-#include "chrome/browser/tab_contents/constrained_window.h"
-#include "chrome/common/content_settings.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "views/controls/tree/tree_view.h"
-#include "views/window/dialog_delegate.h"
-
-class ConstrainedWindow;
-class CookiesTreeModel;
-class InfobarView;
-class TabContents;
-namespace views {
-class Label;
-class NativeButton;
-}
-
-// CollectedCookiesWin 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 CollectedCookiesWin : public ConstrainedDialogDelegate,
- NotificationObserver,
- views::ButtonListener,
- views::TreeViewController,
- views::View {
- public:
- // Use BrowserWindow::ShowCollectedCookiesDialog to show.
- CollectedCookiesWin(gfx::NativeWindow parent_window,
- TabContents* tab_contents);
-
- // ConstrainedDialogDelegate implementation.
- virtual std::wstring GetWindowTitle() const;
- virtual int GetDialogButtons() const;
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual void DeleteDelegate();
- virtual bool Cancel();
- virtual views::View* GetContentsView();
-
- // views::ButtonListener implementation.
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // views::TreeViewController implementation.
- virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view);
-
- private:
- virtual ~CollectedCookiesWin();
-
- void Init();
-
- void EnableControls();
-
- void AddContentException(views::TreeView* tree_view, ContentSetting setting);
-
- // Notification Observer implementation.
- void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- NotificationRegistrar registrar_;
-
- ConstrainedWindow* window_;
-
- // The tab contents.
- TabContents* tab_contents_;
-
- // Assorted views.
- views::Label* allowed_label_;
- views::Label* blocked_label_;
-
- views::TreeView* allowed_cookies_tree_;
- views::TreeView* blocked_cookies_tree_;
-
- views::NativeButton* block_allowed_button_;
- views::NativeButton* allow_blocked_button_;
- views::NativeButton* for_session_blocked_button_;
-
- scoped_ptr<CookiesTreeModel> allowed_cookies_tree_model_;
- scoped_ptr<CookiesTreeModel> blocked_cookies_tree_model_;
-
- InfobarView* infobar_;
-
- DISALLOW_COPY_AND_ASSIGN(CollectedCookiesWin);
-};
+#include "chrome/browser/ui/views/collected_cookies_win.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_COLLECTED_COOKIES_WIN_H_
+
diff --git a/chrome/browser/views/confirm_message_box_dialog.h b/chrome/browser/views/confirm_message_box_dialog.h
index c0c5da7..26ca059 100644
--- a/chrome/browser/views/confirm_message_box_dialog.h
+++ b/chrome/browser/views/confirm_message_box_dialog.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,8 @@
#define CHROME_BROWSER_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_
#pragma once
-#include <string>
-
-#include "base/basictypes.h"
-#include "gfx/native_widget_types.h"
-#include "views/controls/label.h"
-#include "views/window/dialog_delegate.h"
-
-// An interface the confirm dialog uses to notify its clients (observers) when
-// the user makes a decision to confirm or cancel. Only one method will be
-// invoked per use (i.e per invocation of ConfirmMessageBoxDialog::Run).
-class ConfirmMessageBoxObserver {
- public:
- // The user explicitly confirmed by clicking "OK".
- virtual void OnConfirmMessageAccept() = 0;
- // The user chose not to confirm either by clicking "Cancel" or by closing
- // the dialog.
- virtual void OnConfirmMessageCancel() {}
-};
-
-class ConfirmMessageBoxDialog : public views::DialogDelegate,
- public views::View {
- public:
- // The method presents a modal confirmation dialog to the user with the title
- // |window_title| and message |message_text|, and 'Yes' 'No' buttons.
- // |observer| will be notified when the user makes a decision or closes the
- // dialog. Note that this class guarantees it will call one of the observer's
- // methods, so it is the caller's responsibility to ensure |observer| lives
- // until one of the methods is invoked; it can be deleted thereafter from this
- // class' point of view. |parent| specifies where to insert the view into the
- // hierarchy and effectively assumes ownership of the dialog.
- static void Run(gfx::NativeWindow parent,
- ConfirmMessageBoxObserver* observer,
- const std::wstring& message_text,
- const std::wstring& window_title);
-
- // A variant of the above for when the message text is longer/shorter than
- // what the default size of this dialog can accommodate.
- static void RunWithCustomConfiguration(gfx::NativeWindow parent,
- ConfirmMessageBoxObserver* observer,
- const std::wstring& message_text,
- const std::wstring& window_title,
- const std::wstring& confirm_label,
- const std::wstring& reject_label,
- const gfx::Size& preferred_size);
-
- virtual ~ConfirmMessageBoxDialog() {}
-
- // views::DialogDelegate implementation.
- virtual int GetDialogButtons() const;
- virtual std::wstring GetWindowTitle() const;
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual int GetDefaultDialogButton() const {
- return MessageBoxFlags::DIALOGBUTTON_CANCEL;
- }
-
- virtual bool Accept();
- virtual bool Cancel();
-
- // views::WindowDelegate implementation.
- virtual bool IsModal() const { return true; }
- virtual views::View* GetContentsView() { return this; }
-
- // views::View implementation.
- virtual void Layout();
- virtual gfx::Size GetPreferredSize();
-
- private:
- ConfirmMessageBoxDialog(ConfirmMessageBoxObserver* observer,
- const std::wstring& message_text,
- const std::wstring& window_title);
-
- // The message which will be shown to user.
- views::Label* message_label_;
-
- // This is the Title bar text.
- std::wstring window_title_;
-
- // The text for the 'OK' and 'CANCEL' buttons.
- std::wstring confirm_label_;
- std::wstring reject_label_;
-
- // The preferred size of the dialog.
- gfx::Size preferred_size_;
-
- // The observer to notify of acceptance or cancellation.
- ConfirmMessageBoxObserver* observer_;
-
- DISALLOW_COPY_AND_ASSIGN(ConfirmMessageBoxDialog);
-};
+#include "chrome/browser/ui/views/confirm_message_box_dialog.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_
+
diff --git a/chrome/browser/views/constrained_window_win.h b/chrome/browser/views/constrained_window_win.h
index 9b17bf6..61ed885 100644
--- a/chrome/browser/views/constrained_window_win.h
+++ b/chrome/browser/views/constrained_window_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,8 @@
#define CHROME_BROWSER_VIEWS_CONSTRAINED_WINDOW_WIN_H_
#pragma once
-#include "chrome/browser/tab_contents/constrained_window.h"
-#include "chrome/browser/tab_contents/tab_contents_delegate.h"
-#include "gfx/rect.h"
-#include "views/window/window_win.h"
-
-class ConstrainedTabContentsWindowDelegate;
-class ConstrainedWindowAnimation;
-class ConstrainedWindowFrameView;
-namespace views {
-class WindowDelegate;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// ConstrainedWindowWin
-//
-// A ConstrainedWindow implementation that implements a Constrained Window as
-// a child HWND with a custom window frame.
-//
-class ConstrainedWindowWin : public ConstrainedWindow,
- public views::WindowWin {
- public:
- virtual ~ConstrainedWindowWin();
-
- // Returns the TabContents that constrains this Constrained Window.
- TabContents* owner() const { return owner_; }
-
- // Overridden from views::Window:
- virtual views::NonClientFrameView* CreateFrameViewForWindow();
-
- // Overridden from ConstrainedWindow:
- virtual void ShowConstrainedWindow();
- virtual void CloseConstrainedWindow();
- virtual void FocusConstrainedWindow();
- virtual std::wstring GetWindowTitle() const;
- virtual const gfx::Rect& GetCurrentBounds() const;
-
- protected:
- // Windows message handlers:
- virtual void OnDestroy();
- virtual void OnFinalMessage(HWND window);
- virtual LRESULT OnMouseActivate(HWND window, UINT hittest_code, UINT message);
- virtual void OnWindowPosChanged(WINDOWPOS* window_pos);
-
- private:
- friend class ConstrainedWindow;
-
- // Use the static factory methods on ConstrainedWindow to construct a
- // ConstrainedWindow.
- ConstrainedWindowWin(TabContents* owner,
- views::WindowDelegate* window_delegate);
-
- // Moves this window to the front of the Z-order and registers us with the
- // focus manager.
- void ActivateConstrainedWindow();
-
- // The TabContents that owns and constrains this ConstrainedWindow.
- TabContents* owner_;
-
- // Current "anchor point", the lower right point at which we render
- // the constrained title bar.
- gfx::Point anchor_point_;
-
- // Current display rectangle (relative to owner_'s visible area).
- gfx::Rect current_bounds_;
-
- DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowWin);
-};
+#include "chrome/browser/ui/views/constrained_window_win.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_CONSTRAINED_WINDOW_WIN_H_
+
diff --git a/chrome/browser/views/content_setting_bubble_contents.h b/chrome/browser/views/content_setting_bubble_contents.h
index b35744f..03ac993 100644
--- a/chrome/browser/views/content_setting_bubble_contents.h
+++ b/chrome/browser/views/content_setting_bubble_contents.h
@@ -6,99 +6,8 @@
#define CHROME_BROWSER_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_
#pragma once
-#include <map>
-
-#include "chrome/common/content_settings_types.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "views/controls/button/button.h"
-#include "views/controls/link.h"
-
-// ContentSettingBubbleContents is used when the user turns on different kinds
-// of content blocking (e.g. "block images"). When viewing a page with blocked
-// content, icons appear in the omnibox corresponding to the content types that
-// were blocked, and the user can click one to get a bubble hosting a few
-// controls. This class provides the content of that bubble. In general,
-// these bubbles typically have a title, a pair of radio buttons for toggling
-// the blocking settings for the current site, a close button, and a link to
-// get to a more comprehensive settings management dialog. A few types have
-// more or fewer controls than this.
-
-class ContentSettingBubbleModel;
-class InfoBubble;
-class Profile;
-class TabContents;
-
-namespace views {
-class NativeButton;
-class RadioButton;
-}
-
-class ContentSettingBubbleContents : public views::View,
- public views::ButtonListener,
- public views::LinkController,
- public NotificationObserver {
- public:
- ContentSettingBubbleContents(
- ContentSettingBubbleModel* content_setting_bubble_model,
- Profile* profile, TabContents* tab_contents);
- virtual ~ContentSettingBubbleContents();
-
- // Sets |info_bubble_|, so we can close the bubble if needed. The caller owns
- // the bubble and must keep it alive.
- void set_info_bubble(InfoBubble* info_bubble) { info_bubble_ = info_bubble; }
-
- virtual gfx::Size GetPreferredSize();
-
- private:
- class Favicon;
-
- typedef std::map<views::Link*, int> PopupLinks;
-
- // Overridden from views::View:
- virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
-
- // views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- // NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Creates the child views.
- void InitControlLayout();
-
- // Provides data for this bubble.
- scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model_;
-
- // The active profile.
- Profile* profile_;
-
- // The active tab contents.
- TabContents* tab_contents_;
-
- // A registrar for listening for TAB_CONTENTS_DESTROYED notifications.
- NotificationRegistrar registrar_;
-
- // The InfoBubble holding us.
- InfoBubble* info_bubble_;
-
- // Some of our controls, so we can tell what's been clicked when we get a
- // message.
- PopupLinks popup_links_;
- typedef std::vector<views::RadioButton*> RadioGroup;
- RadioGroup radio_group_;
- views::NativeButton* close_button_;
- views::Link* manage_link_;
- views::Link* clear_link_;
- views::Link* info_link_;
- views::Link* load_plugins_link_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingBubbleContents);
-};
+#include "chrome/browser/ui/views/content_setting_bubble_contents.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_
+
diff --git a/chrome/browser/views/cookie_info_view.h b/chrome/browser/views/cookie_info_view.h
index 2099a004..6eb19e5 100644
--- a/chrome/browser/views/cookie_info_view.h
+++ b/chrome/browser/views/cookie_info_view.h
@@ -6,118 +6,8 @@
#define CHROME_BROWSER_VIEWS_COOKIE_INFO_VIEW_H_
#pragma once
-#include <string>
-#include <vector>
-
-#include "app/combobox_model.h"
-#include "base/string16.h"
-#include "net/base/cookie_monster.h"
-#include "views/controls/combobox/combobox.h"
-#include "views/view.h"
-
-namespace views {
-class GridLayout;
-class Label;
-class NativeButton;
-class Textfield;
-}
-
-
-///////////////////////////////////////////////////////////////////////////////
-// CookieInfoViewDelegate
-//
-class CookieInfoViewDelegate {
- public:
- virtual void ModifyExpireDate(bool session_expire) = 0;
-
- protected:
- virtual ~CookieInfoViewDelegate() {}
-};
-
-///////////////////////////////////////////////////////////////////////////////
-// CookieInfoView
-//
-// Responsible for displaying a tabular grid of Cookie information.
-class CookieInfoView : public views::View,
- public views::Combobox::Listener,
- public ComboboxModel {
- public:
- explicit CookieInfoView(bool editable_expiration_date);
- virtual ~CookieInfoView();
-
- // Update the display from the specified CookieNode.
- void SetCookie(const std::string& domain,
- const net::CookieMonster::CanonicalCookie& cookie_node);
-
- // Update the display from the specified cookie string.
- void SetCookieString(const GURL& url, const std::string& cookie_line);
-
- // Clears the cookie display to indicate that no or multiple cookies are
- // selected.
- void ClearCookieDisplay();
-
- // Enables or disables the cookie property text fields.
- void EnableCookieDisplay(bool enabled);
-
- void set_delegate(CookieInfoViewDelegate* delegate) { delegate_ = delegate; }
-
- protected:
- // views::View overrides:
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
-
- // views::Combobox::Listener override.
- virtual void ItemChanged(views::Combobox* combo_box,
- int prev_index,
- int new_index);
-
- // ComboboxModel overrides for expires_value_combobox_.
- virtual int GetItemCount();
- virtual string16 GetItemAt(int index);
-
- private:
- // Layout helper routines.
- void AddLabelRow(int layout_id, views::GridLayout* layout,
- views::View* label, views::View* value);
- void AddControlRow(int layout_id, views::GridLayout* layout,
- views::View* label, views::View* control);
-
- // Sets up the view layout.
- void Init();
-
- // Individual property labels
- views::Label* name_label_;
- views::Textfield* name_value_field_;
- views::Label* content_label_;
- views::Textfield* content_value_field_;
- views::Label* domain_label_;
- views::Textfield* domain_value_field_;
- views::Label* path_label_;
- views::Textfield* path_value_field_;
- views::Label* send_for_label_;
- views::Textfield* send_for_value_field_;
- views::Label* created_label_;
- views::Textfield* created_value_field_;
- views::Label* expires_label_;
- views::Textfield* expires_value_field_;
- views::Combobox* expires_value_combobox_;
- views::View* expire_view_;
-
- // Option values for expires_value_combobox_.
- std::vector<std::wstring> expire_combo_values_;
-
- // True if expiration date can be edited. In this case we will show
- // expires_value_combobox_ instead of expires_value_field_. The cookie's
- // expiration date is editable only this class is used in
- // CookiesPromptView (alert before cookie is set), in all other cases we
- // don't let user directly change cookie setting.
- bool editable_expiration_date_;
-
- CookieInfoViewDelegate* delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(CookieInfoView);
-};
+#include "chrome/browser/ui/views/cookie_info_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_COOKIE_INFO_VIEW_H_
diff --git a/chrome/browser/views/create_application_shortcut_view.h b/chrome/browser/views/create_application_shortcut_view.h
index d3112f2..d117ab2 100644
--- a/chrome/browser/views/create_application_shortcut_view.h
+++ b/chrome/browser/views/create_application_shortcut_view.h
@@ -6,88 +6,8 @@
#define CHROME_BROWSER_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_
#pragma once
-#include <string>
-
-#include "chrome/browser/web_applications/web_app.h"
-#include "views/controls/label.h"
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-
-namespace views {
-class Checkbox;
-class Label;
-class Window;
-}; // namespace views
-
-class MessageLoop;
-class Profile;
-class TabContents;
-
-// CreateShortcutView implements a dialog that asks user where to create
-// the shortcut for given web app.
-class CreateApplicationShortcutView : public views::View,
- public views::DialogDelegate,
- public views::ButtonListener {
- public:
- explicit CreateApplicationShortcutView(TabContents* tab_contents);
- virtual ~CreateApplicationShortcutView();
-
- // Initialize the controls on the dialog.
- void Init();
-
- // Overridden from views::View:
- virtual gfx::Size GetPreferredSize();
-
- // Overridden from views::DialogDelegate:
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual bool IsDialogButtonEnabled(
- MessageBoxFlags::DialogButton button) const;
- virtual bool CanResize() const;
- virtual bool CanMaximize() const;
- virtual bool IsAlwaysOnTop() const;
- virtual bool HasAlwaysOnTopMenu() const;
- virtual bool IsModal() const;
- virtual std::wstring GetWindowTitle() const;
- virtual bool Accept();
- virtual views::View* GetContentsView();
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- private:
- // Adds a new check-box as a child to the view.
- views::Checkbox* AddCheckbox(const std::wstring& text, bool checked);
-
- // Fetch the largest unprocessed icon.
- // The first largest icon downloaded and decoded successfully will be used.
- void FetchIcon();
-
- // Callback of icon download.
- void OnIconDownloaded(bool errored, const SkBitmap& image);
-
- // TabContents of the page that we want to create shortcut.
- TabContents* tab_contents_;
-
- // UI elements on the dialog.
- views::View* app_info_;
- views::Label* create_shortcuts_label_;
- views::Checkbox* desktop_check_box_;
- views::Checkbox* menu_check_box_;
- views::Checkbox* quick_launch_check_box_;
-
- // Target shortcut info.
- ShellIntegration::ShortcutInfo shortcut_info_;
-
- // Unprocessed icons from the WebApplicationInfo passed in.
- web_app::IconInfoList unprocessed_icons_;
-
- // Pending app icon download tracked by us.
- class IconDownloadCallbackFunctor;
- IconDownloadCallbackFunctor* pending_download_;
-
- DISALLOW_COPY_AND_ASSIGN(CreateApplicationShortcutView);
-};
+#include "chrome/browser/ui/views/create_application_shortcut_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_
+
diff --git a/chrome/browser/views/database_info_view.h b/chrome/browser/views/database_info_view.h
index 269d3c4..5f7e747 100644
--- a/chrome/browser/views/database_info_view.h
+++ b/chrome/browser/views/database_info_view.h
@@ -6,51 +6,8 @@
#define CHROME_BROWSER_VIEWS_DATABASE_INFO_VIEW_H_
#pragma once
-#include "views/view.h"
-#include "chrome/browser/browsing_data_database_helper.h"
-
-namespace views {
-class Label;
-class Textfield;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// DatabaseInfoView
-//
-// Responsible for displaying a tabular grid of Database information.
-class DatabaseInfoView : public views::View {
- public:
- DatabaseInfoView();
- virtual ~DatabaseInfoView();
-
- // Update the display from the specified Database info.
- void SetDatabaseInfo(
- const BrowsingDataDatabaseHelper::DatabaseInfo& database_info);
-
- // Clears the cookie display to indicate that no or multiple databases are
- // selected.
- void ClearDatabaseDisplay();
-
- // Enables or disables the database property text fields.
- void EnableDatabaseDisplay(bool enabled);
-
- protected:
- // views::View overrides:
- virtual void ViewHierarchyChanged(
- bool is_add, views::View* parent, views::View* child);
-
- private:
- // Set up the view layout.
- void Init();
-
- // Individual property labels.
- views::Textfield* name_value_field_;
- views::Textfield* description_value_field_;
- views::Textfield* size_value_field_;
- views::Textfield* last_modified_value_field_;
-
- DISALLOW_COPY_AND_ASSIGN(DatabaseInfoView);
-};
-
+#include "chrome/browser/ui/views/database_info_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_DATABASE_INFO_VIEW_H_
+
diff --git a/chrome/browser/views/database_open_info_view.h b/chrome/browser/views/database_open_info_view.h
index 81926ae..be808238 100644
--- a/chrome/browser/views/database_open_info_view.h
+++ b/chrome/browser/views/database_open_info_view.h
@@ -6,28 +6,8 @@
#define CHROME_BROWSER_VIEWS_DATABASE_OPEN_INFO_VIEW_H_
#pragma once
-#include "base/string16.h"
-#include "chrome/browser/views/generic_info_view.h"
-
-///////////////////////////////////////////////////////////////////////////////
-// DatabaseOpenInfoView
-//
-// Responsible for displaying a tabular grid of Database information when
-// prompting for permission to open a new database.
-class DatabaseOpenInfoView : public GenericInfoView {
- public:
- DatabaseOpenInfoView();
-
- // Update the display from the specified Database data.
- void SetFields(const std::string& host,
- const string16& database_name,
- const string16& display_name,
- unsigned long estimated_size);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(DatabaseOpenInfoView);
-};
-
+#include "chrome/browser/ui/views/database_open_info_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_DATABASE_OPEN_INFO_VIEW_H_
diff --git a/chrome/browser/views/default_search_view.h b/chrome/browser/views/default_search_view.h
index 052664d..12651c4 100644
--- a/chrome/browser/views/default_search_view.h
+++ b/chrome/browser/views/default_search_view.h
@@ -6,60 +6,8 @@
#define CHROME_BROWSER_VIEWS_DEFAULT_SEARCH_VIEW_H_
#pragma once
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "base/string16.h"
-#include "chrome/browser/tab_contents/constrained_window.h"
-#include "views/window/dialog_delegate.h"
-
-#if defined(TOOLKIT_USES_GTK)
-#include "chrome/browser/gtk/constrained_window_gtk.h"
-#endif
-
-class MessageBoxView;
-class TabContents;
-class TemplateURL;
-class TemplateURLModel;
-
-namespace views {
-class View;
-}
-
-// This class is responsible for displaying the contents of the default search
-// prompt for when InstallSearchProvider(url, true) is called.
-class DefaultSearchView : public ConstrainedDialogDelegate {
- public:
- static void Show(TabContents* tab_contents,
- TemplateURL* default_url,
- TemplateURLModel* template_url_model);
-
- protected:
- // ConstrainedDialogDelegate:
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual std::wstring GetWindowTitle() const;
- virtual void DeleteDelegate();
- virtual views::View* GetContentsView();
- virtual int GetDefaultDialogButton() const;
- virtual bool Accept();
-
- private:
- DefaultSearchView(TabContents* tab_contents,
- TemplateURL* default_url,
- TemplateURLModel* template_url_model);
- ~DefaultSearchView();
-
- // The host name for the possible default search provider.
- string16 DefaultHostName() const;
-
- // The possible new default url.
- scoped_ptr<TemplateURL> default_url_;
- TemplateURLModel* template_url_model_;
-
- // The message box view whose commands we handle.
- MessageBoxView* message_box_view_;
-
- DISALLOW_COPY_AND_ASSIGN(DefaultSearchView);
-};
+#include "chrome/browser/ui/views/default_search_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_DEFAULT_SEARCH_VIEW_H_
+
diff --git a/chrome/browser/views/detachable_toolbar_view.h b/chrome/browser/views/detachable_toolbar_view.h
index fe6137b..68c967b 100644
--- a/chrome/browser/views/detachable_toolbar_view.h
+++ b/chrome/browser/views/detachable_toolbar_view.h
@@ -6,86 +6,8 @@
#define CHROME_BROWSER_VIEWS_DETACHABLE_TOOLBAR_VIEW_H_
#pragma once
-#include "chrome/browser/views/accessible_pane_view.h"
-
-class SkBitmap;
-struct SkRect;
-
-// DetachableToolbarView contains functionality common to views that can detach
-// from the Chrome frame, such as the BookmarkBarView and the Extension shelf.
-class DetachableToolbarView : public AccessiblePaneView {
- public:
- // The color gradient start value close to the edge of the divider.
- static const SkColor kEdgeDividerColor;
- // The color gradient value for the middle of the divider.
- static const SkColor kMiddleDividerColor;
-
- DetachableToolbarView() {}
- virtual ~DetachableToolbarView() {}
-
- // Whether the view is currently detached from the Chrome frame.
- virtual bool IsDetached() const = 0;
-
- // Gets the current state of the resize animation (show/hide).
- virtual double GetAnimationValue() const = 0;
-
- // Gets the current amount of overlap atop the browser toolbar.
- virtual int GetToolbarOverlap() const = 0;
-
- // Paints the background (including the theme image behind content area) when
- // the bar/shelf is attached to the top toolbar. |background_origin| is the
- // origin to use for painting the theme image.
- static void PaintBackgroundAttachedMode(gfx::Canvas* canvas,
- views::View* view,
- const gfx::Point& background_origin);
-
- // Calculate the rect for the content area of the bar/shelf. This is only
- // needed when the bar/shelf is detached from the Chrome frame (otherwise the
- // content area is the whole area of the bar/shelf. When detached, however,
- // only a small round rectangle is for drawing our content on. This calculates
- // how big this area is, where it is located within the shelf and how round
- // the edges should be.
- static void CalculateContentArea(double animation_state,
- double horizontal_padding,
- double vertical_padding,
- SkRect* rect,
- double* roundness,
- views::View* view);
-
- // Paint the horizontal border separating the shelf/bar from the page content.
- static void PaintHorizontalBorder(gfx::Canvas* canvas,
- DetachableToolbarView* view);
-
- // Paint the background of the content area (the surface behind the
- // bookmarks or extension toolstrips). |rect| is the rectangle to paint
- // the background within. |roundness| describes the roundness of the corners.
- static void PaintContentAreaBackground(gfx::Canvas* canvas,
- ThemeProvider* theme_provider,
- const SkRect& rect,
- double roundness);
- // Paint the border around the content area (when in detached mode).
- static void PaintContentAreaBorder(gfx::Canvas* canvas,
- ThemeProvider* theme_provider,
- const SkRect& rect,
- double roundness);
-
- // Paint a themed gradient divider at location |x|. |height| is the full
- // height of the view you want to paint the divider into, not the height of
- // the divider. The height of the divider will become:
- // |height| - 2 * |vertical_padding|.
- // The color of the divider is a gradient starting with |top_color| at the
- // top, and changing into |middle_color| and then over to |bottom_color| as
- // you go further down.
- static void PaintVerticalDivider(gfx::Canvas* canvas,
- int x,
- int height,
- int vertical_padding,
- const SkColor& top_color,
- const SkColor& middle_color,
- const SkColor& bottom_color);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(DetachableToolbarView);
-};
+#include "chrome/browser/ui/views/detachable_toolbar_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_DETACHABLE_TOOLBAR_VIEW_H_
+
diff --git a/chrome/browser/views/dom_view.h b/chrome/browser/views/dom_view.h
index 4a804f8..095fcb7 100644
--- a/chrome/browser/views/dom_view.h
+++ b/chrome/browser/views/dom_view.h
@@ -1,59 +1,13 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// DOMView is a ChromeView that displays the content of a web DOM.
-// It should be used with data: URLs.
-
#ifndef CHROME_BROWSER_VIEWS_DOM_VIEW_H_
#define CHROME_BROWSER_VIEWS_DOM_VIEW_H_
#pragma once
-#include "base/scoped_ptr.h"
-#include "googleurl/src/gurl.h"
-#include "views/controls/native/native_view_host.h"
-#include "views/event.h"
-
-class Profile;
-class SiteInstance;
-class TabContents;
-
-class DOMView : public views::NativeViewHost {
- public:
- DOMView();
- virtual ~DOMView();
-
- // Initialize the view, creating the contents. This should be
- // called once the view has been added to a container.
- //
- // If |instance| is not null, then the view will be loaded in the same
- // process as the given instance.
- bool Init(Profile* profile, SiteInstance* instance);
-
- // Loads the given URL into the page. You must have previously called Init().
- void LoadURL(const GURL& url);
-
- // The tab contents displaying the actual contents.
- TabContents* tab_contents() const { return tab_contents_.get(); }
-
- protected:
- // Overridden from View.
- virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e);
- virtual void Focus();
- virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
- views::View* child);
-
- // Returns new allocated TabContents instance, caller is responsible deleting.
- // Override in derived classes to replace TabContents with derivative.
- virtual TabContents* CreateTabContents(Profile* profile,
- SiteInstance* instance);
-
- scoped_ptr<TabContents> tab_contents_;
-
- private:
- bool initialized_;
-
- DISALLOW_COPY_AND_ASSIGN(DOMView);
-};
+#include "chrome/browser/ui/views/dom_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_DOM_VIEW_H_
+
diff --git a/chrome/browser/views/download_item_view.h b/chrome/browser/views/download_item_view.h
index bd76c0d..cb7dd5c 100644
--- a/chrome/browser/views/download_item_view.h
+++ b/chrome/browser/views/download_item_view.h
@@ -1,276 +1,13 @@
// Copyright (c) 2010 The Chromium 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 ChromeView that implements one download on the Download shelf.
-// Each DownloadItemView contains an application icon, a text label
-// indicating the download's file name, a text label indicating the
-// download's status (such as the number of bytes downloaded so far)
-// and a button for canceling an in progress download, or opening
-// the completed download.
-//
-// The DownloadItemView lives in the Browser, and has a corresponding
-// DownloadController that receives / writes data which lives in the
-// Renderer.
-#ifndef CHROME_BROWSER_VIEWS_DOWNLOAD_ITEM_VIEW_H__
-#define CHROME_BROWSER_VIEWS_DOWNLOAD_ITEM_VIEW_H__
+#ifndef CHROME_BROWSER_VIEWS_DOWNLOAD_ITEM_VIEW_H_
+#define CHROME_BROWSER_VIEWS_DOWNLOAD_ITEM_VIEW_H_
#pragma once
-#include <string>
+#include "chrome/browser/ui/views/download_item_view.h"
+// TODO(beng): remove this file once all includes have been updated.
-#include "app/slide_animation.h"
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "base/time.h"
-#include "base/timer.h"
-#include "chrome/browser/cancelable_request.h"
-#include "chrome/browser/download/download_item.h"
-#include "chrome/browser/download/download_manager.h"
-#include "chrome/browser/icon_manager.h"
-#include "gfx/font.h"
-#include "views/event.h"
-#include "views/controls/button/button.h"
-#include "views/view.h"
+#endif // CHROME_BROWSER_VIEWS_DOWNLOAD_ITEM_VIEW_H_
-namespace views {
-class Label;
-class NativeButton;
-}
-class BaseDownloadItemModel;
-class DownloadShelfView;
-class SkBitmap;
-class DownloadShelfContextMenuWin;
-
-class DownloadItemView : public views::ButtonListener,
- public views::View,
- public DownloadItem::Observer,
- public AnimationDelegate {
- public:
- DownloadItemView(DownloadItem* download,
- DownloadShelfView* parent,
- BaseDownloadItemModel* model);
- virtual ~DownloadItemView();
-
- // DownloadObserver method
- virtual void OnDownloadUpdated(DownloadItem* download);
- virtual void OnDownloadFileCompleted(DownloadItem* download) { }
- virtual void OnDownloadOpened(DownloadItem* download);
-
- // View overrides
- virtual void Layout();
- virtual void Paint(gfx::Canvas* canvas);
- virtual gfx::Size GetPreferredSize();
- virtual void OnMouseExited(const views::MouseEvent& event);
- virtual void OnMouseMoved(const views::MouseEvent& event);
- virtual bool OnMousePressed(const views::MouseEvent& event);
- virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
- virtual bool OnMouseDragged(const views::MouseEvent& event);
- virtual bool OnKeyPressed(const views::KeyEvent& e);
- virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture);
- virtual AccessibilityTypes::Role GetAccessibleRole();
- virtual AccessibilityTypes::State GetAccessibleState();
-
- // ButtonListener implementation.
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // AnimationDelegate implementation.
- virtual void AnimationProgressed(const Animation* animation);
-
- // Timer callback for handling animations
- void UpdateDownloadProgress();
- void StartDownloadProgress();
- void StopDownloadProgress();
-
- // IconManager::Client interface.
- void OnExtractIconComplete(IconManager::Handle handle, SkBitmap* icon_bitmap);
-
- // Returns the DownloadItem model object belonging to this item.
- DownloadItem* download() const { return download_; }
-
- private:
- enum State {
- NORMAL = 0,
- HOT,
- PUSHED,
- DANGEROUS
- };
-
- // The image set associated with the part containing the icon and text.
- struct BodyImageSet {
- SkBitmap* top_left;
- SkBitmap* left;
- SkBitmap* bottom_left;
- SkBitmap* top;
- SkBitmap* center;
- SkBitmap* bottom;
- SkBitmap* top_right;
- SkBitmap* right;
- SkBitmap* bottom_right;
- };
-
- // The image set associated with the drop-down button on the right.
- struct DropDownImageSet {
- SkBitmap* top;
- SkBitmap* center;
- SkBitmap* bottom;
- };
-
- void OpenDownload();
-
- void LoadIcon();
-
- virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip);
-
- // Convenience method to paint the 3 vertical bitmaps (bottom, middle, top)
- // that form the background.
- void PaintBitmaps(gfx::Canvas* canvas,
- const SkBitmap* top_bitmap,
- const SkBitmap* center_bitmap,
- const SkBitmap* bottom_bitmap,
- int x,
- int y,
- int height,
- int width);
-
- // Sets the state and triggers a repaint.
- void SetState(State body_state, State drop_down_state);
-
- // Whether we are in the dangerous mode.
- bool IsDangerousMode() { return body_state_ == DANGEROUS; }
-
- // Reverts from dangerous mode to normal download mode.
- void ClearDangerousMode();
-
- // Sets |size| with the size of the Save and Discard buttons (they have the
- // same size).
- gfx::Size GetButtonSize();
-
- // Sizes the dangerous download label to a minimum width available using 2
- // lines. The size is computed only the first time this method is invoked
- // and simply returned on subsequent calls.
- void SizeLabelToMinWidth();
-
- // Reenables the item after it has been disabled when a user clicked it to
- // open the downloaded file.
- void Reenable();
-
- // Given |x|, returns whether |x| is within the x coordinate range of
- // the drop-down button or not.
- bool InDropDownButtonXCoordinateRange(int x);
-
- // Update the accessible name to reflect the current state of the control,
- // so that screenreaders can access the filename, status text, and
- // dangerous download warning message (if any).
- void UpdateAccessibleName();
-
- // The different images used for the background.
- BodyImageSet normal_body_image_set_;
- BodyImageSet hot_body_image_set_;
- BodyImageSet pushed_body_image_set_;
- BodyImageSet dangerous_mode_body_image_set_;
- DropDownImageSet normal_drop_down_image_set_;
- DropDownImageSet hot_drop_down_image_set_;
- DropDownImageSet pushed_drop_down_image_set_;
-
- // The warning icon showns for dangerous downloads.
- SkBitmap* warning_icon_;
-
- // The model we query for display information
- DownloadItem* download_;
-
- // Our parent view that owns us.
- DownloadShelfView* parent_;
-
- // Elements of our particular download
- std::wstring status_text_;
- bool show_status_text_;
-
- // The font used to print the file name and status.
- gfx::Font font_;
-
- // The tooltip.
- std::wstring tooltip_text_;
-
- // The current state (normal, hot or pushed) of the body and drop-down.
- State body_state_;
- State drop_down_state_;
-
- // In degrees, for downloads with no known total size.
- int progress_angle_;
-
- // The left and right x coordinates of the drop-down button.
- int drop_down_x_left_;
- int drop_down_x_right_;
-
- // Used when we are showing the menu to show the drop-down as pressed.
- bool drop_down_pressed_;
-
- // The height of the box formed by the background images and its labels.
- int box_height_;
-
- // The y coordinate of the box formed by the background images and its labels.
- int box_y_;
-
- // Whether we are dragging the download button.
- bool dragging_;
-
- // Whether we are tracking a possible drag.
- bool starting_drag_;
-
- // Position that a possible drag started at.
- gfx::Point drag_start_point_;
-
- // For canceling an in progress icon request.
- CancelableRequestConsumerT<int, 0> icon_consumer_;
-
- // A model class to control the status text we display and the cancel
- // behavior.
- // This class owns the pointer.
- scoped_ptr<BaseDownloadItemModel> model_;
-
- // Hover animations for our body and drop buttons.
- scoped_ptr<SlideAnimation> body_hover_animation_;
- scoped_ptr<SlideAnimation> drop_hover_animation_;
-
- // Animation for download complete.
- scoped_ptr<SlideAnimation> complete_animation_;
-
- // Progress animation
- base::RepeatingTimer<DownloadItemView> progress_timer_;
-
- // Dangerous mode buttons.
- views::NativeButton* save_button_;
- views::NativeButton* discard_button_;
-
- // Dangerous mode label.
- views::Label* dangerous_download_label_;
-
- // Whether the dangerous mode label has been sized yet.
- bool dangerous_download_label_sized_;
-
- // The size of the buttons. Cached so animation works when hidden.
- gfx::Size cached_button_size_;
-
- // Whether we are currently disabled as part of opening the downloaded file.
- bool disabled_while_opening_;
-
- // The time at which this view was created.
- base::Time creation_time_;
-
- // Method factory used to delay reenabling of the item when opening the
- // downloaded file.
- ScopedRunnableMethodFactory<DownloadItemView> reenable_method_factory_;
-
- // The currently running download context menu.
- scoped_ptr<DownloadShelfContextMenuWin> context_menu_;
-
- // If non-NULL, set to true when this object is deleted.
- // (Used when showing the context menu as it runs an inner message loop that
- // might delete us).
- bool* deleted_;
-
- DISALLOW_COPY_AND_ASSIGN(DownloadItemView);
-};
-
-#endif // CHROME_BROWSER_VIEWS_DOWNLOAD_ITEM_VIEW_H__
diff --git a/chrome/browser/views/download_shelf_view.h b/chrome/browser/views/download_shelf_view.h
index d307d6d..628abba 100644
--- a/chrome/browser/views/download_shelf_view.h
+++ b/chrome/browser/views/download_shelf_view.h
@@ -2,154 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_VIEWS_DOWNLOAD_SHELF_VIEW_H_
-#define CHROME_BROWSER_VIEWS_DOWNLOAD_SHELF_VIEW_H_
+#ifndef CHROME_BROWSER_DOWNLOAD_SHELF_VIEW_H_
+#define CHROME_BROWSER_DOWNLOAD_SHELF_VIEW_H_
#pragma once
-#include "app/slide_animation.h"
-#include "chrome/browser/download/download_shelf.h"
-#include "chrome/browser/views/accessible_pane_view.h"
-#include "views/controls/button/button.h"
-#include "views/controls/link.h"
-#include "views/mouse_watcher.h"
+#include "chrome/browser/ui/views/download_shelf_view.h"
+// TODO(beng): remove this file once all includes have been updated.
-namespace views {
-class ImageButton;
-class ImageView;
-}
+#endif // CHROME_BROWSER_DOWNLOAD_SHELF_VIEW_H_
-class BaseDownloadItemModel;
-class Browser;
-class BrowserView;
-
-class DownloadAnimation;
-class DownloadItemView;
-
-// DownloadShelfView is a view that contains individual views for each download,
-// as well as a close button and a link to show all downloads.
-//
-// DownloadShelfView does not hold an infinite number of download views, rather
-// it'll automatically remove views once a certain point is reached.
-class DownloadShelfView : public AccessiblePaneView,
- public AnimationDelegate,
- public DownloadShelf,
- public views::ButtonListener,
- public views::LinkController,
- public views::MouseWatcherListener {
- public:
- DownloadShelfView(Browser* browser, BrowserView* parent);
- virtual ~DownloadShelfView();
-
- // Sent from the DownloadItemView when the user opens an item.
- void OpenedDownload(DownloadItemView* view);
-
- // Implementation of View.
- virtual gfx::Size GetPreferredSize();
- virtual void Layout();
- virtual void Paint(gfx::Canvas* canvas);
-
- // Implementation of AnimationDelegate.
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
-
- // Implementation of LinkController.
- // Invoked when the user clicks the 'show all downloads' link button.
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- // Implementation of ButtonListener.
- // Invoked when the user clicks the close button. Asks the browser to
- // hide the download shelf.
- virtual void ButtonPressed(views::Button* button, const views::Event& event);
-
- // Implementation of DownloadShelf.
- virtual void AddDownload(BaseDownloadItemModel* download_model);
- virtual bool IsShowing() const;
- virtual bool IsClosing() const;
- virtual void Show();
- virtual void Close();
- virtual Browser* browser() const { return browser_; }
-
- // Implementation of MouseWatcherDelegate.
- virtual void MouseMovedOutOfView();
-
- // Override views::FocusChangeListener method from AccessiblePaneView.
- virtual void FocusWillChange(View* focused_before,
- View* focused_now);
-
- // Removes a specified download view. The supplied view is deleted after
- // it's removed.
- void RemoveDownloadView(views::View* view);
-
- protected:
- // From AccessiblePaneView
- virtual views::View* GetDefaultFocusableChild();
-
- private:
- void Init();
-
- // Adds a View representing a download to this DownloadShelfView.
- // DownloadShelfView takes ownership of the View, and will delete it as
- // necessary.
- void AddDownloadView(DownloadItemView* view);
-
- // Paints the border.
- void PaintBorder(gfx::Canvas* canvas);
-
- // Returns true if the shelf is wide enough to show the first download item.
- bool CanFitFirstDownloadItem();
-
- // Called on theme change.
- void UpdateButtonColors();
-
- // Overridden from views::View.
- virtual void OnThemeChanged();
-
- // Called when the "close shelf" animation ended.
- void Closed();
-
- // Returns true if we can auto close. We can auto-close if all the items on
- // the shelf have been opened.
- bool CanAutoClose();
-
- // Called when any view |view| gains or loses focus. If it's one of our
- // DownloadItemView children, call SchedulePaint on its bounds
- // so that its focus rect is repainted.
- void SchedulePaintForDownloadItem(views::View* view);
-
- // Get the rect that perfectly surrounds a DownloadItemView so we can
- // draw a focus rect around it.
- gfx::Rect GetFocusRectBounds(const DownloadItemView* download_item_view);
-
- // The browser for this shelf.
- Browser* browser_;
-
- // The animation for adding new items to the shelf.
- scoped_ptr<SlideAnimation> new_item_animation_;
-
- // The show/hide animation for the shelf itself.
- scoped_ptr<SlideAnimation> shelf_animation_;
-
- // The download views. These are also child Views, and deleted when
- // the DownloadShelfView is deleted.
- std::vector<DownloadItemView*> download_views_;
-
- // An image displayed on the right of the "Show all downloads..." link.
- views::ImageView* arrow_image_;
-
- // Link for showing all downloads. This is contained as a child, and deleted
- // by View.
- views::Link* show_all_view_;
-
- // Button for closing the downloads. This is contained as a child, and
- // deleted by View.
- views::ImageButton* close_button_;
-
- // The window this shelf belongs to.
- BrowserView* parent_;
-
- views::MouseWatcher mouse_watcher_;
-
- DISALLOW_COPY_AND_ASSIGN(DownloadShelfView);
-};
-
-#endif // CHROME_BROWSER_VIEWS_DOWNLOAD_SHELF_VIEW_H_
diff --git a/chrome/browser/views/dropdown_bar_host.h b/chrome/browser/views/dropdown_bar_host.h
index 72b9aac..23c9053 100644
--- a/chrome/browser/views/dropdown_bar_host.h
+++ b/chrome/browser/views/dropdown_bar_host.h
@@ -6,183 +6,8 @@
#define CHROME_BROWSER_VIEWS_DROPDOWN_BAR_HOST_H_
#pragma once
-#include "app/animation.h"
-#include "base/scoped_ptr.h"
-#include "chrome/common/native_web_keyboard_event.h"
-#include "gfx/native_widget_types.h"
-#include "gfx/rect.h"
-#include "views/controls/textfield/textfield.h"
-#include "views/focus/focus_manager.h"
-
-class BrowserView;
-class DropdownBarView;
-class SlideAnimation;
-class TabContents;
-
-namespace views {
-class ExternalFocusTracker;
-class View;
-class Widget;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// The DropdownBarHost implements the container widget for the UI that
-// is shown at the top of browser contents. It uses the appropriate
-// implementation from dropdown_bar_host_win.cc or dropdown_bar_host_gtk.cc to
-// draw its content and is responsible for showing, hiding, animating, closing,
-// and moving the bar if needed, for example if the widget is
-// obscuring the selection results in FindBar.
-//
-////////////////////////////////////////////////////////////////////////////////
-class DropdownBarHost : public views::AcceleratorTarget,
- public views::FocusChangeListener,
- public AnimationDelegate {
- public:
- explicit DropdownBarHost(BrowserView* browser_view);
- virtual ~DropdownBarHost();
-
- // Initializes the dropdown bar host with the give view.
- void Init(DropdownBarView* view);
-
- // Whether we are animating the position of the dropdown widget.
- bool IsAnimating() const;
- // Returns true if the dropdown bar view is visible, or false otherwise.
- bool IsVisible() const;
- // Selects text in the entry field and set focus.
- void SetFocusAndSelection();
- // Stops the animation.
- void StopAnimation();
-
- // Shows the dropdown bar.
- virtual void Show(bool animate);
- // Hides the dropdown bar.
- virtual void Hide(bool animate);
-
- // Returns the rectangle representing where to position the dropdown widget.
- virtual gfx::Rect GetDialogPosition(gfx::Rect avoid_overlapping_rect) = 0;
-
- // Moves the widget to the provided location, moves it to top
- // in the z-order (HWND_TOP, not HWND_TOPMOST for windows) and shows
- // the widget (if hidden).
- virtual void SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw) = 0;
-
- // Overridden from views::FocusChangeListener:
- virtual void FocusWillChange(views::View* focused_before,
- views::View* focused_now);
-
- // Overridden from views::AcceleratorTarget:
- virtual bool AcceleratorPressed(const views::Accelerator& accelerator) = 0;
-
- // AnimationDelegate implementation:
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
-
- // During testing we can disable animations by setting this flag to true,
- // so that opening and closing the dropdown bar is shown instantly, instead of
- // having to poll it while it animates to open/closed status.
- static bool disable_animations_during_testing_;
-
- // Returns the browser view that the dropdown belongs to.
- BrowserView* browser_view() const { return browser_view_; }
-
- // Registers this class as the handler for when Escape is pressed. Once we
- // loose focus we will unregister Escape and (any accelerators the derived
- // classes registers by using overrides of RegisterAccelerators). See also:
- // SetFocusChangeListener().
- virtual void RegisterAccelerators();
-
- // When we loose focus, we unregister all accelerator handlers. See also:
- // SetFocusChangeListener().
- virtual void UnregisterAccelerators();
-
- protected:
- // Returns the dropdown bar view.
- DropdownBarView* view() const { return view_; }
-
- // Returns the focus tracker.
- views::ExternalFocusTracker* focus_tracker() const {
- return focus_tracker_.get();
- }
-
- // Resets the focus tracker.
- void ResetFocusTracker();
-
- // The focus manager we register with to keep track of focus changes.
- views::FocusManager* focus_manager() const { return focus_manager_; }
-
- // Returns the host widget.
- views::Widget* host() const { return host_.get(); }
-
- // Returns the animation offset.
- int animation_offset() const { return animation_offset_; }
-
- // Retrieves the boundary that the dropdown widget has to work with
- // within the Chrome frame window. The boundary differs depending on
- // the dropdown bar implementation. The default implementation
- // returns the boundary of browser_view and the drop down
- // can be shown in any client area.
- virtual void GetWidgetBounds(gfx::Rect* bounds);
-
- // The find bar widget needs rounded edges, so we create a polygon
- // that corresponds to the background images for this window (and
- // make the polygon only contain the pixels that we want to
- // draw). The polygon is then given to SetWindowRgn which changes
- // the window from being a rectangle in shape, to being a rect with
- // curved edges. We also check to see if the region should be
- // truncated to prevent from drawing onto Chrome's window border.
- void UpdateWindowEdges(const gfx::Rect& new_pos);
-
- // Creates and returns the native Widget.
- views::Widget* CreateHost();
-
- // Allows implementation to tweak widget position.
- void SetWidgetPositionNative(const gfx::Rect& new_pos, bool no_redraw);
-
- // Returns a keyboard event suitable for fowarding.
- NativeWebKeyboardEvent GetKeyboardEvent(
- const TabContents* contents,
- const views::Textfield::Keystroke& key_stroke);
-
- // Returns the animation for the dropdown.
- SlideAnimation* animation() {
- return animation_.get();
- }
-
- private:
- // The BrowserView that created us.
- BrowserView* browser_view_;
-
- // Our view, which is responsible for drawing the UI.
- DropdownBarView* view_;
-
- // The y position pixel offset of the widget while animating the
- // dropdown widget.
- int animation_offset_;
-
- // The animation class to use when opening the Dropdown widget.
- scoped_ptr<SlideAnimation> animation_;
-
- // The focus manager we register with to keep track of focus changes.
- views::FocusManager* focus_manager_;
-
- // True if the accelerator target for Esc key is registered.
- bool esc_accel_target_registered_;
-
- // Tracks and stores the last focused view which is not the DropdownBarView
- // or any of its children. Used to restore focus once the DropdownBarView is
- // closed.
- scoped_ptr<views::ExternalFocusTracker> focus_tracker_;
-
- // Host is the Widget implementation that is created and maintained by the
- // dropdown bar. It contains the DropdownBarView.
- scoped_ptr<views::Widget> host_;
-
- // A flag to manually manage visibility. GTK/X11 is asynchrnous and
- // the state of the widget can be out of sync.
- bool is_visible_;
-
- DISALLOW_COPY_AND_ASSIGN(DropdownBarHost);
-};
+#include "chrome/browser/ui/views/dropdown_bar_host.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_DROPDOWN_BAR_HOST_H_
+
diff --git a/chrome/browser/views/dropdown_bar_view.h b/chrome/browser/views/dropdown_bar_view.h
index 1486509..9ae52cc 100644
--- a/chrome/browser/views/dropdown_bar_view.h
+++ b/chrome/browser/views/dropdown_bar_view.h
@@ -6,49 +6,8 @@
#define CHROME_BROWSER_VIEWS_DROPDOWN_BAR_VIEW_H_
#pragma once
-#include "views/view.h"
-
-class DropdownBarHost;
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// The DropdownBarView is an abstract view to draw the UI controls of the
-// DropdownBarHost.
-//
-////////////////////////////////////////////////////////////////////////////////
-class DropdownBarView : public views::View {
- public:
- explicit DropdownBarView(DropdownBarHost* host)
- : host_(host),
- animation_offset_(0) {
- }
- virtual ~DropdownBarView() {}
-
- // Claims focus for the text field and selects its contents.
- virtual void SetFocusAndSelection(bool select_all) = 0;
-
- // Updates the view to let it know where the host is clipping the
- // dropdown widget (while animating the opening or closing of the widget).
- void set_animation_offset(int offset) { animation_offset_ = offset; }
-
- // Returns the offset used while animating.
- int animation_offset() const { return animation_offset_; }
-
- protected:
- // Returns the DropdownBarHost that manages this view.
- DropdownBarHost* host() const { return host_; }
-
- private:
- // The dropdown bar host that controls this view.
- DropdownBarHost* host_;
-
- // While animating, the host clips the widget and draws only the bottom
- // part of it. The view needs to know the pixel offset at which we are drawing
- // the widget so that we can draw the curved edges that attach to the toolbar
- // in the right location.
- int animation_offset_;
-
- DISALLOW_COPY_AND_ASSIGN(DropdownBarView);
-};
+#include "chrome/browser/ui/views/dropdown_bar_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_DROPDOWN_BAR_VIEW_H_
+
diff --git a/chrome/browser/views/edit_search_engine_dialog.h b/chrome/browser/views/edit_search_engine_dialog.h
index 43c4dd0..f5881ec 100644
--- a/chrome/browser/views/edit_search_engine_dialog.h
+++ b/chrome/browser/views/edit_search_engine_dialog.h
@@ -1,105 +1,13 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// EditSearchEngineDialog provides text fields for editing a keyword: the title,
-// url and actual keyword. It is used by the KeywordEditorView of the Options
-// dialog, and also on its own to confirm the addition of a keyword added by
-// the ExternalJSObject via the RenderView.
-
#ifndef CHROME_BROWSER_VIEWS_EDIT_SEARCH_ENGINE_DIALOG_H_
#define CHROME_BROWSER_VIEWS_EDIT_SEARCH_ENGINE_DIALOG_H_
#pragma once
-#include <windows.h>
-
-#include "views/controls/textfield/textfield.h"
-#include "views/window/dialog_delegate.h"
-
-namespace views {
-class Label;
-class ImageView;
-class Window;
-}
-
-class EditSearchEngineController;
-class EditSearchEngineControllerDelegate;
-class Profile;
-class TemplateURL;
-class TemplateURLModel;
-
-class EditSearchEngineDialog : public views::View,
- public views::Textfield::Controller,
- public views::DialogDelegate {
- public:
- // The |template_url| and/or |delegate| may be NULL.
- EditSearchEngineDialog(const TemplateURL* template_url,
- EditSearchEngineControllerDelegate* delegate,
- Profile* profile);
- virtual ~EditSearchEngineDialog() {}
-
- // Shows the dialog to the user.
- static void Show(gfx::NativeWindow parent,
- const TemplateURL* template_url,
- EditSearchEngineControllerDelegate* delegate,
- Profile* profile);
-
- // views::DialogDelegate overrides.
- virtual bool IsModal() const;
- virtual std::wstring GetWindowTitle() const;
- virtual bool IsDialogButtonEnabled(
- MessageBoxFlags::DialogButton button) const;
- virtual bool Cancel();
- virtual bool Accept();
- virtual views::View* GetContentsView();
-
- // views::Textfield::Controller overrides. Updates whether the user can
- // accept the dialog as well as updating image views showing whether value is
- // valid.
- virtual void ContentsChanged(views::Textfield* sender,
- const std::wstring& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& key);
-
- private:
- void Init();
-
- // Create a Label containing the text with the specified message id.
- views::Label* CreateLabel(int message_id);
-
- // Creates a text field with the specified text. If |lowercase| is true, the
- // Textfield is configured to map all input to lower case.
- views::Textfield* CreateTextfield(const std::wstring& text, bool lowercase);
-
- // Invokes UpdateImageView for each of the images views.
- void UpdateImageViews();
-
- // 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 UpdateImageView(views::ImageView* image_view,
- bool is_valid,
- int invalid_message_id);
-
- // Used to parent window to. May be NULL or an invalid window.
- HWND parent_;
-
- // View containing the buttons, text fields ...
- views::View* view_;
-
- // Text fields.
- views::Textfield* title_tf_;
- views::Textfield* keyword_tf_;
- views::Textfield* url_tf_;
-
- // Shows error images.
- views::ImageView* title_iv_;
- views::ImageView* keyword_iv_;
- views::ImageView* url_iv_;
-
- scoped_ptr<EditSearchEngineController> controller_;
-
- DISALLOW_COPY_AND_ASSIGN(EditSearchEngineDialog);
-};
+#include "chrome/browser/ui/views/edit_search_engine_dialog.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_EDIT_SEARCH_ENGINE_DIALOG_H_
+
diff --git a/chrome/browser/views/event_utils.h b/chrome/browser/views/event_utils.h
index 188041f..7d7d370 100644
--- a/chrome/browser/views/event_utils.h
+++ b/chrome/browser/views/event_utils.h
@@ -1,28 +1,13 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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_VIEWS_EVENT_UTILS_H__
-#define CHROME_BROWSER_VIEWS_EVENT_UTILS_H__
+#ifndef CHROME_BROWSER_VIEWS_EVENT_UTILS_H_
+#define CHROME_BROWSER_VIEWS_EVENT_UTILS_H_
#pragma once
-#include "webkit/glue/window_open_disposition.h"
+#include "chrome/browser/ui/views/event_utils.h"
+// TODO(beng): remove this file once all includes have been updated.
-namespace views {
-class MouseEvent;
-}
+#endif // CHROME_BROWSER_VIEWS_EVENT_UTILS_H_
-namespace event_utils {
-
-// Translates event flags into what kind of disposition they represents.
-// For example, a middle click would mean to open a background tab.
-// event_flags are the flags as understood by views::MouseEvent.
-WindowOpenDisposition DispositionFromEventFlags(int event_flags);
-
-// Returns true if the specified mouse event may have a
-// WindowOptionDisposition.
-bool IsPossibleDispositionEvent(const views::MouseEvent& event);
-
-}
-
-#endif // CHROME_BROWSER_VIEWS_EVENT_UTILS_H__
diff --git a/chrome/browser/views/extensions/browser_action_drag_data.h b/chrome/browser/views/extensions/browser_action_drag_data.h
index 33995fd..ee3ac8f 100644
--- a/chrome/browser/views/extensions/browser_action_drag_data.h
+++ b/chrome/browser/views/extensions/browser_action_drag_data.h
@@ -6,59 +6,8 @@
#define CHROME_BROWSER_VIEWS_EXTENSIONS_BROWSER_ACTION_DRAG_DATA_H_
#pragma once
-#include <string>
-
-#include "base/basictypes.h"
-#include "chrome/browser/profile.h"
-
-#if defined(TOOLKIT_VIEWS)
-#include "app/os_exchange_data.h"
-#endif
-
-class BrowserActionButton;
-class FilePath;
-class Pickle;
-class Profile;
-
-class BrowserActionDragData {
- public:
- BrowserActionDragData();
- BrowserActionDragData(const std::string& id, int index);
-
- const std::string& id() const { return id_; }
-
- size_t index() const { return index_; }
-
- // Returns true if this data is from the specified profile.
- bool IsFromProfile(Profile* profile) const;
-
-#if defined(TOOLKIT_VIEWS)
- void Write(Profile* profile, OSExchangeData* data) const;
-
- // Restores this data from the clipboard, returning true on success.
- bool Read(const OSExchangeData& data);
-
- // Returns the Custom Format this class supports (for Browser Actions).
- static OSExchangeData::CustomFormat GetBrowserActionCustomFormat();
-#endif
-
- private:
- void WriteToPickle(Profile* profile, Pickle* pickle) const;
- bool ReadFromPickle(Pickle* pickle);
-
- // ID of the profile we originated from.
- ProfileId profile_id_;
-
- // The id of the view being dragged.
- std::string id_;
-
- // The index of the view being dragged.
- size_t index_;
-
- // The MIME type for the clipboard format for BrowserActionDragData.
- static const char* kClipboardFormatString;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserActionDragData);
-};
+#include "chrome/browser/ui/views/extensions/browser_action_drag_data.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_EXTENSIONS_BROWSER_ACTION_DRAG_DATA_H_
+
diff --git a/chrome/browser/views/extensions/browser_action_overflow_menu_controller.h b/chrome/browser/views/extensions/browser_action_overflow_menu_controller.h
index 08a0d55..5023765 100644
--- a/chrome/browser/views/extensions/browser_action_overflow_menu_controller.h
+++ b/chrome/browser/views/extensions/browser_action_overflow_menu_controller.h
@@ -6,112 +6,8 @@
#define CHROME_BROWSER_VIEWS_EXTENSIONS_BROWSER_ACTION_OVERFLOW_MENU_CONTROLLER_H_
#pragma once
-#include <set>
-#include <vector>
-
-#include "base/scoped_ptr.h"
-#include "base/task.h"
-#include "views/controls/menu/menu_delegate.h"
-
-class BrowserActionsContainer;
-class BrowserActionView;
-class ExtensionContextMenuModel;
-
-namespace views {
-class Menu2;
-}
-
-// This class handles the overflow menu for browser actions (showing the menu,
-// drag and drop, etc). This class manages its own lifetime.
-class BrowserActionOverflowMenuController : public views::MenuDelegate {
- public:
- // The observer is notified prior to the menu being deleted.
- class Observer {
- public:
- virtual void NotifyMenuDeleted(
- BrowserActionOverflowMenuController* controller) = 0;
- };
-
- BrowserActionOverflowMenuController(
- BrowserActionsContainer* owner,
- views::MenuButton* menu_button,
- const std::vector<BrowserActionView*>& views,
- int start_index);
-
- void set_observer(Observer* observer) { observer_ = observer; }
-
- // Shows the overflow menu.
- bool RunMenu(gfx::NativeWindow window, bool for_drop);
-
- // Closes the overflow menu (and its context menu if open as well).
- void CancelMenu();
-
- // Overridden from views::MenuDelegate:
- virtual void ExecuteCommand(int id);
- virtual bool ShowContextMenu(views::MenuItemView* source,
- int id,
- const gfx::Point& p,
- bool is_mouse_gesture);
- virtual void DropMenuClosed(views::MenuItemView* menu);
- // These drag functions offer support for dragging icons into the overflow
- // menu.
- virtual bool GetDropFormats(
- views::MenuItemView* menu,
- int* formats,
- std::set<OSExchangeData::CustomFormat>* custom_formats);
- virtual bool AreDropTypesRequired(views::MenuItemView* menu);
- virtual bool CanDrop(views::MenuItemView* menu, const OSExchangeData& data);
- virtual int GetDropOperation(views::MenuItemView* item,
- const views::DropTargetEvent& event,
- DropPosition* position);
- virtual int OnPerformDrop(views::MenuItemView* menu,
- DropPosition position,
- const views::DropTargetEvent& event);
- // These three drag functions offer support for dragging icons out of the
- // overflow menu.
- virtual bool CanDrag(views::MenuItemView* menu);
- virtual void WriteDragData(views::MenuItemView* sender, OSExchangeData* data);
- virtual int GetDragOperations(views::MenuItemView* sender);
-
- private:
- // This class manages its own lifetime.
- virtual ~BrowserActionOverflowMenuController();
-
- // Converts a menu item |id| into a BrowserActionView by adding the |id| value
- // to the number of visible views (according to the container owner). If
- // |index| is specified, it will point to the absolute index of the view.
- BrowserActionView* ViewForId(int id, size_t* index);
-
- // A pointer to the browser action container that owns the overflow menu.
- BrowserActionsContainer* owner_;
-
- // The observer, may be null.
- Observer* observer_;
-
- // A pointer to the overflow menu button that we are showing the menu for.
- views::MenuButton* menu_button_;
-
- // The overflow menu for the menu button.
- scoped_ptr<views::MenuItemView> menu_;
-
- // The views vector of all the browser actions the container knows about. We
- // won't show all items, just the one starting at |start_index| and above.
- const std::vector<BrowserActionView*>* views_;
-
- // The index into the BrowserActionView vector, indicating where to start
- // picking browser actions to draw.
- int start_index_;
-
- // Whether this controller is being used for drop.
- bool for_drop_;
-
- // The browser action context menu and model.
- scoped_refptr<ExtensionContextMenuModel> context_menu_contents_;
- scoped_ptr<views::Menu2> context_menu_menu_;
-
- friend class DeleteTask<BrowserActionOverflowMenuController>;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserActionOverflowMenuController);
-};
+#include "chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_EXTENSIONS_BROWSER_ACTION_OVERFLOW_MENU_CONTROLLER_H_
+
diff --git a/chrome/browser/views/extensions/extension_installed_bubble.h b/chrome/browser/views/extensions/extension_installed_bubble.h
index a35f820..ab1c498 100644
--- a/chrome/browser/views/extensions/extension_installed_bubble.h
+++ b/chrome/browser/views/extensions/extension_installed_bubble.h
@@ -6,80 +6,8 @@
#define CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_
#pragma once
-#include "base/ref_counted.h"
-#include "chrome/browser/views/info_bubble.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-
-class Browser;
-class Extension;
-class InstalledBubbleContent;
-class SkBitmap;
-
-// Provides feedback to the user upon successful installation of an
-// extension. Depending on the type of extension, the InfoBubble will
-// point to:
-// BROWSER_ACTION -> The browserAction icon in the toolbar.
-// PAGE_ACTION -> A preview of the pageAction icon in the location
-// bar which is shown while the InfoBubble is shown.
-// GENERIC -> The wrench menu. This case includes pageActions that
-// don't specify a default icon.
-//
-// ExtensionInstallBubble manages its own lifetime.
-class ExtensionInstalledBubble
- : public InfoBubbleDelegate,
- public NotificationObserver,
- public base::RefCountedThreadSafe<ExtensionInstalledBubble> {
- public:
- // The behavior and content of this InfoBubble comes in these varieties:
- enum BubbleType {
- BROWSER_ACTION,
- PAGE_ACTION,
- EXTENSION_APP,
- 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<ExtensionInstalledBubble>;
-
- // Private ctor. Registers a listener for EXTENSION_LOADED.
- ExtensionInstalledBubble(const Extension* extension, Browser *browser,
- SkBitmap icon);
-
- ~ExtensionInstalledBubble() {}
-
- // 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(InfoBubble* info_bubble,
- bool closed_by_escape);
- virtual bool CloseOnEscape() { return true; }
- virtual bool FadeInOnShow() { return true; }
-
- const Extension* extension_;
- Browser* browser_;
- SkBitmap icon_;
- NotificationRegistrar registrar_;
- InstalledBubbleContent* bubble_content_;
- BubbleType type_;
-
- // How many times we've deferred due to animations being in progress.
- int animation_wait_retries_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubble);
-};
+#include "chrome/browser/ui/views/extensions/extension_installed_bubble.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_
+
diff --git a/chrome/browser/views/extensions/extension_popup.h b/chrome/browser/views/extensions/extension_popup.h
index 9d656be..6bfa6f6 100644
--- a/chrome/browser/views/extensions/extension_popup.h
+++ b/chrome/browser/views/extensions/extension_popup.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,219 +6,8 @@
#define CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_
#pragma once
-#include "chrome/browser/extensions/extension_host.h"
-#include "chrome/browser/views/browser_bubble.h"
-#include "chrome/browser/views/extensions/extension_view.h"
-#include "chrome/browser/views/bubble_border.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "gfx/native_widget_types.h"
-#include "googleurl/src/gurl.h"
-
-
-class Browser;
-class ExtensionHost;
-class Profile;
-
-namespace views {
-class Widget;
-}
-
-class ExtensionPopup : public BrowserBubble,
- public BrowserBubble::Delegate,
- public NotificationObserver,
- public ExtensionView::Container {
- public:
- // Observer to ExtensionPopup events.
- class Observer {
- public:
- // Called when the ExtensionPopup is closing. Note that it
- // is ref-counted, and thus will be released shortly after
- // making this delegate call.
- virtual void ExtensionPopupIsClosing(ExtensionPopup* popup) {}
-
- // Called after the ExtensionPopup has been closed and deleted.
- // |popup_token| is the address of the deleted ExtensionPopup.
- virtual void ExtensionPopupClosed(void* popup_token) {}
-
- // Called when the ExtensionHost is first created for the pop-up view.
- // Note that this is invoked BEFORE the ExtensionPopup is created, and can
- // be used to provide extra configuration of the host before it is pushed
- // into the popup. An example use is for automation resource routing in
- // Chrome-Frame. See extension_popup_api.cc.
- virtual void ExtensionHostCreated(ExtensionHost* host) {}
-
- // Called when the ExtensionPopup is resized. Note that the popup may have
- // an empty bounds, if a popup is repositioned before the hosted content
- // has loaded.
- virtual void ExtensionPopupResized(ExtensionPopup* popup) {}
- };
-
- enum PopupChrome {
- BUBBLE_CHROME,
- RECTANGLE_CHROME
- };
-
- virtual ~ExtensionPopup();
-
- // Create and show a popup with |url| positioned adjacent to |relative_to| in
- // screen coordinates.
- // |browser| is the browser to which the pop-up will be attached. NULL is a
- // valid parameter for pop-ups not associated with a browser.
- // |profile| is the user profile instance associated with the popup. A
- // non NULL value must be given.
- // |frame_window| is the native window that hosts the view inside which the
- // popup will be anchored.
- // The positioning of the pop-up is determined by |arrow_location| according
- // to the following logic: The popup is anchored so that the corner indicated
- // by value of |arrow_location| remains fixed during popup resizes.
- // If |arrow_location| is BOTTOM_*, then the popup 'pops up', otherwise
- // the popup 'drops down'.
- // Pass |activate_on_show| as true to activate the popup window.
- // Pass |inspect_with_devtools| as true to pin the popup open and show the
- // devtools window for it.
- // The |chrome| argument controls the chrome that surrounds the pop-up.
- // Passing BUBBLE_CHROME will give the pop-up a bubble-like appearance,
- // including the arrow mentioned above. Passing RECTANGLE_CHROME will give
- // the popup a rectangular, black border with a drop-shadow with no arrow.
- // The positioning of the popup is still governed by the arrow-location
- // parameter.
- //
- // The actual display of the popup is delayed until the page contents
- // finish loading in order to minimize UI flashing and resizing.
- static ExtensionPopup* Show(const GURL& url, Browser* browser,
- Profile* profile,
- gfx::NativeWindow frame_window,
- const gfx::Rect& relative_to,
- BubbleBorder::ArrowLocation arrow_location,
- bool activate_on_show,
- bool inspect_with_devtools,
- PopupChrome chrome,
- Observer* observer);
-
- // Closes the ExtensionPopup (this will cause the delegate
- // ExtensionPopupIsClosing and ExtensionPopupClosed to fire.
- void Close();
-
- // Some clients wish to do their own custom focus change management. If this
- // is set to false, then the ExtensionPopup will not do anything in response
- // to the BubbleLostFocus() calls it gets from the BrowserBubble.
- void set_close_on_lost_focus(bool close_on_lost_focus) {
- close_on_lost_focus_ = close_on_lost_focus;
- }
-
- ExtensionHost* host() const { return extension_host_.get(); }
-
- // Assigns the arrow location of the popup view, and updates the popup
- // border widget, if necessary.
- void SetArrowPosition(BubbleBorder::ArrowLocation arrow_location);
- BubbleBorder::ArrowLocation arrow_position() const {
- return anchor_position_;
- }
-
- // Gives the desired bounds (in screen coordinates) given the rect to point
- // to and the size of the contained contents. Includes all of the
- // border-chrome surrounding the pop-up as well.
- gfx::Rect GetOuterBounds() const;
-
- // BrowserBubble overrides.
- virtual void Hide();
- virtual void Show(bool activate);
- virtual void ResizeToView();
-
- // BrowserBubble::Delegate methods.
- virtual void BubbleBrowserWindowMoved(BrowserBubble* bubble);
- virtual void BubbleBrowserWindowClosing(BrowserBubble* bubble);
- virtual void BubbleGotFocus(BrowserBubble* bubble);
- virtual void BubbleLostFocus(BrowserBubble* bubble,
- bool lost_focus_to_child);
-
- // NotificationObserver overrides.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // ExtensionView::Container overrides.
- virtual void OnExtensionMouseMove(ExtensionView* view) { }
- virtual void OnExtensionMouseLeave(ExtensionView* view) { }
- virtual void OnExtensionPreferredSizeChanged(ExtensionView* view);
-
- // Export the refrence-counted interface required for use as template
- // arguments for RefCounted. ExtensionPopup does not inherit from RefCounted
- // because it must override the behaviour of Release.
- void AddRef() { instance_lifetime_->AddRef(); }
- static bool ImplementsThreadSafeReferenceCounting() {
- return InternalRefCounter::ImplementsThreadSafeReferenceCounting();
- }
-
- // Implements the standard RefCounted<T>::Release behaviour, except
- // signals Observer::ExtensionPopupClosed after final release.
- void Release();
-
- // The min/max height of popups.
- static const int kMinWidth;
- static const int kMinHeight;
- static const int kMaxWidth;
- static const int kMaxHeight;
-
- private:
- ExtensionPopup(ExtensionHost* host,
- views::Widget* frame,
- const gfx::Rect& relative_to,
- BubbleBorder::ArrowLocation arrow_location,
- bool activate_on_show,
- bool inspect_with_devtools,
- PopupChrome chrome,
- Observer* observer);
-
- // The area on the screen that the popup should be positioned relative to.
- gfx::Rect relative_to_;
-
- // The contained host for the view.
- scoped_ptr<ExtensionHost> extension_host_;
-
- // Flag used to indicate if the pop-up should be activated upon first display.
- bool activate_on_show_;
-
- // Flag used to indicate if the pop-up should open a devtools window once
- // it is shown inspecting it.
- bool inspect_with_devtools_;
-
- // If false, ignore BrowserBubble::Delegate::BubbleLostFocus() calls.
- bool close_on_lost_focus_;
-
- // Whether the ExtensionPopup is current going about closing itself.
- bool closing_;
-
- NotificationRegistrar registrar_;
-
- // A separate widget and associated pieces to draw a border behind the
- // popup. This has to be a separate window in order to support transparency.
- // Layered windows can't contain native child windows, so we wouldn't be
- // able to have the ExtensionView child.
- views::Widget* border_widget_;
- BubbleBorder* border_;
- views::View* border_view_;
-
- // The type of chrome associated with the popup window.
- PopupChrome popup_chrome_;
-
- // The observer of this popup.
- Observer* observer_;
-
- // A cached copy of the arrow-position for the bubble chrome.
- // If a black-border was requested, we still need this value to determine
- // the position of the pop-up in relation to |relative_to_|.
- BubbleBorder::ArrowLocation anchor_position_;
-
- // ExtensionPopup's lifetime is managed via reference counting, but it does
- // not expose the RefCounted interface. Instead, the lifetime is tied to
- // this member variable.
- class InternalRefCounter : public base::RefCounted<InternalRefCounter> {
- };
- InternalRefCounter* instance_lifetime_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionPopup);
-};
+#include "chrome/browser/ui/views/extensions/extension_popup.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_
+
diff --git a/chrome/browser/views/extensions/extension_view.h b/chrome/browser/views/extensions/extension_view.h
index 037c2e8e..f7b4e8d 100644
--- a/chrome/browser/views/extensions/extension_view.h
+++ b/chrome/browser/views/extensions/extension_view.h
@@ -6,107 +6,8 @@
#define CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_VIEW_H_
#pragma once
-#include "build/build_config.h"
-
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "views/controls/native/native_view_host.h"
-
-class Browser;
-class Extension;
-class ExtensionHost;
-class ExtensionView;
-class RenderViewHost;
-
-// This handles the display portion of an ExtensionHost.
-class ExtensionView : public views::NativeViewHost {
- public:
- ExtensionView(ExtensionHost* host, Browser* browser);
- ~ExtensionView();
-
- // A class that represents the container that this view is in.
- // (bottom shelf, side bar, etc.)
- class Container {
- public:
- virtual ~Container() {}
- // Mouse event notifications from the view. (useful for hover UI).
- virtual void OnExtensionMouseMove(ExtensionView* view) = 0;
- virtual void OnExtensionMouseLeave(ExtensionView* view) = 0;
- virtual void OnExtensionPreferredSizeChanged(ExtensionView* view) {}
- };
-
- ExtensionHost* host() const { return host_; }
- Browser* browser() const { return browser_; }
- const Extension* extension() const;
- RenderViewHost* render_view_host() const;
- void DidStopLoading();
- void SetIsClipped(bool is_clipped);
-
- // Notification from ExtensionHost.
- void UpdatePreferredSize(const gfx::Size& new_size);
- void HandleMouseMove();
- void HandleMouseLeave();
-
- // Method for the ExtensionHost to notify us when the RenderViewHost has a
- // connection.
- void RenderViewCreated();
-
- // Set a custom background for the view. The background will be tiled.
- void SetBackground(const SkBitmap& background);
-
- // Sets the container for this view.
- void SetContainer(Container* container) { container_ = container; }
-
- // Overridden from views::NativeViewHost:
- virtual void SetVisible(bool is_visible);
- virtual void DidChangeBounds(const gfx::Rect& previous,
- const gfx::Rect& current);
- virtual void ViewHierarchyChanged(bool is_add,
- views::View *parent, views::View *child);
-
- protected:
- // Overridden from views::View.
- virtual void PreferredSizeChanged();
- virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e);
-
- private:
- friend class ExtensionHost;
-
- // Initializes the RenderWidgetHostView for this object.
- void CreateWidgetHostView();
-
- // We wait to show the ExtensionView until several things have loaded.
- void ShowIfCompletelyLoaded();
-
- // Restore object to initial state. Called on shutdown or after a renderer
- // crash.
- void CleanUp();
-
- // The running extension instance that we're displaying.
- // Note that host_ owns view
- ExtensionHost* host_;
-
- // The browser window that this view is in.
- Browser* browser_;
-
- // True if we've been initialized.
- bool initialized_;
-
- // 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_;
-
- // What we should set the preferred width to once the ExtensionView has
- // loaded.
- gfx::Size pending_preferred_size_;
-
- // The container this view is in (not necessarily its direct superview).
- // Note: the view does not own its container.
- Container* container_;
-
- // Whether this extension view is clipped.
- bool is_clipped_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionView);
-};
+#include "chrome/browser/ui/views/extensions/extension_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_VIEW_H_
+
diff --git a/chrome/browser/views/external_protocol_dialog.h b/chrome/browser/views/external_protocol_dialog.h
index 3932f58..9925dd4 100644
--- a/chrome/browser/views/external_protocol_dialog.h
+++ b/chrome/browser/views/external_protocol_dialog.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,54 +6,8 @@
#define CHROME_BROWSER_VIEWS_EXTERNAL_PROTOCOL_DIALOG_H_
#pragma once
-#include "base/time.h"
-#include "googleurl/src/gurl.h"
-#include "views/window/dialog_delegate.h"
-
-class MessageBoxView;
-class TabContents;
-
-class ExternalProtocolDialog : public views::DialogDelegate {
- public:
- // RunExternalProtocolDialog calls this private constructor.
- ExternalProtocolDialog(TabContents* tab_contents,
- const GURL& url,
- const std::wstring& command);
-
- // Returns the path of the application to be launched given the protocol
- // of the requested url. Returns an empty string on failure.
- static std::wstring GetApplicationForProtocol(const GURL& url);
-
- virtual ~ExternalProtocolDialog();
-
- // views::DialogDelegate Methods:
- virtual int GetDefaultDialogButton() const;
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual std::wstring GetWindowTitle() const;
- virtual void DeleteDelegate();
- virtual bool Cancel();
- virtual bool Accept();
- virtual views::View* GetContentsView();
-
- // views::WindowDelegate Methods:
- virtual bool IsAlwaysOnTop() const { return false; }
- virtual bool IsModal() const { return false; }
-
- private:
- // The message box view whose commands we handle.
- MessageBoxView* message_box_view_;
-
- // The associated TabContents.
- TabContents* tab_contents_;
-
- // URL of the external protocol request.
- GURL url_;
-
- // The time at which this dialog was created.
- base::TimeTicks creation_time_;
-
- DISALLOW_COPY_AND_ASSIGN(ExternalProtocolDialog);
-};
+#include "chrome/browser/ui/views/external_protocol_dialog.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_EXTERNAL_PROTOCOL_DIALOG_H_
+
diff --git a/chrome/browser/views/find_bar_host.h b/chrome/browser/views/find_bar_host.h
index d675b3c8..4e34679 100644
--- a/chrome/browser/views/find_bar_host.h
+++ b/chrome/browser/views/find_bar_host.h
@@ -6,125 +6,8 @@
#define CHROME_BROWSER_VIEWS_FIND_BAR_HOST_H_
#pragma once
-#include "chrome/browser/find_bar.h"
-#include "chrome/browser/renderer_host/render_view_host_delegate.h"
-#include "chrome/browser/views/dropdown_bar_host.h"
-#include "gfx/native_widget_types.h"
-#include "gfx/rect.h"
-#include "views/controls/textfield/textfield.h"
-
-class BrowserView;
-class FindBarController;
-class FindBarView;
-class FindNotificationDetails;
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// The FindBarHost implements the container widget for the
-// find-in-page functionality. It uses the appropriate implementation from
-// find_bar_host_win.cc or find_bar_host_gtk.cc to draw its content and is
-// responsible for showing, hiding, closing, and moving the widget if needed,
-// for example if the widget is obscuring the selection results. It also
-// receives notifications about the search results and communicates that to
-// the view.
-//
-// There is one FindBarHost per BrowserView, and its state is updated
-// whenever the selected Tab is changed. The FindBarHost is created when
-// the BrowserView is attached to the frame's Widget for the first time.
-//
-////////////////////////////////////////////////////////////////////////////////
-class FindBarHost : public DropdownBarHost,
- public FindBar,
- public FindBarTesting {
- public:
- explicit FindBarHost(BrowserView* browser_view);
- virtual ~FindBarHost();
-
- // Forwards selected keystrokes to the renderer. This is useful to make sure
- // that arrow keys and PageUp and PageDown result in scrolling, instead of
- // being eaten because the FindBar has focus. Returns true if the keystroke
- // was forwarded, false if not.
- bool MaybeForwardKeystrokeToWebpage(
- const views::Textfield::Keystroke& key_stroke);
-
- // FindBar implementation:
- 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();
-
- // Overridden from views::AcceleratorTarget in DropdownBarHost class:
- virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
-
- // FindBarTesting implementation:
- virtual bool GetFindBarWindowInfo(gfx::Point* position,
- bool* fully_visible);
- virtual string16 GetFindText();
-
- // Overridden from DropdownBarHost:
- // Returns the rectangle representing where to position the find bar. It uses
- // GetDialogBounds and positions itself within that, either to the left (if an
- // InfoBar is present) or to the right (no InfoBar). 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.
- virtual gfx::Rect GetDialogPosition(gfx::Rect avoid_overlapping_rect);
- // Moves the dialog window to the provided location, moves it to top in the
- // z-order (HWND_TOP, not HWND_TOPMOST) and shows the window (if hidden).
- // It then calls UpdateWindowEdges to make sure we don't overwrite the Chrome
- // window border. If |no_redraw| is set, the window is getting moved but not
- // sized, and should not be redrawn to reduce update flicker.
- virtual void SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw);
-
- // Retrieves the boundaries that the find bar widget has to work with
- // within the Chrome frame window. The resulting rectangle will be a
- // rectangle that overlaps the bottom of the Chrome toolbar by one
- // pixel (so we can create the illusion that the dropdown widget is
- // part of the toolbar) and covers the page area, except that we
- // deflate the rect width by subtracting (from both sides) the width
- // of the toolbar and some extra pixels to account for the width of
- // the Chrome window borders. |bounds| is relative to the browser
- // window. If the function fails to determine the browser
- // window/client area rectangle or the rectangle for the page area
- // then |bounds| will be an empty rectangle.
- virtual void GetWidgetBounds(gfx::Rect* bounds);
-
- // Additional accelerator handling (on top of what DropDownBarHost does).
- virtual void RegisterAccelerators();
- virtual void UnregisterAccelerators();
-
- private:
- // Allows implementation to tweak widget position.
- void GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect);
-
- // Allows native implementation to prevent keystrokes from being forwarded.
- bool ShouldForwardKeystrokeToWebpageNative(
- const views::Textfield::Keystroke& key_stroke);
-
- // Returns the FindBarView.
- FindBarView* find_bar_view();
-
- // A pointer back to the owning controller.
- FindBarController* find_bar_controller_;
-
- DISALLOW_COPY_AND_ASSIGN(FindBarHost);
-};
+#include "chrome/browser/ui/views/find_bar_host.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_FIND_BAR_HOST_H_
+
diff --git a/chrome/browser/views/find_bar_view.h b/chrome/browser/views/find_bar_view.h
index ab119b9..bb980df 100644
--- a/chrome/browser/views/find_bar_view.h
+++ b/chrome/browser/views/find_bar_view.h
@@ -6,121 +6,8 @@
#define CHROME_BROWSER_VIEWS_FIND_BAR_VIEW_H_
#pragma once
-#include "base/string16.h"
-#include "chrome/browser/find_notification_details.h"
-#include "chrome/browser/views/dropdown_bar_view.h"
-#include "gfx/size.h"
-#include "views/controls/button/button.h"
-#include "views/controls/textfield/textfield.h"
-
-class FindBarHost;
-
-namespace views {
-class ImageButton;
-class Label;
-class MouseEvent;
-class View;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// The FindBarView is responsible for drawing the UI controls of the
-// FindBar, the find text box, the 'Find' button and the 'Close'
-// button. It communicates the user search words to the FindBarHost.
-//
-////////////////////////////////////////////////////////////////////////////////
-class FindBarView : public DropdownBarView,
- public views::ButtonListener,
- public views::Textfield::Controller {
- public:
- // A tag denoting which button the user pressed.
- enum ButtonTag {
- FIND_PREVIOUS_TAG = 0, // The Find Previous button.
- FIND_NEXT_TAG, // The Find Next button.
- CLOSE_TAG, // The Close button (the 'X').
- };
-
- explicit FindBarView(FindBarHost* host);
- virtual ~FindBarView();
-
- // Gets/sets the text displayed in the text box.
- string16 GetFindText() const;
- void SetFindText(const string16& find_text);
-
- // Updates the label inside the Find text box that shows the ordinal of the
- // active item and how many matches were found.
- void UpdateForResult(const FindNotificationDetails& result,
- const string16& find_text);
-
- // Claims focus for the text field and selects its contents.
- virtual void SetFocusAndSelection(bool select_all);
-
- // Overridden from views::View:
- virtual void Paint(gfx::Canvas* canvas);
- virtual void Layout();
- virtual gfx::Size GetPreferredSize();
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Overridden from views::Textfield::Controller:
- virtual void ContentsChanged(views::Textfield* sender,
- const string16& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& key);
-
- private:
- // Update the appearance for the match count label.
- void UpdateMatchCountAppearance(bool no_match);
-
- // Overridden from views::View.
- virtual void OnThemeChanged();
-
- // We use a hidden view to grab mouse clicks and bring focus to the find
- // text box. This is because although the find text box may look like it
- // extends all the way to the find button, it only goes as far as to the
- // match_count label. The user, however, expects being able to click anywhere
- // inside what looks like the find text box (including on or around the
- // match_count label) and have focus brought to the find box.
- class FocusForwarderView : public views::View {
- public:
- explicit FocusForwarderView(
- views::Textfield* view_to_focus_on_mousedown)
- : view_to_focus_on_mousedown_(view_to_focus_on_mousedown) {}
-
- private:
- virtual bool OnMousePressed(const views::MouseEvent& event);
-
- views::Textfield* view_to_focus_on_mousedown_;
-
- DISALLOW_COPY_AND_ASSIGN(FocusForwarderView);
- };
-
- // Returns the OS-specific view for the find bar that acts as an intermediary
- // between us and the TabContentsView.
- FindBarHost* find_bar_host() const;
-
-#if defined(OS_LINUX)
- // In gtk we get changed signals if we programatically set the text. If we
- // don't ignore them we run into problems. For example, switching tabs back
- // to one with the find bar visible will cause a search to the next found
- // text. Also if the find bar had been visible and then hidden and the user
- // switches back, found text will be highlighted again.
- bool ignore_contents_changed_;
-#endif
-
- // The controls in the window.
- views::Textfield* find_text_;
- views::Label* match_count_text_;
- FocusForwarderView* focus_forwarder_view_;
- views::ImageButton* find_previous_button_;
- views::ImageButton* find_next_button_;
- views::ImageButton* close_button_;
-
- DISALLOW_COPY_AND_ASSIGN(FindBarView);
-};
+#include "chrome/browser/ui/views/find_bar_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_FIND_BAR_VIEW_H_
+
diff --git a/chrome/browser/views/first_run_bubble.h b/chrome/browser/views/first_run_bubble.h
index 7de3969..235e004 100644
--- a/chrome/browser/views/first_run_bubble.h
+++ b/chrome/browser/views/first_run_bubble.h
@@ -6,51 +6,8 @@
#define CHROME_BROWSER_VIEWS_FIRST_RUN_BUBBLE_H_
#pragma once
-#include "base/compiler_specific.h"
-#include "base/task.h"
-#include "chrome/browser/first_run/first_run.h"
-#include "chrome/browser/views/info_bubble.h"
-
-class FirstRunBubbleViewBase;
-class Profile;
-
-class FirstRunBubble : public InfoBubble,
- public InfoBubbleDelegate {
- public:
- static FirstRunBubble* Show(Profile* profile, views::Widget* parent,
- const gfx::Rect& position_relative_to,
- BubbleBorder::ArrowLocation arrow_location,
- FirstRun::BubbleType bubble_type);
-
- private:
- FirstRunBubble();
- virtual ~FirstRunBubble();
-
- void set_view(FirstRunBubbleViewBase* view) { view_ = view; }
-
- // Re-enable the parent window.
- void EnableParent();
-
-#if defined(OS_WIN)
- // Overridden from InfoBubble:
- virtual void OnActivate(UINT action, BOOL minimized, HWND window);
-#endif
-
- // InfoBubbleDelegate.
- virtual void InfoBubbleClosing(InfoBubble* info_bubble,
- bool closed_by_escape);
- virtual bool CloseOnEscape() { return true; }
- virtual bool FadeInOnShow() { return true; }
-
- // Whether we have already been activated.
- bool has_been_activated_;
-
- ScopedRunnableMethodFactory<FirstRunBubble> enable_window_method_factory_;
-
- // The view inside the FirstRunBubble.
- FirstRunBubbleViewBase* view_;
-
- DISALLOW_COPY_AND_ASSIGN(FirstRunBubble);
-};
+#include "chrome/browser/ui/views/first_run_bubble.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_FIRST_RUN_BUBBLE_H_
+
diff --git a/chrome/browser/views/first_run_search_engine_view.h b/chrome/browser/views/first_run_search_engine_view.h
index a29a7ba..7dffda0 100644
--- a/chrome/browser/views/first_run_search_engine_view.h
+++ b/chrome/browser/views/first_run_search_engine_view.h
@@ -6,139 +6,8 @@
#define CHROME_BROWSER_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_
#pragma once
-#include <vector>
-
-#include "chrome/browser/search_engines/template_url_model_observer.h"
-#include "gfx/size.h"
-#include "views/controls/button/native_button.h"
-#include "views/view.h"
-#include "views/window/window_delegate.h"
-
-namespace views {
-class ButtonListener;
-class ImageView;
-class Label;
-class Separator;
-class Window;
-}
-
-class Profile;
-class TemplateURL;
-class TemplateURLModel;
-
-// This class holds the logo and TemplateURL for a search engine and serves
-// as its button in the search engine selection view.
-class SearchEngineChoice : public views::NativeButton {
- public:
- // |listener| is the FirstRunView that waits for the search engine selection
- // to complete; |search_engine| holds the data for the particular search
- // engine this button represents; |use_small_logos| is true if we're
- // displaying more than three choices.
- SearchEngineChoice(views::ButtonListener* listener,
- const TemplateURL* search_engine,
- bool use_small_logos);
-
- virtual ~SearchEngineChoice() {}
-
- // These methods return data about the logo or text view associated
- // with this search engine choice.
- views::View* GetView() { return choice_view_; }
- int GetChoiceViewWidth();
- int GetChoiceViewHeight();
-
- // Set the bounds for the search engine choice view; called in the
- // Layout method, when we know what the new bounds should be.
- void SetChoiceViewBounds(int x, int y, int width, int height);
-
- // Accessor for the search engine data this button represents.
- const TemplateURL* GetSearchEngine() { return search_engine_; }
-
- // Used for UX testing.
- void set_slot(int slot) { slot_ = slot; }
- int slot() const { return slot_; }
-
- private:
- // Either an ImageView of a logo, or a Label with text. Owned by
- // FirstRunSearchEngineView.
- views::View* choice_view_;
-
- // True if choice_view_ is holding an ImageView.
- bool is_image_label_;
-
- // Data for the search engine held here.
- const TemplateURL* search_engine_;
-
- // Used for UX testing. Gives slot in which search engine was shown.
- int slot_;
-
- DISALLOW_COPY_AND_ASSIGN(SearchEngineChoice);
-};
-
-// This class displays a large search engine choice dialog view during
-// initial first run import.
-class FirstRunSearchEngineView
- : public views::View,
- public views::ButtonListener,
- public views::WindowDelegate,
- public TemplateURLModelObserver {
- public:
- // |profile| allows us to get the set of imported search engines.
- // |randomize| is true if logos are to be displayed in random order.
- FirstRunSearchEngineView(Profile* profile, bool randomize);
-
- virtual ~FirstRunSearchEngineView();
-
- // Overridden from views::View:
- virtual gfx::Size GetPreferredSize();
- virtual void Layout();
- virtual AccessibilityTypes::Role GetAccessibleRole();
-
- // Overridden from views::WindowDelegate:
- virtual std::wstring GetWindowTitle() const;
- views::View* GetContentsView() { return this; }
- bool CanResize() const { return false; }
- bool CanMaximize() const { return false; }
- bool IsAlwaysOnTop() const { return true; }
- bool HasAlwaysOnTopMenu() const { return false; }
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Override from View so we can draw the gray background at dialog top.
- virtual void Paint(gfx::Canvas* canvas);
-
- // Overridden from TemplateURLModelObserver. When the search engines have
- // loaded from the profile, we can populate the logos in the dialog box
- // to present to the user.
- virtual void OnTemplateURLModelChanged();
-
- private:
- // Initializes the labels and controls in the view.
- void SetupControls();
-
- // Owned by the profile_.
- TemplateURLModel* search_engines_model_;
-
- // One for each search engine choice offered, either three or four.
- std::vector<SearchEngineChoice*> search_engine_choices_;
-
- // If logos are to be displayed in random order. Used for UX testing.
- bool randomize_;
-
- // The profile associated with this import process.
- Profile* profile_;
-
- bool text_direction_is_rtl_;
-
- // Image of browser search box with grey background and bubble arrow.
- views::ImageView* background_image_;
-
- // UI elements:
- views::Label* title_label_;
- views::Label* text_label_;
-
- DISALLOW_COPY_AND_ASSIGN(FirstRunSearchEngineView);
-};
+#include "chrome/browser/ui/views/first_run_search_engine_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_
diff --git a/chrome/browser/views/frame/app_panel_browser_frame_view.h b/chrome/browser/views/frame/app_panel_browser_frame_view.h
index eae6d9b..cc93319 100644
--- a/chrome/browser/views/frame/app_panel_browser_frame_view.h
+++ b/chrome/browser/views/frame/app_panel_browser_frame_view.h
@@ -6,125 +6,8 @@
#define CHROME_BROWSER_VIEWS_FRAME_APP_PANEL_BROWSER_FRAME_VIEW_H_
#pragma once
-#include "chrome/browser/views/frame/browser_frame.h"
-#include "chrome/browser/views/frame/browser_non_client_frame_view.h"
-#include "chrome/browser/views/tab_icon_view.h"
-#include "views/controls/button/button.h"
-#include "views/window/non_client_view.h"
-
-class BaseTabStrip;
-class BrowserView;
-class TabContents;
-namespace gfx {
-class Font;
-}
-namespace views {
-class ImageButton;
-class ImageView;
-}
-// The frame view which is used for Application Panels.
-// TODO(rafaelw): Refactor. This shares much duplicated code with
-// OpaqueBrowserFrameView.
-class AppPanelBrowserFrameView : public BrowserNonClientFrameView,
- public views::ButtonListener,
- public TabIconView::TabIconViewModel {
- public:
- // Constructs a non-client view for an BrowserFrame.
- AppPanelBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view);
- virtual ~AppPanelBrowserFrameView();
-
- // Overridden from BrowserNonClientFrameView:
- virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const;
- virtual int GetHorizontalTabStripVerticalOffset(bool restored) const;
- virtual void UpdateThrobber(bool running);
- virtual gfx::Size GetMinimumSize();
-
- protected:
- // Overridden from views::NonClientFrameView:
- virtual gfx::Rect GetBoundsForClientView() const;
- virtual bool AlwaysUseCustomFrame() const;
- virtual bool AlwaysUseNativeFrame() const;
- virtual gfx::Rect GetWindowBoundsForClientBounds(
- const gfx::Rect& client_bounds) const;
- virtual int NonClientHitTest(const gfx::Point& point);
- virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask);
- virtual void EnableClose(bool enable);
- virtual void ResetWindowControls();
-
- // Overridden from views::View:
- virtual void Paint(gfx::Canvas* canvas);
- virtual void Layout();
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Overridden from TabIconView::TabIconViewModel:
- virtual bool ShouldTabIconViewAnimate() const;
- virtual SkBitmap GetFavIconForTabIconView();
-
- private:
- // Returns the thickness of the border that makes up the window frame edges.
- // This does not include any client edge.
- int FrameBorderThickness() const;
-
- // Returns the thickness of the entire nonclient left, right, and bottom
- // borders, including both the window frame and any client edge.
- int NonClientBorderThickness() const;
-
- // Returns the height of the entire nonclient top border, including the window
- // frame, any title area, and any connected client edge.
- int NonClientTopBorderHeight() const;
-
- // Returns the thickness of the nonclient portion of the 3D edge along the
- // bottom of the titlebar.
- int TitlebarBottomThickness() const;
-
- // Returns the size of the titlebar icon.
- int IconSize() const;
-
- // Returns the bounds of the titlebar icon.
- gfx::Rect IconBounds() const;
-
- // Paint various sub-components of this view. The *FrameBorder() function
- // also paints the background of the titlebar area, since the top frame border
- // and titlebar background are a contiguous component.
- void PaintRestoredFrameBorder(gfx::Canvas* canvas);
- void PaintMaximizedFrameBorder(gfx::Canvas* canvas);
- void PaintTitleBar(gfx::Canvas* canvas);
- void PaintRestoredClientEdge(gfx::Canvas* canvas);
-
- // Layout various sub-components of this view.
- void LayoutWindowControls();
- void LayoutTitleBar();
-
- // Returns the bounds of the client area for the specified view size.
- gfx::Rect CalculateClientAreaBounds(int width, int height) const;
-
- // The layout rect of the title, if visible.
- gfx::Rect title_bounds_;
-
- // Window controls.
- views::ImageButton* close_button_;
-
- // The Window icon.
- TabIconView* window_icon_;
-
- // The frame that hosts this view.
- BrowserFrame* frame_;
-
- // The BrowserView hosted within this View.
- BrowserView* browser_view_;
-
- // The bounds of the ClientView.
- gfx::Rect client_view_bounds_;
-
- // The accessible name of this view.
- std::wstring accessible_name_;
-
- static void InitAppWindowResources();
- static gfx::Font* title_font_;
-
- DISALLOW_COPY_AND_ASSIGN(AppPanelBrowserFrameView);
-};
+#include "chrome/browser/ui/views/frame/app_panel_browser_frame_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_FRAME_APP_PANEL_BROWSER_FRAME_VIEW_H_
+
diff --git a/chrome/browser/views/frame/browser_bubble_host.h b/chrome/browser/views/frame/browser_bubble_host.h
index 99b8058..f903d99 100644
--- a/chrome/browser/views/frame/browser_bubble_host.h
+++ b/chrome/browser/views/frame/browser_bubble_host.h
@@ -6,38 +6,8 @@
#define CHROME_BROWSER_VIEWS_FRAME_BROWSER_BUBBLE_HOST_H_
#pragma once
-#include <set>
-
-#include "base/basictypes.h"
-
-class BrowserBubble;
-
-// A class providing a hosting environment for BrowserBubble instances.
-// Allows for notification to attached BrowserBubbles of browser move, and
-// close events.
-class BrowserBubbleHost {
- public:
- BrowserBubbleHost() {}
-
- // Invoked when the window containing the attached browser-bubbles is moved.
- // Calls BrowserBubble::BrowserWindowMoved on all attached bubbles.
- void WindowMoved();
-
- // To be called when the frame containing the BrowserBubbleHost is closing.
- // Calls BrowserBubble::BrowserWindowClosing on all attached bubbles.
- void Close();
-
- // Registers/Unregisters |bubble| to receive notifications when the host moves
- // or is closed.
- void AttachBrowserBubble(BrowserBubble* bubble);
- void DetachBrowserBubble(BrowserBubble* bubble);
-
- private:
- // The set of bubbles associated with this host.
- typedef std::set<BrowserBubble*> BubbleSet;
- BubbleSet browser_bubbles_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserBubbleHost);
-};
+#include "chrome/browser/ui/views/frame/browser_bubble_host.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_BUBBLE_HOST_H_
+
diff --git a/chrome/browser/views/frame/browser_frame.h b/chrome/browser/views/frame/browser_frame.h
index 0e3b9b2..eaf9fe6 100644
--- a/chrome/browser/views/frame/browser_frame.h
+++ b/chrome/browser/views/frame/browser_frame.h
@@ -6,75 +6,8 @@
#define CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_H_
#pragma once
-#include "build/build_config.h"
-#include "views/window/non_client_view.h"
-
-class BaseTabStrip;
-class BrowserView;
-class Profile;
-class ThemeProvider;
-
-namespace gfx {
-class Font;
-class Rect;
-} // namespace gfx
-
-namespace views {
-class Window;
-
-#if defined(OS_WIN)
-class WindowWin;
-#endif
-} // namespace views
-
-// This is a virtual interface that allows system specific browser frames.
-class BrowserFrame {
- public:
- virtual ~BrowserFrame() {}
-
- // Creates the appropriate BrowserFrame for this platform. The returned
- // object is owned by the caller.
- static BrowserFrame* Create(BrowserView* browser_view, Profile* profile);
-
- static const gfx::Font& GetTitleFont();
-
- // Returns the Window associated with this frame. Guraranteed non-NULL after
- // construction.
- virtual views::Window* GetWindow() = 0;
-
- // Determine the distance of the left edge of the minimize button from the
- // left edge of the window. Used in our Non-Client View's Layout.
- virtual int GetMinimizeButtonOffset() const = 0;
-
- // Retrieves the bounds, in non-client view coordinates for the specified
- // TabStrip.
- virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const = 0;
-
- // Returns the y coordinate within the window at which the horizontal TabStrip
- // begins (or would begin). If |restored| is true, this is calculated as if
- // we were in restored mode regardless of the current mode.
- virtual int GetHorizontalTabStripVerticalOffset(bool restored) const = 0;
-
- // Tells the frame to update the throbber.
- virtual void UpdateThrobber(bool running) = 0;
-
- // Tells the frame to continue a drag detached tab operation.
- virtual void ContinueDraggingDetachedTab() = 0;
-
- // Returns the theme provider for this frame.
- virtual ThemeProvider* GetThemeProviderForFrame() const = 0;
-
- // Returns true if the window should use the native frame view. This is true
- // if there are no themes applied on Vista, or if there are themes applied and
- // this browser window is an app or popup.
- virtual bool AlwaysUseNativeFrame() const = 0;
-
- // Returns the NonClientFrameView of this frame.
- virtual views::View* GetFrameView() const = 0;
-
- // Notifies the frame that the tab strip display mode changed so it can update
- // its frame treatment if necessary.
- virtual void TabStripDisplayModeChanged() = 0;
-};
+#include "chrome/browser/ui/views/frame/browser_frame.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_H_
+
diff --git a/chrome/browser/views/frame/browser_frame_gtk.h b/chrome/browser/views/frame/browser_frame_gtk.h
index 742eea5..1b8977c 100644
--- a/chrome/browser/views/frame/browser_frame_gtk.h
+++ b/chrome/browser/views/frame/browser_frame_gtk.h
@@ -6,80 +6,8 @@
#define CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_GTK_H_
#pragma once
-#include "base/basictypes.h"
-#include "chrome/browser/views/frame/browser_frame.h"
-#include "views/window/window_gtk.h"
-
-class BrowserNonClientFrameView;
-class BrowserRootView;
-
-class BrowserFrameGtk : public BrowserFrame,
- public views::WindowGtk {
- public:
- // Normally you will create this class by calling BrowserFrame::Create.
- // Init must be called before using this class, which Create will do for you.
- BrowserFrameGtk(BrowserView* browser_view, Profile* profile);
- virtual ~BrowserFrameGtk();
-
- // Creates a frame view and initializes the window. This
- // initialization function must be called after construction, it is
- // separate to avoid recursive calling of the frame from its
- // constructor.
- virtual void Init();
-
- // Overridden from BrowserFrame:
- virtual views::Window* GetWindow();
- virtual int GetMinimizeButtonOffset() const;
- virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const;
- virtual int GetHorizontalTabStripVerticalOffset(bool restored) const;
- virtual void UpdateThrobber(bool running);
- virtual void ContinueDraggingDetachedTab();
- virtual ThemeProvider* GetThemeProviderForFrame() const;
- virtual bool AlwaysUseNativeFrame() const;
- virtual views::View* GetFrameView() const;
- virtual void TabStripDisplayModeChanged();
-
- // Overridden from views::Widget:
- virtual ThemeProvider* GetThemeProvider() const;
- virtual ThemeProvider* GetDefaultThemeProvider() const;
- virtual void IsActiveChanged();
- virtual void SetInitialFocus();
-
- protected:
- void set_browser_frame_view(BrowserNonClientFrameView* browser_frame_view) {
- browser_frame_view_ = browser_frame_view;
- }
-
- // Overridden from views::WidgetGtk:
- virtual views::RootView* CreateRootView();
- virtual bool GetAccelerator(int cmd_id, menus::Accelerator* accelerator);
-
- // Overriden from views::WindowGtk:
- virtual gboolean OnWindowStateEvent(GtkWidget* widget,
- GdkEventWindowState* event);
- virtual gboolean OnConfigureEvent(GtkWidget* widget,
- GdkEventConfigure* event);
-
- protected:
- BrowserView* browser_view() const {
- return browser_view_;
- }
-
- private:
- // The BrowserView is our ClientView. This is a pointer to it.
- BrowserView* browser_view_;
-
- // A pointer to our NonClientFrameView as a BrowserNonClientFrameView.
- BrowserNonClientFrameView* browser_frame_view_;
-
- // An unowning reference to the root view associated with the window. We save
- // a copy as a BrowserRootView to avoid evil casting later, when we need to
- // call functions that only exist on BrowserRootView (versus RootView).
- BrowserRootView* root_view_;
-
- Profile* profile_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserFrameGtk);
-};
+#include "chrome/browser/ui/views/frame/browser_frame_gtk.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_GTK_H_
+
diff --git a/chrome/browser/views/frame/browser_frame_win.h b/chrome/browser/views/frame/browser_frame_win.h
index 1dbc4dd..b755e21 100644
--- a/chrome/browser/views/frame/browser_frame_win.h
+++ b/chrome/browser/views/frame/browser_frame_win.h
@@ -6,96 +6,8 @@
#define CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_WIN_H_
#pragma once
-#include "base/basictypes.h"
-#include "chrome/browser/views/frame/browser_frame.h"
-#include "views/window/window_win.h"
-
-class AeroGlassNonClientView;
-class BrowserNonClientFrameView;
-class BrowserRootView;
-class BrowserView;
-class NonClientFrameView;
-class Profile;
-
-///////////////////////////////////////////////////////////////////////////////
-// BrowserFrameWin
-//
-// BrowserFrame is a WindowWin subclass that provides the window frame for the
-// Chrome browser window.
-//
-class BrowserFrameWin : public BrowserFrame, public views::WindowWin {
- public:
- // Normally you will create this class by calling BrowserFrame::Create.
- // Init must be called before using this class, which Create will do for you.
- BrowserFrameWin(BrowserView* browser_view, Profile* profile);
- virtual ~BrowserFrameWin();
-
- // This initialization function must be called after construction, it is
- // separate to avoid recursive calling of the frame from its constructor.
- void Init();
-
- BrowserView* browser_view() const { return browser_view_; }
-
- // BrowserFrame implementation.
- virtual views::Window* GetWindow();
- virtual int GetMinimizeButtonOffset() const;
- virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const;
- virtual int GetHorizontalTabStripVerticalOffset(bool restored) const;
- virtual void UpdateThrobber(bool running);
- virtual void ContinueDraggingDetachedTab();
- virtual ThemeProvider* GetThemeProviderForFrame() const;
- virtual bool AlwaysUseNativeFrame() const;
- virtual views::View* GetFrameView() const;
- virtual void TabStripDisplayModeChanged();
-
- protected:
- // Overridden from views::WindowWin:
- virtual gfx::Insets GetClientAreaInsets() const;
- virtual bool GetAccelerator(int cmd_id, menus::Accelerator* accelerator);
- virtual void OnEndSession(BOOL ending, UINT logoff);
- virtual void OnEnterSizeMove();
- virtual void OnExitSizeMove();
- virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu);
- virtual LRESULT OnMouseActivate(HWND window,
- UINT hittest_code,
- UINT message);
- virtual void OnMove(const CPoint& point);
- virtual void OnMoving(UINT param, LPRECT new_bounds);
- virtual LRESULT OnNCActivate(BOOL active);
- virtual LRESULT OnNCHitTest(const CPoint& pt);
- virtual void OnWindowPosChanged(WINDOWPOS* window_pos);
- virtual ThemeProvider* GetThemeProvider() const;
- virtual ThemeProvider* GetDefaultThemeProvider() const;
- virtual void OnScreenReaderDetected();
-
- // Overridden from views::Window:
- virtual int GetShowState() const;
- virtual void Activate();
- virtual bool IsAppWindow() const { return true; }
- virtual views::NonClientFrameView* CreateFrameViewForWindow();
- virtual void UpdateFrameAfterFrameChange();
- virtual views::RootView* CreateRootView();
-
- private:
- // Updates the DWM with the frame bounds.
- void UpdateDWMFrame();
-
- // The BrowserView is our ClientView. This is a pointer to it.
- BrowserView* browser_view_;
-
- // A pointer to our NonClientFrameView as a BrowserNonClientFrameView.
- BrowserNonClientFrameView* browser_frame_view_;
-
- // An unowning reference to the root view associated with the window. We save
- // a copy as a BrowserRootView to avoid evil casting later, when we need to
- // call functions that only exist on BrowserRootView (versus RootView).
- BrowserRootView* root_view_;
-
- bool frame_initialized_;
-
- Profile* profile_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserFrameWin);
-};
+#include "chrome/browser/ui/views/frame/browser_frame_win.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_WIN_H_
+
diff --git a/chrome/browser/views/frame/browser_non_client_frame_view.h b/chrome/browser/views/frame/browser_non_client_frame_view.h
index ba8ba40..38b6cfd 100644
--- a/chrome/browser/views/frame/browser_non_client_frame_view.h
+++ b/chrome/browser/views/frame/browser_non_client_frame_view.h
@@ -6,28 +6,8 @@
#define CHROME_BROWSER_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_
#pragma once
-#include "views/window/non_client_view.h"
-
-class BaseTabStrip;
-
-// A specialization of the NonClientFrameView object that provides additional
-// Browser-specific methods.
-class BrowserNonClientFrameView : public views::NonClientFrameView {
- public:
- BrowserNonClientFrameView() : NonClientFrameView() {}
- virtual ~BrowserNonClientFrameView() {}
-
- // Returns the bounds within which the TabStrip should be laid out.
- virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const = 0;
-
- // Returns the y coordinate within the window at which the horizontal TabStrip
- // begins, or (in vertical tabs mode) would begin. If |restored| is true,
- // this is calculated as if we were in restored mode regardless of the current
- // mode. This is used to correctly align theme images.
- virtual int GetHorizontalTabStripVerticalOffset(bool restored) const = 0;
-
- // Updates the throbber.
- virtual void UpdateThrobber(bool running) = 0;
-};
+#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_
+
diff --git a/chrome/browser/views/frame/browser_root_view.h b/chrome/browser/views/frame/browser_root_view.h
index 4ae382a..bf129da 100644
--- a/chrome/browser/views/frame/browser_root_view.h
+++ b/chrome/browser/views/frame/browser_root_view.h
@@ -1,63 +1,13 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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_VIEWS_FRAME_BROWSER_ROOT_VIEW_H_
-#define CHROME_BROWSER_VIEWS_FRAME_BROWSER_ROOT_VIEW_H_
+#ifndef CHROME_BROWSER_VIEWS_FRAME_POPUP_BROWSER_ROOT_VIEW_H_
+#define CHROME_BROWSER_VIEWS_FRAME_POPUP_BROWSER_ROOT_VIEW_H_
#pragma once
-#include "views/widget/root_view.h"
+#include "chrome/browser/ui/views/frame/browser_root_view.h"
+// TODO(beng): remove this file once all includes have been updated.
-class BrowserView;
-class OSExchangeData;
-class BaseTabStrip;
+#endif // CHROME_BROWSER_VIEWS_FRAME_POPUP_BROWSER_ROOT_VIEW_H_
-// RootView implementation used by BrowserFrame. This forwards drop events to
-// the TabStrip. Visually the tabstrip extends to the top of the frame, but in
-// actually it doesn't. The tabstrip is only as high as a tab. To enable
-// dropping above the tabstrip BrowserRootView forwards drop events to the
-// TabStrip.
-class BrowserRootView : public views::RootView {
- public:
- // You must call set_tabstrip before this class will accept drops.
- BrowserRootView(BrowserView* browser_view, views::Widget* widget);
-
- virtual bool GetDropFormats(
- int* formats,
- std::set<OSExchangeData::CustomFormat>* custom_formats);
- virtual bool AreDropTypesRequired();
- virtual bool CanDrop(const OSExchangeData& data);
- virtual void OnDragEntered(const views::DropTargetEvent& event);
- virtual int OnDragUpdated(const views::DropTargetEvent& event);
- virtual void OnDragExited();
- virtual int OnPerformDrop(const views::DropTargetEvent& event);
-
- private:
- // Returns true if the event should be forwarded to the tabstrip.
- bool ShouldForwardToTabStrip(const views::DropTargetEvent& event);
-
- // Converts the event from the hosts coordinate system to the tabstrips
- // coordinate system.
- views::DropTargetEvent* MapEventToTabStrip(
- const views::DropTargetEvent& event,
- const OSExchangeData& data);
-
- inline BaseTabStrip* tabstrip() const;
-
- // Returns true if |data| has string contents and the user can "paste and go".
- // If |url| is non-NULL and the user can "paste and go", |url| is set to the
- // desired destination.
- bool GetPasteAndGoURL(const OSExchangeData& data, GURL* url);
-
- // The BrowserView.
- BrowserView* browser_view_;
-
- // If true, drag and drop events are being forwarded to the tab strip.
- // This is used to determine when to send OnDragEntered and OnDragExited
- // to the tab strip.
- bool forwarding_to_tab_strip_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserRootView);
-};
-
-#endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_ROOT_VIEW_H_
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index d113525..4e90f82 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -2,653 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_H_
-#define CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_H_
+#ifndef CHROME_BROWSER_VIEWS_FRAME_POPUP_BROWSER_VIEW_H_
+#define CHROME_BROWSER_VIEWS_FRAME_POPUP_BROWSER_VIEW_H_
#pragma once
-#include <map>
-#include <string>
-#include <vector>
+#include "chrome/browser/ui/views/frame/browser_view.h"
+// TODO(beng): remove this file once all includes have been updated.
-#include "app/menus/simple_menu_model.h"
-#include "base/scoped_ptr.h"
-#include "base/timer.h"
-#include "build/build_config.h"
-#include "chrome/browser/browser.h"
-#include "chrome/browser/browser_window.h"
-#include "chrome/browser/tabs/tab_strip_model_observer.h"
-#include "chrome/browser/views/frame/browser_bubble_host.h"
-#include "chrome/browser/views/frame/browser_frame.h"
-#include "chrome/browser/views/infobars/infobar_container.h"
-#include "chrome/browser/views/tabs/tab_strip.h"
-#include "chrome/browser/views/tabs/base_tab_strip.h"
-#include "chrome/browser/views/unhandled_keyboard_event_handler.h"
-#include "chrome/common/notification_registrar.h"
-#include "gfx/native_widget_types.h"
-#include "views/window/client_view.h"
-#include "views/window/window_delegate.h"
+#endif // CHROME_BROWSER_VIEWS_FRAME_POPUP_BROWSER_VIEW_H_
-#if defined(OS_WIN)
-#include "chrome/browser/hang_monitor/hung_plugin_action.h"
-#include "chrome/browser/hang_monitor/hung_window_detector.h"
-#include "views/controls/menu/native_menu_win.h"
-#endif
-
-// NOTE: For more information about the objects and files in this directory,
-// view: http://dev.chromium.org/developers/design-documents/browser-window
-
-class AccessiblePaneView;
-class AccessibleViewHelper;
-class BookmarkBarView;
-class Browser;
-class BrowserBubble;
-class BrowserViewLayout;
-class ContentsContainer;
-class DownloadShelfView;
-class EncodingMenuModel;
-class FullscreenExitBubble;
-class HtmlDialogUIDelegate;
-class InfoBarContainer;
-class LocationBarView;
-class SideTabStrip;
-class StatusBubbleViews;
-class TabContentsContainer;
-class TabStripModel;
-class ToolbarView;
-class ZoomMenuModel;
-
-#if defined(OS_WIN)
-class AeroPeekManager;
-class JumpList;
-#endif
-
-namespace views {
-class ExternalFocusTracker;
-class Menu;
-class SingleSplitView;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// BrowserView
-//
-// A ClientView subclass that provides the contents of a browser window,
-// including the TabStrip, toolbars, download shelves, the content area etc.
-//
-class BrowserView : public BrowserBubbleHost,
- public BrowserWindow,
- public BrowserWindowTesting,
- public NotificationObserver,
- public TabStripModelObserver,
- public menus::SimpleMenuModel::Delegate,
- public views::WindowDelegate,
- public views::ClientView,
- public InfoBarContainer::Delegate {
- public:
- // The browser view's class name.
- static const char kViewClassName[];
-
- // Explicitly sets how windows are shown. Use a value of -1 to give the
- // default behavior. This is used during testing and not generally useful
- // otherwise.
- static void SetShowState(int state);
-
- explicit BrowserView(Browser* browser);
- virtual ~BrowserView();
-
- void set_frame(BrowserFrame* frame) { frame_ = frame; }
- BrowserFrame* frame() const { return frame_; }
-
- // Returns a pointer to the BrowserView* interface implementation (an
- // instance of this object, typically) for a given native window, or NULL if
- // there is no such association.
- static BrowserView* GetBrowserViewForNativeWindow(gfx::NativeWindow window);
-
- // Returns a Browser instance of this view.
- Browser* browser() const { return browser_.get(); }
-
- // Returns the show flag that should be used to show the frame containing
- // this view.
- int GetShowState() const;
-
- // Called by the frame to notify the BrowserView that it was moved, and that
- // any dependent popup windows should be repositioned.
- void WindowMoved();
-
- // Called by the frame to notify the BrowserView that a move or resize was
- // initiated.
- void WindowMoveOrResizeStarted();
-
- // Returns the apparent bounds of the toolbar, in BrowserView coordinates.
- // These differ from |toolbar_.bounds()| in that they match where the toolbar
- // background image is drawn -- slightly outside the "true" bounds
- // horizontally, and, when using vertical tabs, behind the tab column.
- gfx::Rect GetToolbarBounds() const;
-
- // Returns the bounds of the content area, in the coordinates of the
- // BrowserView's parent.
- gfx::Rect GetClientAreaBounds() const;
-
- // Returns the constraining bounding box that should be used to lay out the
- // FindBar within. This is _not_ the size of the find bar, just the bounding
- // box it should be laid out within. The coordinate system of the returned
- // rect is in the coordinate system of the frame, since the FindBar is a child
- // window.
- gfx::Rect GetFindBarBoundingBox() const;
-
- // Returns the preferred height of the TabStrip. Used to position the OTR
- // avatar icon.
- int GetTabStripHeight() const;
-
- // Takes some view's origin (relative to this BrowserView) and offsets it such
- // that it can be used as the source origin for seamlessly tiling the toolbar
- // background image over that view.
- gfx::Point OffsetPointForToolbarBackgroundImage(
- const gfx::Point& point) const;
-
- // Returns the width of the currently displayed sidebar or 0.
- int GetSidebarWidth() const;
-
- // Accessor for the TabStrip.
- BaseTabStrip* tabstrip() const { return tabstrip_; }
-
- // Accessor for the Toolbar.
- ToolbarView* toolbar() const { return toolbar_; }
-
- // Returns true if various window components are visible.
- bool IsTabStripVisible() const;
-
- // Returns true if the vertical tabstrip is in use.
- bool UseVerticalTabs() const;
-
- // Returns true if the profile associated with this Browser window is
- // off the record.
- bool IsOffTheRecord() const;
-
- // Returns true if the non-client view should render the Off-The-Record
- // avatar icon if the window is off the record.
- bool ShouldShowOffTheRecordAvatar() const;
-
- // Handle the specified |accelerator| being pressed.
- bool AcceleratorPressed(const views::Accelerator& accelerator);
-
- // Provides the containing frame with the accelerator for the specified
- // command id. This can be used to provide menu item shortcut hints etc.
- // Returns true if an accelerator was found for the specified |cmd_id|, false
- // otherwise.
- bool GetAccelerator(int cmd_id, menus::Accelerator* accelerator);
-
- // Shows the next app-modal dialog box, if there is one to be shown, or moves
- // an existing showing one to the front. Returns true if one was shown or
- // activated, false if none was shown.
- bool ActivateAppModalDialog() const;
-
- // Returns the selected TabContents. Used by our NonClientView's
- // TabIconView::TabContentsProvider implementations.
- // TODO(beng): exposing this here is a bit bogus, since it's only used to
- // determine loading state. It'd be nicer if we could change this to be
- // bool IsSelectedTabLoading() const; or something like that. We could even
- // move it to a WindowDelegate subclass.
- TabContents* GetSelectedTabContents() const;
-
- // Retrieves the icon to use in the frame to indicate an OTR window.
- SkBitmap GetOTRAvatarIcon();
-
-#if defined(OS_WIN)
- // Called right before displaying the system menu to allow the BrowserView
- // to add or delete entries.
- void PrepareToRunSystemMenu(HMENU menu);
-#endif
-
- // Returns true if the Browser object associated with this BrowserView is a
- // normal-type window (i.e. a browser window, not an app or popup).
- bool IsBrowserTypeNormal() const {
- return browser_->type() == Browser::TYPE_NORMAL;
- }
-
- // Returns true if the Browser object associated with this BrowserView is a
- // app panel window.
- bool IsBrowserTypePanel() const {
- return browser_->type() == Browser::TYPE_APP_PANEL;
- }
-
- // Returns true if the Browser object associated with this BrowserView is a
- // popup window.
- bool IsBrowserTypePopup() const {
- return (browser_->type() & Browser::TYPE_POPUP) != 0;
- }
-
- // Register preferences specific to this view.
- static void RegisterBrowserViewPrefs(PrefService* prefs);
-
- // Returns true if the specified point(BrowserView coordinates) is in
- // in the window caption area of the browser window.
- bool IsPositionInWindowCaption(const gfx::Point& point);
-
- // Returns whether the fullscreen bubble is visible or not.
- bool IsFullscreenBubbleVisible() const;
-
- // Invoked from the frame when the full screen state changes. This is only
- // used on Linux.
- void FullScreenStateChanged();
-
- // Restores the focused view. This is also used to set the initial focus
- // when a new browser window is created.
- void RestoreFocus();
-
- // Called when the activation of the frame changes.
- virtual void ActivationChanged(bool activated);
-
- // 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 LocationBar* GetLocationBar() const;
- virtual void SetFocusToLocationBar(bool select_all);
- virtual void UpdateReloadStopState(bool is_loading, bool force);
- virtual void UpdateToolbar(TabContents* contents, bool should_restore_state);
- virtual void FocusToolbar();
- virtual void FocusAppMenu();
- virtual void FocusBookmarksToolbar();
- virtual void FocusChromeOSStatus() {}
- virtual void RotatePaneFocus(bool forwards);
- virtual void DestroyBrowser();
- virtual bool IsBookmarkBarVisible() const;
- virtual bool IsBookmarkBarAnimating() const;
- virtual bool IsToolbarVisible() const;
- virtual gfx::Rect GetRootWindowResizerRect() const;
- virtual void DisableInactiveFrame();
- virtual void ConfirmSetDefaultSearchProvider(
- TabContents* tab_contents,
- TemplateURL* template_url,
- TemplateURLModel* template_url_model);
- 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 void SetDownloadShelfVisible(bool visible);
- virtual bool IsDownloadShelfVisible() const;
- virtual DownloadShelf* GetDownloadShelf();
- virtual void ShowReportBugDialog();
- 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 ContinueDraggingDetachedTab(const gfx::Rect& tab_bounds);
- virtual void UserChangedTheme();
- virtual int GetExtraRenderViewHeight() const;
- virtual void TabContentsFocused(TabContents* source);
- 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 ShowCreateShortcutsDialog(TabContents* tab_contents);
- virtual void Cut();
- virtual void Copy();
- virtual void Paste();
- virtual void ToggleTabStripMode();
- virtual void ShowInstant(TabContents* preview_contents);
- virtual void HideInstant();
- virtual gfx::Rect GetInstantBounds();
-
- // Overridden from BrowserWindowTesting:
- virtual BookmarkBarView* GetBookmarkBarView() const;
- virtual LocationBarView* GetLocationBarView() const;
- virtual views::View* GetTabContentsContainerView() const;
- virtual views::View* GetSidebarContainerView() const;
- virtual ToolbarView* GetToolbarView() const;
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Overridden from TabStripModelObserver:
- virtual void TabDetachedAt(TabContents* contents, int index);
- virtual void TabDeselectedAt(TabContents* contents, int index);
- virtual void TabSelectedAt(TabContents* old_contents,
- TabContents* new_contents,
- int index,
- bool user_gesture);
- virtual void TabReplacedAt(TabContents* old_contents,
- TabContents* new_contents,
- int index);
- virtual void TabStripEmpty();
-
- // Overridden from menus::SimpleMenuModel::Delegate:
- virtual bool IsCommandIdChecked(int command_id) const;
- virtual bool IsCommandIdEnabled(int command_id) const;
- virtual bool GetAcceleratorForCommandId(int command_id,
- menus::Accelerator* accelerator);
- virtual bool IsLabelForCommandIdDynamic(int command_id) const;
- virtual string16 GetLabelForCommandId(int command_id) const;
- virtual void ExecuteCommand(int command_id);
-
- // Overridden from views::WindowDelegate:
- virtual bool CanResize() const;
- virtual bool CanMaximize() const;
- virtual bool IsModal() const;
- virtual std::wstring GetWindowTitle() const;
- virtual std::wstring GetAccessibleWindowTitle() const;
- virtual views::View* GetInitiallyFocusedView();
- virtual bool ShouldShowWindowTitle() const;
- virtual SkBitmap GetWindowAppIcon();
- virtual SkBitmap GetWindowIcon();
- virtual bool ShouldShowWindowIcon() const;
- virtual bool ExecuteWindowsCommand(int command_id);
- virtual std::wstring GetWindowName() const;
- virtual void SaveWindowPlacement(const gfx::Rect& bounds,
- bool maximized);
- virtual bool GetSavedWindowBounds(gfx::Rect* bounds) const;
- virtual bool GetSavedMaximizedState(bool* maximized) const;
- virtual views::View* GetContentsView();
- virtual views::ClientView* CreateClientView(views::Window* window);
-
- // Overridden from views::ClientView:
- virtual bool CanClose() const;
- virtual int NonClientHitTest(const gfx::Point& point);
- virtual gfx::Size GetMinimumSize();
-
- // InfoBarContainer::Delegate overrides
- virtual void InfoBarSizeChanged(bool is_animating);
-
- protected:
- // Appends to |toolbars| a pointer to each AccessiblePaneView that
- // can be traversed using F6, in the order they should be traversed.
- // Abstracted here so that it can be extended for Chrome OS.
- virtual void GetAccessiblePanes(
- std::vector<AccessiblePaneView*>* panes);
-
- // Save the current focused view to view storage
- void SaveFocusedView();
-
- int last_focused_view_storage_id() const {
- return last_focused_view_storage_id_;
- }
-
- // Overridden from views::View:
- virtual std::string GetClassName() const;
- virtual void Layout();
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
- virtual void ChildPreferredSizeChanged(View* child);
- virtual AccessibilityTypes::Role GetAccessibleRole();
-
- // Factory Methods.
- // Returns a new LayoutManager for this browser view. A subclass may
- // override to implemnet different layout pocily.
- virtual views::LayoutManager* CreateLayoutManager() const;
-
- // Initializes a new TabStrip for the browser view. This can be performed
- // multiple times over the life of the browser, and is run when the display
- // mode for the tabstrip changes from horizontal to vertical.
- virtual void InitTabStrip(TabStripModel* tab_strip_model);
-
- // Browser window related initializations.
- virtual void Init();
-
- private:
- friend class BrowserViewLayout;
-
-#if defined(OS_WIN)
- // Creates the system menu.
- void InitSystemMenu();
-#endif
-
- // Returns the BrowserViewLayout.
- BrowserViewLayout* GetBrowserViewLayout() const;
-
- // Layout the Status Bubble.
- void LayoutStatusBubble();
-
- // Prepare to show the Bookmark Bar for the specified TabContents. Returns
- // true if the Bookmark Bar can be shown (i.e. it's supported for this
- // Browser type) and there should be a subsequent re-layout to show it.
- // |contents| can be NULL.
- bool MaybeShowBookmarkBar(TabContents* contents);
-
- // Prepare to show an Info Bar for the specified TabContents. Returns true
- // if there is an Info Bar to show and one is supported for this Browser
- // type, and there should be a subsequent re-layout to show it.
- // |contents| can be NULL.
- bool MaybeShowInfoBar(TabContents* contents);
-
- // Updates sidebar UI according to the current tab and sidebar state.
- void UpdateSidebar();
- // Displays active sidebar linked to the |tab_contents| or hides sidebar UI,
- // if there's no such sidebar.
- void UpdateSidebarForContents(TabContents* tab_contents);
-
- // Updated devtools window for given contents.
- void UpdateDevToolsForContents(TabContents* tab_contents);
-
- // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the
- // Download Shelf in response to a change notification from the specified
- // |contents|. |contents| can be NULL. In this case, all optional UI will be
- // removed.
- void UpdateUIForContents(TabContents* contents);
-
- // Updates an optional child View, e.g. Bookmarks Bar, Info Bar, Download
- // Shelf. If |*old_view| differs from new_view, the old_view is removed and
- // the new_view is added. This is intended to be used when swapping in/out
- // child views that are referenced via a field.
- // Returns true if anything was changed, and a re-Layout is now required.
- bool UpdateChildViewAndLayout(views::View* new_view, views::View** old_view);
-
- // Invoked to update the necessary things when our fullscreen state changes
- // to |fullscreen|. On Windows this is invoked immediately when we toggle the
- // full screen state. On Linux changing the fullscreen state is async, so we
- // ask the window to change it's fullscreen state, then when we get
- // notification that it succeeded this method is invoked.
- void ProcessFullscreen(bool fullscreen);
-
- // Copy the accelerator table from the app resources into something we can
- // use.
- void LoadAccelerators();
-
-#if defined(OS_WIN)
- // Builds the correct menu for when we have minimal chrome.
- void BuildSystemMenuForBrowserWindow();
- void BuildSystemMenuForAppOrPopupWindow(bool is_app);
-#endif
-
- // Retrieves the command id for the specified Windows app command.
- int GetCommandIDForAppCommandID(int app_command_id) const;
-
- // Callback for the loading animation(s) associated with this view.
- void LoadingAnimationCallback();
-
- // Initialize the hung plugin detector.
- void InitHangMonitor();
-
- // Invoked from TabSelectedAt or when instant is made active. Is
- // |change_tab_contents| is true, |new_contents| is added to the view
- // hierarchy, if |change_tab_contents| is false, it's assumed |new_contents|
- // has already been added to the view hierarchy.
- void ProcessTabSelected(TabContents* new_contents, bool change_tab_contents);
-
- // Last focused view that issued a tab traversal.
- int last_focused_view_storage_id_;
-
- // The BrowserFrame that hosts this view.
- BrowserFrame* frame_;
-
- // The Browser object we are associated with.
- scoped_ptr<Browser> browser_;
-
- // BrowserView layout (LTR one is pictured here).
- //
- // --------------------------------------------------------------------------
- // | | Tabs (1) |
- // | |--------------------------------------------------------------|
- // | | Navigation buttons, menus and the address bar (toolbar_) |
- // | |--------------------------------------------------------------|
- // | | All infobars (infobar_container_) * |
- // | |--------------------------------------------------------------|
- // | | Bookmarks (bookmark_bar_view_) * |
- // | |--------------------------------------------------------------|
- // | |Page content (contents_) || |
- // | |--------------------------------------|| Sidebar content |
- // | || contents_container_ and/or ||| (sidebar_container_) |
- // | || preview_container_ ||| |
- // | || |(3) |
- // | Tabs (2)|| ||| |
- // | || ||| |
- // | || ||| |
- // | || ||| |
- // | |--------------------------------------|| |
- // | |==(4)=========================================================|
- // | | |
- // | | |
- // | | Debugger (devtools_container_) |
- // | | |
- // | | |
- // | |--------------------------------------------------------------|
- // | | Active downloads (download_shelf_) |
- // --------------------------------------------------------------------------
- //
- // (1) - tabstrip_, default position
- // (2) - tabstrip_, position when side tabs are enabled
- // (3) - sidebar_split_
- // (4) - contents_split_
- //
- // * - The bookmark bar and info bar are swapped when on the new tab page.
- // Additionally contents_ is positioned on top of the bookmark bar when
- // the bookmark bar is detached. This is done to allow the
- // preview_container_ to appear over the bookmark bar.
-
- // Tool/Info bars that we are currently showing. Used for layout.
- // active_bookmark_bar_ is either NULL, if the bookmark bar isn't showing,
- // or is bookmark_bar_view_ if the bookmark bar is showing.
- views::View* active_bookmark_bar_;
-
- // The TabStrip.
- BaseTabStrip* tabstrip_;
-
- // The Toolbar containing the navigation buttons, menus and the address bar.
- ToolbarView* toolbar_;
-
- // The Bookmark Bar View for this window. Lazily created.
- scoped_ptr<BookmarkBarView> bookmark_bar_view_;
-
- // The download shelf view (view at the bottom of the page).
- scoped_ptr<DownloadShelfView> download_shelf_;
-
- // The InfoBarContainer that contains InfoBars for the current tab.
- InfoBarContainer* infobar_container_;
-
- // The view that contains sidebar for the current tab.
- TabContentsContainer* sidebar_container_;
-
- // Split view containing the contents container and sidebar container.
- views::SingleSplitView* sidebar_split_;
-
- // The view that contains the selected TabContents.
- TabContentsContainer* contents_container_;
-
- // The view that contains devtools window for the selected TabContents.
- TabContentsContainer* devtools_container_;
-
- // The view that contains instant's TabContents.
- TabContentsContainer* preview_container_;
-
- // The view managing both the contents_container_ and preview_container_.
- ContentsContainer* contents_;
-
- // Split view containing the contents container and devtools container.
- views::SingleSplitView* contents_split_;
-
- // Tracks and stores the last focused view which is not the
- // devtools_container_ or any of its children. Used to restore focus once
- // the devtools_container_ is hidden.
- scoped_ptr<views::ExternalFocusTracker> devtools_focus_tracker_;
-
- // The Status information bubble that appears at the bottom of the window.
- scoped_ptr<StatusBubbleViews> status_bubble_;
-
- // A mapping between accelerators and commands.
- std::map<views::Accelerator, int> accelerator_table_;
-
- // True if we have already been initialized.
- bool initialized_;
-
- // True if we should ignore requests to layout. This is set while toggling
- // fullscreen mode on and off to reduce jankiness.
- bool ignore_layout_;
-
- scoped_ptr<FullscreenExitBubble> fullscreen_bubble_;
-
-#if defined(OS_WIN)
- // The additional items we insert into the system menu.
- scoped_ptr<views::SystemMenuModel> system_menu_contents_;
- scoped_ptr<ZoomMenuModel> zoom_menu_contents_;
- scoped_ptr<EncodingMenuModel> encoding_menu_contents_;
- // The wrapped system menu itself.
- scoped_ptr<views::NativeMenuWin> system_menu_;
-
- // This object is used to perform periodic actions in a worker
- // thread. It is currently used to monitor hung plugin windows.
- WorkerThreadTicker ticker_;
-
- // This object is initialized with the frame window HWND. This
- // object is also passed as a tick handler with the ticker_ object.
- // It is used to periodically monitor for hung plugin windows
- HungWindowDetector hung_window_detector_;
-
- // This object is invoked by hung_window_detector_ when it detects a hung
- // plugin window.
- HungPluginAction hung_plugin_action_;
-
- // The custom JumpList for Windows 7.
- scoped_ptr<JumpList> jumplist_;
-
- // The custom AeroPeek manager for Windows 7.
- scoped_ptr<AeroPeekManager> aeropeek_manager_;
-#endif
-
- // The timer used to update frames for the Loading Animation.
- base::RepeatingTimer<BrowserView> loading_animation_timer_;
-
- UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
-
- scoped_ptr<AccessibleViewHelper> accessible_view_helper_;
-
- NotificationRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserView);
-};
-
-#endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_H_
diff --git a/chrome/browser/views/frame/browser_view_layout.h b/chrome/browser/views/frame/browser_view_layout.h
index 42652ef..a96fa8e 100644
--- a/chrome/browser/views/frame/browser_view_layout.h
+++ b/chrome/browser/views/frame/browser_view_layout.h
@@ -6,107 +6,8 @@
#define CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_
#pragma once
-#include "views/layout_manager.h"
-
-class BaseTabStrip;
-class BookmarkBarView;
-class Browser;
-class BrowserView;
-class ContentsContainer;
-class DownloadShelfView;
-class ToolbarView;
-
-// The layout manager used in chrome browser.
-class BrowserViewLayout : public views::LayoutManager {
- public:
- BrowserViewLayout();
- virtual ~BrowserViewLayout() {}
-
- // Returns the minimum size of the browser view.
- virtual gfx::Size GetMinimumSize();
-
- // Returns the bounding box for the find bar.
- virtual gfx::Rect GetFindBarBoundingBox() const;
-
- // Returns true if the specified point(BrowserView coordinates) is in
- // in the window caption area of the browser window.
- virtual bool IsPositionInWindowCaption(const gfx::Point& point);
-
- // Tests to see if the specified |point| (in nonclient view's coordinates)
- // is within the views managed by the laymanager. Returns one of
- // HitTestCompat enum defined in views/window/hit_test.h.
- // See also ClientView::NonClientHitTest.
- virtual int NonClientHitTest(const gfx::Point& point);
-
- // views::LayoutManager overrides:
- virtual void Installed(views::View* host);
- virtual void Uninstalled(views::View* host);
- virtual void ViewAdded(views::View* host, views::View* view);
- virtual void ViewRemoved(views::View* host, views::View* view);
- virtual void Layout(views::View* host);
- virtual gfx::Size GetPreferredSize(views::View* host);
-
- protected:
- Browser* browser();
- const Browser* browser() const;
-
- // Layout the TabStrip, returns the coordinate of the bottom of the TabStrip,
- // for laying out subsequent controls.
- virtual int LayoutTabStrip();
-
- // Layout the following controls, starting at |top|, returns the coordinate
- // of the bottom of the control, for laying out the next control.
- virtual int LayoutToolbar(int top);
- int LayoutBookmarkAndInfoBars(int top);
- int LayoutBookmarkBar(int top);
- int LayoutInfoBar(int top);
-
- // Layout the TabContents container, between the coordinates |top| and
- // |bottom|.
- void LayoutTabContents(int top, int bottom);
-
- // Returns the top margin to adjust the contents_container_ by. This is used
- // to make the bookmark bar and contents_container_ overlap so that the
- // preview contents hides the bookmark bar.
- int GetTopMarginForActiveContent();
-
- // Layout the Download Shelf, returns the coordinate of the top of the
- // control, for laying out the previous control.
- int LayoutDownloadShelf(int bottom);
-
- // Returns true if an infobar is showing.
- bool InfobarVisible() const;
-
- // See description above vertical_layout_rect_ for details.
- void set_vertical_layout_rect(const gfx::Rect& bounds) {
- vertical_layout_rect_ = bounds;
- }
- const gfx::Rect& vertical_layout_rect() const {
- return vertical_layout_rect_;
- }
-
- // Child views that the layout manager manages.
- BaseTabStrip* tabstrip_;
- ToolbarView* toolbar_;
- views::View* contents_split_;
- ContentsContainer* contents_container_;
- views::View* infobar_container_;
- DownloadShelfView* download_shelf_;
- BookmarkBarView* active_bookmark_bar_;
-
- BrowserView* browser_view_;
-
- // The bounds within which the vertically-stacked contents of the BrowserView
- // should be laid out within. When the SideTabstrip is not visible, this is
- // just the local bounds of the BrowserView, otherwise it's the local bounds
- // of the BrowserView less the width of the SideTabstrip.
- gfx::Rect vertical_layout_rect_;
-
- // The distance the FindBar is from the top of the window, in pixels.
- int find_bar_y_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout);
-};
+#include "chrome/browser/ui/views/frame/browser_view_layout.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_
diff --git a/chrome/browser/views/frame/contents_container.h b/chrome/browser/views/frame/contents_container.h
index fe22d47..07b7983 100644
--- a/chrome/browser/views/frame/contents_container.h
+++ b/chrome/browser/views/frame/contents_container.h
@@ -6,81 +6,8 @@
#define CHROME_BROWSER_VIEWS_FRAME_CONTENTS_CONTAINER_H_
#pragma once
-#include "views/view.h"
-
-class BrowserView;
-class TabContents;
-
-namespace views {
-class Widget;
-}
-
-// ContentsContainer is responsible for managing the TabContents views.
-// ContentsContainer has up to two children: one for the currently active
-// TabContents and one for instant's TabContents.
-class ContentsContainer : public views::View {
- public:
- ContentsContainer(BrowserView* browser_view, views::View* active);
- virtual ~ContentsContainer();
-
- // Makes the preview view the active view and nulls out the old active view.
- // It's assumed the caller will delete or remove the old active view
- // separately.
- void MakePreviewContentsActiveContents();
-
- // Sets the preview view. This does not delete the old.
- void SetPreview(views::View* preview, TabContents* preview_tab_contents);
-
- TabContents* preview_tab_contents() const { return preview_tab_contents_; }
-
- // Sets the active top margin.
- void SetActiveTopMargin(int margin);
-
- // Returns the bounds of the preview. If the preview isn't active this
- // retuns the bounds the preview would be shown at.
- gfx::Rect GetPreviewBounds();
-
- // View overrides:
- virtual void Layout();
-
- private:
-#if defined(OS_WIN)
- class TearWindow;
-#else
- typedef views::Widget TearWindow;
-#endif
-
- // Creates and configures the tear window.
- void CreateTearWindow();
-
- // Creates and returns a new TearWindow.
- TearWindow* CreateTearWindowImpl();
-
- // Resets the bounds of the tear window.
- void PositionTearWindow();
-
- // Closes and deletes the tear window.
- void DeleteTearWindow();
-
- // Invoked when the tear window is destroyed.
- void TearWindowDestroyed();
-
- BrowserView* browser_view_;
-
- views::View* active_;
-
- views::View* preview_;
-
- TabContents* preview_tab_contents_;
-
- // Window used to show the page tear.
- TearWindow* tear_window_;
-
- // The margin between the top and the active view. This is used to make the
- // preview overlap the bookmark bar on the new tab page.
- int active_top_margin_;
-
- DISALLOW_COPY_AND_ASSIGN(ContentsContainer);
-};
+#include "chrome/browser/ui/views/frame/contents_container.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_FRAME_CONTENTS_CONTAINER_H_
+
diff --git a/chrome/browser/views/frame/glass_browser_frame_view.h b/chrome/browser/views/frame/glass_browser_frame_view.h
index 0a39da1..397ef26 100644
--- a/chrome/browser/views/frame/glass_browser_frame_view.h
+++ b/chrome/browser/views/frame/glass_browser_frame_view.h
@@ -6,98 +6,8 @@
#define CHROME_BROWSER_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_
#pragma once
-#include "chrome/browser/views/frame/browser_frame_win.h"
-#include "chrome/browser/views/frame/browser_non_client_frame_view.h"
-#include "views/controls/button/button.h"
-#include "views/window/non_client_view.h"
-
-class BrowserView;
-class SkBitmap;
-
-class GlassBrowserFrameView : public BrowserNonClientFrameView {
- public:
- // Constructs a non-client view for an BrowserFrame.
- GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view);
- virtual ~GlassBrowserFrameView();
-
- // Overridden from BrowserNonClientFrameView:
- virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const;
- virtual int GetHorizontalTabStripVerticalOffset(bool restored) const;
- virtual void UpdateThrobber(bool running);
-
- // Overridden from views::NonClientFrameView:
- virtual gfx::Rect GetBoundsForClientView() const;
- virtual bool AlwaysUseNativeFrame() const;
- virtual gfx::Rect GetWindowBoundsForClientBounds(
- const gfx::Rect& client_bounds) const;
- virtual int NonClientHitTest(const gfx::Point& point);
- virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) { }
- virtual void EnableClose(bool enable) { }
- virtual void ResetWindowControls() { }
-
- protected:
- // Overridden from views::View:
- virtual void Paint(gfx::Canvas* canvas);
- virtual void Layout();
-
- private:
- // Returns the thickness of the border that makes up the window frame edges.
- // This does not include any client edge.
- int FrameBorderThickness() const;
-
- // Returns the thickness of the entire nonclient left, right, and bottom
- // borders, including both the window frame and any client edge.
- int NonClientBorderThickness() const;
-
- // Returns the height of the entire nonclient top border, including the window
- // frame, any title area, and any connected client edge. If |restored| is
- // true, acts as if the window is restored regardless of the real mode. If
- // |ignore_vertical_tabs| is true, acts as if vertical tabs are off regardless
- // of the real state.
- int NonClientTopBorderHeight(bool restored, bool ignore_vertical_tabs) const;
-
- // Paint various sub-components of this view.
- void PaintToolbarBackground(gfx::Canvas* canvas);
- void PaintOTRAvatar(gfx::Canvas* canvas);
- void PaintRestoredClientEdge(gfx::Canvas* canvas);
-
- // Layout various sub-components of this view.
- void LayoutOTRAvatar();
- void LayoutClientView();
-
- // Returns the bounds of the client area for the specified view size.
- gfx::Rect CalculateClientAreaBounds(int width, int height) const;
-
- // Starts/Stops the window throbber running.
- void StartThrobber();
- void StopThrobber();
-
- // Displays the next throbber frame.
- void DisplayNextThrobberFrame();
-
- // The layout rect of the OTR avatar icon, if visible.
- gfx::Rect otr_avatar_bounds_;
-
- // The frame that hosts this view.
- BrowserFrame* frame_;
-
- // The BrowserView hosted within this View.
- BrowserView* browser_view_;
-
- // The bounds of the ClientView.
- gfx::Rect client_view_bounds_;
-
- // Whether or not the window throbber is currently animating.
- bool throbber_running_;
-
- // The index of the current frame of the throbber animation.
- int throbber_frame_;
-
- static const int kThrobberIconCount = 24;
- static HICON throbber_icons_[kThrobberIconCount];
- static void InitThrobberIcons();
-
- DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView);
-};
+#include "chrome/browser/ui/views/frame/glass_browser_frame_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_
+
diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.h b/chrome/browser/views/frame/opaque_browser_frame_view.h
index 483693e..3e11721 100644
--- a/chrome/browser/views/frame/opaque_browser_frame_view.h
+++ b/chrome/browser/views/frame/opaque_browser_frame_view.h
@@ -6,143 +6,8 @@
#define CHROME_BROWSER_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_
#pragma once
-#include "chrome/browser/views/frame/browser_frame.h"
-#include "chrome/browser/views/frame/browser_non_client_frame_view.h"
-#include "chrome/browser/views/tab_icon_view.h"
-#include "views/controls/button/button.h"
-#include "views/window/non_client_view.h"
-
-class BaseTabStrip;
-class BrowserView;
-namespace gfx {
-class Font;
-}
-class TabContents;
-namespace views {
-class ImageButton;
-class ImageView;
-}
-
-class OpaqueBrowserFrameView : public BrowserNonClientFrameView,
- public views::ButtonListener,
- public TabIconView::TabIconViewModel {
- public:
- // Constructs a non-client view for an BrowserFrame.
- OpaqueBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view);
- virtual ~OpaqueBrowserFrameView();
-
- // Overridden from BrowserNonClientFrameView:
- virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const;
- virtual int GetHorizontalTabStripVerticalOffset(bool restored) const;
- virtual void UpdateThrobber(bool running);
- virtual gfx::Size GetMinimumSize();
-
- protected:
- // Overridden from views::NonClientFrameView:
- virtual gfx::Rect GetBoundsForClientView() const;
- virtual bool AlwaysUseNativeFrame() const;
- virtual bool AlwaysUseCustomFrame() const;
- virtual gfx::Rect GetWindowBoundsForClientBounds(
- const gfx::Rect& client_bounds) const;
- virtual int NonClientHitTest(const gfx::Point& point);
- virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask);
- virtual void EnableClose(bool enable);
- virtual void ResetWindowControls();
-
- // Overridden from views::View:
- virtual void Paint(gfx::Canvas* canvas);
- virtual void Layout();
- virtual bool HitTest(const gfx::Point& l) const;
- virtual AccessibilityTypes::Role GetAccessibleRole();
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Overridden from TabIconView::TabIconViewModel:
- virtual bool ShouldTabIconViewAnimate() const;
- virtual SkBitmap GetFavIconForTabIconView();
-
- private:
- // Returns the thickness of the border that makes up the window frame edges.
- // This does not include any client edge. If |restored| is true, acts as if
- // the window is restored regardless of the real mode.
- int FrameBorderThickness(bool restored) const;
-
- // Returns the height of the top resize area. This is smaller than the frame
- // border height in order to increase the window draggable area.
- int TopResizeHeight() const;
-
- // Returns the thickness of the entire nonclient left, right, and bottom
- // borders, including both the window frame and any client edge.
- int NonClientBorderThickness() const;
-
- // Returns the height of the entire nonclient top border, including the window
- // frame, any title area, and any connected client edge. If |restored| is
- // true, acts as if the window is restored regardless of the real mode. If
- // |ignore_vertical_tabs| is true, acts as if vertical tabs are off regardless
- // of the real state.
- int NonClientTopBorderHeight(bool restored, bool ignore_vertical_tabs) const;
-
- // Returns the y-coordinate of the caption buttons. If |restored| is true,
- // acts as if the window is restored regardless of the real mode.
- int CaptionButtonY(bool restored) const;
-
- // Returns the thickness of the 3D edge along the bottom of the titlebar. If
- // |restored| is true, acts as if the window is restored regardless of the
- // real mode.
- int TitlebarBottomThickness(bool restored) const;
-
- // Returns the size of the titlebar icon. This is used even when the icon is
- // not shown, e.g. to set the titlebar height.
- int IconSize() const;
-
- // Returns the bounds of the titlebar icon (or where the icon would be if
- // there was one).
- gfx::Rect IconBounds() const;
-
- // Paint various sub-components of this view. The *FrameBorder() functions
- // also paint the background of the titlebar area, since the top frame border
- // and titlebar background are a contiguous component.
- void PaintRestoredFrameBorder(gfx::Canvas* canvas);
- void PaintMaximizedFrameBorder(gfx::Canvas* canvas);
- void PaintTitleBar(gfx::Canvas* canvas);
- void PaintToolbarBackground(gfx::Canvas* canvas);
- void PaintOTRAvatar(gfx::Canvas* canvas);
- void PaintRestoredClientEdge(gfx::Canvas* canvas);
-
- // Layout various sub-components of this view.
- void LayoutWindowControls();
- void LayoutTitleBar();
- void LayoutOTRAvatar();
-
- // Returns the bounds of the client area for the specified view size.
- gfx::Rect CalculateClientAreaBounds(int width, int height) const;
-
- // The layout rect of the title, if visible.
- gfx::Rect title_bounds_;
-
- // The layout rect of the OTR avatar icon, if visible.
- gfx::Rect otr_avatar_bounds_;
-
- // Window controls.
- views::ImageButton* minimize_button_;
- views::ImageButton* maximize_button_;
- views::ImageButton* restore_button_;
- views::ImageButton* close_button_;
-
- // The Window icon.
- TabIconView* window_icon_;
-
- // The frame that hosts this view.
- BrowserFrame* frame_;
-
- // The BrowserView hosted within this View.
- BrowserView* browser_view_;
-
- // The bounds of the ClientView.
- gfx::Rect client_view_bounds_;
-
- DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameView);
-};
+#include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_
+
diff --git a/chrome/browser/views/frame/popup_non_client_frame_view.h b/chrome/browser/views/frame/popup_non_client_frame_view.h
index 12982c9..4866d34 100644
--- a/chrome/browser/views/frame/popup_non_client_frame_view.h
+++ b/chrome/browser/views/frame/popup_non_client_frame_view.h
@@ -6,35 +6,8 @@
#define CHROME_BROWSER_VIEWS_FRAME_POPUP_NON_CLIENT_FRAME_VIEW_H_
#pragma once
-#include "chrome/browser/views/frame/browser_non_client_frame_view.h"
-
-class BaseTabStrip;
-
-// BrowserNonClientFrameView implementation for popups. We let the window
-// manager implementation render the decorations for popups, so this draws
-// nothing.
-class PopupNonClientFrameView : public BrowserNonClientFrameView {
- public:
- PopupNonClientFrameView() {}
-
- // NonClientFrameView:
- virtual gfx::Rect GetBoundsForClientView() const;
- virtual bool AlwaysUseCustomFrame() const;
- virtual bool AlwaysUseNativeFrame() const;
- virtual gfx::Rect GetWindowBoundsForClientBounds(
- const gfx::Rect& client_bounds) const;
- virtual int NonClientHitTest(const gfx::Point& point);
- virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask);
- virtual void EnableClose(bool enable);
- virtual void ResetWindowControls();
-
- // BrowserNonClientFrameView:
- virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const;
- virtual int GetHorizontalTabStripVerticalOffset(bool restored) const;
- virtual void UpdateThrobber(bool running);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(PopupNonClientFrameView);
-};
+#include "chrome/browser/ui/views/frame/popup_non_client_frame_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_FRAME_POPUP_NON_CLIENT_FRAME_VIEW_H_
+
diff --git a/chrome/browser/views/fullscreen_exit_bubble.h b/chrome/browser/views/fullscreen_exit_bubble.h
index c2ebd5a..fc71d5c 100644
--- a/chrome/browser/views/fullscreen_exit_bubble.h
+++ b/chrome/browser/views/fullscreen_exit_bubble.h
@@ -1,107 +1,13 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__
-#define CHROME_BROWSER_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__
+#ifndef CHROME_BROWSER_VIEWS_FULLSCREEN_EXIT_BUBBLE_H_
+#define CHROME_BROWSER_VIEWS_FULLSCREEN_EXIT_BUBBLE_H_
#pragma once
-#include "app/slide_animation.h"
-#include "base/scoped_ptr.h"
-#include "base/timer.h"
-#include "chrome/browser/command_updater.h"
-#include "views/controls/link.h"
+#include "chrome/browser/ui/views/fullscreen_exit_bubble.h"
+// TODO(beng): remove this file once all includes have been updated.
-#if defined(OS_LINUX)
-namespace views {
-class WidgetGtk;
-}
-#endif
+#endif // CHROME_BROWSER_VIEWS_FULLSCREEN_EXIT_BUBBLE_H_
-// FullscreenExitBubble is responsible for showing a bubble atop the screen in
-// fullscreen mode, telling users how to exit and providing a click target.
-// The bubble auto-hides, and re-shows when the user moves to the screen top.
-
-class FullscreenExitBubble : public views::LinkController,
- public AnimationDelegate {
- public:
- explicit FullscreenExitBubble(
- views::Widget* frame,
- CommandUpdater::CommandUpdaterDelegate* delegate);
- virtual ~FullscreenExitBubble();
-
- private:
- class FullscreenExitView;
- class FullscreenExitPopup;
-
- static const double kOpacity; // Opacity of the bubble, 0.0 - 1.0
- static const int kInitialDelayMs; // Initial time bubble remains onscreen
- static const int kIdleTimeMs; // Time before mouse idle triggers hide
- static const int kPositionCheckHz; // How fast to check the mouse position
- static const int kSlideInRegionHeightPx;
- // Height of region triggering slide-in
- static const int kSlideInDurationMs; // Duration of slide-in animation
- static const int kSlideOutDurationMs; // Duration of slide-out animation
-
- // views::LinkController
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- // AnimationDelegate
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
-
- // Called repeatedly to get the current mouse position and animate the bubble
- // on or off the screen as appropriate.
- void CheckMousePosition();
-
- // Hides the bubble. This is a separate function so it can be called by a
- // timer.
- void Hide();
-
- // Returns the current desirable rect for the popup window. If
- // |ignore_animation_state| is true this returns the rect assuming the popup
- // is fully onscreen.
- gfx::Rect GetPopupRect(bool ignore_animation_state) const;
-
- // The root view containing us.
- views::View* root_view_;
-
- // Someone who can toggle fullscreen mode on and off when the user requests
- // it.
- CommandUpdater::CommandUpdaterDelegate* delegate_;
-
-#if defined(OS_WIN)
- // The popup itself, which is a slightly modified WidgetWin. We need to use
- // a WidgetWin (and thus an HWND) to make the popup float over other HWNDs.
- FullscreenExitPopup* popup_;
-#elif defined(OS_LINUX)
- views::WidgetGtk* popup_;
-#endif
-
- // The contents of the popup.
- FullscreenExitView* view_;
-
- // Animation controlling sliding into/out of the top of the screen.
- scoped_ptr<SlideAnimation> size_animation_;
-
- // Timer to delay before allowing the bubble to hide after it's initially
- // shown.
- base::OneShotTimer<FullscreenExitBubble> initial_delay_;
-
- // Timer to see how long the mouse has been idle.
- base::OneShotTimer<FullscreenExitBubble> idle_timeout_;
-
- // Timer to poll the current mouse position. We can't just listen for mouse
- // events without putting a non-empty HWND onscreen (or hooking Windows, which
- // has other problems), so instead we run a low-frequency poller to see if the
- // user has moved in or out of our show/hide regions.
- base::RepeatingTimer<FullscreenExitBubble> mouse_position_checker_;
-
- // The most recently seen mouse position, in screen coordinates. Used to see
- // if the mouse has moved since our last check.
- gfx::Point last_mouse_pos_;
-
- DISALLOW_COPY_AND_ASSIGN(FullscreenExitBubble);
-};
-
-#endif // CHROME_BROWSER_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__
diff --git a/chrome/browser/views/generic_info_view.h b/chrome/browser/views/generic_info_view.h
index 4c0318c..014ae18 100644
--- a/chrome/browser/views/generic_info_view.h
+++ b/chrome/browser/views/generic_info_view.h
@@ -6,62 +6,8 @@
#define CHROME_BROWSER_VIEWS_GENERIC_INFO_VIEW_H_
#pragma once
-#include "base/gtest_prod_util.h"
-#include "base/scoped_ptr.h"
-#include "base/string16.h"
-#include "views/view.h"
-
-namespace views {
-class GridLayout;
-class Label;
-class Textfield;
-}
-
-// GenericInfoView, displays a tabular grid of read-only textual information,
-// <name, value> pairs. The fixed number of rows must be known at the time of
-// construction.
-class GenericInfoView : public views::View {
- public:
- // Constructs a info view with |number_of_rows| and populated with
- // empty strings.
- explicit GenericInfoView(int number_of_rows);
-
- // Constructs a info view with |number_of_rows|, and populates
- // the name column with localized strings having the given
- // |name_string_ids|. The array of ids should contain |number_of_rows|
- // values and should remain valid for the life of the view.
- GenericInfoView(int number_of_rows, const int name_string_ids[]);
-
- // The following methods should only be called after
- // the view has been added to a view hierarchy.
- void SetNameByStringId(int row, int id);
- void SetName(int row, const string16& name);
- void SetValue(int row, const string16& value);
- void ClearValues() {
- const string16 kEmptyString;
- for (int i = 0; i < number_of_rows_; ++i)
- SetValue(i, kEmptyString);
- }
-
- protected:
- // views::View override
- virtual void ViewHierarchyChanged(
- bool is_add, views::View* parent, views::View* child);
-
- private:
- FRIEND_TEST_ALL_PREFIXES(GenericInfoViewTest, GenericInfoView);
-
- void InitGenericInfoView();
- void AddRow(int layout_id, views::GridLayout* layout,
- views::Label* name, views::Textfield* value);
-
- const int number_of_rows_;
- const int* name_string_ids_;
- scoped_array<views::Label*> name_views_;
- scoped_array<views::Textfield*> value_views_;
-
- DISALLOW_COPY_AND_ASSIGN(GenericInfoView);
-};
+#include "chrome/browser/ui/views/generic_info_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_GENERIC_INFO_VIEW_H_
diff --git a/chrome/browser/views/html_dialog_view.h b/chrome/browser/views/html_dialog_view.h
index 1d42b6f..c26c76a 100644
--- a/chrome/browser/views/html_dialog_view.h
+++ b/chrome/browser/views/html_dialog_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,83 +6,8 @@
#define CHROME_BROWSER_VIEWS_HTML_DIALOG_VIEW_H_
#pragma once
-#include <string>
-
-#include "chrome/browser/dom_ui/html_dialog_ui.h"
-#include "chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h"
-#include "chrome/browser/views/dom_view.h"
-#include "gfx/size.h"
-#include "views/window/window_delegate.h"
-
-class Browser;
-namespace views {
-class Window;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// HtmlDialogView is a view used to display an HTML dialog to the user. The
-// content of the dialogs is determined by the delegate
-// (HtmlDialogUIDelegate), but is basically a file URL along with a
-// JSON input string. The HTML is supposed to show a UI to the user and is
-// expected to send back a JSON file as a return value.
-//
-////////////////////////////////////////////////////////////////////////////////
-//
-// TODO(akalin): Make HtmlDialogView contain an HtmlDialogTabContentsDelegate
-// instead of inheriting from it to avoid violating the "no multiple
-// inheritance" rule.
-class HtmlDialogView
- : public DOMView,
- public HtmlDialogTabContentsDelegate,
- public HtmlDialogUIDelegate,
- public views::WindowDelegate {
- public:
- HtmlDialogView(Profile* profile, HtmlDialogUIDelegate* delegate);
- virtual ~HtmlDialogView();
-
- // Initializes the contents of the dialog (the DOMView and the callbacks).
- void InitDialog();
-
- // Overridden from views::View:
- virtual gfx::Size GetPreferredSize();
- virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
-
- // Overridden from views::WindowDelegate:
- virtual bool CanResize() const;
- virtual bool IsModal() const;
- virtual std::wstring GetWindowTitle() const;
- virtual void WindowClosing();
- virtual views::View* GetContentsView();
- virtual views::View* GetInitiallyFocusedView();
- virtual bool ShouldShowWindowTitle() const;
-
- // Overridden from HtmlDialogUIDelegate:
- 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);
- virtual void CloseContents(TabContents* source);
-
- private:
- // 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_;
-
- DISALLOW_COPY_AND_ASSIGN(HtmlDialogView);
-};
+#include "chrome/browser/ui/views/html_dialog_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_HTML_DIALOG_VIEW_H_
+
diff --git a/chrome/browser/views/importer_lock_view.h b/chrome/browser/views/importer_lock_view.h
index d974f38..1c64d40 100644
--- a/chrome/browser/views/importer_lock_view.h
+++ b/chrome/browser/views/importer_lock_view.h
@@ -2,47 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_VIEWS_IMPORTER_LOCK_VIEW_H__
-#define CHROME_BROWSER_VIEWS_IMPORTER_LOCK_VIEW_H__
+#ifndef CHROME_BROWSER_IMPORTER_LOCK_VIEW_H_
+#define CHROME_BROWSER_IMPORTER_LOCK_VIEW_H_
#pragma once
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
+#include "chrome/browser/ui/views/importer_lock_view.h"
+// TODO(beng): remove this file once all includes have been updated.
-namespace views {
-class Label;
-class Window;
-}
+#endif // CHROME_BROWSER_IMPORTER_LOCK_VIEW_H_
-class ImporterHost;
-
-// ImporterLockView draws the dialog, and asks the user to shut Firefox
-// down before starting the import.
-class ImporterLockView : public views::View,
- public views::DialogDelegate {
- public:
- explicit ImporterLockView(ImporterHost* host);
- virtual ~ImporterLockView();
-
- // Overridden from views::View.
- virtual gfx::Size GetPreferredSize();
- virtual void Layout();
-
- // Overridden from views::DialogDelegate:
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual bool IsModal() const;
- virtual std::wstring GetWindowTitle() const;
- virtual bool Accept();
- virtual bool Cancel();
- virtual views::View* GetContentsView();
-
- private:
- views::Label* description_label_;
-
- ImporterHost* importer_host_;
-
- DISALLOW_COPY_AND_ASSIGN(ImporterLockView);
-};
-
-#endif // CHROME_BROWSER_VIEWS_IMPORTER_LOCK_VIEW_H__
diff --git a/chrome/browser/views/importer_view.h b/chrome/browser/views/importer_view.h
index 51044e5..44afa36 100644
--- a/chrome/browser/views/importer_view.h
+++ b/chrome/browser/views/importer_view.h
@@ -6,104 +6,8 @@
#define CHROME_BROWSER_VIEWS_IMPORTER_VIEW_H_
#pragma once
-#include "app/combobox_model.h"
-#include "base/string16.h"
-#include "chrome/browser/importer/importer.h"
-#include "views/controls/button/native_button.h"
-#include "views/controls/combobox/combobox.h"
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
-
-namespace views {
-class Checkbox;
-class Label;
-class Window;
-}
-
-class Profile;
-
-// ImporterView draws the dialog that allows the user to select what to
-// import from other browsers.
-// Note: The UI team hasn't defined yet how the import UI will look like.
-// So now use dialog as a placeholder.
-class ImporterView : public views::View,
- public views::DialogDelegate,
- public views::ButtonListener,
- public ComboboxModel,
- public views::Combobox::Listener,
- public ImportObserver {
- public:
- // Creates a new ImporterView. |initial_state| is a bitmask of ImportItems.
- // Each checkbox for the bits in |initial_state| is checked.
- ImporterView(Profile* profile, int initial_state);
- virtual ~ImporterView();
-
- // Overridden from views::View:
- virtual gfx::Size GetPreferredSize();
- virtual void Layout();
-
- // Overridden from views::DialogDelegate:
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual bool IsDialogButtonEnabled(
- MessageBoxFlags::DialogButton button) const;
- virtual bool IsModal() const;
- virtual std::wstring GetWindowTitle() const;
- virtual bool Accept();
- virtual views::View* GetContentsView();
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Overridden from ComboboxModel:
- virtual int GetItemCount();
- virtual string16 GetItemAt(int index);
-
- // Overridden from ChromeViews::Combobox::Listener:
- virtual void ItemChanged(views::Combobox* combobox,
- int prev_index,
- int new_index);
-
- // Overridden from ImportObserver:
- virtual void ImportCanceled();
- virtual void ImportComplete();
-
- private:
- // Initializes the controls on the dialog.
- void SetupControl();
-
- // Creates and initializes a new check-box.
- views::Checkbox* InitCheckbox(const std::wstring& text, bool checked);
-
- // Create a bitmap from the checkboxes of the view.
- uint16 GetCheckedItems();
-
- // Enables/Disables all the checked items for the given state.
- void SetCheckedItemsState(uint16 items);
-
- // Sets all checked items in the given state.
- void SetCheckedItems(uint16 items);
-
- views::Label* import_from_label_;
- views::Combobox* profile_combobox_;
- views::Label* import_items_label_;
- views::Checkbox* history_checkbox_;
- views::Checkbox* favorites_checkbox_;
- views::Checkbox* passwords_checkbox_;
- views::Checkbox* search_engines_checkbox_;
-
- scoped_refptr<ImporterHost> importer_host_;
-
- // Stores the state of the checked items associated with the position of the
- // selected item in the combo-box.
- std::vector<uint16> checkbox_items_;
-
- // Initial state of the |checkbox_items_|.
- uint16 initial_state_;
-
- Profile* profile_;
-
- DISALLOW_COPY_AND_ASSIGN(ImporterView);
-};
+#include "chrome/browser/ui/views/importer_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_IMPORTER_VIEW_H_
+
diff --git a/chrome/browser/views/importing_progress_view.h b/chrome/browser/views/importing_progress_view.h
index ec842e79..5805c52 100644
--- a/chrome/browser/views/importing_progress_view.h
+++ b/chrome/browser/views/importing_progress_view.h
@@ -6,90 +6,8 @@
#define CHROME_BROWSER_VIEWS_IMPORTING_PROGRESS_VIEW_H_
#pragma once
-#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/importer/importer_data_types.h"
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
-#include "views/window/window.h"
-
-namespace views {
-class CheckmarkThrobber;
-class Label;
-}
-
-class ImportingProgressView : public views::View,
- public views::DialogDelegate,
- public ImporterHost::Observer {
- public:
- // |items| is a bitmask of ImportItems being imported.
- // |bookmark_import| is true if we're importing bookmarks from a
- // bookmarks.html file.
- ImportingProgressView(const std::wstring& source_name,
- int16 items,
- ImporterHost* coordinator,
- ImportObserver* observer,
- HWND parent_window,
- bool bookmarks_import);
- virtual ~ImportingProgressView();
-
- protected:
- // Overridden from ImporterHost::Observer:
- virtual void ImportItemStarted(importer::ImportItem item);
- virtual void ImportItemEnded(importer::ImportItem item);
- virtual void ImportStarted();
- virtual void ImportEnded();
-
- // Overridden from views::DialogDelegate:
- virtual int GetDialogButtons() const;
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual bool IsModal() const;
- virtual std::wstring GetWindowTitle() const;
- virtual bool Cancel();
- virtual views::View* GetContentsView();
-
- // Overridden from views::View:
- virtual gfx::Size GetPreferredSize();
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
-
- private:
- // Set up the control layout within this dialog.
- void InitControlLayout();
-
- // Various dialog controls.
- scoped_ptr<views::CheckmarkThrobber> state_bookmarks_;
- scoped_ptr<views::CheckmarkThrobber> state_searches_;
- scoped_ptr<views::CheckmarkThrobber> state_passwords_;
- scoped_ptr<views::CheckmarkThrobber> state_history_;
- scoped_ptr<views::CheckmarkThrobber> state_cookies_;
- views::Label* label_info_;
- scoped_ptr<views::Label> label_bookmarks_;
- scoped_ptr<views::Label> label_searches_;
- scoped_ptr<views::Label> label_passwords_;
- scoped_ptr<views::Label> label_history_;
- scoped_ptr<views::Label> label_cookies_;
-
- // The native window that we are parented to. Can be NULL.
- HWND parent_window_;
-
- // The importer host coordinating the import.
- scoped_refptr<ImporterHost> coordinator_;
-
- // An object that wants to be notified when the import is complete.
- ImportObserver* import_observer_;
-
- // The ImportItems we are importing.
- int16 items_;
-
- // True if the import operation is in progress.
- bool importing_;
-
- // Are we importing a bookmarks.html file?
- bool bookmarks_import_;
-
- DISALLOW_COPY_AND_ASSIGN(ImportingProgressView);
-};
+#include "chrome/browser/ui/views/importing_progress_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_IMPORTING_PROGRESS_VIEW_H_
+
diff --git a/chrome/browser/views/indexed_db_info_view.h b/chrome/browser/views/indexed_db_info_view.h
index 4be00a5..6f2ccb4 100644
--- a/chrome/browser/views/indexed_db_info_view.h
+++ b/chrome/browser/views/indexed_db_info_view.h
@@ -6,50 +6,8 @@
#define CHROME_BROWSER_VIEWS_INDEXED_DB_INFO_VIEW_H_
#pragma once
-#include "views/view.h"
-#include "chrome/browser/browsing_data_indexed_db_helper.h"
-
-namespace views {
-class Label;
-class Textfield;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// IndexedDBInfoView
-//
-// Responsible for displaying a tabular grid of IndexedDB information.
-class IndexedDBInfoView : public views::View {
- public:
- IndexedDBInfoView();
- virtual ~IndexedDBInfoView();
-
- // Update the display from the specified Local Storage info.
- void SetIndexedDBInfo(
- const BrowsingDataIndexedDBHelper::IndexedDBInfo&
- indexed_db_info);
-
- // Clears the cookie display to indicate that no or multiple local storages
- // are selected.
- void ClearIndexedDBDisplay();
-
- // Enables or disables the local storate property text fields.
- void EnableIndexedDBDisplay(bool enabled);
-
- protected:
- // views::View overrides:
- virtual void ViewHierarchyChanged(
- bool is_add, views::View* parent, views::View* child);
-
- private:
- // Set up the view layout
- void Init();
-
- // Individual property labels
- views::Textfield* origin_value_field_;
- views::Textfield* size_value_field_;
- views::Textfield* last_modified_value_field_;
-
- DISALLOW_COPY_AND_ASSIGN(IndexedDBInfoView);
-};
+#include "chrome/browser/ui/views/indexed_db_info_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_INDEXED_DB_INFO_VIEW_H_
+
diff --git a/chrome/browser/views/info_bubble.h b/chrome/browser/views/info_bubble.h
index 52bffe4..bd7dba6 100644
--- a/chrome/browser/views/info_bubble.h
+++ b/chrome/browser/views/info_bubble.h
@@ -6,302 +6,8 @@
#define CHROME_BROWSER_VIEWS_INFO_BUBBLE_H_
#pragma once
-#include "app/slide_animation.h"
-#include "third_party/skia/include/core/SkColor.h"
-#include "views/accelerator.h"
-#include "views/view.h"
-#include "chrome/browser/views/bubble_border.h"
-#if defined(OS_WIN)
-#include "views/widget/widget_win.h"
-#elif defined(OS_LINUX)
-#include "views/widget/widget_gtk.h"
-#endif
-
-// InfoBubble is used to display an arbitrary view above all other windows.
-// Think of InfoBubble as a tooltip that allows you to embed an arbitrary view
-// in the tooltip. Additionally the InfoBubble renders an arrow pointing at
-// the region the info bubble is providing the information about.
-//
-// To use an InfoBubble, invoke Show() and it'll take care of the rest. The
-// InfoBubble insets the contents for you, so the contents typically shouldn't
-// have any additional margins.
-
-#if defined(OS_WIN)
-class BorderWidget;
-#endif
-class InfoBubble;
-
-namespace views {
-class Widget;
-}
-
-namespace gfx {
-class Path;
-}
-
-// This is used to paint the border of the InfoBubble. Windows uses this via
-// BorderWidget (see below), while others can use it directly in the bubble.
-class BorderContents : public views::View {
- public:
- BorderContents() : bubble_border_(NULL) { }
-
- // Must be called before this object can be used.
- void Init();
-
- // Given the size of the contents and the rect to point at, returns the bounds
- // of both the border and the contents inside the bubble.
- // |arrow_location| specifies the preferred location for the arrow
- // anchor. If the bubble does not fit on the monitor and
- // |allow_bubble_offscreen| is false, the arrow location may change so the
- // bubble shows entirely.
- virtual void SizeAndGetBounds(
- const gfx::Rect& position_relative_to, // In screen coordinates
- BubbleBorder::ArrowLocation arrow_location,
- bool allow_bubble_offscreen,
- const gfx::Size& contents_size,
- gfx::Rect* contents_bounds, // Returned in window coordinates
- gfx::Rect* window_bounds); // Returned in screen coordinates
-
- protected:
- virtual ~BorderContents() { }
-
- // Returns the bounds for the monitor showing the specified |rect|.
- // Overridden in unit-tests.
- virtual gfx::Rect GetMonitorBounds(const gfx::Rect& rect);
-
- // Margins between the contents and the inside of the border, in pixels.
- static const int kLeftMargin = 6;
- static const int kTopMargin = 6;
- static const int kRightMargin = 6;
- static const int kBottomMargin = 9;
-
- BubbleBorder* bubble_border_;
-
- private:
- // Overridden from View:
- virtual void Paint(gfx::Canvas* canvas);
-
- // Changes |arrow_location| to its mirrored version, vertically if |vertical|
- // is true, horizontally otherwise, if |window_bounds| don't fit in
- // |monitor_bounds|.
- void MirrorArrowIfOffScreen(bool vertical,
- const gfx::Rect& position_relative_to,
- const gfx::Rect& monitor_bounds,
- const gfx::Size& local_contents_size,
- BubbleBorder::ArrowLocation* arrow_location,
- gfx::Rect* window_bounds);
-
- // Computes how much |window_bounds| is off-screen of the monitor bounds
- // |monitor_bounds| and puts the values in |offscreen_insets|.
- // Returns false if |window_bounds| is actually contained in |monitor_bounds|,
- // in which case |offscreen_insets| is not modified.
- static bool ComputeOffScreenInsets(const gfx::Rect& monitor_bounds,
- const gfx::Rect& window_bounds,
- gfx::Insets* offscreen_insets);
-
- // Convenience methods that returns the height of |insets| if |vertical| is
- // true, its width otherwise.
- static int GetInsetsLength(const gfx::Insets& insets, bool vertical);
-
- DISALLOW_COPY_AND_ASSIGN(BorderContents);
-};
-
-#if defined(OS_WIN)
-// This is a window that surrounds the info bubble and paints the margin and
-// border. It is a separate window so that it can be a layered window, so that
-// we can use >1-bit alpha shadow images on the borders, which look nicer than
-// the Windows CS_DROPSHADOW shadows. The info bubble window itself cannot be a
-// layered window because that prevents it from hosting native child controls.
-class BorderWidget : public views::WidgetWin {
- public:
- BorderWidget();
- virtual ~BorderWidget() { }
-
- // Initializes the BrowserWidget making |owner| its owning window.
- void Init(BorderContents* border_contents, HWND owner);
-
- // Given the size of the contained contents (without margins), and the rect
- // (in screen coordinates) to point to, sets the border window positions and
- // sizes the border window and returns the bounds (in screen coordinates) the
- // contents should use. |arrow_location| is prefered arrow location,
- // the function tries to preserve the location and direction, in case of RTL
- // arrow location is mirrored.
- virtual gfx::Rect SizeAndGetBounds(const gfx::Rect& position_relative_to,
- BubbleBorder::ArrowLocation arrow_location,
- const gfx::Size& contents_size);
-
- // Simple accessors.
- BorderContents* border_contents() { return border_contents_; }
-
- protected:
- BorderContents* border_contents_;
-
- private:
- // Overridden from WidgetWin:
- virtual LRESULT OnMouseActivate(HWND window,
- UINT hit_test,
- UINT mouse_message);
-
- DISALLOW_COPY_AND_ASSIGN(BorderWidget);
-};
-#endif
-
-class InfoBubbleDelegate {
- 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 the user pressing
- // escape.
- virtual void InfoBubbleClosing(InfoBubble* info_bubble,
- bool closed_by_escape) = 0;
-
- // Whether the InfoBubble should be closed when the Esc key is pressed.
- virtual bool CloseOnEscape() = 0;
-
- // Whether the InfoBubble should fade in when opening. When trying to
- // determine whether to use FadeIn, consider whether the bubble is shown as a
- // direct result of a user action or not. For example, if the bubble is being
- // shown as a direct result of a mouse-click, we should not use FadeIn.
- // However, if the bubble appears as a notification that something happened
- // in the background, we use FadeIn.
- virtual bool FadeInOnShow() = 0;
-
- // The name of the window to which this delegate belongs.
- virtual std::wstring accessible_name() { return L""; }
-};
-
-// TODO(sky): this code is ifdef-tastic. It might be cleaner to refactor the
-// WidgetFoo subclass into a separate class that calls into InfoBubble.
-// That way InfoBubble has no (or very few) ifdefs.
-class InfoBubble
-#if defined(OS_WIN)
- : public views::WidgetWin,
-#elif defined(OS_LINUX)
- : public views::WidgetGtk,
-#endif
- public views::AcceleratorTarget,
- public AnimationDelegate {
- public:
- // Shows the InfoBubble. |parent| is set as the parent window, |contents| are
- // the contents shown in the bubble, and |position_relative_to| is a rect in
- // screen coordinates at which the InfoBubble will point. Show() takes
- // ownership of |contents| and deletes the created InfoBubble when another
- // window is activated. You can explicitly close the bubble by invoking
- // Close(). |arrow_location| specifies preferred bubble alignment.
- // You may provide an optional |delegate| to:
- // - Be notified when the InfoBubble is closed.
- // - Prevent the InfoBubble from being closed when the Escape key is
- // pressed (the default behavior).
- static InfoBubble* Show(views::Widget* parent,
- const gfx::Rect& position_relative_to,
- BubbleBorder::ArrowLocation arrow_location,
- views::View* contents,
- InfoBubbleDelegate* delegate);
-
-#if defined(OS_CHROMEOS)
- // Shows the InfoBubble not grabbing the focus. Others are the same as above.
- // TYPE_POPUP widget is used to achieve the focusless effect.
- static InfoBubble* ShowFocusless(views::Widget* parent,
- const gfx::Rect& position_relative_to,
- BubbleBorder::ArrowLocation arrow_location,
- views::View* contents,
- InfoBubbleDelegate* delegate);
-#endif
-
- // Resizes and potentially moves the InfoBubble to best accommodate the
- // contents preferred size.
- void SizeToContents();
-
- // Whether the InfoBubble should fade away when it closes. Generally speaking,
- // we use FadeOut when the user selects something within the bubble that
- // causes the bubble to dismiss. We don't use it when the bubble gets
- // deactivated as a result of clicking outside the bubble.
- void set_fade_away_on_close(bool fade_away_on_close) {
- fade_away_on_close_ = fade_away_on_close;
- }
-
- // Overridden from WidgetWin:
- virtual void Close();
-
- // Overridden from AnimationDelegate:
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationProgressed(const Animation* animation);
-
- static const SkColor kBackgroundColor;
-
- protected:
- InfoBubble();
-#if defined(OS_CHROMEOS)
- explicit InfoBubble(views::WidgetGtk::Type type);
-#endif
- virtual ~InfoBubble() {}
-
- // Creates the InfoBubble.
- virtual void Init(views::Widget* parent,
- const gfx::Rect& position_relative_to,
- BubbleBorder::ArrowLocation arrow_location,
- views::View* contents,
- InfoBubbleDelegate* delegate);
-
- // Instantiates and returns the BorderContents this InfoBubble should use.
- // Subclasses can return their own BorderContents implementation.
- virtual BorderContents* CreateBorderContents();
-
-#if defined(OS_WIN)
- // Overridden from WidgetWin:
- virtual void OnActivate(UINT action, BOOL minimized, HWND window);
-#elif defined(OS_LINUX)
- // Overridden from WidgetGtk:
- virtual void IsActiveChanged();
-#endif
-
-#if defined(OS_WIN)
- // The window used to render the padding, border and arrow.
- BorderWidget* border_;
-#elif defined(OS_LINUX)
- // The view displaying the border.
- BorderContents* border_contents_;
-#endif
-
- private:
- enum ShowStatus {
- kOpen,
- kClosing,
- kClosed
- };
-
- // Closes the window notifying the delegate. |closed_by_escape| is true if
- // the close is the result of pressing escape.
- void DoClose(bool closed_by_escape);
-
- // Animates to a visible state.
- void FadeIn();
- // Animates to a hidden state.
- void FadeOut();
-
- // Animates to a visible/hidden state (visible if |fade_in| is true).
- void Fade(bool fade_in);
-
- // Overridden from AcceleratorTarget:
- virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
-
- // The delegate, if any.
- InfoBubbleDelegate* delegate_;
-
- // The animation used to fade the bubble out.
- scoped_ptr<SlideAnimation> animation_;
-
- // The current visibility status of the bubble.
- ShowStatus show_status_;
-
- // Whether to fade away when the bubble closes.
- bool fade_away_on_close_;
-
- gfx::Rect position_relative_to_;
- BubbleBorder::ArrowLocation arrow_location_;
-
- views::View* contents_;
-
- DISALLOW_COPY_AND_ASSIGN(InfoBubble);
-};
+#include "chrome/browser/ui/views/info_bubble.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_INFO_BUBBLE_H_
+
diff --git a/chrome/browser/views/infobars/after_translate_infobar.h b/chrome/browser/views/infobars/after_translate_infobar.h
index 1b94ec8..d0c8fcc 100644
--- a/chrome/browser/views/infobars/after_translate_infobar.h
+++ b/chrome/browser/views/infobars/after_translate_infobar.h
@@ -6,74 +6,8 @@
#define CHROME_BROWSER_VIEWS_INFOBARS_AFTER_TRANSLATE_INFOBAR_H_
#pragma once
-#include "chrome/browser/translate/languages_menu_model.h"
-#include "chrome/browser/translate/options_menu_model.h"
-#include "chrome/browser/translate/translate_infobar_view.h"
-#include "chrome/browser/views/infobars/translate_infobar_base.h"
-#include "views/controls/button/button.h"
-#include "views/controls/link.h"
-#include "views/controls/menu/view_menu_delegate.h"
-
-class InfoBarTextButton;
-class TranslateInfoBarDelegate;
-
-namespace views {
-class Menu2;
-class MenuButton;
-}
-
-class AfterTranslateInfoBar : public TranslateInfoBarBase,
- public views::ViewMenuDelegate {
- public:
- explicit AfterTranslateInfoBar(TranslateInfoBarDelegate* delegate);
- virtual ~AfterTranslateInfoBar();
-
- // Overridden from views::View:
- virtual void Layout();
-
- // Overridden from TranslateInfoBarView:
- virtual void OriginalLanguageChanged();
- virtual void TargetLanguageChanged();
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- protected:
- // Overridden from views::ViewMenuDelegate:
- virtual void RunMenu(View* source, const gfx::Point& pt);
-
- private:
- // Sets the text of the original or target language menu buttons to reflect
- // the current value from the delegate.
- void UpdateLanguageButtonText(LanguagesMenuModel::LanguageType language);
-
- // The text displayed in the infobar is something like:
- // "Translated from <lang1> to <lang2>"
- // Where <lang1> and <lang2> are displayed in a combobox.
- // So the text is split in 3 chunks, each one displayed in one of the label
- // below.
- views::Label* label_1_;
- views::Label* label_2_;
- views::Label* label_3_;
-
- views::MenuButton* original_language_menu_button_;
- views::MenuButton* target_language_menu_button_;
- views::MenuButton* options_menu_button_;
- InfoBarTextButton* revert_button_;
-
- scoped_ptr<views::Menu2> original_language_menu_;
- LanguagesMenuModel original_language_menu_model_;
-
- scoped_ptr<views::Menu2> target_language_menu_;
- LanguagesMenuModel target_language_menu_model_;
-
- scoped_ptr<views::Menu2> options_menu_;
- OptionsMenuModel options_menu_model_;
-
- // True if the target language comes before the original one.
- bool swapped_language_buttons_;
-
- DISALLOW_COPY_AND_ASSIGN(AfterTranslateInfoBar);
-};
+#include "chrome/browser/ui/views/infobars/after_translate_infobar.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_INFOBARS_AFTER_TRANSLATE_INFOBAR_H_
+
diff --git a/chrome/browser/views/infobars/before_translate_infobar.h b/chrome/browser/views/infobars/before_translate_infobar.h
index 7ac6208..1cf685c 100644
--- a/chrome/browser/views/infobars/before_translate_infobar.h
+++ b/chrome/browser/views/infobars/before_translate_infobar.h
@@ -6,71 +6,8 @@
#define CHROME_BROWSER_VIEWS_INFOBARS_BEFORE_TRANSLATE_INFOBAR_H_
#pragma once
-#include "chrome/browser/translate/languages_menu_model.h"
-#include "chrome/browser/translate/options_menu_model.h"
-#include "chrome/browser/translate/translate_infobar_view.h"
-#include "chrome/browser/views/infobars/infobars.h"
-#include "chrome/browser/views/infobars/translate_infobar_base.h"
-#include "views/controls/button/button.h"
-#include "views/controls/link.h"
-#include "views/controls/menu/view_menu_delegate.h"
-
-class InfoBarTextButton;
-class TranslateInfoBarDelegate;
-
-namespace views {
-class Menu2;
-class MenuButton;
-}
-
-class BeforeTranslateInfoBar
- : public TranslateInfoBarBase,
- public views::ViewMenuDelegate {
- public:
- explicit BeforeTranslateInfoBar(TranslateInfoBarDelegate* delegate);
- virtual ~BeforeTranslateInfoBar();
-
- // Overridden from views::View:
- virtual void Layout();
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Overridden from TranslateInfoBarView:
- virtual void OriginalLanguageChanged();
- virtual void TargetLanguageChanged();
-
- protected:
- // Overridden from views::ViewMenuDelegate:
- virtual void RunMenu(View* source, const gfx::Point& pt);
-
- private:
- // Sets the text of the original language menu button to reflect the current
- // value from the delegate.
- void UpdateOriginalButtonText();
-
- // The text displayed in the infobar is something like:
- // "The page is in <lang>. Would you like to translate it?"
- // Where <lang> is displayed in a combobox.
- // So the text is split in 2 chunks, each one displayed in one of the label
- // below.
- views::Label* label_1_;
- views::Label* label_2_;
-
- views::MenuButton* language_menu_button_;
- views::MenuButton* options_menu_button_;
- InfoBarTextButton* accept_button_;
- InfoBarTextButton* deny_button_;
- InfoBarTextButton* never_translate_button_;
- InfoBarTextButton* always_translate_button_;
-
- scoped_ptr<views::Menu2> languages_menu_;
- LanguagesMenuModel languages_menu_model_;
-
- scoped_ptr<views::Menu2> options_menu_;
- OptionsMenuModel options_menu_model_;
-
- DISALLOW_COPY_AND_ASSIGN(BeforeTranslateInfoBar);
-};
+#include "chrome/browser/ui/views/infobars/before_translate_infobar.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_INFOBARS_BEFORE_TRANSLATE_INFOBAR_H_
+
diff --git a/chrome/browser/views/infobars/extension_infobar.h b/chrome/browser/views/infobars/extension_infobar.h
index b4bab7e..0b1ae4a 100644
--- a/chrome/browser/views/infobars/extension_infobar.h
+++ b/chrome/browser/views/infobars/extension_infobar.h
@@ -6,67 +6,8 @@
#define CHROME_BROWSER_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_
#pragma once
-#include "chrome/browser/views/infobars/infobars.h"
-
-#include "chrome/browser/extensions/extension_infobar_delegate.h"
-#include "chrome/browser/extensions/image_loading_tracker.h"
-#include "chrome/browser/views/extensions/extension_view.h"
-#include "views/controls/menu/view_menu_delegate.h"
-
-class ExtensionContextMenuModel;
-class ExtensionInfoBarDelegate;
-
-namespace views {
- class MenuButton;
- class Menu2;
-}
-
-// This class implements InfoBars for Extensions.
-class ExtensionInfoBar : public InfoBar,
- public ExtensionView::Container,
- public ImageLoadingTracker::Observer,
- public ExtensionInfoBarDelegate::DelegateObserver,
- public views::ViewMenuDelegate {
- public:
- explicit ExtensionInfoBar(ExtensionInfoBarDelegate* delegate);
- virtual ~ExtensionInfoBar();
-
- // Overridden from ExtensionView::Container:
- virtual void OnExtensionMouseMove(ExtensionView* view) {}
- virtual void OnExtensionMouseLeave(ExtensionView* view) {}
- virtual void OnExtensionPreferredSizeChanged(ExtensionView* view);
-
- // Overridden from views::View:
- virtual void Layout();
-
- // Overridden from ImageLoadingTracker::Observer:
- virtual void OnImageLoaded(
- SkBitmap* image, ExtensionResource resource, int index);
-
- // Overridden from ExtensionInfoBarDelegate::DelegateObserver:
- virtual void OnDelegateDeleted();
-
- // Overridden from views::ViewMenuDelegate:
- virtual void RunMenu(View* source, const gfx::Point& pt);
-
- private:
- // Setup the menu button showing the small extension icon and its dropdown
- // menu.
- void SetupIconAndMenu();
-
- NotificationRegistrar notification_registrar_;
-
- ExtensionInfoBarDelegate* delegate_;
-
- // The dropdown menu for accessing the contextual extension actions.
- scoped_refptr<ExtensionContextMenuModel> options_menu_contents_;
- scoped_ptr<views::Menu2> options_menu_menu_;
- views::MenuButton* menu_;
-
- // Keeps track of images being loaded on the File thread.
- ImageLoadingTracker tracker_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBar);
-};
+#include "chrome/browser/ui/views/infobars/extension_infobar.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_
+
diff --git a/chrome/browser/views/infobars/infobar_button_border.h b/chrome/browser/views/infobars/infobar_button_border.h
index 865e4f8..daafb16 100644
--- a/chrome/browser/views/infobars/infobar_button_border.h
+++ b/chrome/browser/views/infobars/infobar_button_border.h
@@ -6,48 +6,8 @@
#define CHROME_BROWSER_VIEWS_INFOBARS_INFOBAR_BUTTON_BORDER_H_
#pragma once
-#include "views/border.h"
-
-#include "third_party/skia/include/core/SkBitmap.h"
-
-namespace gfx {
-class Canvas;
-}
-namespace views {
-class View;
-}
-
-// A TextButtonBorder that is dark and also paints the button frame in the
-// normal state.
-
-class InfoBarButtonBorder : public views::Border {
- public:
- InfoBarButtonBorder();
- virtual ~InfoBarButtonBorder();
-
- // Overriden from Border:
- virtual void GetInsets(gfx::Insets* insets) const;
- virtual void Paint(const views::View& view, gfx::Canvas* canvas) const;
-
- private:
- // Images
- struct MBBImageSet {
- SkBitmap* top_left;
- SkBitmap* top;
- SkBitmap* top_right;
- SkBitmap* left;
- SkBitmap* center;
- SkBitmap* right;
- SkBitmap* bottom_left;
- SkBitmap* bottom;
- SkBitmap* bottom_right;
- };
-
- MBBImageSet normal_set_;
- MBBImageSet hot_set_;
- MBBImageSet pushed_set_;
-
- DISALLOW_COPY_AND_ASSIGN(InfoBarButtonBorder);
-};
+#include "chrome/browser/ui/views/infobars/infobar_button_border.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_INFOBARS_INFOBAR_BUTTON_BORDER_H_
+
diff --git a/chrome/browser/views/infobars/infobar_container.h b/chrome/browser/views/infobars/infobar_container.h
index 89d5a91..13c3f56 100644
--- a/chrome/browser/views/infobars/infobar_container.h
+++ b/chrome/browser/views/infobars/infobar_container.h
@@ -6,89 +6,8 @@
#define CHROME_BROWSER_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_
#pragma once
-#include "chrome/browser/views/accessible_pane_view.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "views/view.h"
-
-class BrowserView;
-class InfoBarDelegate;
-class TabContents;
-
-// A views::View subclass that contains a collection of InfoBars associated with
-// a TabContents.
-class InfoBarContainer : public AccessiblePaneView,
- public NotificationObserver {
- public:
- // Implement this interface when you want to receive notifications from the
- // InfoBarContainer
- class Delegate {
- public:
- virtual ~Delegate() {}
- virtual void InfoBarSizeChanged(bool is_animating) = 0;
- };
-
- explicit InfoBarContainer(Delegate* delegate);
- virtual ~InfoBarContainer();
-
- // Changes the TabContents for which this container is showing InfoBars. Can
- // be NULL.
- void ChangeTabContents(TabContents* contents);
-
- // Called by child InfoBars as they animate. If |completed| is true, the
- // animation has finished running.
- void InfoBarAnimated(bool completed);
-
- // 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);
-
- // Overridden from views::View:
- virtual gfx::Size GetPreferredSize();
- virtual void Layout();
- virtual AccessibilityTypes::Role GetAccessibleRole();
-
- protected:
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
-
- 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();
-
- // Adds an InfoBar for the specified delegate, in response to a notification
- // from the selected TabContents. The InfoBar's appearance will be animated
- // if |use_animation| is true.
- void AddInfoBar(InfoBarDelegate* delegate, bool use_animation);
-
- // Removes an InfoBar for the specified delegate, in response to a
- // notification from the selected TabContents. The InfoBar's disappearance
- // will be animated if |use_animation| is true.
- void RemoveInfoBar(InfoBarDelegate* delegate, bool use_animation);
-
- // Replaces an InfoBar for the specified delegate with a new one. There is no
- // animation.
- void ReplaceInfoBar(InfoBarDelegate* old_delegate,
- InfoBarDelegate* new_delegate);
-
- NotificationRegistrar registrar_;
-
- // The Delegate which receives notifications from the InfoBarContainer.
- Delegate* delegate_;
-
- // The TabContents for which we are currently showing InfoBars.
- TabContents* tab_contents_;
-
- DISALLOW_COPY_AND_ASSIGN(InfoBarContainer);
-};
+#include "chrome/browser/ui/views/infobars/infobar_container.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_
+
diff --git a/chrome/browser/views/infobars/infobar_text_button.h b/chrome/browser/views/infobars/infobar_text_button.h
index 35f16a1..7255f0d 100644
--- a/chrome/browser/views/infobars/infobar_text_button.h
+++ b/chrome/browser/views/infobars/infobar_text_button.h
@@ -6,33 +6,8 @@
#define CHROME_BROWSER_VIEWS_INFOBARS_INFOBAR_TEXT_BUTTON_H_
#pragma once
-#include "views/controls/button/text_button.h"
-
-// A TextButton subclass that overrides OnMousePressed to default to
-// CustomButton so as to create pressed state effect.
-
-class InfoBarTextButton : public views::TextButton {
- public:
- // Creates a button with the specified |text|.
- static InfoBarTextButton* Create(views::ButtonListener* listener,
- const string16& text);
- // Creates a button which text is the resource string identified by
- // |message_id|.
- static InfoBarTextButton* CreateWithMessageID(views::ButtonListener* listener,
- int message_id);
- static InfoBarTextButton* CreateWithMessageIDAndParam(
- views::ButtonListener* listener, int message_id, const string16& param);
-
- virtual ~InfoBarTextButton();
-
- protected:
- InfoBarTextButton(views::ButtonListener* listener, const string16& text);
-
- // Overriden from TextButton:
- virtual bool OnMousePressed(const views::MouseEvent& e);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(InfoBarTextButton);
-};
+#include "chrome/browser/ui/views/infobars/infobar_text_button.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_INFOBARS_INFOBAR_TEXT_BUTTON_H_
+
diff --git a/chrome/browser/views/infobars/infobars.h b/chrome/browser/views/infobars/infobars.h
index ec270d5..9345bdc 100644
--- a/chrome/browser/views/infobars/infobars.h
+++ b/chrome/browser/views/infobars/infobars.h
@@ -6,246 +6,8 @@
#define CHROME_BROWSER_VIEWS_INFOBARS_INFOBARS_H_
#pragma once
-#include "app/animation.h"
-#include "base/task.h"
-#include "chrome/browser/tab_contents/infobar_delegate.h"
-#include "views/controls/button/button.h"
-#include "views/controls/link.h"
-#include "views/focus/focus_manager.h"
-
-class InfoBarContainer;
-class SlideAnimation;
-namespace views {
-class ExternalFocusTracker;
-class ImageButton;
-class ImageView;
-class Label;
-class NativeButton;
-}
-
-// This file contains implementations for some general purpose InfoBars. See
-// chrome/browser/tab_contents/infobar_delegate.h for the delegate interface(s)
-// that you must implement to use these.
-
-class InfoBarBackground : public views::Background {
- public:
- explicit InfoBarBackground(InfoBarDelegate::Type infobar_type);
-
- // Overridden from views::Background:
- virtual void Paint(gfx::Canvas* canvas, views::View* view) const;
-
- private:
- scoped_ptr<views::Background> gradient_background_;
-
- DISALLOW_COPY_AND_ASSIGN(InfoBarBackground);
-};
-
-class InfoBar : public views::View,
- public views::ButtonListener,
- public views::FocusChangeListener,
- public AnimationDelegate {
- public:
- explicit InfoBar(InfoBarDelegate* delegate);
- virtual ~InfoBar();
-
- InfoBarDelegate* delegate() const { return delegate_; }
-
- // Set a link to the parent InfoBarContainer. This must be set before the
- // InfoBar is added to the view hierarchy.
- void set_container(InfoBarContainer* container) { container_ = container; }
-
- // The target height of the InfoBar, regardless of what its current height
- // is (due to animation).
- static const double kDefaultTargetHeight;
-
- static const int kHorizontalPadding;
- static const int kIconLabelSpacing;
- static const int kButtonButtonSpacing;
- static const int kEndOfLabelSpacing;
- static const int kCloseButtonSpacing;
- static const int kButtonInLabelSpacing;
-
- // Overridden from views::View:
- virtual AccessibilityTypes::Role GetAccessibleRole();
- virtual gfx::Size GetPreferredSize();
- virtual void Layout();
-
- protected:
- // Overridden from views::View:
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
-
- // Returns the available width of the View for use by child view layout,
- // excluding the close button.
- virtual int GetAvailableWidth() const;
-
- // Removes our associated InfoBarDelegate from the associated TabContents.
- // (Will lead to this InfoBar being closed).
- void RemoveInfoBar() const;
-
- void set_target_height(double height) { target_height_ = height; }
-
- SlideAnimation* animation() { return animation_.get(); }
-
- // Returns a centered y-position of a control of height specified in
- // |prefsize| within the standard InfoBar height. Stable during an animation.
- int CenterY(const gfx::Size prefsize);
-
- // Returns a centered y-position of a control of height specified in
- // |prefsize| within the standard InfoBar height, adjusted according to the
- // current amount of animation offset the |parent| InfoBar currently has.
- // Changes during an animation.
- int OffsetY(views::View* parent, const gfx::Size prefsize);
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Overridden from views::FocusChangeListener:
- virtual void FocusWillChange(View* focused_before, View* focused_now);
-
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
-
- private:
- friend class InfoBarContainer;
-
- // 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();
-
- // Called when an InfoBar is added or removed from a view hierarchy to do
- // setup and shutdown.
- void InfoBarAdded();
- void InfoBarRemoved();
-
- // Destroys the external focus tracker, if present. If |restore_focus| is
- // true, restores focus to the view tracked by the focus tracker before doing
- // so.
- void DestroyFocusTracker(bool restore_focus);
-
- // Deletes this object (called after a return to the message loop to allow
- // the stack in ViewHierarchyChanged to unwind).
- void DeleteSelf();
-
- // The InfoBar's container
- InfoBarContainer* container_;
-
- // The InfoBar's delegate.
- InfoBarDelegate* delegate_;
-
- // The Close Button at the right edge of the InfoBar.
- views::ImageButton* close_button_;
-
- // The animation that runs when the InfoBar is opened or closed.
- scoped_ptr<SlideAnimation> animation_;
-
- // Tracks and stores the last focused view which is not the InfoBar or any of
- // its children. Used to restore focus once the InfoBar is closed.
- scoped_ptr<views::ExternalFocusTracker> focus_tracker_;
-
- // Used to delete this object after a return to the message loop.
- ScopedRunnableMethodFactory<InfoBar> delete_factory_;
-
- // The target height for the InfoBar.
- double target_height_;
-
- DISALLOW_COPY_AND_ASSIGN(InfoBar);
-};
-
-class AlertInfoBar : public InfoBar {
- public:
- explicit AlertInfoBar(AlertInfoBarDelegate* delegate);
- virtual ~AlertInfoBar();
-
- // Overridden from views::View:
- virtual void Layout();
-
- protected:
- views::Label* label() const { return label_; }
- views::ImageView* icon() const { return icon_; }
-
- private:
- AlertInfoBarDelegate* GetDelegate();
-
- views::Label* label_;
- views::ImageView* icon_;
-
- DISALLOW_COPY_AND_ASSIGN(AlertInfoBar);
-};
-
-class LinkInfoBar : public InfoBar,
- public views::LinkController {
- public:
- explicit LinkInfoBar(LinkInfoBarDelegate* delegate);
- virtual ~LinkInfoBar();
-
- // Overridden from views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- // Overridden from views::View:
- virtual void Layout();
-
- private:
- LinkInfoBarDelegate* GetDelegate();
-
- views::ImageView* icon_;
- views::Label* label_1_;
- views::Label* label_2_;
- views::Link* link_;
-
- DISALLOW_COPY_AND_ASSIGN(LinkInfoBar);
-};
-
-class ConfirmInfoBar : public AlertInfoBar,
- public views::LinkController {
- public:
- explicit ConfirmInfoBar(ConfirmInfoBarDelegate* delegate);
- virtual ~ConfirmInfoBar();
-
- // Overridden from views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- // Overridden from views::View:
- virtual void Layout();
-
- protected:
- // Overridden from views::View:
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Overridden from InfoBar:
- virtual int GetAvailableWidth() const;
-
- private:
- void Init();
-
- ConfirmInfoBarDelegate* GetDelegate();
-
- views::NativeButton* ok_button_;
- views::NativeButton* cancel_button_;
- views::Link* link_;
-
- bool initialized_;
-
- DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBar);
-};
-
+#include "chrome/browser/ui/views/infobars/infobars.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_INFOBARS_INFOBARS_H_
+
diff --git a/chrome/browser/views/infobars/translate_infobar_base.h b/chrome/browser/views/infobars/translate_infobar_base.h
index a16d1ca..84b68dc 100644
--- a/chrome/browser/views/infobars/translate_infobar_base.h
+++ b/chrome/browser/views/infobars/translate_infobar_base.h
@@ -6,70 +6,8 @@
#define CHROME_BROWSER_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_
#pragma once
-#include "chrome/browser/translate/translate_infobar_view.h"
-#include "chrome/browser/views/infobars/infobars.h"
-
-class TranslateInfoBarDelegate;
-
-namespace views {
-class MenuButton;
-class ViewMenuDelegate;
-}
-
-// This class contains some of the base functionality that translate infobars
-// use.
-class TranslateInfoBarBase : public TranslateInfoBarView,
- public InfoBar {
- public:
- explicit TranslateInfoBarBase(TranslateInfoBarDelegate* delegate);
- virtual ~TranslateInfoBarBase();
-
- // TranslateInfoBarView implementation:
- virtual void OriginalLanguageChanged() {}
- virtual void TargetLanguageChanged() {}
-
- // Overridden from views::View:
- virtual void Layout();
- virtual void PaintBackground(gfx::Canvas* canvas);
-
- protected:
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
-
- // Creates a label with the appropriate font and color for the translate
- // infobars.
- views::Label* CreateLabel(const string16& text);
-
- // Creates a menu-button with a custom appearance for the translate infobars.
- views::MenuButton* CreateMenuButton(const string16& text,
- bool normal_has_border,
- views::ViewMenuDelegate* menu_delegate);
-
- // Returns the location at which the menu triggered by |menu_button| should be
- // positioned.
- gfx::Point DetermineMenuPosition(views::MenuButton* menu_button);
-
- // Convenience to retrieve the TranslateInfoBarDelegate for this infobar.
- TranslateInfoBarDelegate* GetDelegate() const;
-
- // The translate icon.
- views::ImageView* icon_;
-
- InfoBarBackground normal_background_;
- InfoBarBackground error_background_;
- scoped_ptr<SlideAnimation> background_color_animation_;
-
- private:
- // Returns the background that should be displayed when not animating.
- const InfoBarBackground& GetBackground() const;
-
- // Paints |background| to |canvas| with the opacity level based on
- // |animation_value|.
- void FadeBackground(gfx::Canvas* canvas,
- double animation_value,
- const InfoBarBackground& background);
-
- DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarBase);
-};
+#include "chrome/browser/ui/views/infobars/translate_infobar_base.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_
+
diff --git a/chrome/browser/views/infobars/translate_message_infobar.h b/chrome/browser/views/infobars/translate_message_infobar.h
index e77bcf2..d893fe7 100644
--- a/chrome/browser/views/infobars/translate_message_infobar.h
+++ b/chrome/browser/views/infobars/translate_message_infobar.h
@@ -6,24 +6,8 @@
#define CHROME_BROWSER_VIEWS_INFOBARS_TRANSLATE_MESSAGE_INFOBAR_H_
#pragma once
-#include "chrome/browser/views/infobars/translate_infobar_base.h"
-
-class InfoBarTextButton;
-
-class TranslateMessageInfoBar : public TranslateInfoBarBase {
- public:
- explicit TranslateMessageInfoBar(TranslateInfoBarDelegate* delegate);
-
- virtual void Layout();
-
- // views::ButtonListener implementation:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- private:
- views::Label* label_;
- InfoBarTextButton* button_;
-
- DISALLOW_COPY_AND_ASSIGN(TranslateMessageInfoBar);
-};
+#include "chrome/browser/ui/views/infobars/translate_message_infobar.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_INFOBARS_TRANSLATE_MESSAGE_INFOBAR_H_
+
diff --git a/chrome/browser/views/instant_confirm_view.h b/chrome/browser/views/instant_confirm_view.h
index 958837c..d0f87d4 100644
--- a/chrome/browser/views/instant_confirm_view.h
+++ b/chrome/browser/views/instant_confirm_view.h
@@ -6,36 +6,8 @@
#define CHROME_BROWSER_VIEWS_INSTANT_CONFIRM_VIEW_H_
#pragma once
-#include "views/controls/label.h"
-#include "views/controls/link.h"
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
-
-class Profile;
-
-// The view shown in the instant confirm dialog.
-class InstantConfirmView : public views::View,
- public views::DialogDelegate,
- public views::LinkController {
- public:
- explicit InstantConfirmView(Profile* profile);
-
- // DialogDelegate overrides:
- virtual bool Accept(bool window_closing);
- virtual bool Accept();
- virtual bool Cancel();
- virtual views::View* GetContentsView();
- virtual std::wstring GetWindowTitle() const;
- virtual gfx::Size GetPreferredSize();
- virtual bool IsModal() const;
-
- // LinkController overrides:
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- private:
- Profile* profile_;
-
- DISALLOW_COPY_AND_ASSIGN(InstantConfirmView);
-};
+#include "chrome/browser/ui/views/instant_confirm_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_INSTANT_CONFIRM_VIEW_H_
+
diff --git a/chrome/browser/views/js_modal_dialog_views.h b/chrome/browser/views/js_modal_dialog_views.h
index 00d1bb7..a5c6425 100644
--- a/chrome/browser/views/js_modal_dialog_views.h
+++ b/chrome/browser/views/js_modal_dialog_views.h
@@ -6,55 +6,8 @@
#define CHROME_BROWSER_VIEWS_JS_MODAL_DIALOG_VIEWS_H_
#pragma once
-#include "chrome/browser/js_modal_dialog.h"
-
-#include <string>
-
-#include "app/message_box_flags.h"
-#include "chrome/browser/native_app_modal_dialog.h"
-#include "views/window/dialog_delegate.h"
-
-class MessageBoxView;
-
-class JSModalDialogViews : public NativeAppModalDialog,
- public views::DialogDelegate {
- public:
- explicit JSModalDialogViews(JavaScriptAppModalDialog* parent);
- virtual ~JSModalDialogViews();
-
- // Overridden from NativeAppModalDialog:
- virtual int GetAppModalDialogButtons() const;
- virtual void ShowAppModalDialog();
- virtual void ActivateAppModalDialog();
- virtual void CloseAppModalDialog();
- virtual void AcceptAppModalDialog();
- virtual void CancelAppModalDialog();
-
- // Overridden from views::DialogDelegate:
- virtual int GetDefaultDialogButton() const;
- virtual int GetDialogButtons() const;
- virtual std::wstring GetWindowTitle() const;
- virtual void WindowClosing();
- virtual void DeleteDelegate();
- virtual bool Cancel();
- virtual bool Accept();
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
-
- // Overridden from views::WindowDelegate:
- virtual bool IsModal() const { return true; }
- virtual views::View* GetContentsView();
- virtual views::View* GetInitiallyFocusedView();
- virtual void OnClose();
-
- private:
- // A pointer to the AppModalDialog that owns us.
- JavaScriptAppModalDialog* parent_;
-
- // The message box view whose commands we handle.
- MessageBoxView* message_box_view_;
-
- DISALLOW_COPY_AND_ASSIGN(JSModalDialogViews);
-};
+#include "chrome/browser/ui/views/js_modal_dialog_views.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_JS_MODAL_DIALOG_VIEWS_H_
+
diff --git a/chrome/browser/views/keyword_editor_view.h b/chrome/browser/views/keyword_editor_view.h
index b4e7736..a3f5b8f 100644
--- a/chrome/browser/views/keyword_editor_view.h
+++ b/chrome/browser/views/keyword_editor_view.h
@@ -6,112 +6,8 @@
#define CHROME_BROWSER_VIEWS_KEYWORD_EDITOR_VIEW_H_
#pragma once
-#include <Windows.h>
-
-#include "base/string16.h"
-#include "chrome/browser/search_engines/edit_search_engine_controller.h"
-#include "chrome/browser/search_engines/keyword_editor_controller.h"
-#include "chrome/browser/search_engines/template_url_model_observer.h"
-#include "views/controls/button/button.h"
-#include "views/controls/table/table_view_observer.h"
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
-
-namespace views {
-class Label;
-class NativeButton;
-}
-
-namespace {
-class BorderView;
-}
-
-class SearchEngineSelectionObserver;
-class SkBitmap;
-class TemplateURL;
-
-// KeywordEditorView allows the user to edit keywords.
-
-class KeywordEditorView : public views::View,
- public views::TableViewObserver,
- public views::ButtonListener,
- public TemplateURLModelObserver,
- public views::DialogDelegate,
- public EditSearchEngineControllerDelegate {
- public:
- // Shows the KeywordEditorView for the specified profile. If there is a
- // KeywordEditorView already open, it is closed and a new one is shown.
- static void Show(Profile* profile);
-
- // Shows the KeywordEditorView for the specified profile, and passes in
- // an observer to be called back on view close.
- static void ShowAndObserve(Profile* profile,
- SearchEngineSelectionObserver* observer);
-
- KeywordEditorView(Profile* profile,
- SearchEngineSelectionObserver* observer);
-
- virtual ~KeywordEditorView();
-
- // Overridden from EditSearchEngineControllerDelegate.
- // Calls AddTemplateURL or ModifyTemplateURL as appropriate.
- virtual void OnEditedKeyword(const TemplateURL* template_url,
- const string16& title,
- const string16& keyword,
- const std::string& url);
-
- // Overridden to invoke Layout.
- virtual gfx::Size GetPreferredSize();
-
- // views::DialogDelegate methods:
- virtual bool CanResize() const;
- virtual std::wstring GetWindowTitle() const;
- virtual std::wstring GetWindowName() const;
- virtual int GetDialogButtons() const;
- virtual bool Accept();
- virtual bool Cancel();
- virtual views::View* GetContentsView();
-
- private:
- void Init();
-
- // Creates the layout and adds the views to it.
- void InitLayoutManager();
-
- // TableViewObserver method. Updates buttons contingent on the selection.
- virtual void OnSelectionChanged();
- // Edits the selected item.
- virtual void OnDoubleClick();
-
- // Button::ButtonListener method.
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // TemplateURLModelObserver notification.
- virtual void OnTemplateURLModelChanged();
-
- // Toggles whether the selected keyword is the default search provider.
- void MakeDefaultTemplateURL();
-
- // The profile.
- Profile* profile_;
-
- // Observer gets a callback when the KeywordEditorView closes.
- SearchEngineSelectionObserver* observer_;
-
- scoped_ptr<KeywordEditorController> controller_;
-
- // True if the user has set a default search engine in this dialog.
- bool default_chosen_;
-
- // All the views are added as children, so that we don't need to delete
- // them directly.
- views::TableView* table_view_;
- views::NativeButton* add_button_;
- views::NativeButton* edit_button_;
- views::NativeButton* remove_button_;
- views::NativeButton* make_default_button_;
-
- DISALLOW_COPY_AND_ASSIGN(KeywordEditorView);
-};
+#include "chrome/browser/ui/views/keyword_editor_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_KEYWORD_EDITOR_VIEW_H_
+
diff --git a/chrome/browser/views/list_background.h b/chrome/browser/views/list_background.h
index 4f29a34..4cf550b 100644
--- a/chrome/browser/views/list_background.h
+++ b/chrome/browser/views/list_background.h
@@ -6,32 +6,8 @@
#define CHROME_BROWSER_VIEWS_LIST_BACKGROUND_H_
#pragma once
-#include "gfx/canvas_skia.h"
-#include "gfx/native_theme_win.h"
-#include "views/background.h"
-
-// A background object that paints the scrollable list background,
-// which may be rendered by the system visual styles system.
-class ListBackground : public views::Background {
- public:
- explicit ListBackground() {
- SkColor list_color =
- gfx::NativeTheme::instance()->GetThemeColorWithDefault(
- gfx::NativeTheme::LIST, 1, TS_NORMAL, TMT_FILLCOLOR, COLOR_WINDOW);
- SetNativeControlColor(list_color);
- }
- virtual ~ListBackground() {}
-
- virtual void Paint(gfx::Canvas* canvas, views::View* view) const {
- HDC dc = canvas->BeginPlatformPaint();
- RECT native_lb = view->GetLocalBounds(true).ToRECT();
- gfx::NativeTheme::instance()->PaintListBackground(dc, true, &native_lb);
- canvas->EndPlatformPaint();
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ListBackground);
-};
+#include "chrome/browser/ui/views/list_background.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_LIST_BACKGROUND_H_
diff --git a/chrome/browser/views/local_storage_info_view.h b/chrome/browser/views/local_storage_info_view.h
index aa3e14f..3550959 100644
--- a/chrome/browser/views/local_storage_info_view.h
+++ b/chrome/browser/views/local_storage_info_view.h
@@ -6,52 +6,8 @@
#define CHROME_BROWSER_VIEWS_LOCAL_STORAGE_INFO_VIEW_H_
#pragma once
-#include "views/view.h"
-#include "chrome/browser/browsing_data_local_storage_helper.h"
-
-namespace views {
-class Label;
-class Textfield;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// LocalStorageInfoView
-//
-// Responsible for displaying a tabular grid of Local Storage information.
-class LocalStorageInfoView : public views::View {
- public:
- LocalStorageInfoView();
- virtual ~LocalStorageInfoView();
-
- // Update the display from the specified Local Storage info.
- void SetLocalStorageInfo(
- const BrowsingDataLocalStorageHelper::LocalStorageInfo&
- local_storage_info);
-
- // Clears the cookie display to indicate that no or multiple local storages
- // are selected.
- void ClearLocalStorageDisplay();
-
- // Enables or disables the local storate property text fields.
- void EnableLocalStorageDisplay(bool enabled);
-
- protected:
- // views::View overrides:
- virtual void ViewHierarchyChanged(
- bool is_add, views::View* parent, views::View* child);
-
- private:
- // Set up the view layout
- void Init();
-
- // Individual property labels
- views::Textfield* origin_value_field_;
- views::Textfield* size_value_field_;
- views::Textfield* last_modified_value_field_;
-
- DISALLOW_COPY_AND_ASSIGN(LocalStorageInfoView);
-};
-
+#include "chrome/browser/ui/views/local_storage_info_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_LOCAL_STORAGE_INFO_VIEW_H_
diff --git a/chrome/browser/views/local_storage_set_item_info_view.h b/chrome/browser/views/local_storage_set_item_info_view.h
index 9b555b6..ee16aaa 100644
--- a/chrome/browser/views/local_storage_set_item_info_view.h
+++ b/chrome/browser/views/local_storage_set_item_info_view.h
@@ -6,55 +6,8 @@
#define CHROME_BROWSER_VIEWS_LOCAL_STORAGE_SET_ITEM_INFO_VIEW_H_
#pragma once
-#include <string>
-
-#include "base/string16.h"
-#include "views/view.h"
-
-namespace views {
-class Label;
-class Textfield;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// LocalStorageSetItemInfoView
-//
-// Responsible for displaying a tabular grid of Local Storage information when
-// prompting for permission to set an item.
-class LocalStorageSetItemInfoView : public views::View {
- public:
- LocalStorageSetItemInfoView();
- virtual ~LocalStorageSetItemInfoView();
-
- // Update the display from the specified Local Storage info.
- void SetFields(const std::string& host,
- const string16& key,
- const string16& value);
-
- // Clears the display to indicate that no or multiple local storages
- // are selected.
- void ClearLocalStorageDisplay();
-
- // Enables or disables the local storate property text fields.
- void EnableLocalStorageDisplay(bool enabled);
-
- protected:
- // views::View overrides:
- virtual void ViewHierarchyChanged(
- bool is_add, views::View* parent, views::View* child);
-
- private:
- // Set up the view layout
- void Init();
-
- // Individual property labels
- views::Textfield* host_value_field_;
- views::Textfield* key_value_field_;
- views::Textfield* value_value_field_;
-
- DISALLOW_COPY_AND_ASSIGN(LocalStorageSetItemInfoView);
-};
-
+#include "chrome/browser/ui/views/local_storage_set_item_info_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_LOCAL_STORAGE_SET_ITEM_INFO_VIEW_H_
diff --git a/chrome/browser/views/location_bar/click_handler.h b/chrome/browser/views/location_bar/click_handler.h
index dc8c917..155e501f 100644
--- a/chrome/browser/views/location_bar/click_handler.h
+++ b/chrome/browser/views/location_bar/click_handler.h
@@ -6,29 +6,8 @@
#define CHROME_BROWSER_VIEWS_LOCATION_BAR_CLICK_HANDLER_H_
#pragma once
-#include "base/basictypes.h"
-
-class LocationBarView;
-
-namespace views {
-class MouseEvent;
-class View;
-}
-
-// This helper class is kept as a member by classes that need to show the Page
-// Info dialog on click, to encapsulate that logic in one place.
-class ClickHandler {
- public:
- ClickHandler(const views::View* owner, const LocationBarView* location_bar);
-
- void OnMouseReleased(const views::MouseEvent& event, bool canceled);
-
- private:
- const views::View* owner_;
- const LocationBarView* location_bar_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(ClickHandler);
-};
+#include "chrome/browser/ui/views/location_bar/click_handler.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_CLICK_HANDLER_H_
diff --git a/chrome/browser/views/location_bar/content_setting_image_view.h b/chrome/browser/views/location_bar/content_setting_image_view.h
index 366ed48..1bcb7bf 100644
--- a/chrome/browser/views/location_bar/content_setting_image_view.h
+++ b/chrome/browser/views/location_bar/content_setting_image_view.h
@@ -6,56 +6,8 @@
#define CHROME_BROWSER_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_
#pragma once
-#include "base/scoped_ptr.h"
-#include "chrome/browser/views/info_bubble.h"
-#include "chrome/common/content_settings_types.h"
-#include "views/controls/image_view.h"
-
-class ContentSettingImageModel;
-class InfoBubble;
-class LocationBarView;
-class Profile;
-class TabContents;
-
-namespace views {
-class MouseEvent;
-}
-
-class ContentSettingImageView : public views::ImageView,
- public InfoBubbleDelegate {
- public:
- ContentSettingImageView(ContentSettingsType content_type,
- const LocationBarView* parent,
- Profile* profile);
- virtual ~ContentSettingImageView();
-
- void set_profile(Profile* profile) { profile_ = profile; }
- void UpdateFromTabContents(const TabContents* tab_contents);
-
- private:
- // views::ImageView overrides:
- virtual bool OnMousePressed(const views::MouseEvent& event);
- virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
- virtual void VisibilityChanged(View* starting_from, bool is_visible);
-
- // InfoBubbleDelegate overrides:
- virtual void InfoBubbleClosing(InfoBubble* info_bubble,
- bool closed_by_escape);
- virtual bool CloseOnEscape();
- virtual bool FadeInOnShow() { return false; }
-
- scoped_ptr<ContentSettingImageModel> content_setting_image_model_;
-
- // The owning LocationBarView.
- const LocationBarView* parent_;
-
- // The currently active profile.
- Profile* profile_;
-
- // The currently shown info bubble if any.
- InfoBubble* info_bubble_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingImageView);
-};
+#include "chrome/browser/ui/views/location_bar/content_setting_image_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_
+
diff --git a/chrome/browser/views/location_bar/ev_bubble_view.h b/chrome/browser/views/location_bar/ev_bubble_view.h
index 058c8a2..1070a6b 100644
--- a/chrome/browser/views/location_bar/ev_bubble_view.h
+++ b/chrome/browser/views/location_bar/ev_bubble_view.h
@@ -6,33 +6,8 @@
#define CHROME_BROWSER_VIEWS_LOCATION_BAR_EV_BUBBLE_VIEW_H_
#pragma once
-#include "chrome/browser/views/location_bar/click_handler.h"
-#include "chrome/browser/views/location_bar/icon_label_bubble_view.h"
-
-class LocationBarView;
-
-namespace views {
-class MouseEvent;
-}
-
-// EVBubbleView displays the EV Bubble in the LocationBarView.
-class EVBubbleView : public IconLabelBubbleView {
- public:
- EVBubbleView(const int background_images[],
- int contained_image,
- const SkColor& color,
- const LocationBarView* location_bar);
- virtual ~EVBubbleView();
-
- // Overridden from view.
- virtual bool OnMousePressed(const views::MouseEvent& event);
- virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
-
- private:
- ClickHandler click_handler_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(EVBubbleView);
-};
+#include "chrome/browser/ui/views/location_bar/ev_bubble_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_EV_BUBBLE_VIEW_H_
diff --git a/chrome/browser/views/location_bar/icon_label_bubble_view.h b/chrome/browser/views/location_bar/icon_label_bubble_view.h
index d2e4b78..9e3dde6 100644
--- a/chrome/browser/views/location_bar/icon_label_bubble_view.h
+++ b/chrome/browser/views/location_bar/icon_label_bubble_view.h
@@ -6,59 +6,8 @@
#define CHROME_BROWSER_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_
#pragma once
-#include <string>
-
-#include "gfx/size.h"
-#include "views/painter.h"
-#include "views/view.h"
-
-namespace gfx {
-class Canvas;
-class Font;
-}
-namespace views {
-class ImageView;
-class Label;
-}
-
-class SkBitmap;
-
-// View used to draw a bubble to the left of the address, containing an icon and
-// a label. We use this as a base for the classes that handle the EV bubble and
-// tab-to-search UI.
-class IconLabelBubbleView : public views::View {
- public:
- IconLabelBubbleView(const int background_images[],
- int contained_image,
- const SkColor& color);
- virtual ~IconLabelBubbleView();
-
- void SetFont(const gfx::Font& font);
- void SetLabel(const std::wstring& label);
- void SetImage(const SkBitmap& bitmap);
- void SetItemPadding(int padding) { item_padding_ = padding; }
-
- virtual void Paint(gfx::Canvas* canvas);
- virtual gfx::Size GetPreferredSize();
- virtual void Layout();
-
- protected:
- void SetElideInMiddle(bool elide_in_middle);
- gfx::Size GetNonLabelSize();
-
- private:
- int GetNonLabelWidth();
-
- // For painting the background.
- views::HorizontalPainter background_painter_;
-
- // The contents of the bubble.
- views::ImageView* image_;
- views::Label* label_;
-
- int item_padding_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(IconLabelBubbleView);
-};
+#include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_
+
diff --git a/chrome/browser/views/location_bar/keyword_hint_view.h b/chrome/browser/views/location_bar/keyword_hint_view.h
index af11a84..defea0e 100644
--- a/chrome/browser/views/location_bar/keyword_hint_view.h
+++ b/chrome/browser/views/location_bar/keyword_hint_view.h
@@ -6,57 +6,8 @@
#define CHROME_BROWSER_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_
#pragma once
-#include <string>
-
-#include "gfx/size.h"
-#include "views/view.h"
-
-namespace gfx {
-class Font;
-}
-class Profile;
-namespace views {
-class Label;
-}
-
-// KeywordHintView is used by the location bar view to display a hint to the
-// user when the selected url has a corresponding keyword.
-//
-// Internally KeywordHintView uses two labels to render the text, and draws
-// the tab image itself.
-//
-// NOTE: This should really be called LocationBarKeywordHintView, but I
-// couldn't bring myself to use such a long name.
-class KeywordHintView : public views::View {
- public:
- explicit KeywordHintView(Profile* profile);
- virtual ~KeywordHintView();
-
- void SetFont(const gfx::Font& font);
-
- void SetColor(const SkColor& color);
-
- void SetKeyword(const std::wstring& keyword);
- std::wstring keyword() const { return keyword_; }
-
- virtual void Paint(gfx::Canvas* canvas);
- virtual gfx::Size GetPreferredSize();
- // The minimum size is just big enough to show the tab.
- virtual gfx::Size GetMinimumSize();
- virtual void Layout();
-
- void set_profile(Profile* profile) { profile_ = profile; }
-
- private:
- views::Label* leading_label_;
- views::Label* trailing_label_;
-
- // The keyword.
- std::wstring keyword_;
-
- Profile* profile_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(KeywordHintView);
-};
+#include "chrome/browser/ui/views/location_bar/keyword_hint_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_
+
diff --git a/chrome/browser/views/location_bar/location_bar_view.h b/chrome/browser/views/location_bar/location_bar_view.h
index 019e7a1..1e2b2d7 100644
--- a/chrome/browser/views/location_bar/location_bar_view.h
+++ b/chrome/browser/views/location_bar/location_bar_view.h
@@ -6,399 +6,8 @@
#define CHROME_BROWSER_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_
#pragma once
-#include <string>
-#include <vector>
-
-#include "base/task.h"
-#include "chrome/browser/autocomplete/autocomplete_edit.h"
-#include "chrome/browser/extensions/extension_context_menu_model.h"
-#include "chrome/browser/first_run/first_run.h"
-#include "chrome/browser/location_bar.h"
-#include "chrome/browser/search_engines/template_url_model_observer.h"
-#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/browser/toolbar_model.h"
-#include "chrome/browser/views/extensions/extension_popup.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "gfx/font.h"
-#include "gfx/rect.h"
-#include "views/controls/native/native_view_host.h"
-
-#if defined(OS_WIN)
-#include "chrome/browser/autocomplete/autocomplete_edit_view_win.h"
-#else
-#include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h"
-#include "chrome/browser/gtk/accessible_widget_helper_gtk.h"
-#endif
-
-class CommandUpdater;
-class ContentSettingImageView;
-class EVBubbleView;
-class ExtensionAction;
-class GURL;
-class InstantController;
-class KeywordHintView;
-class LocationIconView;
-class PageActionWithBadgeView;
-class Profile;
-class SelectedKeywordView;
-class StarView;
-class TemplateURLModel;
-
-namespace views {
-class HorizontalPainter;
-class Label;
-};
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// LocationBarView class
-//
-// The LocationBarView class is a View subclass that paints the background
-// of the URL bar strip and contains its content.
-//
-/////////////////////////////////////////////////////////////////////////////
-class LocationBarView : public LocationBar,
- public LocationBarTesting,
- public views::View,
- public views::DragController,
- public AutocompleteEditController,
- public TemplateURLModelObserver {
- public:
- // The location bar view's class name.
- static const char kViewClassName[];
-
- class Delegate {
- public:
- // Should return the current tab contents.
- virtual TabContents* GetTabContents() = 0;
-
- // Returns the InstantController, or NULL if there isn't one.
- virtual InstantController* GetInstant() = 0;
-
- // Called by the location bar view when the user starts typing in the edit.
- // This forces our security style to be UNKNOWN for the duration of the
- // editing.
- virtual void OnInputInProgress(bool in_progress) = 0;
- };
-
- enum ColorKind {
- BACKGROUND = 0,
- TEXT,
- SELECTED_TEXT,
- DEEMPHASIZED_TEXT,
- SECURITY_TEXT,
- };
-
- // The modes reflect the different scenarios where a location bar can be used.
- // The normal mode is the mode used in a regular browser window.
- // In popup mode, the location bar view is read only and has a slightly
- // different presentation (font size / color).
- // In app launcher mode, the location bar is empty and no security states or
- // page/browser actions are displayed.
- enum Mode {
- NORMAL = 0,
- POPUP,
- APP_LAUNCHER
- };
-
- LocationBarView(Profile* profile,
- CommandUpdater* command_updater,
- ToolbarModel* model,
- Delegate* delegate,
- Mode mode);
- virtual ~LocationBarView();
-
- void Init();
-
- // True if this instance has been initialized by calling Init, which can only
- // be called when the receiving instance is attached to a view container.
- bool IsInitialized() const;
-
- // Returns the appropriate color for the desired kind, based on the user's
- // system theme.
- static SkColor GetColor(ToolbarModel::SecurityLevel security_level,
- ColorKind kind);
-
- // 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);
-
- void SetProfile(Profile* profile);
- Profile* profile() const { return profile_; }
-
- // Returns the current TabContents.
- TabContents* GetTabContents() const;
-
- // Sets |preview_enabled| for the PageAction View associated with this
- // |page_action|. If |preview_enabled| is true, the view will display the
- // PageActions icon even though it has not been activated by the extension.
- // This is used by the ExtensionInstalledBubble 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 PageAction View which is associated with |page_action|.
- views::View* GetPageActionView(ExtensionAction* page_action);
-
- // Toggles the star on or off.
- void SetStarToggled(bool on);
-
- // Shows the bookmark bubble.
- void ShowStarBubble(const GURL& url, bool newly_bookmarked);
-
- // Sizing functions
- virtual gfx::Size GetPreferredSize();
-
- // Layout and Painting functions
- virtual void Layout();
- virtual void Paint(gfx::Canvas* canvas);
-
- // No focus border for the location bar, the caret is enough.
- virtual void PaintFocusBorder(gfx::Canvas* canvas) { }
-
- // Called when any ancestor changes its size, asks the AutocompleteEditModel
- // to close its popup.
- virtual void VisibleBoundsInRootChanged();
-
- // Set if we should show a focus rect while the location entry field is
- // focused. Used when the toolbar is in full keyboard accessibility mode.
- // Repaints if necessary.
- virtual void SetShowFocusRect(bool show);
-
- // Select all of the text. Needed when the user tabs through controls
- // in the toolbar in full keyboard accessibility mode.
- virtual void SelectAll();
-
-#if defined(OS_WIN)
- // Event Handlers
- virtual bool OnMousePressed(const views::MouseEvent& event);
- virtual bool OnMouseDragged(const views::MouseEvent& event);
- virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
-#endif
-
- // AutocompleteEditController
- virtual void OnAutocompleteWillClosePopup();
- virtual void OnAutocompleteLosingFocus(gfx::NativeView view_gaining_focus);
- virtual void OnAutocompleteWillAccept();
- virtual bool OnCommitSuggestedText(const std::wstring& typed_text);
- 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 OnInputInProgress(bool in_progress);
- virtual void OnKillFocus();
- virtual void OnSetFocus();
- virtual SkBitmap GetFavIcon() const;
- virtual std::wstring GetTitle() const;
-
- // Overridden from views::View:
- virtual std::string GetClassName() const;
- virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e);
- virtual AccessibilityTypes::Role GetAccessibleRole();
-
- // Overridden from views::DragController:
- virtual void WriteDragData(View* sender,
- const gfx::Point& press_pt,
- OSExchangeData* data);
- virtual int GetDragOperations(View* sender, const gfx::Point& p);
- virtual bool CanStartDrag(View* sender,
- const gfx::Point& press_pt,
- const gfx::Point& p);
-
- // Overridden from LocationBar:
- 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 {
- return location_entry_.get();
- }
- virtual AutocompleteEditView* location_entry() {
- return location_entry_.get();
- }
- virtual LocationBarTesting* GetLocationBarForTesting() { return this; }
-
- // Overridden from LocationBarTesting:
- virtual int PageActionCount() { return page_action_views_.size(); }
- virtual int PageActionVisibleCount();
- virtual ExtensionAction* GetPageAction(size_t index);
- virtual ExtensionAction* GetVisiblePageAction(size_t index);
- virtual void TestPageActionPressed(size_t index);
-
- // Overridden from TemplateURLModelObserver
- virtual void OnTemplateURLModelChanged();
-
- // Thickness of the left and right edges of the omnibox, in normal mode.
- static const int kNormalHorizontalEdgeThickness;
- // Thickness of the top and bottom edges of the omnibox.
- static const int kVerticalEdgeThickness;
- // Space between items in the location bar.
- static const int kItemPadding;
- // Space between items in the location bar when an extension keyword is
- // showing.
- static const int kExtensionItemPadding;
- // Space between the edges and the items next to them.
- static const int kEdgeItemPadding;
- // Space between the edge and a bubble.
- static const int kBubblePadding;
-
- protected:
- void Focus();
-
- private:
- typedef std::vector<ContentSettingImageView*> ContentSettingViews;
-
- friend class PageActionImageView;
- friend class PageActionWithBadgeView;
- typedef std::vector<PageActionWithBadgeView*> PageActionViews;
-
- // Returns the amount of horizontal space (in pixels) out of
- // |location_bar_width| that is not taken up by the actual text in
- // location_entry_.
- int AvailableWidth(int location_bar_width);
-
- // If |view| fits in |available_width|, it is made visible and positioned at
- // the leading or trailing end of |bounds|, which are then shrunk
- // appropriately. Otherwise |view| is made invisible.
- // Note: |view| is expected to have already been positioned and sized
- // vertically.
- void LayoutView(views::View* view,
- int padding,
- int available_width,
- bool leading,
- gfx::Rect* bounds);
-
- // Update the visibility state of the Content Blocked icons to reflect what is
- // actually blocked on the current page.
- void RefreshContentSettingViews();
-
- // Delete all page action views that we have created.
- void DeletePageActionViews();
-
- // Update the views for the Page Actions, to reflect state changes for
- // PageActions.
- void RefreshPageActionViews();
-
- // Sets the visibility of view to new_vis.
- void ToggleVisibility(bool new_vis, views::View* view);
-
-#if defined(OS_WIN)
- // Helper for the Mouse event handlers that does all the real work.
- void OnMouseEvent(const views::MouseEvent& event, UINT msg);
-#endif
-
- // Helper to show the first run info bubble.
- void ShowFirstRunBubbleInternal(FirstRun::BubbleType bubble_type);
-
- // Current profile. Not owned by us.
- Profile* profile_;
-
- // The Autocomplete Edit field.
-#if defined(OS_WIN)
- scoped_ptr<AutocompleteEditViewWin> location_entry_;
-#else
- scoped_ptr<AutocompleteEditViewGtk> location_entry_;
-#endif
-
- // The CommandUpdater for the Browser object that corresponds to this View.
- CommandUpdater* command_updater_;
-
- // The model.
- ToolbarModel* model_;
-
- // Our delegate.
- Delegate* delegate_;
-
- // This is the string of text from the autocompletion session that the user
- // entered or selected.
- 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_;
-
- // Font used by edit and some of the hints.
- gfx::Font font_;
-
- // An object used to paint the normal-mode background.
- scoped_ptr<views::HorizontalPainter> painter_;
-
- // An icon to the left of the edit field.
- LocationIconView* location_icon_view_;
-
- // A bubble displayed for EV HTTPS sites.
- EVBubbleView* ev_bubble_view_;
-
- // Location_entry view wrapper
- views::NativeViewHost* location_entry_view_;
-
- // The following views are used to provide hints and remind the user as to
- // what is going in the edit. They are all added a children of the
- // LocationBarView. At most one is visible at a time. Preference is
- // given to the keyword_view_, then hint_view_.
- // These autocollapse when the edit needs the room.
-
- // Shown if the user has selected a keyword.
- SelectedKeywordView* selected_keyword_view_;
-
- // View responsible for showing suggested text. This is NULL when there is no
- // suggested text.
- views::Label* suggested_text_view_;
-
- // Shown if the selected url has a corresponding keyword.
- KeywordHintView* keyword_hint_view_;
-
- // The content setting views.
- ContentSettingViews content_setting_views_;
-
- // The page action icon views.
- PageActionViews page_action_views_;
-
- // The star.
- StarView* star_view_;
-
- // The mode that dictates how the bar shows.
- Mode mode_;
-
- // True if we should show a focus rect while the location entry field is
- // focused. Used when the toolbar is in full keyboard accessibility mode.
- bool show_focus_rect_;
-
- // Whether bubble text is short or long.
- FirstRun::BubbleType bubble_type_;
-
- // This is in case we're destroyed before the model loads. We store the model
- // because calling profile_->GetTemplateURLModel() in the destructor causes a
- // crash.
- TemplateURLModel* template_url_model_;
-
-#if defined(OS_LINUX)
- scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
-#endif
-
- // Should instant be updated? This is set to false in OnAutocompleteWillAccept
- // and true in OnAutocompleteAccept. This is needed as prior to accepting an
- // autocomplete suggestion the model is reverted which triggers resetting
- // instant.
- bool update_instant_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView);
-};
+#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_
+
diff --git a/chrome/browser/views/location_bar/location_icon_view.h b/chrome/browser/views/location_bar/location_icon_view.h
index 524da4e..d0de238 100644
--- a/chrome/browser/views/location_bar/location_icon_view.h
+++ b/chrome/browser/views/location_bar/location_icon_view.h
@@ -6,30 +6,8 @@
#define CHROME_BROWSER_VIEWS_LOCATION_BAR_LOCATION_ICON_VIEW_H_
#pragma once
-#include "chrome/browser/views/location_bar/click_handler.h"
-#include "views/controls/image_view.h"
-
-class LocationBarView;
-namespace views {
-class MouseEvent;
-}
-
-// LocationIconView is used to display an icon to the left of the edit field.
-// This shows the user's current action while editing, the page security
-// status on https pages, or a globe for other URLs.
-class LocationIconView : public views::ImageView {
- public:
- explicit LocationIconView(const LocationBarView* location_bar);
- virtual ~LocationIconView();
-
- // Overridden from view.
- virtual bool OnMousePressed(const views::MouseEvent& event);
- virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
-
- private:
- ClickHandler click_handler_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(LocationIconView);
-};
+#include "chrome/browser/ui/views/location_bar/location_icon_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_LOCATION_ICON_VIEW_H_
+
diff --git a/chrome/browser/views/location_bar/page_action_image_view.h b/chrome/browser/views/location_bar/page_action_image_view.h
index 71ee6c3..aa01f4d 100644
--- a/chrome/browser/views/location_bar/page_action_image_view.h
+++ b/chrome/browser/views/location_bar/page_action_image_view.h
@@ -6,108 +6,8 @@
#define CHROME_BROWSER_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_
#pragma once
-#include <map>
-#include <string>
-
-#include "base/scoped_ptr.h"
-#include "chrome/browser/extensions/image_loading_tracker.h"
-#include "chrome/browser/extensions/extension_context_menu_model.h"
-#include "chrome/browser/views/extensions/extension_popup.h"
-#include "views/controls/image_view.h"
-
-class LocationBarView;
-namespace views {
-class Menu2;
-};
-
-// PageActionImageView is used by the LocationBarView to display the icon for a
-// given PageAction and notify the extension when the icon is clicked.
-class PageActionImageView : public views::ImageView,
- public ImageLoadingTracker::Observer,
- public ExtensionContextMenuModel::PopupDelegate,
- public ExtensionPopup::Observer {
- public:
- PageActionImageView(LocationBarView* owner,
- Profile* profile,
- ExtensionAction* page_action);
- virtual ~PageActionImageView();
-
- ExtensionAction* page_action() { return page_action_; }
-
- int current_tab_id() { return current_tab_id_; }
-
- void set_preview_enabled(bool preview_enabled) {
- preview_enabled_ = preview_enabled;
- }
-
- // Overridden from view.
- virtual AccessibilityTypes::Role GetAccessibleRole();
- virtual bool OnMousePressed(const views::MouseEvent& event);
- virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
- virtual bool OnKeyPressed(const views::KeyEvent& e);
- virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture);
-
- // Overridden from ImageLoadingTracker.
- virtual void OnImageLoaded(
- SkBitmap* image, ExtensionResource resource, int index);
-
- // Overridden from ExtensionContextMenuModelModel::Delegate
- virtual void InspectPopup(ExtensionAction* action);
-
- // Overridden from ExtensionPopup::Observer
- virtual void ExtensionPopupIsClosing(ExtensionPopup* popup);
-
- // 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, const GURL& url);
-
- // Either notify listeners or show a popup depending on the page action.
- void ExecuteAction(int button, bool inspect_with_devtools);
-
- private:
- // Hides the active popup, if there is one.
- void HidePopup();
-
- // The location bar view that owns us.
- LocationBarView* 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 bitmaps the page actions might need to show, mapped by path.
- typedef std::map<std::string, SkBitmap> PageActionMap;
- PageActionMap page_action_icons_;
-
- // The context menu for this page action.
- scoped_refptr<ExtensionContextMenuModel> context_menu_contents_;
- scoped_ptr<views::Menu2> context_menu_menu_;
-
- // The object that is waiting for the image loading to complete
- // asynchronously.
- ImageLoadingTracker tracker_;
-
- // 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_;
-
- // The string to show for a tooltip;
- std::string tooltip_;
-
- // 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 current popup and the button it came from. NULL if no popup.
- ExtensionPopup* popup_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(PageActionImageView);
-};
+#include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_
+
diff --git a/chrome/browser/views/location_bar/page_action_with_badge_view.h b/chrome/browser/views/location_bar/page_action_with_badge_view.h
index 69d0c36..4bdc71e 100644
--- a/chrome/browser/views/location_bar/page_action_with_badge_view.h
+++ b/chrome/browser/views/location_bar/page_action_with_badge_view.h
@@ -6,32 +6,8 @@
#define CHROME_BROWSER_VIEWS_LOCATION_BAR_PAGE_ACTION_WITH_BADGE_VIEW_H_
#pragma once
-#include "gfx/size.h"
-#include "views/view.h"
-
-class GURL;
-class PageActionImageView;
-class TabContents;
-
-// A container for the PageActionImageView plus its badge.
-class PageActionWithBadgeView : public views::View {
- public:
- explicit PageActionWithBadgeView(PageActionImageView* image_view);
-
- PageActionImageView* image_view() { return image_view_; }
-
- virtual AccessibilityTypes::Role GetAccessibleRole();
- virtual gfx::Size GetPreferredSize();
-
- void UpdateVisibility(TabContents* contents, const GURL& url);
-
- private:
- virtual void Layout();
-
- // The button this view contains.
- PageActionImageView* image_view_;
-
- DISALLOW_COPY_AND_ASSIGN(PageActionWithBadgeView);
-};
+#include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_PAGE_ACTION_WITH_BADGE_VIEW_H_
+
diff --git a/chrome/browser/views/location_bar/selected_keyword_view.h b/chrome/browser/views/location_bar/selected_keyword_view.h
index 0199cea..bce29d0 100644
--- a/chrome/browser/views/location_bar/selected_keyword_view.h
+++ b/chrome/browser/views/location_bar/selected_keyword_view.h
@@ -6,54 +6,8 @@
#define CHROME_BROWSER_VIEWS_LOCATION_BAR_SELECTED_KEYWORD_VIEW_H_
#pragma once
-#include <string>
-
-#include "chrome/browser/views/location_bar/icon_label_bubble_view.h"
-#include "views/controls/label.h"
-
-class Profile;
-namespace gfx {
-class Font;
-class Size;
-}
-
-// SelectedKeywordView displays the tab-to-search UI in the location bar view.
-class SelectedKeywordView : public IconLabelBubbleView {
- public:
- SelectedKeywordView(const int background_images[],
- int contained_image,
- const SkColor& color,
- Profile* profile);
- virtual ~SelectedKeywordView();
-
- void SetFont(const gfx::Font& font);
-
- virtual gfx::Size GetPreferredSize();
- virtual gfx::Size GetMinimumSize();
- virtual void Layout();
-
- // The current keyword, or an empty string if no keyword is displayed.
- void SetKeyword(const std::wstring& keyword);
- std::wstring keyword() const { return keyword_; }
-
- void set_profile(Profile* profile) { profile_ = profile; }
-
- private:
- // The keyword we're showing. If empty, no keyword is selected.
- // NOTE: we don't cache the TemplateURL as it is possible for it to get
- // deleted out from under us.
- std::wstring keyword_;
-
- // These labels are never visible. They are used to size the view. One
- // label contains the complete description of the keyword, the second
- // contains a truncated version of the description, for if there is not
- // enough room to display the complete description.
- views::Label full_label_;
- views::Label partial_label_;
-
- Profile* profile_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(SelectedKeywordView);
-};
+#include "chrome/browser/ui/views/location_bar/selected_keyword_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_SELECTED_KEYWORD_VIEW_H_
+
diff --git a/chrome/browser/views/location_bar/star_view.h b/chrome/browser/views/location_bar/star_view.h
index 8e8794c..a964d14 100644
--- a/chrome/browser/views/location_bar/star_view.h
+++ b/chrome/browser/views/location_bar/star_view.h
@@ -6,43 +6,8 @@
#define CHROME_BROWSER_VIEWS_LOCATION_BAR_STAR_VIEW_H_
#pragma once
-#include "chrome/browser/views/info_bubble.h"
-#include "views/controls/image_view.h"
-
-class CommandUpdater;
-class InfoBubble;
-
-namespace views {
-class KeyEvent;
-class MouseEvent;
-}
-
-class StarView : public views::ImageView, public InfoBubbleDelegate {
- public:
- explicit StarView(CommandUpdater* command_updater);
- virtual ~StarView();
-
- // Toggles the star on or off.
- void SetToggled(bool on);
-
- private:
- // views::ImageView overrides:
- virtual AccessibilityTypes::Role GetAccessibleRole();
- virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip);
- virtual bool OnMousePressed(const views::MouseEvent& event);
- virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
- virtual bool OnKeyPressed(const views::KeyEvent& e);
-
- // InfoBubbleDelegate overrides:
- virtual void InfoBubbleClosing(InfoBubble* info_bubble,
- bool closed_by_escape);
- virtual bool CloseOnEscape();
- virtual bool FadeInOnShow() { return false; }
-
- // The CommandUpdater for the Browser object that owns the location bar.
- CommandUpdater* command_updater_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(StarView);
-};
+#include "chrome/browser/ui/views/location_bar/star_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_STAR_VIEW_H_
+
diff --git a/chrome/browser/views/login_view.h b/chrome/browser/views/login_view.h
index b4c133a..bb45e10 100644
--- a/chrome/browser/views/login_view.h
+++ b/chrome/browser/views/login_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,8 @@
#define CHROME_BROWSER_VIEWS_LOGIN_VIEW_H_
#pragma once
-#include "base/task.h"
-#include "chrome/browser/login_model.h"
-#include "views/view.h"
-
-namespace views {
-class Label;
-class Textfield;
-class LoginModel;
-} // namespace views
-
-// This class is responsible for displaying the contents of a login window
-// for HTTP/FTP authentication.
-class LoginView : public views::View, public LoginModelObserver {
- public:
- // |focus_view| indicates if the view can be focused.
- LoginView(const std::wstring& explanation, bool focus_view);
- virtual ~LoginView();
-
- // Access the data in the username/password text fields.
- std::wstring GetUsername();
- std::wstring GetPassword();
-
- // LoginModelObserver implementation.
- virtual void OnAutofillDataAvailable(const std::wstring& username,
- const std::wstring& password);
-
- // Sets the model. This lets the observer notify the model
- // when it has been closed / freed, so the model should no longer try and
- // contact it. The view does not own the model, and it is the responsibility
- // of the caller to inform this view if the model is deleted.
- void SetModel(LoginModel* model);
-
- virtual void RequestFocus();
-
- protected:
- // views::View overrides:
- virtual void ViewHierarchyChanged(bool is_add, views::View *parent,
- views::View *child);
-
- virtual void NativeViewHierarchyChanged(bool attached,
- gfx::NativeView native_view,
- views::RootView* root_view);
-
- private:
- void FocusFirstField();
-
- // Non-owning refs to the input text fields.
- views::Textfield* username_field_;
- views::Textfield* password_field_;
-
- // Button labels
- views::Label* username_label_;
- views::Label* password_label_;
-
- // Authentication message.
- views::Label* message_label_;
-
- // If not null, points to a model we need to notify of our own destruction
- // so it doesn't try and access this when its too late.
- LoginModel* login_model_;
-
- ScopedRunnableMethodFactory<LoginView> focus_grabber_factory_;
-
- // See description above constructor.
- const bool focus_view_;
-
- // Indicates that this view was created when focus manager was unavailable
- // (on the hidden tab, for example). This is only used if focus_view_ is true.
- bool focus_delayed_;
-
- DISALLOW_COPY_AND_ASSIGN(LoginView);
-};
+#include "chrome/browser/ui/views/login_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_LOGIN_VIEW_H_
+
diff --git a/chrome/browser/views/modal_dialog_delegate.h b/chrome/browser/views/modal_dialog_delegate.h
index ad7125e..06cba14 100644
--- a/chrome/browser/views/modal_dialog_delegate.h
+++ b/chrome/browser/views/modal_dialog_delegate.h
@@ -6,26 +6,8 @@
#define CHROME_BROWSER_VIEWS_MODAL_DIALOG_DELEGATE_H_
#pragma once
-#include "views/window/dialog_delegate.h"
-
-namespace views {
-class Window;
-}
-
-class ModalDialogDelegate : public views::DialogDelegate {
- public:
- virtual ~ModalDialogDelegate() {}
- // Methods called from AppModalDialog.
- virtual gfx::NativeWindow GetDialogRootWindow() = 0;
- virtual void ShowModalDialog();
- virtual void ActivateModalDialog();
- virtual void CloseModalDialog();
- protected:
- ModalDialogDelegate();
-
- // The dialog if it is currently visible.
- views::Window* dialog_;
-};
+#include "chrome/browser/ui/views/modal_dialog_delegate.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_MODAL_DIALOG_DELEGATE_H_
diff --git a/chrome/browser/views/notifications/balloon_view.h b/chrome/browser/views/notifications/balloon_view.h
index ad4380e..2896feb 100644
--- a/chrome/browser/views/notifications/balloon_view.h
+++ b/chrome/browser/views/notifications/balloon_view.h
@@ -2,170 +2,12 @@
// 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_VIEWS_NOTIFICATIONS_BALLOON_VIEW_H_
#define CHROME_BROWSER_VIEWS_NOTIFICATIONS_BALLOON_VIEW_H_
#pragma once
-#include "app/slide_animation.h"
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "base/task.h"
-#include "chrome/browser/notifications/balloon.h"
-#include "chrome/browser/views/notifications/balloon_view_host.h"
-#include "chrome/common/notification_registrar.h"
-#include "chrome/common/notification_service.h"
-#include "gfx/path.h"
-#include "gfx/point.h"
-#include "gfx/rect.h"
-#include "gfx/size.h"
-#include "views/controls/button/menu_button.h"
-#include "views/controls/label.h"
-#include "views/controls/menu/view_menu_delegate.h"
-#include "views/view.h"
-#include "views/widget/widget_delegate.h"
-
-namespace views {
-class ButtonListener;
-class ImageButton;
-class ImagePainter;
-class TextButton;
-class WidgetWin;
-class Menu2;
-} // namespace views
-
-class BalloonCollection;
-class NotificationDetails;
-class NotificationOptionsMenuModel;
-class NotificationSource;
-
-// A balloon view is the UI component for a desktop notification toasts.
-// It draws a border, and within the border an HTML renderer.
-class BalloonViewImpl : public BalloonView,
- public views::View,
- public views::ViewMenuDelegate,
- public views::WidgetDelegate,
- public views::ButtonListener,
- public NotificationObserver,
- public 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 { return html_contents_.get(); }
-
- private:
- // views::View interface.
- virtual void Paint(gfx::Canvas* canvas);
- virtual void DidChangeBounds(const gfx::Rect& previous,
- const gfx::Rect& current);
- virtual gfx::Size GetPreferredSize() {
- return gfx::Size(1000, 1000);
- }
-
- // views::ViewMenuDelegate interface.
- void RunMenu(views::View* source, const gfx::Point& pt);
-
- // views::WidgetDelegate interface.
- void DisplayChanged();
- void WorkAreaChanged();
-
- // views::ButtonListener interface.
- virtual void ButtonPressed(views::Button* sender, const views::Event&);
-
- // NotificationObserver interface.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // AnimationDelegate interface.
- virtual void AnimationProgressed(const Animation* animation);
-
- // Launches the options menu at screen coordinates |pt|.
- void RunOptionsMenu(const gfx::Point& pt);
-
- // Initializes the options menu.
- void CreateOptionsMenu();
-
- // Masks the contents to fit within the frame.
- void GetContentsMask(const gfx::Rect& contents_rect, gfx::Path* path) const;
-
- // Masks the frame for the rounded corners of the shadow-bubble.
- void GetFrameMask(const gfx::Rect&, gfx::Path* path) const;
-
- // Adjust the contents window size to be appropriate for the frame.
- void SizeContentsWindow();
-
- // 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 height of the part of the frame around the balloon.
- int GetBalloonFrameHeight() const;
-
- int GetTotalWidth() const;
- int GetTotalHeight() const;
-
- gfx::Rect GetCloseButtonBounds() const;
- gfx::Rect GetOptionsButtonBounds() const;
- gfx::Rect GetLabelBounds() 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;
-
- // Non-owned pointer to the balloon which owns this object.
- Balloon* balloon_;
-
- // Non-owned pointer to the balloon collection this is a part of.
- BalloonCollection* collection_;
-
- // The window that contains the frame of the notification.
- // Pointer owned by the View subclass.
- views::Widget* frame_container_;
-
- // The window that contains the contents of the notification.
- // Pointer owned by the View subclass.
- views::Widget* 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_;
-
- // Pointer to sub-view is owned by the View sub-class.
- views::ImageButton* close_button_;
-
- // Pointer to sub-view is owned by View class.
- views::Label* source_label_;
-
- // An animation to move the balloon on the screen as its position changes.
- scoped_ptr<SlideAnimation> animation_;
- gfx::Rect anim_frame_start_;
- gfx::Rect anim_frame_end_;
-
- // The options menu.
- scoped_ptr<NotificationOptionsMenuModel> options_menu_model_;
- scoped_ptr<views::Menu2> options_menu_menu_;
- views::MenuButton* options_menu_button_;
-
- NotificationRegistrar notification_registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(BalloonViewImpl);
-};
+#include "chrome/browser/ui/views/notifications/balloon_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_NOTIFICATIONS_BALLOON_VIEW_H_
+
diff --git a/chrome/browser/views/notifications/balloon_view_host.h b/chrome/browser/views/notifications/balloon_view_host.h
index 94e47e4..2c1a302 100644
--- a/chrome/browser/views/notifications/balloon_view_host.h
+++ b/chrome/browser/views/notifications/balloon_view_host.h
@@ -6,54 +6,8 @@
#define CHROME_BROWSER_VIEWS_NOTIFICATIONS_BALLOON_VIEW_HOST_H_
#pragma once
-#include "chrome/browser/notifications/balloon_host.h"
-#include "views/controls/native/native_view_host.h"
-
-// 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);
-
- virtual ~BalloonViewHost() {
- Shutdown();
- }
-
- void SetPreferredSize(const gfx::Size& size) {
- native_host_->SetPreferredSize(size);
- }
-
- // Accessors.
- views::View* view() {
- return native_host_;
- }
-
- gfx::NativeView native_view() const {
- return native_host_->native_view();
- }
-
- // Initialize the view, parented to |parent|, and show it.
- void Init(gfx::NativeView parent);
-
- protected:
- virtual void InitRenderWidgetHostView();
- virtual RenderWidgetHostView* render_widget_host_view() const {
- return render_widget_host_view_;
- }
-
- private:
- // The platform-specific widget host view. Pointer is owned by the RVH.
- RenderWidgetHostView* render_widget_host_view_;
-
- // The views-specific host view. Pointer owned by the views hierarchy.
- views::NativeViewHost* native_host_;
-
- // The handle to the parent view.
- gfx::NativeView parent_native_view_;
-
- DISALLOW_COPY_AND_ASSIGN(BalloonViewHost);
-};
+#include "chrome/browser/ui/views/notifications/balloon_view_host.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_NOTIFICATIONS_BALLOON_VIEW_HOST_H_
+
diff --git a/chrome/browser/views/options/advanced_contents_view.h b/chrome/browser/views/options/advanced_contents_view.h
index 5adf493..9026e82 100644
--- a/chrome/browser/views/options/advanced_contents_view.h
+++ b/chrome/browser/views/options/advanced_contents_view.h
@@ -2,38 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_VIEWS_OPTIONS_ADVANCED_CONTENTS_VIEW_H__
-#define CHROME_BROWSER_VIEWS_OPTIONS_ADVANCED_CONTENTS_VIEW_H__
+#ifndef CHROME_BROWSER_VIEWS_OPTIONS_ADVANCED_CONTENTS_VIEW_H_
+#define CHROME_BROWSER_VIEWS_OPTIONS_ADVANCED_CONTENTS_VIEW_H_
#pragma once
-#include "chrome/browser/views/options/options_page_view.h"
+#include "chrome/browser/ui/views/options/advanced_contents_view.h"
+// TODO(beng): remove this file once all includes have been updated.
-class AdvancedContentsView;
-namespace views {
-class ScrollView;
-}
+#endif // CHROME_BROWSER_VIEWS_OPTIONS_ADVANCED_CONTENTS_VIEW_H_
-///////////////////////////////////////////////////////////////////////////////
-// AdvancedScrollViewContainer
-//
-// A View that contains a scroll view containing the Advanced options.
-
-class AdvancedScrollViewContainer : public views::View {
- public:
- explicit AdvancedScrollViewContainer(Profile* profile);
- virtual ~AdvancedScrollViewContainer();
-
- // views::View overrides:
- virtual void Layout();
-
- private:
- // The contents of the advanced scroll view.
- AdvancedContentsView* contents_view_;
-
- // The scroll view that contains the advanced options.
- views::ScrollView* scroll_view_;
-
- DISALLOW_COPY_AND_ASSIGN(AdvancedScrollViewContainer);
-};
-
-#endif // CHROME_BROWSER_VIEWS_OPTIONS_ADVANCED_CONTENTS_VIEW_H__
diff --git a/chrome/browser/views/options/advanced_page_view.h b/chrome/browser/views/options/advanced_page_view.h
index 8075021..dccd66e 100644
--- a/chrome/browser/views/options/advanced_page_view.h
+++ b/chrome/browser/views/options/advanced_page_view.h
@@ -6,41 +6,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_ADVANCED_PAGE_VIEW_H_
#pragma once
-#include "chrome/browser/views/options/options_page_view.h"
-#include "views/controls/button/button.h"
-
-class AdvancedOptionsListModel;
-class AdvancedScrollViewContainer;
-class PrefService;
-namespace views {
-class NativeButton;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// AdvancedPageView
-
-class AdvancedPageView : public OptionsPageView,
- public views::ButtonListener {
- public:
- explicit AdvancedPageView(Profile* profile);
- virtual ~AdvancedPageView();
-
- // Resets all prefs to their default values.
- void ResetToDefaults();
-
- // views::ButtonListener implementation:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- protected:
- // OptionsPageView implementation:
- virtual void InitControlLayout();
-
- private:
- // Controls for the Advanced page
- AdvancedScrollViewContainer* advanced_scroll_view_;
- views::NativeButton* reset_to_default_button_;
-
- DISALLOW_COPY_AND_ASSIGN(AdvancedPageView);
-};
+#include "chrome/browser/ui/views/options/advanced_page_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_ADVANCED_PAGE_VIEW_H_
+
diff --git a/chrome/browser/views/options/content_exceptions_table_view.h b/chrome/browser/views/options/content_exceptions_table_view.h
index ac5511f..6cc48fb 100644
--- a/chrome/browser/views/options/content_exceptions_table_view.h
+++ b/chrome/browser/views/options/content_exceptions_table_view.h
@@ -6,26 +6,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_EXCEPTIONS_TABLE_VIEW_H_
#pragma once
-#include "chrome/browser/content_exceptions_table_model.h"
-#include "views/controls/table/table_view.h"
-
-// A thin wrapper around TableView that displays off-the-record entries in
-// italics.
-class ContentExceptionsTableView : public views::TableView {
- public:
- ContentExceptionsTableView(ContentExceptionsTableModel* model,
- const std::vector<TableColumn>& columns);
-
- virtual ~ContentExceptionsTableView() {}
-
- private:
- virtual bool GetCellColors(int model_row,
- int column,
- ItemColor* foreground,
- ItemColor* background,
- LOGFONT* logfont);
-
- ContentExceptionsTableModel* exceptions_;
-};
+#include "chrome/browser/ui/views/options/content_exceptions_table_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_EXCEPTIONS_TABLE_VIEW_H_
+
diff --git a/chrome/browser/views/options/content_filter_page_view.h b/chrome/browser/views/options/content_filter_page_view.h
index 8c9bd99..0a1115e 100644
--- a/chrome/browser/views/options/content_filter_page_view.h
+++ b/chrome/browser/views/options/content_filter_page_view.h
@@ -6,44 +6,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_FILTER_PAGE_VIEW_H_
#pragma once
-#include "chrome/browser/views/options/options_page_view.h"
-#include "chrome/common/content_settings_types.h"
-#include "views/controls/button/button.h"
-
-namespace views {
-class Label;
-class NativeButton;
-class RadioButton;
-}
-class PrefService;
-
-////////////////////////////////////////////////////////////////////////////////
-// The ContentFilterPageView class is used to render the Images, JavaScript,
-// Pop-ups and Location pages in the Content Settings window.
-
-class ContentFilterPageView : public OptionsPageView,
- public views::ButtonListener {
- public:
- ContentFilterPageView(Profile* profile, ContentSettingsType content_type);
- virtual ~ContentFilterPageView();
-
- protected:
- // OptionsPageView implementation:
- virtual void InitControlLayout();
-
- // views::ButtonListener implementation:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- private:
- ContentSettingsType content_type_;
-
- // Controls for the content filter tab page.
- views::RadioButton* allow_radio_;
- views::RadioButton* ask_radio_;
- views::RadioButton* block_radio_;
- views::NativeButton* exceptions_button_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(ContentFilterPageView);
-};
+#include "chrome/browser/ui/views/options/content_filter_page_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_FILTER_PAGE_VIEW_H_
+
diff --git a/chrome/browser/views/options/content_page_view.h b/chrome/browser/views/options/content_page_view.h
index 181f8a1..1335775 100644
--- a/chrome/browser/views/options/content_page_view.h
+++ b/chrome/browser/views/options/content_page_view.h
@@ -6,112 +6,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_PAGE_VIEW_H_
#pragma once
-#include "chrome/browser/autofill/personal_data_manager.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/browser/sync/profile_sync_service.h"
-#include "chrome/browser/views/options/options_page_view.h"
-#include "chrome/browser/views/confirm_message_box_dialog.h"
-#include "views/controls/button/button.h"
-#include "views/controls/link.h"
-#include "views/view.h"
-
-namespace views {
-class Checkbox;
-class Label;
-class NativeButton;
-class RadioButton;
-}
-class FileDisplayArea;
-class OptionsGroupView;
-class PrefService;
-
-////////////////////////////////////////////////////////////////////////////////
-// ContentPageView
-
-class ContentPageView : public OptionsPageView,
- public views::LinkController,
- public ProfileSyncServiceObserver,
- public views::ButtonListener,
- public ConfirmMessageBoxObserver {
- public:
- explicit ContentPageView(Profile* profile);
- virtual ~ContentPageView();
-
- // views::ButtonListener implementation:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // views::LinkController method.
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- // ConfirmMessageBoxObserver implementation.
- virtual void OnConfirmMessageAccept();
-
- // ProfileSyncServiceObserver method.
- virtual void OnStateChanged();
-
- protected:
- // OptionsPageView implementation:
- virtual void InitControlLayout();
- virtual void NotifyPrefChanged(const std::string* pref_name);
-
- // views::View overrides:
- virtual void Layout();
-
- private:
- // Updates various sync controls based on the current sync state.
- void UpdateSyncControls();
-
- // Returns whether initialization of controls is done or not.
- bool is_initialized() const {
- // If initialization is already done, all the UI controls data members
- // should be non-NULL. So check for one of them to determine if controls
- // are already initialized or not.
- return sync_group_ != NULL;
- }
-
- // Init all the dialog controls.
- void InitPasswordSavingGroup();
- void InitFormAutofillGroup();
- void InitBrowsingDataGroup();
- void InitThemesGroup();
- void InitSyncGroup();
-
- // Controls for the Password Saving group
- views::NativeButton* show_passwords_button_;
- OptionsGroupView* passwords_group_;
- views::RadioButton* passwords_asktosave_radio_;
- views::RadioButton* passwords_neversave_radio_;
-
- // Controls for the Form Autofill group
- views::NativeButton* change_autofill_settings_button_;
- OptionsGroupView* form_autofill_group_;
-
- // Controls for the Themes group
- OptionsGroupView* themes_group_;
- views::NativeButton* themes_reset_button_;
- views::Link* themes_gallery_link_;
-
- // Controls for the browsing data group.
- OptionsGroupView* browsing_data_group_;
- views::NativeButton* import_button_;
-
- // Controls for the Sync group.
- OptionsGroupView* sync_group_;
- views::Label* sync_status_label_;
- views::Link* sync_action_link_;
- views::NativeButton* sync_start_stop_button_;
- views::NativeButton* sync_customize_button_;
- views::Link* privacy_dashboard_link_;
-
- BooleanPrefMember ask_to_save_passwords_;
- BooleanPrefMember form_autofill_enabled_;
- StringPrefMember is_using_default_theme_;
-
- // Cached pointer to ProfileSyncService, if it exists. Kept up to date
- // and NULL-ed out on destruction.
- ProfileSyncService* sync_service_;
-
- DISALLOW_COPY_AND_ASSIGN(ContentPageView);
-};
+#include "chrome/browser/ui/views/options/content_page_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_PAGE_VIEW_H_
+
diff --git a/chrome/browser/views/options/content_settings_window_view.h b/chrome/browser/views/options/content_settings_window_view.h
index 2b843b4..a3bc919 100644
--- a/chrome/browser/views/options/content_settings_window_view.h
+++ b/chrome/browser/views/options/content_settings_window_view.h
@@ -6,87 +6,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_SETTINGS_WINDOW_VIEW_H_
#pragma once
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/common/content_settings_types.h"
-#include "views/controls/listbox/listbox.h"
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
-
-class Profile;
-class MessageLoop;
-class OptionsPageView;
-
-namespace views {
-class Label;
-} // namespace views
-
-///////////////////////////////////////////////////////////////////////////////
-// ContentSettingsWindowView
-//
-// The contents of the Options dialog window.
-//
-class ContentSettingsWindowView : public views::View,
- public views::DialogDelegate,
- public views::Listbox::Listener {
- public:
- explicit ContentSettingsWindowView(Profile* profile);
- virtual ~ContentSettingsWindowView();
-
- // Shows the Tab corresponding to the specified Content Settings page.
- void ShowContentSettingsTab(ContentSettingsType page);
-
- protected:
- // views::View overrides:
- virtual void Layout();
- virtual gfx::Size GetPreferredSize();
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
-
- // views::DialogDelegate implementation:
- virtual int GetDialogButtons() const {
- return MessageBoxFlags::DIALOGBUTTON_CANCEL;
- }
- virtual std::wstring GetWindowTitle() const;
- virtual void WindowClosing();
- virtual bool Cancel();
- virtual views::View* GetContentsView();
-
- // views::Listbox::Listener implementation:
- virtual void ListboxSelectionChanged(views::Listbox* sender);
-
- private:
- // Initializes the view.
- void Init();
-
- // Makes |pages_[page]| the currently visible page.
- void ShowSettingsPage(int page);
-
- // Returns the currently selected OptionsPageView.
- const OptionsPageView* GetCurrentContentSettingsTabView() const;
-
- // The Profile associated with these options.
- Profile* profile_;
-
- // The label above the left box.
- views::Label* label_;
-
- // The listbox used to select a page.
- views::Listbox* listbox_;
-
- // The last page the user was on when they opened the Options window.
- IntegerPrefMember last_selected_page_;
-
- // Stores the index of the currently visible page.
- int current_page_;
-
- // Stores the possible content pages displayed on the right.
- // |pages_[current_page_]| is the currently displayed page, and it's the only
- // parented View in |pages_|.
- std::vector<View*> pages_;
-
- DISALLOW_COPY_AND_ASSIGN(ContentSettingsWindowView);
-};
+#include "chrome/browser/ui/views/options/content_settings_window_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_SETTINGS_WINDOW_VIEW_H_
diff --git a/chrome/browser/views/options/cookie_filter_page_view.h b/chrome/browser/views/options/cookie_filter_page_view.h
index 0b9b9f7..3168e0e 100644
--- a/chrome/browser/views/options/cookie_filter_page_view.h
+++ b/chrome/browser/views/options/cookie_filter_page_view.h
@@ -6,47 +6,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_COOKIE_FILTER_PAGE_VIEW_H_
#pragma once
-#include "chrome/browser/views/options/content_filter_page_view.h"
-
-#include "chrome/browser/prefs/pref_member.h"
-
-namespace views {
-class Checkbox;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// CookieFilterPageView class is used to render the cookie content settings tab.
-
-class CookieFilterPageView : public ContentFilterPageView,
- public views::LinkController {
- public:
- explicit CookieFilterPageView(Profile* profile);
- virtual ~CookieFilterPageView();
-
- private:
- // Overridden from ContentFilterPageView:
- virtual void InitControlLayout();
-
- // OptionsPageView implementation:
- virtual void NotifyPrefChanged(const std::string* pref_name);
-
- // views::ButtonListener implementation:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Overridden from views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- private:
- // Controls for the cookie filter tab page view.
- views::Checkbox* block_3rdparty_check_;
- views::Checkbox* clear_on_close_check_;
- views::NativeButton* show_cookies_button_;
-
- // Clear locally stored site data on exit pref.
- BooleanPrefMember clear_site_data_on_exit_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(CookieFilterPageView);
-};
+#include "chrome/browser/ui/views/options/cookie_filter_page_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_COOKIE_FILTER_PAGE_VIEW_H_
diff --git a/chrome/browser/views/options/cookies_view.h b/chrome/browser/views/options/cookies_view.h
index dc6b9ff..dd74019 100644
--- a/chrome/browser/views/options/cookies_view.h
+++ b/chrome/browser/views/options/cookies_view.h
@@ -6,154 +6,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_COOKIES_VIEW_H_
#pragma once
-#include <string>
-
-#include "base/task.h"
-#include "chrome/browser/cookies_tree_model.h"
-#include "net/base/cookie_monster.h"
-#include "views/controls/button/button.h"
-#include "views/controls/tree/tree_view.h"
-#include "views/controls/textfield/textfield.h"
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
-#include "views/window/window.h"
-
-namespace views {
-
-class Label;
-class NativeButton;
-
-} // namespace views
-
-
-class AppCacheInfoView;
-class CookieInfoView;
-class CookiesTreeView;
-class DatabaseInfoView;
-class IndexedDBInfoView;
-class LocalStorageInfoView;
-class Profile;
-class Timer;
-class TreeModel;
-class TreeModelNode;
-
-
-class CookiesView : public CookiesTreeModel::Observer,
- public views::View,
- public views::DialogDelegate,
- public views::ButtonListener,
- public views::TreeViewController,
- public views::Textfield::Controller {
- public:
- // Show the Cookies Window, creating one if necessary.
- static void ShowCookiesWindow(Profile* profile);
-
- virtual ~CookiesView();
-
- // Updates the display to show only the search results.
- void UpdateSearchResults();
-
- // 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.
-
- // views::ButtonListener implementation.
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // views::TreeViewController implementation.
- virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view);
-
- // views::TreeViewController implementation.
- virtual void OnTreeViewKeyDown(app::KeyboardCode keycode);
-
- // views::Textfield::Controller implementation.
- virtual void ContentsChanged(views::Textfield* sender,
- const std::wstring& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& key);
-
- // views::WindowDelegate implementation.
- virtual int GetDialogButtons() const {
- return MessageBoxFlags::DIALOGBUTTON_CANCEL;
- }
- virtual views::View* GetInitiallyFocusedView() {
- return search_field_;
- }
-
- virtual bool CanResize() const { return true; }
- virtual std::wstring GetWindowTitle() const;
- virtual void WindowClosing();
- virtual views::View* GetContentsView();
-
- // views::View overrides:
- virtual void Layout();
- virtual gfx::Size GetPreferredSize();
-
- protected:
- // views::View overrides:
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
-
- private:
- class InfoPanelView;
-
- // Use the static factory method to show.
- explicit CookiesView(Profile* profile);
-
- // Initialize the dialog contents and layout.
- void Init();
-
- // Resets the display to what it would be if there were no search query.
- void ResetSearchQuery();
-
- // Update the UI when there are no cookies.
- void UpdateForEmptyState();
-
- // Enable or disable the remove and remove all buttons.
- void UpdateRemoveButtonsState();
-
- // Updates view to be visible inside detailed_info_view_;
- void UpdateVisibleDetailedInfo(views::View* view);
-
- // Assorted dialog controls
- views::Label* search_label_;
- views::Textfield* search_field_;
- views::NativeButton* clear_search_button_;
- views::Label* description_label_;
- CookiesTreeView* cookies_tree_;
- InfoPanelView* info_panel_;
- CookieInfoView* cookie_info_view_;
- DatabaseInfoView* database_info_view_;
- LocalStorageInfoView* local_storage_info_view_;
- AppCacheInfoView* appcache_info_view_;
- IndexedDBInfoView* indexed_db_info_view_;
- views::NativeButton* remove_button_;
- views::NativeButton* remove_all_button_;
-
- // The Cookies Tree model
- scoped_ptr<CookiesTreeModel> cookies_tree_model_;
-
- // The Profile for which Cookies are displayed
- Profile* profile_;
-
- // 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> search_update_factory_;
-
- // Our containing window. If this is non-NULL there is a visible Cookies
- // window somewhere.
- static views::Window* instance_;
-
- DISALLOW_COPY_AND_ASSIGN(CookiesView);
-};
+#include "chrome/browser/ui/views/options/cookies_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_COOKIES_VIEW_H_
+
diff --git a/chrome/browser/views/options/exception_editor_view.h b/chrome/browser/views/options/exception_editor_view.h
index 3dfab19..fb63617 100644
--- a/chrome/browser/views/options/exception_editor_view.h
+++ b/chrome/browser/views/options/exception_editor_view.h
@@ -6,109 +6,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_
#pragma once
-#include <string>
-
-#include "chrome/browser/content_setting_combo_model.h"
-#include "chrome/browser/host_content_settings_map.h"
-#include "chrome/common/content_settings.h"
-#include "chrome/common/content_settings_types.h"
-#include "views/window/dialog_delegate.h"
-#include "views/controls/button/checkbox.h"
-#include "views/controls/combobox/combobox.h"
-#include "views/controls/textfield/textfield.h"
-
-namespace views {
-class ImageView;
-class Label;
-}
-
-class ContentExceptionsTableModel;
-
-// ExceptionEditorView is responsible for showing a dialog that allows the user
-// to create or edit a single content exception. If the user clicks ok the
-// delegate is notified and completes the edit.
-//
-// To use an ExceptionEditorView create one and invoke Show on it.
-// ExceptionEditorView is deleted when the dialog closes.
-class ExceptionEditorView : public views::View,
- public views::Textfield::Controller,
- public views::DialogDelegate {
- public:
- class Delegate {
- public:
- // Invoked when the user accepts the edit.
- virtual void AcceptExceptionEdit(
- const HostContentSettingsMap::Pattern& pattern,
- ContentSetting setting,
- bool is_off_the_record,
- int index,
- bool is_new) = 0;
-
- protected:
- virtual ~Delegate() {}
- };
-
- // Creates a new ExceptionEditorView with the supplied args. |index| is the
- // index into the ContentExceptionsTableModel of the exception. This is not
- // used by ExceptionEditorView but instead passed to the delegate.
- ExceptionEditorView(Delegate* delegate,
- ContentExceptionsTableModel* model,
- bool allow_off_the_record,
- int index,
- const HostContentSettingsMap::Pattern& pattern,
- ContentSetting setting,
- bool is_off_the_record);
- virtual ~ExceptionEditorView() {}
-
- void Show(gfx::NativeWindow parent);
-
- // views::DialogDelegate overrides.
- virtual bool IsModal() const;
- virtual std::wstring GetWindowTitle() const;
- virtual bool IsDialogButtonEnabled(
- MessageBoxFlags::DialogButton button) const;
- virtual bool Cancel();
- virtual bool Accept();
- virtual views::View* GetContentsView();
-
- // views::Textfield::Controller overrides. Updates whether the user can
- // accept the dialog as well as updating image views showing whether value is
- // valid.
- virtual void ContentsChanged(views::Textfield* sender,
- const std::wstring& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& key);
-
- private:
- void Init();
-
- views::Label* CreateLabel(int message_id);
-
- // Returns true if we're adding a new item.
- bool is_new() const { return index_ == -1; }
-
- bool IsPatternValid(const HostContentSettingsMap::Pattern& pattern,
- bool is_off_the_record) const;
-
- void UpdateImageView(views::ImageView* image_view, bool is_valid);
-
- Delegate* delegate_;
- ContentExceptionsTableModel* model_;
- ContentSettingComboModel cb_model_;
-
- // Index of the item being edited. If -1, indices this is a new entry.
- const bool allow_off_the_record_;
- const int index_;
- const HostContentSettingsMap::Pattern pattern_;
- const ContentSetting setting_;
- const bool is_off_the_record_;
-
- views::Textfield* pattern_tf_;
- views::ImageView* pattern_iv_;
- views::Combobox* action_cb_;
- views::Checkbox* incognito_cb_;
-
- DISALLOW_COPY_AND_ASSIGN(ExceptionEditorView);
-};
+#include "chrome/browser/ui/views/options/exception_editor_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_
+
diff --git a/chrome/browser/views/options/exceptions_page_view.h b/chrome/browser/views/options/exceptions_page_view.h
index 9417118..c9eab58 100644
--- a/chrome/browser/views/options/exceptions_page_view.h
+++ b/chrome/browser/views/options/exceptions_page_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTIONS_PAGE_VIEW_H_
#pragma once
-#include <vector>
-
-#include "chrome/browser/views/options/options_page_view.h"
-#include "chrome/browser/views/options/passwords_page_view.h"
-#include "views/controls/table/table_view_observer.h"
-
-class Profile;
-
-///////////////////////////////////////////////////////////////////////////////
-// ExceptionsTableModel
-class ExceptionsTableModel : public PasswordsTableModel {
- public:
- explicit ExceptionsTableModel(Profile* profile);
- virtual ~ExceptionsTableModel();
-
- // TableModel methods.
- virtual std::wstring GetText(int row, int column);
- virtual int CompareValues(int row1, int row2, int col_id);
-
- // PasswordStoreConsumer implementation.
- virtual void OnPasswordStoreRequestDone(
- int handle, const std::vector<webkit_glue::PasswordForm*>& result);
- // Request all logins data.
- void GetAllExceptionsForProfile();
-};
-
-///////////////////////////////////////////////////////////////////////////////
-// ExceptionsPageView
-class ExceptionsPageView : public OptionsPageView,
- public views::TableViewObserver,
- public views::ButtonListener,
- public PasswordsTableModelObserver {
- public:
- explicit ExceptionsPageView(Profile* profile);
- virtual ~ExceptionsPageView();
-
- // views::TableViewObserverImplementation.
- virtual void OnSelectionChanged();
-
- // views::ButtonListener implementation.
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // PasswordsTableModelObserver implementation.
- virtual void OnRowCountChanged(size_t rows);
-
- protected:
- virtual void InitControlLayout();
-
- private:
- // Helper to configure our buttons and labels.
- void SetupButtons();
-
- // Helper to configure our table view.
- void SetupTable();
-
- ExceptionsTableModel table_model_;
- views::TableView* table_view_;
-
- // The buttons and labels.
- views::NativeButton remove_button_;
- views::NativeButton remove_all_button_;
- MultiLabelButtons show_button_;
-
- DISALLOW_COPY_AND_ASSIGN(ExceptionsPageView);
-};
+#include "chrome/browser/ui/views/options/exceptions_page_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTIONS_PAGE_VIEW_H_
+
diff --git a/chrome/browser/views/options/exceptions_view.h b/chrome/browser/views/options/exceptions_view.h
index 4e66e6d..6ff6f02 100644
--- a/chrome/browser/views/options/exceptions_view.h
+++ b/chrome/browser/views/options/exceptions_view.h
@@ -6,112 +6,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTIONS_VIEW_H_
#pragma once
-#include <string>
-
-#include "chrome/browser/content_exceptions_table_model.h"
-#include "chrome/browser/views/options/exception_editor_view.h"
-#include "chrome/common/content_settings.h"
-#include "chrome/common/content_settings_types.h"
-#include "views/controls/button/button.h"
-#include "views/controls/table/table_view_observer.h"
-#include "views/window/dialog_delegate.h"
-
-class HostContentSettingsMap;
-
-namespace views {
-class NativeButton;
-class TableView;
-}
-
-// ExceptionsView is responsible for showing the user the set of content
-// exceptions for a specific type. The exceptions are shown in a table view
-// by way of a ContentExceptionsTableModel. The user can add/edit/remove
-// exceptions. Editing and creating new exceptions is done way of the
-// ExceptionEditorView.
-// Use the ShowExceptionsWindow method to create and show an ExceptionsView
-// for a specific type. ExceptionsView is deleted when the window closes.
-class ExceptionsView : public ExceptionEditorView::Delegate,
- public views::View,
- public views::ButtonListener,
- public views::DialogDelegate,
- public views::TableViewObserver {
- public:
- // Shows the Exceptions window.
- static void ShowExceptionsWindow(gfx::NativeWindow parent,
- HostContentSettingsMap* map,
- HostContentSettingsMap* off_the_record_map,
- ContentSettingsType content_type);
-
- virtual ~ExceptionsView();
-
- // TableViewObserver overrides:
- virtual void OnSelectionChanged();
- virtual void OnDoubleClick();
- virtual void OnTableViewDelete(views::TableView* table_view);
-
- // views::ButtonListener implementation.
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // views::View overrides:
- virtual void Layout();
- virtual gfx::Size GetPreferredSize();
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
-
- // views::WindowDelegate implementation.
- virtual int GetDialogButtons() const {
- return MessageBoxFlags::DIALOGBUTTON_CANCEL;
- }
- virtual bool CanResize() const { return true; }
- virtual std::wstring GetWindowTitle() const;
- virtual views::View* GetContentsView() { return this; }
-
- // ExceptionEditorView::Delegate implementation.
- virtual void AcceptExceptionEdit(
- const HostContentSettingsMap::Pattern& pattern,
- ContentSetting setting,
- bool is_off_the_record,
- int index,
- bool is_new);
-
- private:
- ExceptionsView(HostContentSettingsMap* map,
- HostContentSettingsMap* off_the_record_map,
- ContentSettingsType type);
-
- void Init();
-
- // Resets the enabled state of the buttons from the model.
- void UpdateButtonState();
-
- // Adds a new item.
- void Add();
-
- // Edits the selected item.
- void Edit();
-
- // Removes the selected item.
- void Remove();
-
- // Removes all.
- void RemoveAll();
-
- // The model displayed in the table.
- ContentExceptionsTableModel model_;
-
- // True if the user can also add off the record entries.
- bool allow_off_the_record_;
-
- views::TableView* table_;
-
- views::NativeButton* add_button_;
- views::NativeButton* edit_button_;
- views::NativeButton* remove_button_;
- views::NativeButton* remove_all_button_;
-
- DISALLOW_COPY_AND_ASSIGN(ExceptionsView);
-};
+#include "chrome/browser/ui/views/options/exceptions_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTIONS_VIEW_H_
diff --git a/chrome/browser/views/options/fonts_languages_window_view.h b/chrome/browser/views/options/fonts_languages_window_view.h
index 4af9d01..1702d9a 100644
--- a/chrome/browser/views/options/fonts_languages_window_view.h
+++ b/chrome/browser/views/options/fonts_languages_window_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,69 +6,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_FONTS_LANGUAGES_WINDOW_VIEW_H_
#pragma once
-#include "chrome/browser/fonts_languages_window.h"
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
-
-class Profile;
-class FontsPageView;
-class LanguagesPageView;
-
-namespace views {
-class TabbedPane;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// FontsLanguagesWindowView
-//
-// The contents of the "Fonts and Languages Preferences" dialog window.
-//
-class FontsLanguagesWindowView : public views::View,
- public views::DialogDelegate {
- public:
- explicit FontsLanguagesWindowView(Profile* profile);
- virtual ~FontsLanguagesWindowView();
-
- // views::DialogDelegate implementation:
- virtual bool Accept();
-
- // views::WindowDelegate Methods:
- virtual bool IsModal() const { return true; }
- virtual std::wstring GetWindowTitle() const;
- virtual views::View* GetContentsView();
- virtual void WindowClosing();
-
- // views::View overrides:
- virtual void Layout();
- virtual gfx::Size GetPreferredSize();
-
- // Shows the tab corresponding to the specified |page|.
- void ShowTabPage(FontsLanguagesPage page);
-
- protected:
- // views::View overrides:
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
- private:
- // Init the assorted Tabbed pages
- void Init();
-
- // The Tab view that contains all of the options pages.
- views::TabbedPane* tabs_;
-
- // Fonts Page View handle remembered so that prefs is updated only when
- // OK is pressed.
- FontsPageView* fonts_page_;
-
- // Languages Page View handle remembered so that prefs is updated only when
- // OK is pressed.
- LanguagesPageView* languages_page_;
-
- // The Profile associated with these options.
- Profile* profile_;
-
- DISALLOW_COPY_AND_ASSIGN(FontsLanguagesWindowView);
-};
+#include "chrome/browser/ui/views/options/fonts_languages_window_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_FONTS_LANGUAGES_WINDOW_VIEW_H_
+
diff --git a/chrome/browser/views/options/fonts_page_view.h b/chrome/browser/views/options/fonts_page_view.h
index 477bf91..22cad00 100644
--- a/chrome/browser/views/options/fonts_page_view.h
+++ b/chrome/browser/views/options/fonts_page_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,125 +6,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_FONTS_PAGE_VIEW_H_
#pragma once
-#include <string>
-
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/browser/shell_dialogs.h"
-#include "chrome/browser/views/options/options_page_view.h"
-#include "views/controls/combobox/combobox.h"
-#include "views/controls/button/button.h"
-#include "views/view.h"
-
-namespace views {
-class GroupboxView;
-class Label;
-class NativeButton;
-class TableView;
-}
-
-class DefaultEncodingComboboxModel;
-class FontDisplayView;
-class TableModel;
-
-///////////////////////////////////////////////////////////////////////////////
-// FontsPageView
-
-class FontsPageView : public OptionsPageView,
- public views::Combobox::Listener,
- public SelectFontDialog::Listener,
- public views::ButtonListener {
- public:
- explicit FontsPageView(Profile* profile);
-
- // views::ButtonListener implementation:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // views::Combobox::Listener implementation:
- virtual void ItemChanged(views::Combobox* combo_box,
- int prev_index,
- int new_index);
-
- // SelectFontDialog::Listener implementation:
- virtual void FontSelected(const gfx::Font& font, void* params);
-
- // Save Changes made to relevent pref members associated with this tab.
- // This is public since it is called by FontsLanguageWindowView in its
- // Dialog Delegate Accept() method.
- void SaveChanges();
-
- protected:
- // OptionsPageView implementation:
- virtual void InitControlLayout();
- virtual void NotifyPrefChanged(const std::string* pref_name);
-
- private:
- enum FontTypeBeingChanged {
- NONE,
- SERIF,
- SANS_SERIF,
- FIXED_WIDTH
- };
-
- virtual ~FontsPageView();
-
- // Init Dialog controls.
- void InitFontLayout();
- void InitEncodingLayout();
-
- bool serif_button_pressed_;
- bool sans_serif_button_pressed_;
- bool fixed_width_button_pressed_;
- bool encoding_dropdown_clicked_;
-
- views::Label* fonts_group_title_;
- views::Label* encoding_group_title_;
-
- views::View* fonts_contents_;
- views::View* encoding_contents_;
-
- // Fonts settings.
- // Select Font dialogs.
- scoped_refptr<SelectFontDialog> select_font_dialog_;
-
- // Buttons.
- views::NativeButton* fixed_width_font_change_page_button_;
- views::NativeButton* serif_font_change_page_button_;
- views::NativeButton* sans_serif_font_change_page_button_;
-
- // FontDisplayView objects to display selected font.
- FontDisplayView* fixed_width_font_display_view_;
- FontDisplayView* serif_font_display_view_;
- FontDisplayView* sans_serif_font_display_view_;
-
- // Labels to describe what is to be changed.
- views::Label* fixed_width_font_label_;
- views::Label* serif_font_label_;
- views::Label* sans_serif_font_label_;
-
- // Advanced Font names and sizes as PrefMembers.
- StringPrefMember serif_name_;
- StringPrefMember sans_serif_name_;
- StringPrefMember fixed_width_name_;
- IntegerPrefMember serif_size_;
- IntegerPrefMember sans_serif_size_;
- IntegerPrefMember fixed_width_size_;
- int serif_font_size_pixel_;
- int sans_serif_font_size_pixel_;
- int fixed_width_font_size_pixel_;
- StringPrefMember default_encoding_;
- bool font_changed_;
-
- // Windows font picker flag;
- FontTypeBeingChanged font_type_being_changed_;
-
- // Default Encoding.
- scoped_ptr<DefaultEncodingComboboxModel> default_encoding_combobox_model_;
- views::Label* default_encoding_combobox_label_;
- views::Combobox* default_encoding_combobox_;
- std::string default_encoding_selected_;
- bool default_encoding_changed_;
-
- DISALLOW_COPY_AND_ASSIGN(FontsPageView);
-};
+#include "chrome/browser/ui/views/options/fonts_page_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_FONTS_PAGE_VIEW_H_
+
diff --git a/chrome/browser/views/options/general_page_view.h b/chrome/browser/views/options/general_page_view.h
index a663c82..f9072e1 100644
--- a/chrome/browser/views/options/general_page_view.h
+++ b/chrome/browser/views/options/general_page_view.h
@@ -6,167 +6,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_GENERAL_PAGE_VIEW_H_
#pragma once
-#include "chrome/browser/prefs/pref_change_registrar.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/browser/shell_integration.h"
-#include "chrome/browser/views/options/options_page_view.h"
-#include "chrome/browser/views/url_picker.h"
-#include "views/controls/combobox/combobox.h"
-#include "views/controls/button/button.h"
-#include "views/controls/link.h"
-#include "views/controls/table/table_view_observer.h"
-#include "views/view.h"
-
-namespace views {
-class Checkbox;
-class GroupboxView;
-class Label;
-class NativeButton;
-class RadioButton;
-class TableView;
-class Textfield;
-}
-class CustomHomePagesTableModel;
-class OptionsGroupView;
-class SearchEngineListModel;
-class TableModel;
-
-///////////////////////////////////////////////////////////////////////////////
-// GeneralPageView
-
-class GeneralPageView : public OptionsPageView,
- public views::Combobox::Listener,
- public views::ButtonListener,
- public views::Textfield::Controller,
- public UrlPickerDelegate,
- public views::TableViewObserver,
- public ShellIntegration::DefaultBrowserObserver,
- public views::LinkController {
- public:
- explicit GeneralPageView(Profile* profile);
- virtual ~GeneralPageView();
-
- protected:
- // views::ButtonListener implementation:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // views::Combobox::Listener implementation:
- virtual void ItemChanged(views::Combobox* combobox,
- int prev_index,
- int new_index);
-
- // views::Textfield::Controller implementation:
- virtual void ContentsChanged(views::Textfield* sender,
- const std::wstring& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& key);
-
- // OptionsPageView implementation:
- virtual void InitControlLayout();
- virtual void NotifyPrefChanged(const std::string* pref_name);
- virtual void HighlightGroup(OptionsGroup highlight_group);
-
- // LinkController implementation:
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- private:
- // ShellIntegration::DefaultBrowserObserver implementation:
- // Updates the UI state to reflect the current default browser state.
- virtual void SetDefaultBrowserUIState(
- ShellIntegration::DefaultBrowserUIState state);
-
- // For Side by Side installs, this will disable the Default Browser setting
- // and display an explanitory message.
- void SetDefaultBrowserUIStateForSxS();
-
- // Init all the dialog controls
- void InitStartupGroup();
- void InitHomepageGroup();
- void InitDefaultSearchGroup();
- void InitDefaultBrowserGroup();
-
- // Saves the startup preference from that of the ui.
- void SaveStartupPref();
-
- // Shows a dialog allowing the user to add a new URL to the set of URLs
- // launched on startup.
- void AddURLToStartupURLs();
-
- // Removes the selected URL from the list of startup urls.
- void RemoveURLsFromStartupURLs();
-
- // Resets the list of urls to launch on startup from the list of open
- // browsers.
- void SetStartupURLToCurrentPage();
-
- // Enables/Disables the controls associated with the custom start pages
- // option if that preference is not selected.
- void EnableCustomHomepagesControls(bool enable);
-
- // UrlPickerDelegate. Adds the URL to the list of startup urls.
- virtual void AddBookmark(UrlPicker* dialog,
- const std::wstring& title,
- const GURL& url);
-
- // 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();
-
- // Invoked when the selection of the table view changes. Updates the enabled
- // property of the remove button.
- virtual void OnSelectionChanged();
-
- // 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);
-
- // Sets the default search provider for the selected item in the combobox.
- void SetDefaultSearchProvider();
-
- // Controls for the Startup group
- OptionsGroupView* startup_group_;
- views::RadioButton* startup_homepage_radio_;
- views::RadioButton* startup_last_session_radio_;
- views::RadioButton* startup_custom_radio_;
- views::NativeButton* startup_add_custom_page_button_;
- views::NativeButton* startup_remove_custom_page_button_;
- views::NativeButton* startup_use_current_page_button_;
- views::TableView* startup_custom_pages_table_;
- scoped_ptr<CustomHomePagesTableModel> startup_custom_pages_table_model_;
-
- // Controls for the Home Page group
- OptionsGroupView* homepage_group_;
- views::RadioButton* homepage_use_newtab_radio_;
- views::RadioButton* homepage_use_url_radio_;
- views::Textfield* homepage_use_url_textfield_;
- views::Checkbox* homepage_show_home_button_checkbox_;
- BooleanPrefMember new_tab_page_is_home_page_;
- StringPrefMember homepage_;
- BooleanPrefMember show_home_button_;
-
- // Controls for the Search group
- OptionsGroupView* default_search_group_;
- views::Combobox* default_search_engine_combobox_;
- views::NativeButton* default_search_manage_engines_button_;
- scoped_ptr<SearchEngineListModel> default_search_engines_model_;
- views::Checkbox* instant_checkbox_;
- views::Link* instant_link_;
-
- // Controls for the Default Browser group
- OptionsGroupView* default_browser_group_;
- views::Label* default_browser_status_label_;
- views::NativeButton* default_browser_use_as_default_button_;
-
- // The helper object that performs default browser set/check tasks.
- scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_;
-
- PrefChangeRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(GeneralPageView);
-};
+#include "chrome/browser/ui/views/options/general_page_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_GENERAL_PAGE_VIEW_H_
+
diff --git a/chrome/browser/views/options/languages_page_view.h b/chrome/browser/views/options/languages_page_view.h
index ace044e..722a893 100644
--- a/chrome/browser/views/options/languages_page_view.h
+++ b/chrome/browser/views/options/languages_page_view.h
@@ -2,118 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_VIEWS_OPTIONS_LANGUAGES_PAGE_VIEW_H__
-#define CHROME_BROWSER_VIEWS_OPTIONS_LANGUAGES_PAGE_VIEW_H__
+#ifndef CHROME_BROWSER_VIEWS_OPTIONS_LANGUAGES_PAGE_VIEW_H_
+#define CHROME_BROWSER_VIEWS_OPTIONS_LANGUAGES_PAGE_VIEW_H_
#pragma once
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/browser/views/options/options_page_view.h"
-#include "views/controls/combobox/combobox.h"
-#include "views/controls/button/button.h"
-#include "views/controls/table/table_view_observer.h"
-#include "views/view.h"
+#include "chrome/browser/ui/views/options/languages_page_view.h"
+// TODO(beng): remove this file once all includes have been updated.
-namespace views {
-class Checkbox;
-class Label;
-class NativeButton;
-class TableView;
-}
+#endif // CHROME_BROWSER_VIEWS_OPTIONS_LANGUAGES_PAGE_VIEW_H_
-class AddLanguageView;
-class LanguageComboboxModel;
-class LanguageOrderTableModel;
-class TableModel;
-
-///////////////////////////////////////////////////////////////////////////////
-// LanguagesPageView
-
-class LanguagesPageView : public OptionsPageView,
- public views::ButtonListener,
- public views::TableViewObserver,
- public views::Combobox::Listener {
- public:
- explicit LanguagesPageView(Profile* profile);
- virtual ~LanguagesPageView();
-
- // views::ButtonListener implementation:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Save Changes made to relevant pref members associated with this tab.
- // This is public since it is called by FontsLanguageWindowView in its
- // Dialog Delegate Accept() method.
- void SaveChanges();
-
- // This is public because when user clicks OK in AddLanguageView dialog,
- // this is called back in the LanguagePageView delegate in order to add
- // this language to the table model in this tab.
- void OnAddLanguage(const std::string& new_language);
-
- protected:
- // OptionsPageView implementation:
- virtual void InitControlLayout();
- virtual void NotifyPrefChanged(const std::string* pref_name);
-
- // views::Combobox::Listener implementation:
- virtual void ItemChanged(views::Combobox* sender,
- int prev_index,
- int new_index);
-
- private:
- // Invoked when the selection of the table view changes. Updates the enabled
- // property of the remove button.
- virtual void OnSelectionChanged();
- void OnRemoveLanguage();
- void OnMoveDownLanguage();
- void OnMoveUpLanguage();
-
- views::Label* languages_instructions_;
- views::View* languages_contents_;
- views::View* button_stack_;
- views::TableView* language_order_table_;
- views::NativeButton* move_up_button_;
- views::NativeButton* move_down_button_;
- views::NativeButton* add_button_;
- views::NativeButton* remove_button_;
- views::Label* language_info_label_;
- views::Label* ui_language_label_;
- views::Combobox* change_ui_language_combobox_;
- views::Combobox* change_dictionary_language_combobox_;
- views::Checkbox* enable_autospellcorrect_checkbox_;
- views::Checkbox* enable_spellchecking_checkbox_;
- views::Label* dictionary_language_label_;
-
- scoped_ptr<LanguageOrderTableModel> language_order_table_model_;
- AddLanguageView* add_language_instance_;
- StringPrefMember accept_languages_;
-
- // The contents of the "user interface language" combobox.
- scoped_ptr<LanguageComboboxModel> ui_language_model_;
- StringPrefMember app_locale_;
- int ui_language_index_selected_;
- int starting_ui_language_index_;
-
- // The contents of the "dictionary language" combobox.
- scoped_ptr<LanguageComboboxModel> dictionary_language_model_;
- StringPrefMember dictionary_language_;
-
- // SpellChecker enable pref.
- BooleanPrefMember enable_spellcheck_;
-
- // Auto spell correction pref.
- BooleanPrefMember enable_autospellcorrect_;
-
- // This is assigned the new index of spellcheck language if the language
- // is changed. Otherwise, it remains -1, and pref members are not updated.
- int spellcheck_language_index_selected_;
- std::string spellcheck_language_added_;
-
- bool language_table_edited_;
- bool language_warning_shown_;
- bool enable_spellcheck_checkbox_clicked_;
- bool enable_autospellcorrect_checkbox_clicked_;
-
- DISALLOW_COPY_AND_ASSIGN(LanguagesPageView);
-};
-
-#endif // CHROME_BROWSER_VIEWS_OPTIONS_LANGUAGES_PAGE_VIEW_H__
diff --git a/chrome/browser/views/options/managed_prefs_banner_view.h b/chrome/browser/views/options/managed_prefs_banner_view.h
index f34ab30..d1efb86 100644
--- a/chrome/browser/views/options/managed_prefs_banner_view.h
+++ b/chrome/browser/views/options/managed_prefs_banner_view.h
@@ -6,47 +6,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_MANAGED_PREFS_BANNER_VIEW_H_
#pragma once
-#include "chrome/browser/policy/managed_prefs_banner_base.h"
-#include "views/view.h"
-
-namespace views {
-class ImageView;
-class Label;
-}
-
-// Displays a banner showing a warning message that tells the user some options
-// cannot be changed because the relevant preferences are managed by their
-// system administrator.
-class ManagedPrefsBannerView : public policy::ManagedPrefsBannerBase,
- public views::View {
- public:
- // Initialize the banner. |page| is used to determine the names of the
- // preferences that control the banner visibility through their managed flag.
- ManagedPrefsBannerView(PrefService* pref_service, OptionsPage page);
- virtual ~ManagedPrefsBannerView() {}
-
- private:
- // Initialize contents and layout.
- void Init();
-
- // views::View overrides.
- virtual gfx::Size GetPreferredSize();
- virtual void Layout();
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
-
- // ManagedPrefsBannerBase override.
- virtual void OnUpdateVisibility();
-
- // Holds the warning icon image and text label and renders the border.
- views::View* content_;
- // Warning icon image.
- views::ImageView* warning_image_;
- // The label responsible for rendering the warning text.
- views::Label* label_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(ManagedPrefsBannerView);
-};
+#include "chrome/browser/ui/views/options/managed_prefs_banner_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_MANAGED_PREFS_BANNER_VIEW_H_
+
diff --git a/chrome/browser/views/options/options_group_view.h b/chrome/browser/views/options/options_group_view.h
index b79a36e..b3bf71b 100644
--- a/chrome/browser/views/options/options_group_view.h
+++ b/chrome/browser/views/options/options_group_view.h
@@ -2,62 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_GROUP_VIEW_H__
-#define CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_GROUP_VIEW_H__
+#ifndef CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_GROUP_VIEW_H_
+#define CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_GROUP_VIEW_H_
#pragma once
-#include "views/view.h"
+#include "chrome/browser/ui/views/options/options_group_view.h"
+// TODO(beng): remove this file once all includes have been updated.
-namespace views {
-class Label;
-class Separator;
-};
+#endif // CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_GROUP_VIEW_H_
-///////////////////////////////////////////////////////////////////////////////
-// OptionsGroupView
-//
-// A helper View that gathers related options into groups with a title and
-// optional description.
-//
-class OptionsGroupView : public views::View {
- public:
- OptionsGroupView(views::View* contents,
- const std::wstring& title,
- const std::wstring& description,
- bool show_separator);
- virtual ~OptionsGroupView();
-
- // Sets the group as being highlighted to attract attention.
- void SetHighlighted(bool highlighted);
-
- // Retrieves the width of the ContentsView. Used to help size wrapping items.
- int GetContentsWidth() const;
-
- protected:
- // views::View overrides:
- virtual AccessibilityTypes::Role GetAccessibleRole();
- virtual void Paint(gfx::Canvas* canvas);
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
-
- private:
- void Init();
-
- views::View* contents_;
- views::Label* title_label_;
- views::Label* description_label_;
- views::Separator* separator_;
-
- // True if we should show a separator line below the contents of this
- // section.
- bool show_separator_;
-
- // True if this section should have a highlighted treatment to draw the
- // user's attention.
- bool highlighted_;
-
- DISALLOW_COPY_AND_ASSIGN(OptionsGroupView);
-};
-
-#endif // CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_GROUP_VIEW_H__
diff --git a/chrome/browser/views/options/options_page_view.h b/chrome/browser/views/options/options_page_view.h
index 698cb99..2920edb 100644
--- a/chrome/browser/views/options/options_page_view.h
+++ b/chrome/browser/views/options/options_page_view.h
@@ -2,51 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H__
-#define CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H__
+#ifndef CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H_
+#define CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H_
#pragma once
-#include "chrome/browser/options_page_base.h"
-#include "views/controls/link.h"
-#include "views/controls/button/native_button.h"
+#include "chrome/browser/ui/views/options/options_page_view.h"
+// TODO(beng): remove this file once all includes have been updated.
-class PrefService;
+#endif // CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H_
-///////////////////////////////////////////////////////////////////////////////
-// OptionsPageView
-//
-// A base class for Options dialog pages that handles ensuring control
-// initialization is done just once.
-//
-class OptionsPageView : public views::View,
- public OptionsPageBase {
- public:
- virtual ~OptionsPageView();
-
- // Returns true if the window containing this view can be closed, given the
- // current state of this view. This can be used to prevent the window from
- // being closed when a modal dialog box is showing, for example.
- virtual bool CanClose() const { return true; }
-
- protected:
- // This class cannot be instantiated directly, but its constructor must be
- // called by derived classes.
- explicit OptionsPageView(Profile* profile);
-
- // Initializes the layout of the controls within the panel.
- virtual void InitControlLayout() = 0;
-
- // views::View overrides:
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
- virtual AccessibilityTypes::Role GetAccessibleRole();
-
- private:
- // Whether or not the control layout has been initialized for this page.
- bool initialized_;
-
- DISALLOW_COPY_AND_ASSIGN(OptionsPageView);
-};
-
-#endif // CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H__
diff --git a/chrome/browser/views/options/passwords_exceptions_window_view.h b/chrome/browser/views/options/passwords_exceptions_window_view.h
index df98697..7adbd5f 100644
--- a/chrome/browser/views/options/passwords_exceptions_window_view.h
+++ b/chrome/browser/views/options/passwords_exceptions_window_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_PASSWORDS_EXCEPTIONS_WINDOW_VIEW_H_
#pragma once
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
-
-class Profile;
-class PasswordsPageView;
-class ExceptionsPageView;
-
-namespace views {
-class TabbedPane;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// PasswordsExceptionsWindowView
-//
-// The contents of the "Save passwords and exceptions" dialog window.
-//
-class PasswordsExceptionsWindowView : public views::View,
- public views::DialogDelegate {
- public:
- explicit PasswordsExceptionsWindowView(Profile* profile);
- virtual ~PasswordsExceptionsWindowView() {}
-
- // Show the PasswordManagerExceptionsView for the given profile.
- static void Show(Profile* profile);
-
- // views::View methods.
- virtual void Layout();
- virtual gfx::Size GetPreferredSize();
- virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
- views::View* child);
-
- // views::DialogDelegate methods:
- virtual int GetDialogButtons() const;
- virtual bool CanResize() const { return true; }
- virtual bool CanMaximize() const { return false; }
- virtual bool IsAlwaysOnTop() const { return false; }
- virtual bool HasAlwaysOnTopMenu() const { return false; }
- virtual std::wstring GetWindowTitle() const;
- virtual void WindowClosing();
- virtual views::View* GetContentsView();
-
- private:
- void Init();
-
- // The Tab view that contains all of the options pages.
- views::TabbedPane* tabs_;
-
- PasswordsPageView* passwords_page_view_;
-
- ExceptionsPageView* exceptions_page_view_;
-
- Profile* profile_;
-
- static PasswordsExceptionsWindowView* instance_;
-
- DISALLOW_COPY_AND_ASSIGN(PasswordsExceptionsWindowView);
-};
+#include "chrome/browser/ui/views/options/passwords_exceptions_window_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_PASSWORDS_EXCEPTIONS_WINDOW_VIEW_H_
+
diff --git a/chrome/browser/views/options/passwords_page_view.h b/chrome/browser/views/options/passwords_page_view.h
index 418fcbe..2c4612a 100644
--- a/chrome/browser/views/options/passwords_page_view.h
+++ b/chrome/browser/views/options/passwords_page_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,195 +6,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_PASSWORDS_PAGE_VIEW_H_
#pragma once
-#include <vector>
-
-#include "app/table_model.h"
-#include "app/text_elider.h"
-#include "base/scoped_ptr.h"
-#include "base/stl_util-inl.h"
-#include "chrome/browser/password_manager/password_store.h"
-#include "chrome/browser/profile.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/browser/views/confirm_message_box_dialog.h"
-#include "chrome/browser/views/options/options_page_view.h"
-#include "views/controls/button/native_button.h"
-#include "views/controls/label.h"
-#include "views/controls/table/table_view.h"
-#include "views/controls/table/table_view_observer.h"
-#include "views/window/dialog_delegate.h"
-#include "views/window/window.h"
-#include "webkit/glue/password_form.h"
-
-///////////////////////////////////////////////////////////////////////////////
-// PasswordTableModelObserver
-// An observer interface to notify change of row count in a table model. This
-// allow the container view of TableView(i.e. PasswordsPageView and
-// ExceptionsPageView), to be notified of row count changes directly
-// from the TableModel. We have two different observers in
-// PasswordsTableModel, namely TableModelObserver and
-// PasswordsTableModelObserver, rather than adding this event to
-// TableModelObserver because only container view of
-// PasswordsTableModel cares about this event.
-class PasswordsTableModelObserver {
- public:
- virtual void OnRowCountChanged(size_t rows) = 0;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-// MultiLabelButtons
-// A button that can have 2 different labels set on it and for which the
-// preferred size is the size of the widest string.
-class MultiLabelButtons : public views::NativeButton {
- public:
- MultiLabelButtons(views::ButtonListener* listener,
- const std::wstring& label,
- const std::wstring& alt_label);
-
- virtual gfx::Size GetPreferredSize();
-
- private:
- std::wstring label_;
- std::wstring alt_label_;
- gfx::Size pref_size_;
-
- DISALLOW_COPY_AND_ASSIGN(MultiLabelButtons);
-};
-
-///////////////////////////////////////////////////////////////////////////////
-// PasswordsTableModel
-class PasswordsTableModel : public TableModel,
- public PasswordStoreConsumer {
- public:
- explicit PasswordsTableModel(Profile* profile);
- virtual ~PasswordsTableModel();
-
- // TableModel methods.
- virtual int RowCount();
- virtual std::wstring GetText(int row, int column);
- virtual int CompareValues(int row1, int row2, int column_id);
- virtual void SetObserver(TableModelObserver* observer);
-
- // Delete the PasswordForm at specified row from the database (and remove
- // from view).
- void ForgetAndRemoveSignon(int row);
-
- // Delete all saved signons for the active profile (via web data service),
- // and clear the view.
- void ForgetAndRemoveAllSignons();
-
- // PasswordStoreConsumer implementation.
- virtual void OnPasswordStoreRequestDone(
- int handle, const std::vector<webkit_glue::PasswordForm*>& result);
-
- // Request saved logins data.
- void GetAllSavedLoginsForProfile();
-
- // Return the PasswordForm at the specified index.
- webkit_glue::PasswordForm* GetPasswordFormAt(int row);
-
- // Set the observer who concerns about how many rows are in the table.
- void set_row_count_observer(PasswordsTableModelObserver* observer) {
- row_count_observer_ = observer;
- }
-
- protected:
- // Wraps the PasswordForm from the database and caches the display URL for
- // quick sorting.
- struct PasswordRow {
- PasswordRow(const gfx::SortedDisplayURL& url,
- webkit_glue::PasswordForm* password_form)
- : display_url(url), form(password_form) {
- }
-
- // Contains the URL that is displayed along with the
- gfx::SortedDisplayURL display_url;
-
- // The underlying PasswordForm. We own this.
- scoped_ptr<webkit_glue::PasswordForm> form;
- };
-
- // The password store associated with the currently active profile.
- PasswordStore* password_store() {
- return profile_->GetPasswordStore(Profile::EXPLICIT_ACCESS);
- }
-
- // The TableView observing this model.
- TableModelObserver* observer_;
-
- // Dispatching row count events specific to this password manager table model
- // to this observer.
- PasswordsTableModelObserver* row_count_observer_;
-
- // Handle to any pending PasswordStore login lookup query.
- int pending_login_query_;
-
- // The set of passwords we're showing.
- typedef std::vector<PasswordRow*> PasswordRows;
- PasswordRows saved_signons_;
- STLElementDeleter<PasswordRows> saved_signons_cleanup_;
-
- Profile* profile_;
-
- private:
- // Cancel any pending login query involving a callback.
- void CancelLoginsQuery();
-
- DISALLOW_COPY_AND_ASSIGN(PasswordsTableModel);
-};
-
-///////////////////////////////////////////////////////////////////////////////
-// PasswordsPageView
-class PasswordsPageView : public OptionsPageView,
- public views::TableViewObserver,
- public views::ButtonListener,
- public PasswordsTableModelObserver,
- public ConfirmMessageBoxObserver {
- public:
- explicit PasswordsPageView(Profile* profile);
- virtual ~PasswordsPageView();
-
- // views::TableViewObserverImplementation.
- virtual void OnSelectionChanged();
-
- // views::ButtonListener implementation.
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // PasswordsTableModelObserver implementation.
- virtual void OnRowCountChanged(size_t rows);
-
- // ConfirmMessageBoxObserver implementation.
- virtual void OnConfirmMessageAccept();
-
- protected:
- virtual void InitControlLayout();
-
- private:
- // Helper to configure our buttons and labels.
- void SetupButtonsAndLabels();
-
- // Helper to configure our table view.
- void SetupTable();
-
- // Helper that hides the password.
- void HidePassword();
-
- // Handles changes to the observed preferences and updates the UI.
- void NotifyPrefChanged(const std::string* pref_name);
-
- PasswordsTableModel table_model_;
- views::TableView* table_view_;
-
- // The buttons and labels.
- MultiLabelButtons show_button_;
- views::NativeButton remove_button_;
- views::NativeButton remove_all_button_;
- views::Label password_label_;
- webkit_glue::PasswordForm* current_selected_password_;
-
- // Tracks the preference that controls whether showing passwords is allowed.
- BooleanPrefMember allow_show_passwords_;
-
- DISALLOW_COPY_AND_ASSIGN(PasswordsPageView);
-};
+#include "chrome/browser/ui/views/options/passwords_page_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_PASSWORDS_PAGE_VIEW_H_
+
diff --git a/chrome/browser/views/options/plugin_filter_page_view.h b/chrome/browser/views/options/plugin_filter_page_view.h
index 6dc6af9..d1d4086 100644
--- a/chrome/browser/views/options/plugin_filter_page_view.h
+++ b/chrome/browser/views/options/plugin_filter_page_view.h
@@ -6,27 +6,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_PLUGIN_FILTER_PAGE_VIEW_H_
#pragma once
-#include "chrome/browser/views/options/content_filter_page_view.h"
-
-////////////////////////////////////////////////////////////////////////////////
-// PluginFilterPageView class is used to render the plugin content settings tab.
-
-class PluginFilterPageView : public ContentFilterPageView,
- public views::LinkController {
- public:
- explicit PluginFilterPageView(Profile* profile);
- virtual ~PluginFilterPageView();
-
- private:
- // Overridden from ContentFilterPageView:
- virtual void InitControlLayout();
-
- // Overridden from views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(PluginFilterPageView);
-};
+#include "chrome/browser/ui/views/options/plugin_filter_page_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_PLUGIN_FILTER_PAGE_VIEW_H_
diff --git a/chrome/browser/views/options/simple_content_exceptions_view.h b/chrome/browser/views/options/simple_content_exceptions_view.h
index b0ab00a..6b89cd9 100644
--- a/chrome/browser/views/options/simple_content_exceptions_view.h
+++ b/chrome/browser/views/options/simple_content_exceptions_view.h
@@ -6,90 +6,8 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_VIEW_H_
#pragma once
-#include <string>
-
-#include "chrome/browser/remove_rows_table_model.h"
-#include "chrome/common/content_settings.h"
-#include "views/controls/button/button.h"
-#include "views/controls/table/table_view_observer.h"
-#include "views/window/dialog_delegate.h"
-
-namespace views {
-class NativeButton;
-class TableView;
-}
-
-// SimpleContentExceptionsView is responsible for showing the user the set of
-// site-specific permissions. The exceptions are shown in a table view by way
-// of a RemoveRowsTableModel. The user can remove exceptions.
-// Use the ShowExceptionsWindow method to create and show a
-// SimpleContentExceptionsView, which is deleted when the window closes.
-class SimpleContentExceptionsView : public views::View,
- public views::ButtonListener,
- public views::DialogDelegate,
- public views::TableViewObserver {
- public:
- // Shows the Exceptions window. Takes ownership of |model|.
- static void ShowExceptionsWindow(gfx::NativeWindow parent,
- RemoveRowsTableModel* model,
- int title_message_id);
-
- virtual ~SimpleContentExceptionsView();
-
- // TableViewObserver overrides:
- virtual void OnSelectionChanged();
- virtual void OnTableViewDelete(views::TableView* table_view);
-
- // views::ButtonListener implementation.
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // views::View overrides:
- virtual void Layout();
- virtual gfx::Size GetPreferredSize();
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
-
- // views::WindowDelegate implementation.
- virtual int GetDialogButtons() const {
- return MessageBoxFlags::DIALOGBUTTON_CANCEL;
- }
- virtual bool CanResize() const { return true; }
- virtual std::wstring GetWindowTitle() const;
- virtual views::View* GetContentsView() { return this; }
-
- private:
- // Takes ownership of |model|.
- explicit SimpleContentExceptionsView(RemoveRowsTableModel* model,
- int title_message_id);
-
- void Init();
-
- // Resets the enabled state of the buttons from the model.
- void UpdateButtonState();
-
- // Returns the set of selected rows.
- RemoveRowsTableModel::Rows GetSelectedRows() const;
-
- // Removes the selected item.
- void Remove();
-
- // Removes all.
- void RemoveAll();
-
- // The model displayed in the table.
- scoped_ptr<RemoveRowsTableModel> model_;
-
- views::TableView* table_;
-
- views::NativeButton* remove_button_;
- views::NativeButton* remove_all_button_;
-
- // The message id of the window title.
- int title_message_id_;
-
- DISALLOW_COPY_AND_ASSIGN(SimpleContentExceptionsView);
-};
+#include "chrome/browser/ui/views/options/simple_content_exceptions_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_VIEW_H_
diff --git a/chrome/browser/views/page_info_bubble_view.h b/chrome/browser/views/page_info_bubble_view.h
index cc8d1f0..cb920bb 100644
--- a/chrome/browser/views/page_info_bubble_view.h
+++ b/chrome/browser/views/page_info_bubble_view.h
@@ -6,78 +6,8 @@
#define CHROME_BROWSER_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_
#pragma once
-#include "chrome/browser/page_info_model.h"
-#include "chrome/browser/views/info_bubble.h"
-#include "views/controls/link.h"
-#include "views/view.h"
-
-namespace views {
-class Label;
-}
-
-class PageInfoBubbleView : public views::View,
- public PageInfoModel::PageInfoModelObserver,
- public InfoBubbleDelegate,
- public views::LinkController,
- public AnimationDelegate {
- public:
- PageInfoBubbleView(gfx::NativeWindow parent_window,
- Profile* profile,
- const GURL& url,
- const NavigationEntry::SSLStatus& ssl,
- bool show_history);
- virtual ~PageInfoBubbleView();
-
- // Show the certificate dialog.
- void ShowCertDialog();
-
- void set_info_bubble(InfoBubble* info_bubble) { info_bubble_ = info_bubble; }
-
- // View methods:
- virtual gfx::Size GetPreferredSize();
-
- // PageInfoModel::PageInfoModelObserver methods:
- virtual void ModelChanged();
-
- // InfoBubbleDelegate methods:
- virtual void InfoBubbleClosing(InfoBubble* info_bubble,
- bool closed_by_escape) {}
- virtual bool CloseOnEscape() { return true; }
- virtual bool FadeInOnShow() { return false; }
- virtual std::wstring accessible_name() { return L"PageInfoBubble"; }
-
- // LinkController methods:
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- // Overridden from AnimationDelegate.
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationProgressed(const Animation* animation);
-
- private:
- // Layout the sections within the bubble.
- void LayoutSections();
-
- // The model providing the various section info.
- PageInfoModel model_;
-
- // The parent window of the InfoBubble showing this view.
- gfx::NativeWindow parent_window_;
-
- // The id of the certificate for this page.
- int cert_id_;
-
- InfoBubble* info_bubble_;
-
- // The Help Center link at the bottom of the bubble.
- views::Link* help_center_link_;
-
- // Animation that helps us change size smoothly as more data comes in.
- SlideAnimation resize_animation_;
-
- // The height of the info bubble at the start of the resize animation.
- int animation_start_height_;
-
- DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleView);
-};
+#include "chrome/browser/ui/views/page_info_bubble_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_
+
diff --git a/chrome/browser/views/pinned_contents_info_bubble.h b/chrome/browser/views/pinned_contents_info_bubble.h
index 29cd5972..a2af973 100644
--- a/chrome/browser/views/pinned_contents_info_bubble.h
+++ b/chrome/browser/views/pinned_contents_info_bubble.h
@@ -6,63 +6,8 @@
#define CHROME_BROWSER_VIEWS_PINNED_CONTENTS_INFO_BUBBLE_H_
#pragma once
-#include "chrome/browser/views/info_bubble.h"
-
-// This is a specialization of BorderContents, used to draw a border around
-// an InfoBubble that has its contents pinned to a specific location. See
-// base class for details.
-class PinnedContentsBorderContents : public BorderContents {
- public:
- explicit PinnedContentsBorderContents(const gfx::Point& bubble_anchor)
- : bubble_anchor_(bubble_anchor) {}
-
- // BorderContents overrides:
- virtual void SizeAndGetBounds(
- const gfx::Rect& position_relative_to, // In screen coordinates
- BubbleBorder::ArrowLocation arrow_location,
- bool allow_bubble_offscreen,
- const gfx::Size& contents_size,
- gfx::Rect* contents_bounds, // Returned in window coordinates
- gfx::Rect* window_bounds); // Returned in screen coordinates
-
- private:
- // The location of the pinned contents (in screen coordinates).
- const gfx::Point bubble_anchor_;
-
- DISALLOW_COPY_AND_ASSIGN(PinnedContentsBorderContents);
-};
-
-// A specialization of the InfoBubble. Used to draw an InfoBubble which, in
-// addition to having an arrow pointing to where the user clicked, also shifts
-// the bubble horizontally to fix it to a specific location. See base class
-// for details.
-class PinnedContentsInfoBubble : public InfoBubble {
- public:
- // Shows the InfoBubble (see base class function for details).
- // |bubble_anchor| specifies how far horizontally to shift the bubble in
- // order to anchor its contents. Once the InfoBubble has been anchored its
- // arrow may be pointing to a slightly different |y| location than specified
- // in |position_relative_to|.
- static PinnedContentsInfoBubble* Show(
- views::Widget* parent,
- const gfx::Rect& position_relative_to,
- BubbleBorder::ArrowLocation arrow_location,
- const gfx::Point& bubble_anchor_,
- views::View* contents,
- InfoBubbleDelegate* delegate);
-
- // InfoBubble overrides:
- virtual BorderContents* CreateBorderContents();
-
- private:
- explicit PinnedContentsInfoBubble(const gfx::Point& bubble_anchor)
- : bubble_anchor_(bubble_anchor) {}
- virtual ~PinnedContentsInfoBubble() {}
-
- // The location of the pinned contents (in screen coordinates).
- const gfx::Point bubble_anchor_;
-
- DISALLOW_COPY_AND_ASSIGN(PinnedContentsInfoBubble);
-};
+#include "chrome/browser/ui/views/pinned_contents_info_bubble.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_PINNED_CONTENTS_INFO_BUBBLE_H_
+
diff --git a/chrome/browser/views/reload_button.h b/chrome/browser/views/reload_button.h
index 0c253bf..71118e1 100644
--- a/chrome/browser/views/reload_button.h
+++ b/chrome/browser/views/reload_button.h
@@ -2,81 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_VIEWS_RELOAD_BUTTON_H__
-#define CHROME_BROWSER_VIEWS_RELOAD_BUTTON_H__
+#ifndef CHROME_BROWSER_VIEWS_RELOAD_BUTTON_H_
+#define CHROME_BROWSER_VIEWS_RELOAD_BUTTON_H_
#pragma once
-#include "base/basictypes.h"
-#include "base/gtest_prod_util.h"
-#include "base/timer.h"
-#include "views/controls/button/image_button.h"
+#include "chrome/browser/ui/views/reload_button.h"
+// TODO(beng): remove this file once all includes have been updated.
-class Browser;
-class LocationBarView;
+#endif // CHROME_BROWSER_VIEWS_RELOAD_BUTTON_H_
-////////////////////////////////////////////////////////////////////////////////
-//
-// ReloadButton
-//
-// The reload button in the toolbar, which changes to a stop button when a page
-// load is in progress. Trickiness comes from the desire to have the 'stop'
-// button not change back to 'reload' if the user's mouse is hovering over it
-// (to prevent mis-clicks).
-//
-////////////////////////////////////////////////////////////////////////////////
-
-class ReloadButton : public views::ToggleImageButton,
- public views::ButtonListener {
- public:
- enum Mode { MODE_RELOAD = 0, MODE_STOP };
-
- ReloadButton(LocationBarView* location_bar, Browser* Browser);
- virtual ~ReloadButton();
-
- // Ask for a specified button state. If |force| is true this will be applied
- // immediately.
- void ChangeMode(Mode mode, bool force);
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* /* button */,
- const views::Event& event);
-
- // Overridden from views::View:
- virtual void OnMouseExited(const views::MouseEvent& e);
- virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip);
-
- private:
- friend class ReloadButtonTest;
-
- void OnDoubleClickTimer();
- void OnStopToReloadTimer();
-
- base::OneShotTimer<ReloadButton> double_click_timer_;
- base::OneShotTimer<ReloadButton> stop_to_reload_timer_;
-
- // These may be NULL when testing.
- LocationBarView* location_bar_;
- Browser* 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_;
-
- // 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(ReloadButton);
-};
-
-#endif // CHROME_BROWSER_VIEWS_RELOAD_BUTTON_H__
diff --git a/chrome/browser/views/repost_form_warning_view.h b/chrome/browser/views/repost_form_warning_view.h
index b4e56a6..1dd6888 100644
--- a/chrome/browser/views/repost_form_warning_view.h
+++ b/chrome/browser/views/repost_form_warning_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,52 +6,8 @@
#define CHROME_BROWSER_VIEWS_REPOST_FORM_WARNING_VIEW_H_
#pragma once
-#include "chrome/browser/tab_contents/constrained_window.h"
-#include "chrome/common/notification_registrar.h"
-#include "gfx/native_widget_types.h"
-#include "views/window/dialog_delegate.h"
-
-class ConstrainedWindow;
-class MessageBoxView;
-class NavigationController;
-class RepostFormWarningController;
-class TabContents;
-namespace views {
-class Window;
-}
-
-// 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 RepostFormWarningView : public ConstrainedDialogDelegate {
- public:
- // Use BrowserWindow::ShowRepostFormWarningDialog to use.
- RepostFormWarningView(gfx::NativeWindow parent_window,
- TabContents* tab_contents);
-
- // views::DialogDelegate Methods:
- virtual std::wstring GetWindowTitle() const;
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual void DeleteDelegate();
-
- virtual bool Cancel();
- virtual bool Accept();
-
- // views::WindowDelegate Methods:
- virtual views::View* GetContentsView();
-
- private:
- virtual ~RepostFormWarningView();
-
- // The message box view whose commands we handle.
- MessageBoxView* message_box_view_;
-
- scoped_ptr<RepostFormWarningController> controller_;
-
- DISALLOW_COPY_AND_ASSIGN(RepostFormWarningView);
-};
+#include "chrome/browser/ui/views/repost_form_warning_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_REPOST_FORM_WARNING_VIEW_H_
+
diff --git a/chrome/browser/views/restart_message_box.h b/chrome/browser/views/restart_message_box.h
index 816fe6c..1547e92 100644
--- a/chrome/browser/views/restart_message_box.h
+++ b/chrome/browser/views/restart_message_box.h
@@ -6,38 +6,8 @@
#define CHROME_BROWSER_VIEWS_RESTART_MESSAGE_BOX_H_
#pragma once
-#include "base/basictypes.h"
-#include "gfx/native_widget_types.h"
-#include "views/window/dialog_delegate.h"
-
-class MessageBoxView;
-
-// A dialog box that tells the user that s/he needs to restart Chrome
-// for a change to take effect.
-class RestartMessageBox : public views::DialogDelegate {
- public:
- // This box is modal to |parent_window|.
- static void ShowMessageBox(gfx::NativeWindow parent_window);
-
- protected:
- // views::DialogDelegate:
- virtual int GetDialogButtons() const;
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual std::wstring GetWindowTitle() const;
-
- // views::WindowDelegate:
- virtual void DeleteDelegate();
- virtual bool IsModal() const;
- virtual views::View* GetContentsView();
-
- private:
- explicit RestartMessageBox(gfx::NativeWindow parent_window);
- virtual ~RestartMessageBox();
-
- MessageBoxView* message_box_view_;
-
- DISALLOW_COPY_AND_ASSIGN(RestartMessageBox);
-};
+#include "chrome/browser/ui/views/restart_message_box.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_RESTART_MESSAGE_BOX_H_
+
diff --git a/chrome/browser/views/sad_tab_view.h b/chrome/browser/views/sad_tab_view.h
index 11f26265..f21d8e8 100644
--- a/chrome/browser/views/sad_tab_view.h
+++ b/chrome/browser/views/sad_tab_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,8 @@
#define CHROME_BROWSER_VIEWS_SAD_TAB_VIEW_H_
#pragma once
-#include "base/basictypes.h"
-#include "gfx/font.h"
-#include "views/controls/link.h"
-#include "views/view.h"
+#include "chrome/browser/ui/views/sad_tab_view.h"
+// TODO(beng): remove this file once all includes have been updated.
-class SkBitmap;
-class TabContents;
+#endif // CHROME_BROWSER_VIEWS_SAD_TAB_VIEW_H_
-///////////////////////////////////////////////////////////////////////////////
-//
-// SadTabView
-//
-// A views::View subclass used to render the presentation of the crashed
-// "sad tab" in the browser window when a renderer is destroyed unnaturally.
-//
-///////////////////////////////////////////////////////////////////////////////
-class SadTabView : public views::View,
- public views::LinkController {
- public:
- explicit SadTabView(TabContents* tab_contents);
- virtual ~SadTabView() {}
-
- // Overridden from views::View:
- virtual void Paint(gfx::Canvas* canvas);
- virtual void Layout();
-
- // Overridden from views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
-
- private:
- static void InitClass();
-
- // Assorted resources for display.
- static SkBitmap* sad_tab_bitmap_;
- static gfx::Font* title_font_;
- static gfx::Font* message_font_;
- static std::wstring title_;
- static std::wstring message_;
- static int title_width_;
-
- TabContents* tab_contents_;
- views::Link* learn_more_link_;
-
- // Regions within the display for different components, populated by
- // Layout().
- gfx::Rect icon_bounds_;
- gfx::Rect title_bounds_;
- gfx::Rect message_bounds_;
- gfx::Rect link_bounds_;
-
- DISALLOW_COPY_AND_ASSIGN(SadTabView);
-};
-
-#endif // CHROME_BROWSER_VIEWS_SAD_TAB_VIEW_H__
diff --git a/chrome/browser/views/status_bubble_views.h b/chrome/browser/views/status_bubble_views.h
index 0cd685d..3d10bd4 100644
--- a/chrome/browser/views/status_bubble_views.h
+++ b/chrome/browser/views/status_bubble_views.h
@@ -6,131 +6,8 @@
#define CHROME_BROWSER_VIEWS_STATUS_BUBBLE_VIEWS_H_
#pragma once
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "base/string16.h"
-#include "base/task.h"
-#include "chrome/browser/status_bubble.h"
-#include "googleurl/src/gurl.h"
-#include "gfx/rect.h"
-
-class GURL;
-namespace gfx {
-class Point;
-}
-namespace views {
-class View;
-class Widget;
-}
-
-// StatusBubble displays a bubble of text that fades in, hovers over the
-// browser chrome and fades away when not needed. It is primarily designed
-// to allow users to see where hovered links point to.
-class StatusBubbleViews : public StatusBubble {
- public:
- // How wide the bubble's shadow is.
- static const int kShadowThickness;
-
- // The combined vertical padding above and below the text.
- static const int kTotalVerticalPadding = 7;
-
- // |base_view| is the view that this bubble is positioned relative to.
- explicit StatusBubbleViews(views::View* base_view);
- ~StatusBubbleViews();
-
- views::View* base_view() { return base_view_; }
-
- // Reposition the bubble - as we are using a WS_POPUP for the bubble,
- // we have to manually position it when the browser window moves.
- void Reposition();
-
- // The bubble only has a preferred height: the sum of the height of
- // the font and kTotalVerticalPadding.
- gfx::Size GetPreferredSize();
-
- // Set the bounds of the bubble relative to |base_view_|.
- void SetBounds(int x, int y, int w, int h);
-
- // Set bubble to new width.
- void SetBubbleWidth(int width);
-
- // Overridden from StatusBubble:
- 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);
- virtual void UpdateDownloadShelfVisibility(bool visible);
-
- private:
- class StatusView;
- class StatusViewExpander;
-
- // Initializes the popup and view.
- void Init();
-
- // Attempt to move the status bubble out of the way of the cursor, allowing
- // users to see links in the region normally occupied by the status bubble.
- void AvoidMouse(const gfx::Point& location);
-
- // Returns true if the base_view_'s widget is visible and not minimized.
- bool IsFrameVisible();
-
- // Expand bubble size to accommodate a long URL.
- void ExpandBubble();
-
- // Cancel all waiting expansion animations in the timer.
- void CancelExpandTimer();
-
- // Get the standard width for a status bubble in the current frame size.
- int GetStandardStatusBubbleWidth();
-
- // Get the maximum possible width for a status bubble in the current frame
- // size.
- int GetMaxStatusBubbleWidth();
-
- // The status text we want to display when there are no URLs to display.
- string16 status_text_;
-
- // The url we want to display when there is no status text to display.
- string16 url_text_;
-
- // The original, non-elided URL.
- GURL url_;
-
- // Used to elide the original URL again when we expand it.
- string16 languages_;
-
- // Position relative to the base_view_.
- gfx::Point original_position_;
- // original_position_ adjusted according to the current RTL.
- gfx::Point position_;
- gfx::Size size_;
-
- // How vertically offset the bubble is from its root position_.
- int offset_;
-
- // We use a HWND for the popup so that it may float above any HWNDs in our
- // UI (the location bar, for example).
- scoped_ptr<views::Widget> popup_;
- double opacity_;
-
- views::View* base_view_;
- StatusView* view_;
-
- // Manages the expansion of a status bubble to fit a long URL.
- scoped_ptr<StatusViewExpander> expand_view_;
-
- // If the download shelf is visible, do not obscure it.
- bool download_shelf_is_visible_;
-
- // If the bubble has already been expanded, and encounters a new URL,
- // change size immediately, with no hover.
- bool is_expanded_;
-
- // Times expansion of status bubble when URL is too long for standard width.
- ScopedRunnableMethodFactory<StatusBubbleViews> expand_timer_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(StatusBubbleViews);
-};
+#include "chrome/browser/ui/views/status_bubble_views.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_STATUS_BUBBLE_VIEWS_H_
+
diff --git a/chrome/browser/views/status_icons/status_icon_win.h b/chrome/browser/views/status_icons/status_icon_win.h
index 08545ac..1f7ce62 100644
--- a/chrome/browser/views/status_icons/status_icon_win.h
+++ b/chrome/browser/views/status_icons/status_icon_win.h
@@ -6,60 +6,8 @@
#define CHROME_BROWSER_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_
#pragma once
-#include <windows.h>
-#include <shellapi.h>
-
-#include "base/scoped_handle_win.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/status_icons/status_icon.h"
-
-namespace views {
-class Menu2;
-}
-
-class StatusIconWin : public StatusIcon {
- public:
- // Constructor which provides this icon's unique ID and messaging window.
- StatusIconWin(UINT id, HWND window, UINT message);
- virtual ~StatusIconWin();
-
- // Overridden from StatusIcon:
- virtual void SetImage(const SkBitmap& image);
- virtual void SetPressedImage(const SkBitmap& image);
- virtual void SetToolTip(const string16& tool_tip);
-
- UINT icon_id() const { return icon_id_; }
-
- UINT message_id() const { return message_id_; }
-
- // Handles a click event from the user - if |left_button_click| is true and
- // there is a registered observer, passes the click event to the observer,
- // otherwise displays the context menu if there is one.
- void HandleClickEvent(int x, int y, bool left_button_click);
-
- protected:
- // Overridden from StatusIcon.
- virtual void UpdatePlatformContextMenu(menus::MenuModel* menu);
-
- private:
- void InitIconData(NOTIFYICONDATA* icon_data);
-
- // The unique ID corresponding to this icon.
- UINT icon_id_;
-
- // Window used for processing messages from this icon.
- HWND window_;
-
- // The message identifier used for status icon messages.
- UINT message_id_;
-
- // The currently-displayed icon for the window.
- ScopedHICON icon_;
-
- // Context menu associated with this icon (if any).
- scoped_ptr<views::Menu2> context_menu_;
-
- DISALLOW_COPY_AND_ASSIGN(StatusIconWin);
-};
+#include "chrome/browser/ui/views/status_icons/status_icon_win.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_
+
diff --git a/chrome/browser/views/status_icons/status_tray_win.h b/chrome/browser/views/status_icons/status_tray_win.h
index a2e322c..7d7f301 100644
--- a/chrome/browser/views/status_icons/status_tray_win.h
+++ b/chrome/browser/views/status_icons/status_tray_win.h
@@ -6,38 +6,8 @@
#define CHROME_BROWSER_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_
#pragma once
-#include <windows.h>
-
-#include "chrome/browser/status_icons/status_tray.h"
-
-class StatusTrayWin : public StatusTray {
- public:
- StatusTrayWin();
- ~StatusTrayWin();
-
- // Exposed for testing.
- LRESULT CALLBACK WndProc(HWND hwnd,
- UINT message,
- WPARAM wparam,
- LPARAM lparam);
- protected:
- // Overriden from StatusTray:
- virtual StatusIcon* CreatePlatformStatusIcon();
-
- private:
- // Static callback invoked when a message comes in to our messaging window.
- static LRESULT CALLBACK WndProcStatic(HWND hwnd,
- UINT message,
- WPARAM wparam,
- LPARAM lparam);
-
- // The unique icon ID we will assign to the next icon.
- UINT next_icon_id_;
- // The window used for processing events.
- HWND window_;
-
- DISALLOW_COPY_AND_ASSIGN(StatusTrayWin);
-};
+#include "chrome/browser/ui/views/status_icons/status_tray_win.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_
diff --git a/chrome/browser/views/tab_contents/native_tab_contents_container.h b/chrome/browser/views/tab_contents/native_tab_contents_container.h
index 51e08af..7f2cdfc 100644
--- a/chrome/browser/views/tab_contents/native_tab_contents_container.h
+++ b/chrome/browser/views/tab_contents/native_tab_contents_container.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,43 +6,8 @@
#define CHROME_BROWSER_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_H_
#pragma once
-class RenderViewHost;
-class TabContents;
-class TabContentsContainer;
-namespace views {
-class View;
-}
-
-// An interface that the TabContentsContainer uses to talk to a platform-
-// specific view that hosts the native handle of the TabContents' view.
-class NativeTabContentsContainer {
- public:
- // Creates an appropriate native container for the current platform.
- static NativeTabContentsContainer* CreateNativeContainer(
- TabContentsContainer* container);
-
- // Attaches the new TabContents to the native container.
- virtual void AttachContents(TabContents* contents) = 0;
-
- // Detaches the old TabContents from the native container.
- virtual void DetachContents(TabContents* contents) = 0;
-
- // Tells the container to update less frequently during resizing operations
- // so performance is better.
- virtual void SetFastResize(bool fast_resize) = 0;
-
- // Tells the container that the RenderViewHost for the attached TabContents
- // has changed and it should update focus.
- virtual void RenderViewHostChanged(RenderViewHost* old_host,
- RenderViewHost* new_host) = 0;
-
- // Tells the container that |tab_contents| got the focus.
- virtual void TabContentsFocused(TabContents* tab_contents) = 0;
-
- // Retrieves the views::View that hosts the TabContents.
- virtual views::View* GetView() = 0;
- protected:
- virtual ~NativeTabContentsContainer() {}
-};
+#include "chrome/browser/ui/views/tab_contents/native_tab_contents_container.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_H_
+
diff --git a/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.h b/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.h
index 7de9e26..cab3c2b 100644
--- a/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.h
+++ b/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,8 @@
#define CHROME_BROWSER_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_GTK_H_
#pragma once
-#include <gtk/gtk.h>
-
-#include "chrome/browser/views/tab_contents/native_tab_contents_container.h"
-#include "views/controls/native/native_view_host.h"
-
-class NativeTabContentsContainerGtk : public NativeTabContentsContainer,
- public views::NativeViewHost {
- public:
- explicit NativeTabContentsContainerGtk(TabContentsContainer* container);
- virtual ~NativeTabContentsContainerGtk();
-
- // Overridden from NativeTabContentsContainer:
- virtual void AttachContents(TabContents* contents);
- virtual void DetachContents(TabContents* contents);
- virtual void SetFastResize(bool fast_resize);
- virtual void RenderViewHostChanged(RenderViewHost* old_host,
- RenderViewHost* new_host);
- virtual void TabContentsFocused(TabContents* tab_contents);
- virtual views::View* GetView();
-
- // Overridden from views::View:
- virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e);
- virtual views::FocusTraversable* GetFocusTraversable();
- virtual bool IsFocusable() const;
- virtual void Focus();
- virtual void RequestFocus();
- virtual void AboutToRequestFocusFromTabTraversal(bool reverse);
- virtual AccessibilityTypes::Role GetAccessibleRole();
-
- private:
- TabContentsContainer* container_;
-
- gulong focus_callback_id_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeTabContentsContainerGtk);
-};
+#include "chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_GTK_H_
+
diff --git a/chrome/browser/views/tab_contents/native_tab_contents_container_win.h b/chrome/browser/views/tab_contents/native_tab_contents_container_win.h
index 916ce0f..5418181 100644
--- a/chrome/browser/views/tab_contents/native_tab_contents_container_win.h
+++ b/chrome/browser/views/tab_contents/native_tab_contents_container_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,36 +6,8 @@
#define CHROME_BROWSER_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_WIN_H_
#pragma once
-#include "chrome/browser/views/tab_contents/native_tab_contents_container.h"
-#include "views/controls/native/native_view_host.h"
-
-class NativeTabContentsContainerWin : public NativeTabContentsContainer,
- public views::NativeViewHost {
- public:
- explicit NativeTabContentsContainerWin(TabContentsContainer* container);
- virtual ~NativeTabContentsContainerWin();
-
- // Overridden from NativeTabContentsContainer:
- virtual void AttachContents(TabContents* contents);
- virtual void DetachContents(TabContents* contents);
- virtual void SetFastResize(bool fast_resize);
- virtual void RenderViewHostChanged(RenderViewHost* old_host,
- RenderViewHost* new_host);
- virtual void TabContentsFocused(TabContents* tab_contents);
- virtual views::View* GetView();
-
- // Overridden from views::View:
- virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e);
- virtual bool IsFocusable() const;
- virtual void Focus();
- virtual void RequestFocus();
- virtual void AboutToRequestFocusFromTabTraversal(bool reverse);
- virtual AccessibilityTypes::Role GetAccessibleRole();
-
- private:
- TabContentsContainer* container_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeTabContentsContainerWin);
-};
+#include "chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_WIN_H_
+
diff --git a/chrome/browser/views/tab_contents/render_view_context_menu_views.h b/chrome/browser/views/tab_contents/render_view_context_menu_views.h
index 048dfa9..98e610d 100644
--- a/chrome/browser/views/tab_contents/render_view_context_menu_views.h
+++ b/chrome/browser/views/tab_contents/render_view_context_menu_views.h
@@ -6,42 +6,8 @@
#define CHROME_BROWSER_VIEWS_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_VIEWS_H_
#pragma once
-#include "base/scoped_ptr.h"
-#include "base/scoped_vector.h"
-#include "chrome/browser/tab_contents/render_view_context_menu.h"
-#include "views/controls/menu/menu_2.h"
-
-class RenderViewContextMenuViews : public RenderViewContextMenu {
- public:
- RenderViewContextMenuViews(TabContents* tab_contents,
- const ContextMenuParams& params);
-
- virtual ~RenderViewContextMenuViews();
-
- void RunMenuAt(int x, int y);
-
- gfx::NativeMenu GetMenuHandle() const {
- return (menu_.get() ? menu_->GetNativeMenu() : NULL);
- }
-
-#if defined(OS_WIN)
- // Set this menu to show for an external tab contents. This
- // only has an effect before Init() is called.
- void SetExternal();
-#endif
-
- void UpdateMenuItemStates();
-
- protected:
- // RenderViewContextMenu implementation --------------------------------------
- virtual void PlatformInit();
- virtual bool GetAcceleratorForCommandId(int command_id,
- menus::Accelerator* accelerator);
- private:
- // The context menu itself and its contents.
- scoped_ptr<views::Menu2> menu_;
-
- DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuViews);
-};
+#include "chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_VIEWS_H_
+
diff --git a/chrome/browser/views/tab_contents/tab_contents_container.h b/chrome/browser/views/tab_contents/tab_contents_container.h
index c5c2f1f..9039060 100644
--- a/chrome/browser/views/tab_contents/tab_contents_container.h
+++ b/chrome/browser/views/tab_contents/tab_contents_container.h
@@ -6,76 +6,8 @@
#define CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_
#pragma once
-#include "chrome/browser/views/tab_contents/native_tab_contents_container.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "views/view.h"
-
-class NativeTabContentsContainer;
-class RenderViewHost;
-class TabContents;
-
-class TabContentsContainer : public views::View,
- public NotificationObserver {
- public:
- TabContentsContainer();
- virtual ~TabContentsContainer();
-
- // Changes the TabContents associated with this view.
- void ChangeTabContents(TabContents* contents);
-
- View* GetFocusView() { return native_container_->GetView(); }
-
- // Accessor for |tab_contents_|.
- TabContents* tab_contents() const { return tab_contents_; }
-
- // Called by the BrowserView to notify that |tab_contents| got the focus.
- void TabContentsFocused(TabContents* tab_contents);
-
- // Tells the container to update less frequently during resizing operations
- // so performance is better.
- void SetFastResize(bool fast_resize);
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Overridden from views::View:
- virtual void Layout();
- virtual AccessibilityTypes::Role GetAccessibleRole();
-
- protected:
- // Overridden from views::View:
- virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
- views::View* child);
-
- private:
- // Add or remove observers for events that we care about.
- void AddObservers();
- void RemoveObservers();
-
- // Called when the RenderViewHost of the hosted TabContents has changed, e.g.
- // to show an interstitial page.
- void RenderViewHostChanged(RenderViewHost* old_host,
- RenderViewHost* new_host);
-
- // 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);
-
- // An instance of a NativeTabContentsContainer object that holds the native
- // view handle associated with the attached TabContents.
- NativeTabContentsContainer* native_container_;
-
- // The attached TabContents.
- TabContents* tab_contents_;
-
- // Handles registering for our notifications.
- NotificationRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(TabContentsContainer);
-};
+#include "chrome/browser/ui/views/tab_contents/tab_contents_container.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_
+
diff --git a/chrome/browser/views/tab_contents/tab_contents_drag_win.h b/chrome/browser/views/tab_contents/tab_contents_drag_win.h
index 2fd29e8..79067eb 100644
--- a/chrome/browser/views/tab_contents/tab_contents_drag_win.h
+++ b/chrome/browser/views/tab_contents/tab_contents_drag_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,8 @@
#define CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_
#pragma once
-#include "app/os_exchange_data_provider_win.h"
-#include "base/platform_thread.h"
-#include "base/ref_counted.h"
-#include "base/scoped_ptr.h"
-#include "gfx/point.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h"
-
-class DragDropThread;
-class TabContentsViewWin;
-class WebDragSource;
-struct WebDropData;
-
-// Windows-specific drag-and-drop handling in TabContentsView.
-// If we are dragging a virtual file out of the browser, we use a background
-// thread to do the drag-and-drop because we do not want to run nested
-// message loop in the UI thread. For all other cases, the drag-and-drop happens
-// in the UI thread.
-class TabContentsDragWin
- : public DataObjectImpl::Observer,
- public base::RefCountedThreadSafe<TabContentsDragWin> {
- public:
- explicit TabContentsDragWin(TabContentsViewWin* view);
- virtual ~TabContentsDragWin();
-
- // Called on UI thread.
- void StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask ops,
- const SkBitmap& image,
- const gfx::Point& image_offset);
- void CancelDrag();
-
- // DataObjectImpl::Observer implementation.
- // Called on drag-and-drop thread.
- virtual void OnWaitForData();
- virtual void OnDataObjectDisposed();
-
- private:
- // Called on either UI thread or drag-and-drop thread.
- void PrepareDragForDownload(const WebDropData& drop_data,
- OSExchangeData* data,
- const GURL& page_url,
- const std::string& page_encoding);
- void PrepareDragForFileContents(const WebDropData& drop_data,
- OSExchangeData* data);
- void PrepareDragForUrl(const WebDropData& drop_data, OSExchangeData* data);
- void DoDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask ops,
- const GURL& page_url,
- const std::string& page_encoding,
- const SkBitmap& image,
- const gfx::Point& image_offset);
-
- // Called on drag-and-drop thread.
- void StartBackgroundDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask ops,
- const GURL& page_url,
- const std::string& page_encoding,
- const SkBitmap& image,
- const gfx::Point& image_offset);
- // Called on UI thread.
- void EndDragging(bool restore_suspended_state);
- void CloseThread();
-
- // For debug check only. Access only on drag-and-drop thread.
- PlatformThreadId drag_drop_thread_id_;
-
- // All the member variables below are accessed on UI thread.
-
- // Keep track of the TabContentsViewWin it is associated with.
- TabContentsViewWin* view_;
-
- // |drag_source_| is our callback interface passed to the system when we
- // want to initiate a drag and drop operation. We use it to tell if a
- // drag operation is happening.
- scoped_refptr<WebDragSource> drag_source_;
-
- // The thread used by the drag-out download. This is because we want to avoid
- // running nested message loop in main UI thread.
- scoped_ptr<DragDropThread> drag_drop_thread_;
-
- // The flag to guard that EndDragging is not called twice.
- bool drag_ended_;
-
- // Keep track of the old suspended state of the drop target.
- bool old_drop_target_suspended_state_;
-
- DISALLOW_COPY_AND_ASSIGN(TabContentsDragWin);
-};
-
+#include "chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_
+
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_gtk.h b/chrome/browser/views/tab_contents/tab_contents_view_gtk.h
index 890c6b1..3ee3e9a 100644
--- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.h
+++ b/chrome/browser/views/tab_contents/tab_contents_view_gtk.h
@@ -6,136 +6,8 @@
#define CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_
#pragma once
-#include <vector>
-
-#include "base/scoped_ptr.h"
-#include "chrome/browser/tab_contents/tab_contents_view.h"
-#include "gfx/size.h"
-#include "views/widget/widget_gtk.h"
-
-class ConstrainedWindowGtk;
-typedef struct _GtkFloatingContainer GtkFloatingContainer;
-class RenderViewContextMenuViews;
-class SadTabView;
-class SkBitmap;
-class TabContentsDragSource;
-class WebDragDestGtk;
-namespace gfx {
-class Point;
-}
-namespace views {
-class NativeViewHost;
-}
-
-// Gtk-specific implementation of the TabContentsView for the views-based front
-// end. It is a WidgetGtk that contains all of the contents of the tab and
-// associated child views.
-class TabContentsViewGtk : public TabContentsView,
- public views::WidgetGtk {
- public:
- // The corresponding TabContents is passed in the constructor, and manages our
- // lifetime. This doesn't need to be the case, but is this way currently
- // because that's what was easiest when they were split.
- explicit TabContentsViewGtk(TabContents* tab_contents);
- virtual ~TabContentsViewGtk();
-
- // Unlike Windows, ConstrainedWindows need to collaborate with the
- // TabContentsViewGtk to position the dialogs.
- void AttachConstrainedWindow(ConstrainedWindowGtk* constrained_window);
- void RemoveConstrainedWindow(ConstrainedWindowGtk* constrained_window);
-
- gboolean OnMouseMove(GtkWidget* widget, GdkEventMotion* event);
-
- // TabContentsView implementation --------------------------------------------
-
- virtual void CreateView(const gfx::Size& initial_size);
- virtual RenderWidgetHostView* CreateViewForWidget(
- RenderWidgetHost* render_widget_host);
- virtual gfx::NativeView GetNativeView() const;
- virtual gfx::NativeView GetContentNativeView() const;
- virtual gfx::NativeWindow GetTopLevelNativeWindow() const;
- virtual void GetContainerBounds(gfx::Rect* out) const;
- virtual void SetPageTitle(const std::wstring& title);
- virtual void OnTabCrashed();
- virtual void SizeContents(const gfx::Size& size);
- virtual void Focus();
- virtual void SetInitialFocus();
- virtual void StoreFocus();
- virtual void RestoreFocus();
-
- // Backend implementation of RenderViewHostDelegate::View.
- virtual void ShowContextMenu(const ContextMenuParams& params);
- virtual void ShowPopupMenu(const gfx::Rect& bounds,
- int item_height,
- double item_font_size,
- int selected_item,
- const std::vector<WebMenuItem>& items,
- bool right_aligned);
- virtual void StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask ops_allowed,
- const SkBitmap& image,
- const gfx::Point& image_offset);
- virtual void UpdateDragCursor(WebKit::WebDragOperation operation);
- virtual void GotFocus();
- virtual void TakeFocus(bool reverse);
-
- private:
- // Signal handlers -----------------------------------------------------------
-
- // Overridden from views::WidgetGtk:
- virtual gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event);
- virtual void OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation);
- virtual gboolean OnPaint(GtkWidget* widget, GdkEventExpose* event);
- virtual void OnShow(GtkWidget* widget);
- virtual void OnHide(GtkWidget* widget);
-
- // Handles notifying the TabContents and other operations when the window was
- // shown or hidden.
- void WasHidden();
- void WasShown();
-
- // Handles resizing of the contents. This will notify the RenderWidgetHostView
- // of the change, reposition popups, and the find in page bar.
- void WasSized(const gfx::Size& size);
-
- // For any floating views (ConstrainedDialogs) this function centers them
- // within this view. It's called whem a ConstrainedDialog is attached and
- // when this view is resized.
- void SetFloatingPosition(const gfx::Size& size);
-
- // ---------------------------------------------------------------------------
-
- // Used to render the sad tab. This will be non-NULL only when the sad tab is
- // visible.
- SadTabView* sad_tab_;
-
- // Whether to ignore the next CHAR keyboard event.
- bool ignore_next_char_event_;
-
- // The id used in the ViewStorage to store the last focused view.
- int last_focused_view_storage_id_;
-
- // The context menu. Callbacks are asynchronous so we need to keep it around.
- scoped_ptr<RenderViewContextMenuViews> context_menu_;
-
- // Handles drags from this TabContentsView.
- scoped_ptr<TabContentsDragSource> drag_source_;
-
- // The event for the last mouse down we handled. We need this for drags.
- GdkEventButton last_mouse_down_;
-
- // The helper object that handles drag destination related interactions with
- // GTK.
- scoped_ptr<WebDragDestGtk> drag_dest_;
-
- // Current size. See comment in WidgetGtk as to why this is cached.
- gfx::Size size_;
-
- // Each individual UI for constrained dialogs currently displayed. The
- // objects in this vector are owned by the TabContents, not the view.
- std::vector<ConstrainedWindowGtk*> constrained_windows_;
-
- DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk);
-};
+#include "chrome/browser/ui/views/tab_contents/tab_contents_view_gtk.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_
+
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_win.h b/chrome/browser/views/tab_contents/tab_contents_view_win.h
index a42ffd7..49f6a13 100644
--- a/chrome/browser/views/tab_contents/tab_contents_view_win.h
+++ b/chrome/browser/views/tab_contents/tab_contents_view_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,147 +6,8 @@
#define CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_WIN_H_
#pragma once
-#include "base/scoped_ptr.h"
-#include "base/timer.h"
-#include "chrome/browser/tab_contents/tab_contents_view.h"
-#include "gfx/size.h"
-#include "views/widget/widget_win.h"
-
-class RenderViewContextMenuViews;
-class SadTabView;
-class SkBitmap;
-class TabContentsDragWin;
-struct WebDropData;
-class WebDragSource;
-class WebDropTarget;
-namespace gfx {
-class Point;
-}
-
-// Windows-specific implementation of the TabContentsView. It is a HWND that
-// contains all of the contents of the tab and associated child views.
-class TabContentsViewWin : public TabContentsView,
- public views::WidgetWin {
- public:
- // The corresponding TabContents is passed in the constructor, and manages our
- // lifetime. This doesn't need to be the case, but is this way currently
- // because that's what was easiest when they were split.
- explicit TabContentsViewWin(TabContents* tab_contents);
- virtual ~TabContentsViewWin();
-
- // Reset the native parent of this view to NULL. Unparented windows should
- // not receive any messages.
- virtual void Unparent();
-
- // TabContentsView implementation --------------------------------------------
-
- virtual void CreateView(const gfx::Size& initial_size);
- virtual RenderWidgetHostView* CreateViewForWidget(
- RenderWidgetHost* render_widget_host);
- virtual gfx::NativeView GetNativeView() const;
- virtual gfx::NativeView GetContentNativeView() const;
- virtual gfx::NativeWindow GetTopLevelNativeWindow() const;
- virtual void GetContainerBounds(gfx::Rect* out) const;
- virtual void SetPageTitle(const std::wstring& title);
- virtual void OnTabCrashed();
- virtual void SizeContents(const gfx::Size& size);
- virtual void Focus();
- virtual void SetInitialFocus();
- virtual void StoreFocus();
- virtual void RestoreFocus();
- virtual bool IsDoingDrag() const;
- virtual void CancelDragAndCloseTab();
-
- // Backend implementation of RenderViewHostDelegate::View.
- virtual void ShowContextMenu(const ContextMenuParams& params);
- virtual void ShowPopupMenu(const gfx::Rect& bounds,
- int item_height,
- double item_font_size,
- int selected_item,
- const std::vector<WebMenuItem>& items,
- bool right_aligned);
- virtual void StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask operations,
- const SkBitmap& image,
- const gfx::Point& image_offset);
- virtual void UpdateDragCursor(WebKit::WebDragOperation operation);
- virtual void GotFocus();
- virtual void TakeFocus(bool reverse);
-
- // WidgetWin overridde.
- virtual views::FocusManager* GetFocusManager();
-
- void EndDragging();
-
- WebDropTarget* drop_target() const { return drop_target_.get(); }
-
- private:
- // A helper method for closing the tab.
- void CloseTab();
-
- // Windows events ------------------------------------------------------------
-
- // Overrides from WidgetWin.
- virtual void OnDestroy();
- virtual void OnHScroll(int scroll_type, short position, HWND scrollbar);
- virtual void OnMouseLeave();
- virtual LRESULT OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param);
- virtual void OnPaint(HDC junk_dc);
- virtual LRESULT OnReflectedMessage(UINT msg, WPARAM w_param, LPARAM l_param);
- virtual void OnVScroll(int scroll_type, short position, HWND scrollbar);
- virtual void OnWindowPosChanged(WINDOWPOS* window_pos);
- virtual void OnSize(UINT param, const WTL::CSize& size);
- virtual LRESULT OnNCCalcSize(BOOL w_param, LPARAM l_param);
- virtual void OnNCPaint(HRGN rgn);
-
- // Backend for all scroll messages, the |message| parameter indicates which
- // one it is.
- void ScrollCommon(UINT message, int scroll_type, short position,
- HWND scrollbar);
-
- // Handles notifying the TabContents and other operations when the window was
- // shown or hidden.
- void WasHidden();
- void WasShown();
-
- // Handles resizing of the contents. This will notify the RenderWidgetHostView
- // of the change, reposition popups, and the find in page bar.
- void WasSized(const gfx::Size& size);
-
- // TODO(brettw) comment these. They're confusing.
- bool ScrollZoom(int scroll_type);
- void WheelZoom(int distance);
-
- // ---------------------------------------------------------------------------
-
- // A drop target object that handles drags over this TabContents.
- scoped_refptr<WebDropTarget> drop_target_;
-
- // Used to render the sad tab. This will be non-NULL only when the sad tab is
- // visible.
- SadTabView* sad_tab_;
-
- // The id used in the ViewStorage to store the last focused view.
- int last_focused_view_storage_id_;
-
- // The context menu. Callbacks are asynchronous so we need to keep it around.
- scoped_ptr<RenderViewContextMenuViews> context_menu_;
-
- // The FocusManager associated with this tab. Stored as it is not directly
- // accessible when unparented.
- views::FocusManager* focus_manager_;
-
- // Set to true if we want to close the tab after the system drag operation
- // has finished.
- bool close_tab_after_drag_ends_;
-
- // Used to close the tab after the stack has unwound.
- base::OneShotTimer<TabContentsViewWin> close_tab_timer_;
-
- // Used to handle the drag-and-drop.
- scoped_refptr<TabContentsDragWin> drag_handler_;
-
- DISALLOW_COPY_AND_ASSIGN(TabContentsViewWin);
-};
+#include "chrome/browser/ui/views/tab_contents/tab_contents_view_win.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_WIN_H_
+
diff --git a/chrome/browser/views/tab_icon_view.h b/chrome/browser/views/tab_icon_view.h
index ef42477..064c8a7 100644
--- a/chrome/browser/views/tab_icon_view.h
+++ b/chrome/browser/views/tab_icon_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,8 @@
#define CHROME_BROWSER_VIEWS_TAB_ICON_VIEW_H_
#pragma once
-#include "views/view.h"
-
-class SkBitmap;
-class TabContents;
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// A view to display a tab fav icon or a throbber.
-//
-////////////////////////////////////////////////////////////////////////////////
-class TabIconView : public views::View {
- public:
- // Classes implement this interface to provide state for the TabIconView.
- class TabIconViewModel {
- public:
- // Returns true if the TabIconView should show a loading animation.
- virtual bool ShouldTabIconViewAnimate() const = 0;
-
- // Returns the favicon to display in the icon view
- virtual SkBitmap GetFavIconForTabIconView() = 0;
- };
-
- static void InitializeIfNeeded();
-
- explicit TabIconView(TabIconViewModel* provider);
- virtual ~TabIconView();
-
- // Invoke whenever the tab state changes or the throbber should update.
- void Update();
-
- // Set the throbber to the light style (for use on dark backgrounds).
- void set_is_light(bool is_light) { is_light_ = is_light; }
-
- // Overriden from View
- virtual void Paint(gfx::Canvas* canvas);
- virtual gfx::Size GetPreferredSize();
-
- private:
- void PaintThrobber(gfx::Canvas* canvas);
- void PaintFavIcon(gfx::Canvas* canvas, const SkBitmap& bitmap);
- void PaintIcon(gfx::Canvas* canvas,
- const SkBitmap& bitmap,
- int src_x,
- int src_y,
- int src_w,
- int src_h,
- bool filter);
-
- // Our model.
- TabIconViewModel* model_;
-
- // Whether the throbber is running.
- bool throbber_running_;
-
- // Whether we should display our light or dark style.
- bool is_light_;
-
- // Current frame of the throbber being painted. This is only used if
- // throbber_running_ is true.
- int throbber_frame_;
-
- DISALLOW_COPY_AND_ASSIGN(TabIconView);
-};
+#include "chrome/browser/ui/views/tab_icon_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TAB_ICON_VIEW_H_
+
diff --git a/chrome/browser/views/tabs/base_tab.h b/chrome/browser/views/tabs/base_tab.h
index 9d6567b..e826fbf 100644
--- a/chrome/browser/views/tabs/base_tab.h
+++ b/chrome/browser/views/tabs/base_tab.h
@@ -6,199 +6,8 @@
#define CHROME_BROWSER_VIEWS_TABS_BASE_TAB_H_
#pragma once
-#include "app/animation.h"
-#include "base/ref_counted.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/views/tabs/tab_renderer_data.h"
-#include "views/controls/button/button.h"
-#include "views/view.h"
-
-class AnimationContainer;
-class BaseTab;
-class SlideAnimation;
-class TabController;
-class ThrobAnimation;
-
-namespace gfx {
-class Font;
-} // namespace gfx
-
-namespace views {
-class ImageButton;
-} // namespace views
-
-// Base class for tab renderers.
-class BaseTab : public AnimationDelegate,
- public views::ButtonListener,
- public views::ContextMenuController,
- public views::View {
- public:
- explicit BaseTab(TabController* controller);
- virtual ~BaseTab();
-
- // Sets the data this tabs displays. Invokes DataChanged for subclasses to
- // update themselves appropriately.
- void SetData(const TabRendererData& data);
- const TabRendererData& data() const { return data_; }
-
- // Sets the network state. If the network state changes NetworkStateChanged is
- // invoked.
- virtual void UpdateLoadingAnimation(TabRendererData::NetworkState state);
-
- // Starts/Stops a pulse animation.
- void StartPulse();
- void StopPulse();
-
- // Used to set/check whether this Tab is being animated closed.
- void set_closing(bool closing) { closing_ = closing; }
- bool closing() const { return closing_; }
-
- // See description above field.
- void set_dragging(bool dragging) { dragging_ = dragging; }
- bool dragging() const { return dragging_; }
-
- // Sets the container all animations run from.
- void set_animation_container(AnimationContainer* container) {
- animation_container_ = container;
- }
- AnimationContainer* animation_container() const {
- return animation_container_.get();
- }
-
- // Set the theme provider - because we get detached, we are frequently
- // outside of a hierarchy with a theme provider at the top. This should be
- // called whenever we're detached or attached to a hierarchy.
- void set_theme_provider(ThemeProvider* provider) {
- theme_provider_ = provider;
- }
-
- // Returns true if the tab is selected.
- virtual bool IsSelected() const;
-
- // Returns true if the tab is closeable.
- bool IsCloseable() const;
-
- // views::View overrides:
- virtual void OnMouseEntered(const views::MouseEvent& event);
- virtual void OnMouseExited(const views::MouseEvent& event);
- virtual bool OnMousePressed(const views::MouseEvent& event);
- virtual bool OnMouseDragged(const views::MouseEvent& event);
- virtual void OnMouseReleased(const views::MouseEvent& event,
- bool canceled);
- virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip);
- virtual AccessibilityTypes::Role GetAccessibleRole();
- virtual ThemeProvider* GetThemeProvider();
-
- protected:
- // Invoked from SetData after |data_| has been updated to the new data.
- virtual void DataChanged(const TabRendererData& old) {}
-
- // Invoked if data_.network_state changes, or the network_state is not none.
- virtual void AdvanceLoadingAnimation(TabRendererData::NetworkState old_state,
- TabRendererData::NetworkState state);
-
- TabController* controller() const { return controller_; }
-
- // Returns the pulse animation. The pulse animation is non-null if StartPulse
- // has been invoked.
- ThrobAnimation* pulse_animation() const { return pulse_animation_.get(); }
-
- // Returns the hover animation. This may return null.
- const SlideAnimation* hover_animation() const {
- return hover_animation_.get();
- }
-
- views::ImageButton* close_button() const { return close_button_; }
-
- // Paints the icon at the specified coordinates, mirrored for RTL if needed.
- void PaintIcon(gfx::Canvas* canvas, int x, int y);
- void PaintTitle(gfx::Canvas* canvas, SkColor title_color);
-
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
-
- // views::ButtonListener overrides:
- virtual void ButtonPressed(views::Button* sender,
- const views::Event& event);
-
- // views::ContextMenuController overrides:
- virtual void ShowContextMenu(views::View* source,
- const gfx::Point& p,
- bool is_mouse_gesture);
-
- // Returns the bounds of the title.
- virtual const gfx::Rect& title_bounds() const = 0;
-
- static gfx::Font* font() { return font_; }
- static int font_height() { return font_height_; }
-
- private:
- // The animation object used to swap the favicon with the sad tab icon.
- class FavIconCrashAnimation;
-
- // Set the temporary offset for the favicon. This is used during the crash
- // animation.
- void SetFavIconHidingOffset(int offset);
-
- void DisplayCrashedFavIcon();
- void ResetCrashedFavIcon();
-
- // Starts/Stops the crash animation.
- void StartCrashAnimation();
- void StopCrashAnimation();
-
- // Return true if the crash animation is currently running.
- bool IsPerformingCrashAnimation() const;
-
- static void InitResources();
-
- // The controller.
- // WARNING: this is null during detached tab dragging.
- TabController* controller_;
-
- TabRendererData data_;
-
- // True if the tab is being animated closed.
- bool closing_;
-
- // True if the tab is being dragged.
- bool dragging_;
-
- // Pulse animation.
- scoped_ptr<ThrobAnimation> pulse_animation_;
-
- // Hover animation.
- scoped_ptr<SlideAnimation> hover_animation_;
-
- // Crash animation.
- scoped_ptr<FavIconCrashAnimation> crash_animation_;
-
- scoped_refptr<AnimationContainer> animation_container_;
-
- views::ImageButton* close_button_;
-
- // The current index of the loading animation.
- int loading_animation_frame_;
-
- // Whether to disable throbber animations. Only true if this is an app tab
- // renderer and a command line flag has been passed in to disable the
- // animations.
- bool throbber_disabled_;
-
- ThemeProvider* theme_provider_;
-
- // The offset used to animate the favicon location. This is used when the tab
- // crashes.
- int fav_icon_hiding_offset_;
-
- bool should_display_crashed_favicon_;
-
- static gfx::Font* font_;
- static int font_height_;
-
- DISALLOW_COPY_AND_ASSIGN(BaseTab);
-};
+#include "chrome/browser/ui/views/tabs/base_tab.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TABS_BASE_TAB_H_
+
diff --git a/chrome/browser/views/tabs/base_tab_strip.h b/chrome/browser/views/tabs/base_tab_strip.h
index e3f5231..603dcf9 100644
--- a/chrome/browser/views/tabs/base_tab_strip.h
+++ b/chrome/browser/views/tabs/base_tab_strip.h
@@ -6,261 +6,8 @@
#define CHROME_BROWSER_VIEWS_TABS_BASE_TAB_STRIP_H_
#pragma once
-#include <vector>
-
-#include "base/scoped_ptr.h"
-#include "chrome/browser/views/tabs/base_tab.h"
-#include "chrome/browser/views/tabs/tab_controller.h"
-#include "views/animation/bounds_animator.h"
-#include "views/view.h"
-
-class BaseTab;
-class DraggedTabController;
-class TabStrip;
-class TabStripController;
-class ThemeProvider;
-
-// Base class for the view tab strip implementations.
-class BaseTabStrip : public views::View,
- public TabController {
- public:
- enum Type {
- HORIZONTAL_TAB_STRIP,
- VERTICAL_TAB_STRIP
- };
-
- BaseTabStrip(TabStripController* controller, Type type);
- virtual ~BaseTabStrip();
-
- Type type() const { return type_; }
-
- // Returns the preferred height of this TabStrip. This is based on the
- // typical height of its constituent tabs.
- virtual int GetPreferredHeight() = 0;
-
- // Set the background offset used by inactive tabs to match the frame image.
- virtual void SetBackgroundOffset(const gfx::Point& offset) = 0;
-
- // Returns true if the specified point(TabStrip coordinates) is
- // in the window caption area of the browser window.
- virtual bool IsPositionInWindowCaption(const gfx::Point& point) = 0;
-
- // Sets the bounds of the tab at the specified |tab_index|. |tab_bounds| are
- // in TabStrip coordinates.
- virtual void SetDraggedTabBounds(int tab_index,
- const gfx::Rect& tab_bounds) = 0;
-
- // Updates the loading animations displayed by tabs in the tabstrip to the
- // next frame.
- void UpdateLoadingAnimations();
-
- // Returns true if Tabs in this TabStrip are currently changing size or
- // position.
- virtual bool IsAnimating() const;
-
- // Returns this object as a TabStrip if it is one.
- virtual TabStrip* AsTabStrip() = 0;
-
- // Starts highlighting the tab at the specified index.
- virtual void StartHighlight(int model_index) = 0;
-
- // Stops all tab higlighting.
- virtual void StopAllHighlighting() = 0;
-
- // Returns the selected tab.
- virtual BaseTab* GetSelectedBaseTab() const;
-
- // Retrieves the ideal bounds for the Tab at the specified index.
- const gfx::Rect& ideal_bounds(int tab_data_index) {
- return tab_data_[tab_data_index].ideal_bounds;
- }
-
- // Creates and returns a tab that can be used for dragging. Ownership passes
- // to the caller.
- virtual BaseTab* CreateTabForDragging() = 0;
-
- // Adds a tab at the specified index.
- void AddTabAt(int model_index,
- bool foreground,
- const TabRendererData& data);
-
- // Invoked from the controller when the close initiates from the TabController
- // (the user clicked the tab close button or middle clicked the tab). This is
- // invoked from Close. Because of unload handlers Close is not always
- // immediately followed by RemoveTabAt.
- virtual void PrepareForCloseAt(int model_index) {}
-
- // Removes a tab at the specified index.
- virtual void RemoveTabAt(int model_index) = 0;
-
- // Selects a tab at the specified index. |old_model_index| is the selected
- // index prior to the selection change.
- virtual void SelectTabAt(int old_model_index, int new_model_index) = 0;
-
- // Moves a tab.
- virtual void MoveTab(int from_model_index, int to_model_index);
-
- // Invoked when the title of a tab changes and the tab isn't loading.
- virtual void TabTitleChangedNotLoading(int model_index) = 0;
-
- // Sets the tab data at the specified model index.
- virtual void SetTabData(int model_index, const TabRendererData& data);
-
- // Returns the tab at the specified model index.
- virtual BaseTab* GetBaseTabAtModelIndex(int model_index) const;
-
- // Returns the tab at the specified tab index.
- BaseTab* base_tab_at_tab_index(int tab_index) const {
- return tab_data_[tab_index].tab;
- }
-
- // Returns the index of the specified tab in the model coordiate system, or
- // -1 if tab is closing or not valid.
- virtual int GetModelIndexOfBaseTab(const BaseTab* tab) const;
-
- // Gets the number of Tabs in the tab strip.
- // WARNING: this is the number of tabs displayed by the tabstrip, which if
- // an animation is ongoing is not necessarily the same as the number of tabs
- // in the model.
- int tab_count() const { return static_cast<int>(tab_data_.size()); }
-
- // Cover method for TabStripController::GetCount.
- int GetModelCount() const;
-
- // Cover method for TabStripController::IsValidIndex.
- bool IsValidModelIndex(int model_index) const;
-
- // Returns the index into |tab_data_| corresponding to the index from the
- // TabStripModel, or |tab_data_.size()| if there is no tab representing
- // |model_index|.
- int ModelIndexToTabIndex(int model_index) const;
-
- TabStripController* controller() const { return controller_.get(); }
-
- // Returns true if a drag session is currently active.
- bool IsDragSessionActive() const;
-
- // TabController overrides:
- virtual void SelectTab(BaseTab* tab);
- virtual void CloseTab(BaseTab* tab);
- virtual void ShowContextMenu(BaseTab* tab, const gfx::Point& p);
- virtual bool IsTabSelected(const BaseTab* tab) const;
- virtual bool IsTabPinned(const BaseTab* tab) const;
- virtual bool IsTabCloseable(const BaseTab* tab) const;
- virtual void MaybeStartDrag(BaseTab* tab,
- const views::MouseEvent& event);
- virtual void ContinueDrag(const views::MouseEvent& event);
- virtual bool EndDrag(bool canceled);
- virtual BaseTab* GetTabAt(BaseTab* tab,
- const gfx::Point& tab_in_tab_coordinates);
-
- // View overrides:
- virtual void Layout();
-
- protected:
- // The Tabs we contain, and their last generated "good" bounds.
- struct TabData {
- BaseTab* tab;
- gfx::Rect ideal_bounds;
- };
-
- // View overrides.
- virtual bool OnMouseDragged(const views::MouseEvent& event);
- virtual void OnMouseReleased(const views::MouseEvent& event,
- bool canceled);
-
- // Creates and returns a new tab. The caller owners the returned tab.
- virtual BaseTab* CreateTab() = 0;
-
- // Invoked from |AddTabAt| after the newly created tab has been inserted.
- // Subclasses should either start an animation, or layout.
- virtual void StartInsertTabAnimation(int model_index, bool foreground) = 0;
-
- // Invoked from |MoveTab| after |tab_data_| has been updated to animate the
- // move.
- virtual void StartMoveTabAnimation() = 0;
-
- // Starts the remove tab animation.
- virtual void StartRemoveTabAnimation(int model_index);
-
- // Starts the mini-tab animation.
- virtual void StartMiniTabAnimation();
-
- // Returns whether the highlight button should be highlighted after a remove.
- virtual bool ShouldHighlightCloseButtonAfterRemove() { return true; }
-
- // Animates all the views to their ideal bounds.
- // NOTE: this does *not* invoke GenerateIdealBounds, it uses the bounds
- // currently set in ideal_bounds.
- virtual void AnimateToIdealBounds() = 0;
-
- // Cleans up the Tab from the TabStrip. This is called from the tab animation
- // code and is not a general-purpose method.
- void RemoveAndDeleteTab(BaseTab* tab);
-
- // Resets the bounds of all non-closing tabs.
- virtual void GenerateIdealBounds() = 0;
-
- void set_ideal_bounds(int index, const gfx::Rect& bounds) {
- tab_data_[index].ideal_bounds = bounds;
- }
-
- // Returns the index into |tab_data_| corresponding to the specified tab, or
- // -1 if the tab isn't in |tab_data_|.
- int TabIndexOfTab(BaseTab* tab) const;
-
- // Stops any ongoing animations. If |layout| is true and an animation is
- // ongoing this does a layout.
- virtual void StopAnimating(bool layout) = 0;
-
- // Destroys the active drag controller.
- void DestroyDragController();
-
- // Used by DraggedTabController when the user starts or stops dragging a tab.
- void StartedDraggingTab(BaseTab* tab);
- void StoppedDraggingTab(BaseTab* tab);
-
- // See description above field for details.
- bool attaching_dragged_tab() const { return attaching_dragged_tab_; }
-
- views::BoundsAnimator& bounds_animator() { return bounds_animator_; }
-
- // Invoked prior to starting a new animation.
- virtual void PrepareForAnimation();
-
- // Creates an AnimationDelegate that resets state after a remove animation
- // completes. The caller owns the returned object.
- AnimationDelegate* CreateRemoveTabDelegate(BaseTab* tab);
-
- // Invoked from Layout if the size changes or layout is really needed.
- virtual void DoLayout();
-
- private:
- class RemoveTabDelegate;
-
- friend class DraggedTabController;
-
- // See description above field for details.
- void set_attaching_dragged_tab(bool value) { attaching_dragged_tab_ = value; }
-
- scoped_ptr<TabStripController> controller_;
-
- const Type type_;
-
- std::vector<TabData> tab_data_;
-
- // The controller for a drag initiated from a Tab. Valid for the lifetime of
- // the drag session.
- scoped_ptr<DraggedTabController> drag_controller_;
-
- // If true, the insert is a result of a drag attaching the tab back to the
- // model.
- bool attaching_dragged_tab_;
-
- views::BoundsAnimator bounds_animator_;
-
- // Size we last layed out at.
- gfx::Size last_layout_size_;
-};
+#include "chrome/browser/ui/views/tabs/base_tab_strip.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TABS_BASE_TAB_STRIP_H_
+
diff --git a/chrome/browser/views/tabs/browser_tab_strip_controller.h b/chrome/browser/views/tabs/browser_tab_strip_controller.h
index bbf1121..6606f28 100644
--- a/chrome/browser/views/tabs/browser_tab_strip_controller.h
+++ b/chrome/browser/views/tabs/browser_tab_strip_controller.h
@@ -6,116 +6,8 @@
#define CHROME_BROWSER_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_
#pragma once
-#include "base/scoped_ptr.h"
-#include "chrome/browser/tabs/tab_strip_model.h"
-#include "chrome/browser/views/tabs/tab_strip_controller.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-
-class BaseTab;
-class BaseTabStrip;
-class Browser;
-
-struct TabRendererData;
-
-// An implementation of TabStripController that sources data from the
-// TabContentses in a TabStripModel.
-class BrowserTabStripController : public TabStripController,
- public TabStripModelObserver,
- public NotificationObserver {
- public:
- BrowserTabStripController(Browser* browser, TabStripModel* model);
- virtual ~BrowserTabStripController();
-
- void InitFromModel(BaseTabStrip* tabstrip);
-
- TabStripModel* model() const { return model_; }
-
- bool IsCommandEnabledForTab(TabStripModel::ContextMenuCommand command_id,
- BaseTab* tab) const;
- bool IsCommandCheckedForTab(TabStripModel::ContextMenuCommand command_id,
- BaseTab* tab) const;
- void ExecuteCommandForTab(TabStripModel::ContextMenuCommand command_id,
- BaseTab* tab);
- bool IsTabPinned(BaseTab* tab);
-
- // TabStripController implementation:
- virtual int GetCount() const;
- virtual bool IsValidIndex(int model_index) const;
- virtual int GetSelectedIndex() const;
- virtual bool IsTabSelected(int model_index) const;
- virtual bool IsTabPinned(int model_index) const;
- virtual bool IsTabCloseable(int model_index) const;
- virtual bool IsNewTabPage(int model_index) const;
- virtual void SelectTab(int model_index);
- virtual void CloseTab(int model_index);
- virtual void ShowContextMenu(BaseTab* tab, const gfx::Point& p);
- virtual void UpdateLoadingAnimations();
- virtual int HasAvailableDragActions() const;
- virtual void PerformDrop(bool drop_before, int index, const GURL& url);
- virtual bool IsCompatibleWith(BaseTabStrip* other) const;
- virtual void CreateNewTab();
-
- // TabStripModelObserver implementation:
- virtual void TabInsertedAt(TabContents* contents,
- int model_index,
- bool foreground);
- virtual void TabDetachedAt(TabContents* contents, int model_index);
- virtual void TabSelectedAt(TabContents* old_contents,
- TabContents* contents,
- int model_index,
- bool user_gesture);
- virtual void TabMoved(TabContents* contents,
- int from_model_index,
- int to_model_index);
- virtual void TabChangedAt(TabContents* contents,
- int model_index,
- TabChangeType change_type);
- virtual void TabReplacedAt(TabContents* old_contents,
- TabContents* new_contents,
- int model_index);
- virtual void TabPinnedStateChanged(TabContents* contents, int model_index);
- virtual void TabMiniStateChanged(TabContents* contents, int model_index);
- virtual void TabBlockedStateChanged(TabContents* contents, int model_index);
-
- // NotificationObserver implementation:
- virtual void Observe(NotificationType type, const NotificationSource& source,
- const NotificationDetails& details);
-
- private:
- class TabContextMenuContents;
-
- // Invokes tabstrip_->SetTabData.
- void SetTabDataAt(TabContents* contents, int model_index);
-
- // Sets the TabRendererData from the TabStripModel.
- void SetTabRendererDataFromModel(TabContents* contents,
- int model_index,
- TabRendererData* data);
-
- void StartHighlightTabsForCommand(
- TabStripModel::ContextMenuCommand command_id,
- BaseTab* tab);
- void StopHighlightTabsForCommand(
- TabStripModel::ContextMenuCommand command_id,
- BaseTab* tab);
-
- Profile* profile() const { return model_->profile(); }
-
- TabStripModel* model_;
-
- BaseTabStrip* tabstrip_;
-
- // Non-owning pointer to the browser which is using this controller.
- Browser* browser_;
-
- // If non-NULL it means we're showing a menu for the tab.
- scoped_ptr<TabContextMenuContents> context_menu_contents_;
-
- NotificationRegistrar notification_registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController);
-};
+#include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.h b/chrome/browser/views/tabs/dragged_tab_controller.h
index 5c9c619..e445018 100644
--- a/chrome/browser/views/tabs/dragged_tab_controller.h
+++ b/chrome/browser/views/tabs/dragged_tab_controller.h
@@ -6,334 +6,8 @@
#define CHROME_BROWSER_VIEWS_TABS_DRAGGED_TAB_CONTROLLER_H_
#pragma once
-#include "base/message_loop.h"
-#include "base/scoped_ptr.h"
-#include "base/timer.h"
-#include "chrome/browser/dock_info.h"
-#include "chrome/browser/tab_contents/tab_contents_delegate.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "gfx/rect.h"
-
-namespace views {
-class View;
-}
-class BaseTab;
-class BaseTabStrip;
-class DraggedTabView;
-class NativeViewPhotobooth;
-class TabStripModel;
-
-struct TabRendererData;
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// DraggedTabController
-//
-// An object that handles a drag session for an individual Tab within a
-// TabStrip. This object is created whenever the mouse is pressed down on a
-// Tab and destroyed when the mouse is released or the drag operation is
-// aborted. The Tab that the user dragged (the "source tab") owns this object
-// and must be the only one to destroy it (via |DestroyDragController|).
-//
-///////////////////////////////////////////////////////////////////////////////
-class DraggedTabController : public TabContentsDelegate,
- public NotificationObserver,
- public MessageLoopForUI::Observer {
- public:
- DraggedTabController(BaseTab* source_tab,
- BaseTabStrip* source_tabstrip);
- virtual ~DraggedTabController();
-
- // Returns true if there is a drag underway and the drag is attached to
- // |tab_strip|.
- // NOTE: this returns false if the dragged tab controller is in the process
- // of finishing the drag.
- static bool IsAttachedTo(BaseTabStrip* tab_strip);
-
- // Capture information needed to be used during a drag session for this
- // controller's associated source tab and BaseTabStrip. |mouse_offset| is the
- // distance of the mouse pointer from the tab's origin.
- void CaptureDragInfo(views::View* tab, 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.
- void EndDrag(bool canceled);
-
- TabContents* dragged_contents() { return dragged_contents_; }
-
- // Returns true if a drag started.
- bool started_drag() const { return started_drag_; }
-
- private:
- class DockDisplayer;
- friend class DockDisplayer;
-
- typedef std::set<gfx::NativeView> DockWindows;
-
- // 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 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);
-
- // Overridden from MessageLoop::Observer:
-#if defined(OS_WIN)
- virtual void WillProcessMessage(const MSG& msg);
- virtual void DidProcessMessage(const MSG& msg);
-#else
- virtual void WillProcessEvent(GdkEvent* event);
- virtual void DidProcessEvent(GdkEvent* event);
-#endif
-
- // Initialize the offset used to calculate the position to create windows
- // in |GetWindowCreatePoint|. This should only be invoked from
- // |CaptureDragInfo|.
- void InitWindowCreatePoint();
-
- // Updates the window create point from |mouse_offset_|.
- void UpdateWindowCreatePoint();
-
- // Returns the point where a detached window should be created given the
- // current mouse position.
- gfx::Point GetWindowCreatePoint() const;
-
- void UpdateDockInfo(const gfx::Point& screen_point);
-
- // Sets the TabContents being dragged with the specified |new_contents|.
- void SetDraggedContents(TabContents* new_contents);
-
- // Saves focus in the window that the drag initiated from. Focus will be
- // restored appropriately if the drag ends within this same window.
- void SaveFocus();
-
- // Restore focus to the View that had focus before the drag was started, if
- // the drag ends within the same Window as it began.
- void RestoreFocus();
-
- // Tests whether the position of the mouse is past a minimum elasticity
- // threshold required to start a drag.
- bool CanStartDrag() const;
-
- // Move the DraggedTabView according to the current mouse screen position,
- // potentially updating the source and other TabStrips.
- void ContinueDragging();
-
- // Handles dragging a tab while the tab is attached.
- void MoveAttachedTab(const gfx::Point& screen_point);
-
- // Handles dragging while the tab is detached.
- void MoveDetachedTab(const gfx::Point& screen_point);
-
- // Returns the compatible TabStrip that is under the specified point (screen
- // coordinates), or NULL if there is none.
- BaseTabStrip* GetTabStripForPoint(const gfx::Point& screen_point);
-
- DockInfo GetDockInfoAtPoint(const gfx::Point& screen_point);
-
- // Returns the specified |tabstrip| if it contains the specified point
- // (screen coordinates), NULL if it does not.
- BaseTabStrip* GetTabStripIfItContains(BaseTabStrip* tabstrip,
- const gfx::Point& screen_point) const;
-
- // Attach the dragged Tab to the specified TabStrip.
- void Attach(BaseTabStrip* attached_tabstrip, const gfx::Point& screen_point);
-
- // Detach the dragged Tab from the current TabStrip.
- void Detach();
-
- // 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;
-
- // Retrieve the bounds of the DraggedTabView, relative to the attached
- // TabStrip, given location of the dragged tab in screen coordinates.
- gfx::Rect GetDraggedViewTabStripBounds(const gfx::Point& screen_point);
-
- // Get the position of the dragged tab view relative to the attached tab
- // strip.
- gfx::Point GetAttachedTabDragPoint(const gfx::Point& screen_point);
-
- // Finds the Tab within the specified TabStrip that corresponds to the
- // dragged TabContents.
- BaseTab* GetTabMatchingDraggedContents(BaseTabStrip* tabstrip) const;
-
- // Does the work for EndDrag. If we actually started a drag and |how_end| is
- // not TAB_DESTROYED then one of EndDrag or RevertDrag is invoked.
- void EndDragImpl(EndDragType how_end);
-
- // Reverts a cancelled drag operation.
- void RevertDrag();
-
- // Finishes a succesful drag operation.
- void CompleteDrag();
-
- // Create the DraggedTabView, if it does not yet exist.
- void EnsureDraggedView(const TabRendererData& data);
-
- // Utility for getting the mouse position in screen coordinates.
- gfx::Point GetCursorScreenPoint() const;
-
- // Returns the bounds (in screen coordinates) of the specified View.
- gfx::Rect GetViewScreenBounds(views::View* tabstrip) const;
-
- // Utility to convert the specified TabStripModel index to something valid
- // for the attached TabStrip.
- int NormalizeIndexToAttachedTabStrip(int index) const;
-
- // Hides the frame for the window that contains the TabStrip the current
- // drag session was initiated from.
- void HideFrame();
-
- // Closes a hidden frame at the end of a drag session.
- void CleanUpHiddenFrame();
-
- void DockDisplayerDestroyed(DockDisplayer* controller);
-
- void BringWindowUnderMouseToFront();
-
- // Returns the TabStripModel for the specified tabstrip.
- TabStripModel* GetModel(BaseTabStrip* tabstrip) const;
-
- // Handles registering for notifications.
- NotificationRegistrar registrar_;
-
- // The TabContents being dragged.
- TabContents* 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 TabStrip |source_tab_| originated from.
- BaseTabStrip* 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.
- BaseTabStrip* attached_tabstrip_;
-
- // If attached this is the tab we're dragging.
- BaseTab* attached_tab_;
-
- // The visual representation of the dragged Tab.
- scoped_ptr<DraggedTabView> view_;
-
- // The photo-booth the TabContents sits in when the Tab is detached, to
- // obtain screen shots.
- scoped_ptr<NativeViewPhotobooth> photobooth_;
-
- // 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_;
-
- // Ratio of the x-coordinate of the mouse offset to the width of the tab.
- float offset_to_width_ratio_;
-
- // 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_;
-
- // Location of the first tab in the source tabstrip in screen coordinates.
- // This is used to calculate window_create_point_.
- gfx::Point first_source_tab_point_;
-
- // The bounds of the browser window before the last Tab was detached. When
- // the last Tab is detached, rather than destroying the frame (which would
- // abort the drag session), the frame is moved off-screen. If the drag is
- // aborted (e.g. by the user pressing Esc, or capture being lost), the Tab is
- // attached to the hidden frame and the frame moved back to these bounds.
- gfx::Rect restore_bounds_;
-
- // The last view that had focus in the window containing |source_tab_|. This
- // is saved so that focus can be restored properly when a drag begins and
- // ends within this same window.
- views::View* old_focused_view_;
-
- // The position along the major axis of the mouse cursor in screen coordinates
- // at the time of the last re-order event.
- int last_move_screen_loc_;
-
- DockInfo dock_info_;
-
- DockWindows dock_windows_;
-
- std::vector<DockDisplayer*> dock_controllers_;
-
- // 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<DraggedTabController> bring_to_front_timer_;
-
- // Did the mouse move enough that we started a drag?
- bool started_drag_;
-
- // Is the drag active?
- bool active_;
-
- DISALLOW_COPY_AND_ASSIGN(DraggedTabController);
-};
+#include "chrome/browser/ui/views/tabs/dragged_tab_controller.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TABS_DRAGGED_TAB_CONTROLLER_H_
+
diff --git a/chrome/browser/views/tabs/dragged_tab_view.h b/chrome/browser/views/tabs/dragged_tab_view.h
index 0432d46..2848baf 100644
--- a/chrome/browser/views/tabs/dragged_tab_view.h
+++ b/chrome/browser/views/tabs/dragged_tab_view.h
@@ -6,98 +6,8 @@
#define CHROME_BROWSER_VIEWS_TABS_DRAGGED_TAB_VIEW_H_
#pragma once
-#include "build/build_config.h"
-#include "gfx/point.h"
-#include "gfx/size.h"
-#include "views/view.h"
-
-namespace views {
-#if defined(OS_WIN)
-class WidgetWin;
-#elif defined(OS_LINUX)
-class WidgetGtk;
-#endif
-}
-namespace gfx {
-class Point;
-}
-class NativeViewPhotobooth;
-class Tab;
-class TabRenderer;
-
-class DraggedTabView : public views::View {
- public:
- // Creates a new DraggedTabView using |renderer| as the View. DraggedTabView
- // takes ownership of |renderer|.
- DraggedTabView(views::View* renderer,
- const gfx::Point& mouse_tab_offset,
- const gfx::Size& contents_size,
- const gfx::Size& min_size);
- virtual ~DraggedTabView();
-
- // Moves the DraggedTabView 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;
- }
-
- // Sets the width of the dragged tab and updates the dragged image.
- void SetTabWidthAndUpdate(int width, NativeViewPhotobooth* photobooth);
-
- // Notifies the DraggedTabView that it should update itself.
- void Update();
-
- private:
- // Overridden from views::View:
- virtual void Paint(gfx::Canvas* canvas);
- virtual void Layout();
- virtual gfx::Size GetPreferredSize();
-
- // Paint the view, when it's not attached to any TabStrip.
- void PaintDetachedView(gfx::Canvas* canvas);
-
- // Paint the view, when "Show window contents while dragging" is disabled.
- void PaintFocusRect(gfx::Canvas* canvas);
-
- // 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);
-
- // The window that contains the DraggedTabView.
-#if defined(OS_WIN)
- scoped_ptr<views::WidgetWin> container_;
-#elif defined(OS_LINUX)
- scoped_ptr<views::WidgetGtk> container_;
-#endif
-
- // The renderer that paints the Tab shape.
- scoped_ptr<views::View> renderer_;
-
- // True if "Show window contents while dragging" is enabled.
- bool show_contents_on_drag_;
-
- // 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.
- gfx::Size tab_size_;
-
- // A handle to the DIB containing the current screenshot of the TabContents
- // we are dragging.
- NativeViewPhotobooth* photobooth_;
-
- // Size of the TabContents being dragged.
- gfx::Size contents_size_;
-
- DISALLOW_COPY_AND_ASSIGN(DraggedTabView);
-};
+#include "chrome/browser/ui/views/tabs/dragged_tab_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TABS_DRAGGED_TAB_VIEW_H_
+
diff --git a/chrome/browser/views/tabs/native_view_photobooth.h b/chrome/browser/views/tabs/native_view_photobooth.h
index 0eba321..1a954e5 100644
--- a/chrome/browser/views/tabs/native_view_photobooth.h
+++ b/chrome/browser/views/tabs/native_view_photobooth.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,39 +6,8 @@
#define CHROME_BROWSER_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_H_
#pragma once
-#include "gfx/native_widget_types.h"
-
-namespace gfx {
-class Canvas;
-class Rect;
-}
-///////////////////////////////////////////////////////////////////////////////
-// NativeViewPhotobooth
-//
-// An object that a NativeView "steps into" to have its picture taken. This is
-// used to generate a full size screen shot of the contents of a NativeView
-// including any child windows.
-//
-// Implementation note: This causes the NativeView to be re-parented to a
-// mostly off-screen layered window.
-//
-class NativeViewPhotobooth {
- public:
- // Creates the photo booth. Constructs a nearly off-screen window, parents
- // the view, then shows it. The caller is responsible for destroying this
- // photo-booth, since the photo-booth will detach it before it is destroyed.
- static NativeViewPhotobooth* Create(gfx::NativeView initial_view);
-
- // Destroys the photo booth window.
- virtual ~NativeViewPhotobooth() {}
-
- // Replaces the view in the photo booth with the specified one.
- virtual void Replace(gfx::NativeView new_view) = 0;
-
- // Paints the current display image of the window into |canvas|, clipped to
- // |target_bounds|.
- virtual void PaintScreenshotIntoCanvas(gfx::Canvas* canvas,
- const gfx::Rect& target_bounds) = 0;
-};
+#include "chrome/browser/ui/views/tabs/native_view_photobooth.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_H_
+
diff --git a/chrome/browser/views/tabs/native_view_photobooth_gtk.h b/chrome/browser/views/tabs/native_view_photobooth_gtk.h
index 8bc74063..22c3901 100644
--- a/chrome/browser/views/tabs/native_view_photobooth_gtk.h
+++ b/chrome/browser/views/tabs/native_view_photobooth_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,25 +6,8 @@
#define CHROME_BROWSER_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_GTK_H_
#pragma once
-#include "chrome/browser/views/tabs/native_view_photobooth.h"
-
-class NativeViewPhotoboothGtk : public NativeViewPhotobooth {
- public:
- explicit NativeViewPhotoboothGtk(gfx::NativeView new_view);
-
- // Destroys the photo booth window.
- virtual ~NativeViewPhotoboothGtk();
-
- // Replaces the view in the photo booth with the specified one.
- virtual void Replace(gfx::NativeView new_view);
-
- // Paints the current display image of the window into |canvas|, clipped to
- // |target_bounds|.
- virtual void PaintScreenshotIntoCanvas(gfx::Canvas* canvas,
- const gfx::Rect& target_bounds);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(NativeViewPhotoboothGtk);
-};
+#include "chrome/browser/ui/views/tabs/native_view_photobooth_gtk.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_GTK_H_
+
diff --git a/chrome/browser/views/tabs/native_view_photobooth_win.h b/chrome/browser/views/tabs/native_view_photobooth_win.h
index 4ed4016..2cd2a4b 100644
--- a/chrome/browser/views/tabs/native_view_photobooth_win.h
+++ b/chrome/browser/views/tabs/native_view_photobooth_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,53 +6,8 @@
#define CHROME_BROWSER_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_WIN_H_
#pragma once
-#include "chrome/browser/views/tabs/native_view_photobooth.h"
-
-namespace views {
-class WidgetWin;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// HWNDPhotobooth
-//
-// An object that a HWND "steps into" to have its picture taken. This is used
-// to generate a full size screen shot of the contents of a HWND including
-// any child windows.
-//
-// Implementation note: This causes the HWND to be re-parented to a mostly
-// off-screen layered window.
-//
-class NativeViewPhotoboothWin : public NativeViewPhotobooth {
- public:
- // Creates the photo booth. Constructs a nearly off-screen window, parents
- // the HWND, then shows it. The caller is responsible for destroying this
- // window, since the photo-booth will detach it before it is destroyed.
- // |canvas| is a canvas to paint the contents into, and dest_bounds is the
- // target area in |canvas| to which painted contents will be clipped.
- explicit NativeViewPhotoboothWin(gfx::NativeView initial_view);
-
- // Destroys the photo booth window.
- virtual ~NativeViewPhotoboothWin();
-
- // Replaces the view in the photo booth with the specified one.
- virtual void Replace(gfx::NativeView new_view);
-
- // Paints the current display image of the window into |canvas|, clipped to
- // |target_bounds|.
- virtual void PaintScreenshotIntoCanvas(gfx::Canvas* canvas,
- const gfx::Rect& target_bounds);
-
- private:
- // Creates a mostly off-screen window to contain the HWND to be captured.
- void CreateCaptureWindow(HWND initial_hwnd);
-
- // The nearly off-screen photo-booth layered window used to hold the HWND.
- views::WidgetWin* capture_window_;
-
- // The current HWND being captured.
- HWND current_hwnd_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeViewPhotoboothWin);
-};
+#include "chrome/browser/ui/views/tabs/native_view_photobooth_win.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_WIN_H_
+
diff --git a/chrome/browser/views/tabs/side_tab.h b/chrome/browser/views/tabs/side_tab.h
index 6cff764..5d27ce3 100644
--- a/chrome/browser/views/tabs/side_tab.h
+++ b/chrome/browser/views/tabs/side_tab.h
@@ -6,39 +6,8 @@
#define CHROME_BROWSER_VIEWS_TABS_SIDE_TAB_H_
#pragma once
-#include "chrome/browser/views/tabs/base_tab.h"
-#include "gfx/font.h"
-
-class SideTab;
-class TabStripController;
-
-class SideTab : public BaseTab {
- public:
- explicit SideTab(TabController* controller);
- virtual ~SideTab();
-
- // Returns the preferred height of side tabs.
- static int GetPreferredHeight();
-
- // views::View Overrides:
- virtual void Layout();
- virtual void Paint(gfx::Canvas* canvas);
- virtual gfx::Size GetPreferredSize();
-
- protected:
- virtual const gfx::Rect& title_bounds() const { return title_bounds_; }
-
- // Returns true if the selected highlight should be rendered.
- virtual bool ShouldPaintHighlight() const;
-
- private:
- // Returns true if the icon should be shown.
- bool ShouldShowIcon() const;
-
- gfx::Rect icon_bounds_;
- gfx::Rect title_bounds_;
-
- DISALLOW_COPY_AND_ASSIGN(SideTab);
-};
+#include "chrome/browser/ui/views/tabs/side_tab.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TABS_SIDE_TAB_H_
+
diff --git a/chrome/browser/views/tabs/side_tab_strip.h b/chrome/browser/views/tabs/side_tab_strip.h
index c847077..cbecf20 100644
--- a/chrome/browser/views/tabs/side_tab_strip.h
+++ b/chrome/browser/views/tabs/side_tab_strip.h
@@ -6,62 +6,8 @@
#define CHROME_BROWSER_VIEWS_TABS_SIDE_TAB_STRIP_H_
#pragma once
-#include "chrome/browser/views/tabs/base_tab_strip.h"
-
-struct TabRendererData;
-
-class SideTabStrip : public BaseTabStrip {
- public:
- // The tabs are inset by this much along all axis.
- static const int kTabStripInset;
-
- explicit SideTabStrip(TabStripController* controller);
- virtual ~SideTabStrip();
-
- // BaseTabStrip implementation:
- virtual int GetPreferredHeight();
- virtual void SetBackgroundOffset(const gfx::Point& offset);
- virtual bool IsPositionInWindowCaption(const gfx::Point& point);
- virtual void SetDraggedTabBounds(int tab_index,
- const gfx::Rect& tab_bounds);
- virtual TabStrip* AsTabStrip();
-
- virtual void StartHighlight(int model_index);
- virtual void StopAllHighlighting();
- virtual BaseTab* CreateTabForDragging();
- virtual void RemoveTabAt(int model_index);
- virtual void SelectTabAt(int old_model_index, int new_model_index);
- virtual void TabTitleChangedNotLoading(int model_index);
-
- // views::View overrides:
- virtual gfx::Size GetPreferredSize();
- virtual void PaintChildren(gfx::Canvas* canvas);
-
- protected:
- // BaseTabStrip overrides:
- virtual BaseTab* CreateTab();
- virtual void GenerateIdealBounds();
- virtual void StartInsertTabAnimation(int model_index, bool foreground);
- virtual void StartMoveTabAnimation();
- virtual void StopAnimating(bool layout);
- virtual void AnimateToIdealBounds();
- virtual void DoLayout();
-
- private:
- // The "New Tab" button.
- views::View* newtab_button_;
-
- // Ideal bounds of the new tab button.
- gfx::Rect newtab_button_bounds_;
-
- // Separator between mini-tabs and the new tab button. The separator is
- // positioned above the visible area if there are no mini-tabs.
- views::View* separator_;
-
- // Bounds of the sepatator.
- gfx::Rect separator_bounds_;
-
- DISALLOW_COPY_AND_ASSIGN(SideTabStrip);
-};
+#include "chrome/browser/ui/views/tabs/side_tab_strip.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TABS_SIDE_TAB_STRIP_H_
+
diff --git a/chrome/browser/views/tabs/tab.h b/chrome/browser/views/tabs/tab.h
index e99a8fd..11076c1 100644
--- a/chrome/browser/views/tabs/tab.h
+++ b/chrome/browser/views/tabs/tab.h
@@ -6,136 +6,8 @@
#define CHROME_BROWSER_VIEWS_TABS_TAB_H_
#pragma once
-#include <string>
-
-#include "base/scoped_ptr.h"
-#include "chrome/browser/views/tabs/base_tab.h"
-#include "gfx/point.h"
-
-class MultiAnimation;
-class SlideAnimation;
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// TabRenderer
-//
-// A View that renders a Tab, either in a TabStrip or in a DraggedTabView.
-//
-///////////////////////////////////////////////////////////////////////////////
-class Tab : public BaseTab {
- public:
- // The menu button's class name.
- static const char kViewClassName[];
-
- explicit Tab(TabController* controller);
- virtual ~Tab();
-
- // Start/stop the mini-tab title animation.
- void StartMiniTabTitleAnimation();
- void StopMiniTabTitleAnimation();
-
- // Set the background offset used to match the image in the inactive tab
- // to the frame image.
- void SetBackgroundOffset(const gfx::Point& offset) {
- background_offset_ = offset;
- }
-
- // Paints the icon. Most of the time you'll want to invoke Paint directly, but
- // in certain situations this invoked outside of Paint.
- void PaintIcon(gfx::Canvas* canvas);
-
- // 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();
-
- protected:
- virtual const gfx::Rect& title_bounds() const { return title_bounds_; }
-
- // BaseTab overrides:
- virtual void DataChanged(const TabRendererData& old);
-
- private:
- // Overridden from views::View:
- virtual void Paint(gfx::Canvas* canvas);
- virtual void Layout();
- virtual void OnThemeChanged();
- virtual std::string GetClassName() const { return kViewClassName; }
- virtual bool HasHitTestMask() const;
- virtual void GetHitTestMask(gfx::Path* path) const;
- virtual bool GetTooltipTextOrigin(const gfx::Point& p, gfx::Point* origin);
-
- // Paint various portions of the Tab
- void PaintTabBackground(gfx::Canvas* canvas);
- void PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas);
- void PaintInactiveTabBackground(gfx::Canvas* canvas);
- void PaintActiveTabBackground(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 favicon.
- bool ShouldShowIcon() const;
-
- // Returns whether the Tab should display a close button.
- bool ShouldShowCloseBox() const;
-
- // 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,
- // mini tab title change and pulsing.
- double GetThrobValue();
-
- // The bounds of various sections of the display.
- gfx::Rect favicon_bounds_;
- gfx::Rect title_bounds_;
-
- // The offset used to paint the inactive background image.
- gfx::Point background_offset_;
-
- // Hover animation.
- scoped_ptr<SlideAnimation> hover_animation_;
-
- // Animation used when the title of an inactive mini tab changes.
- scoped_ptr<MultiAnimation> mini_title_animation_;
-
- struct TabImage {
- SkBitmap* image_l;
- SkBitmap* image_c;
- SkBitmap* image_r;
- int l_width;
- int r_width;
- int y_offset;
- };
- static TabImage tab_active;
- static TabImage tab_inactive;
- static TabImage tab_alpha;
-
- // 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 current color of the close button.
- SkColor close_button_color_;
-
- static bool initialized_;
-
- DISALLOW_COPY_AND_ASSIGN(Tab);
-};
+#include "chrome/browser/ui/views/tabs/tab.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TABS_TAB_H_
+
diff --git a/chrome/browser/views/tabs/tab_controller.h b/chrome/browser/views/tabs/tab_controller.h
index abaaf0f..5205f5e 100644
--- a/chrome/browser/views/tabs/tab_controller.h
+++ b/chrome/browser/views/tabs/tab_controller.h
@@ -6,54 +6,8 @@
#define CHROME_BROWSER_VIEWS_TABS_TAB_CONTROLLER_H_
#pragma once
-class BaseTab;
-
-namespace gfx {
-class Point;
-}
-namespace views {
-class MouseEvent;
-}
-
-// Controller for tabs.
-class TabController {
- public:
- // Selects the tab.
- virtual void SelectTab(BaseTab* tab) = 0;
-
- // Closes the tab.
- virtual void CloseTab(BaseTab* tab) = 0;
-
- // Shows a context menu for the tab at the specified point in screen coords.
- virtual void ShowContextMenu(BaseTab* tab, const gfx::Point& p) = 0;
-
- // Returns true if the specified Tab is selected.
- virtual bool IsTabSelected(const BaseTab* tab) const = 0;
-
- // Returns true if the specified Tab is pinned.
- virtual bool IsTabPinned(const BaseTab* tab) const = 0;
-
- // Returns true if the specified Tab is closeable.
- virtual bool IsTabCloseable(const BaseTab* tab) const = 0;
-
- // Potentially starts a drag for the specified Tab.
- virtual void MaybeStartDrag(BaseTab* tab, const views::MouseEvent& event) = 0;
-
- // Continues dragging a Tab.
- virtual void ContinueDrag(const views::MouseEvent& event) = 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 the tab that contains the specified coordinates, in terms of |tab|,
- // or NULL if there is no tab that contains the specified point.
- virtual BaseTab* GetTabAt(BaseTab* tab,
- const gfx::Point& tab_in_tab_coordinates) = 0;
-
- protected:
- virtual ~TabController() {}
-};
+#include "chrome/browser/ui/views/tabs/tab_controller.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TABS_TAB_CONTROLLER_H_
+
diff --git a/chrome/browser/views/tabs/tab_renderer_data.h b/chrome/browser/views/tabs/tab_renderer_data.h
index 31e84ed..dca47c9 100644
--- a/chrome/browser/views/tabs/tab_renderer_data.h
+++ b/chrome/browser/views/tabs/tab_renderer_data.h
@@ -6,41 +6,8 @@
#define CHROME_BROWSER_VIEWS_TABS_TAB_RENDERER_DATA_H_
#pragma once
-#include "base/string16.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-
-// Wraps the state needed by the renderers.
-struct TabRendererData {
- // Different types of network activity for a tab. The NetworkState of a tab
- // may be used to alter the UI (e.g. show different kinds of loading
- // animations).
- enum NetworkState {
- NETWORK_STATE_NONE, // no network activity.
- NETWORK_STATE_WAITING, // waiting for a connection.
- NETWORK_STATE_LOADING, // connected, transferring data.
- };
-
- TabRendererData()
- : network_state(NETWORK_STATE_NONE),
- loading(false),
- crashed(false),
- off_the_record(false),
- show_icon(true),
- mini(false),
- blocked(false),
- app(false) {
- }
-
- SkBitmap favicon;
- NetworkState network_state;
- string16 title;
- bool loading;
- bool crashed;
- bool off_the_record;
- bool show_icon;
- bool mini;
- bool blocked;
- bool app;
-};
+#include "chrome/browser/ui/views/tabs/tab_renderer_data.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TABS_TAB_RENDERER_DATA_H_
+
diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h
index f7ec80fd..4c24f8c 100644
--- a/chrome/browser/views/tabs/tab_strip.h
+++ b/chrome/browser/views/tabs/tab_strip.h
@@ -6,282 +6,8 @@
#define CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_H_
#pragma once
-#include "app/animation_container.h"
-#include "base/ref_counted.h"
-#include "base/timer.h"
-#include "chrome/browser/views/tabs/base_tab_strip.h"
-#include "gfx/point.h"
-#include "gfx/rect.h"
-#include "views/controls/button/image_button.h"
-#include "views/mouse_watcher.h"
-
-class Tab;
-
-namespace views {
-class ImageView;
-#if defined(OS_LINUX)
-class WidgetGtk;
-#elif defined(OS_WIN)
-class WidgetWin;
-#endif
-}
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// TabStrip
-//
-// A View that represents the TabStripModel. The TabStrip has the
-// following responsibilities:
-// - It implements the TabStripModelObserver interface, and acts as a
-// container for Tabs, and is also responsible for creating them.
-// - It takes part in Tab Drag & Drop with Tab, TabDragHelper and
-// DraggedTab, focusing on tasks that require reshuffling other tabs
-// in response to dragged tabs.
-//
-///////////////////////////////////////////////////////////////////////////////
-class TabStrip : public BaseTabStrip,
- public views::ButtonListener,
- public views::MouseWatcherListener {
- public:
- explicit TabStrip(TabStripController* controller);
- virtual ~TabStrip();
-
- // Creates the new tab button.
- void InitTabStripButtons();
-
- // Returns the bounds of the new tab button.
- gfx::Rect GetNewTabButtonBounds();
-
- // MouseWatcherListener overrides:
- virtual void MouseMovedOutOfView();
-
- // BaseTabStrip implementation:
- virtual int GetPreferredHeight();
- virtual void SetBackgroundOffset(const gfx::Point& offset);
- virtual bool IsPositionInWindowCaption(const gfx::Point& point);
- virtual void SetDraggedTabBounds(int tab_index,
- const gfx::Rect& tab_bounds);
- virtual TabStrip* AsTabStrip();
- virtual void PrepareForCloseAt(int model_index);
- virtual void RemoveTabAt(int model_index);
- virtual void SelectTabAt(int old_model_index, int new_model_index);
- virtual void TabTitleChangedNotLoading(int model_index);
- virtual void StartHighlight(int model_index);
- virtual void StopAllHighlighting();
- virtual BaseTab* CreateTabForDragging();
-
- // views::View overrides:
- virtual void PaintChildren(gfx::Canvas* canvas);
- virtual views::View* GetViewByID(int id) const;
- virtual gfx::Size GetPreferredSize();
- // NOTE: the drag and drop methods are invoked from FrameView. This is done to
- // allow for a drop region that extends outside the bounds of the TabStrip.
- virtual void OnDragEntered(const views::DropTargetEvent& event);
- virtual int OnDragUpdated(const views::DropTargetEvent& event);
- virtual void OnDragExited();
- virtual int OnPerformDrop(const views::DropTargetEvent& event);
- virtual AccessibilityTypes::Role GetAccessibleRole();
- virtual views::View* GetViewForPoint(const gfx::Point& point);
- virtual void OnThemeChanged();
-
- protected:
- // BaseTabStrip overrides:
- virtual BaseTab* CreateTab();
- virtual void StartInsertTabAnimation(int model_index, bool foreground);
- virtual void StartMoveTabAnimation();
- virtual void AnimateToIdealBounds();
- virtual bool ShouldHighlightCloseButtonAfterRemove();
- virtual void DoLayout();
-
- // views::View implementation:
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
-
- // TabController overrides.
- virtual bool IsTabSelected(const BaseTab* btr) const;
-
- // views::ButtonListener implementation:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Horizontal gap between mini and non-mini-tabs.
- static const int mini_to_non_mini_gap_;
-
- private:
- friend class DraggedTabController;
-
- // 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.
- struct DropInfo {
- DropInfo(int index, bool drop_before, bool paint_down);
- ~DropInfo();
-
- // 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;
-
- // Renders the drop indicator.
- // TODO(beng): should be views::Widget.
-#if defined(OS_WIN)
- views::WidgetWin* arrow_window;
-#else
- views::WidgetGtk* arrow_window;
-#endif
- views::ImageView* arrow_view;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(DropInfo);
- };
-
- void Init();
-
- // Set the images for the new tab button.
- void LoadNewTabButtonImage();
-
- // Retrieves the Tab at the specified index. Remember, the specified index
- // is in terms of tab_data, *not* the model.
- Tab* GetTabAtTabDataIndex(int tab_data_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 GetTabAtTabDataIndex if the index comes from the model.
- Tab* GetTabAtModelIndex(int model_index) const;
-
- // Returns the number of mini-tabs.
- int GetMiniTabCount() const;
-
- // -- Tab Resize Layout -----------------------------------------------------
-
- // 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;
-
- // Perform an animated resize-relayout of the TabStrip immediately.
- void ResizeLayoutTabs();
-
- // 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();
-
- // -- 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(const views::DropTargetEvent& event);
-
- // Sets the location of the drop, repainting as necessary.
- void SetDropIndex(int tab_data_index, bool drop_before);
-
- // Returns the drop effect for dropping a URL on the tab strip. This does
- // not query the data in anyway, it only looks at the source operations.
- int GetDropEffect(const views::DropTargetEvent& event);
-
- // Returns the image to use for indicating a drop on a tab. If is_down is
- // true, this returns an arrow pointing down.
- static SkBitmap* GetDropArrowImage(bool is_down);
-
- // -- Animations ------------------------------------------------------------
-
- // 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();
-
- // Starts various types of TabStrip animations.
- void StartResizeLayoutAnimation();
- void StartMoveTabAnimation(int from_model_index,
- int to_model_index);
- void StartMiniTabAnimation();
- void StartMouseInitiatedRemoveTabAnimation(int model_index);
-
- // Stops any ongoing animations. If |layout| is true and an animation is
- // ongoing this does a layout.
- virtual void StopAnimating(bool layout);
-
- // Calculates the available width for tabs, assuming a Tab is to be closed.
- int GetAvailableWidthForTabs(Tab* last_tab) const;
-
- // Returns true if the specified point in TabStrip coords is within the
- // hit-test region of the specified Tab.
- bool IsPointInTab(Tab* tab, const gfx::Point& point_in_tabstrip_coords);
-
- // -- Member Variables ------------------------------------------------------
-
- // The "New Tab" button.
- views::ImageButton* newtab_button_;
-
- // Ideal bounds of the new tab button.
- gfx::Rect newtab_button_bounds_;
-
- // 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 PrepareForCloseAt has been invoked. When true remove animations
- // preserve current tab bounds.
- bool in_tab_close_;
-
- // The size of the new tab button must be hardcoded because we need to be
- // able to lay it out before we are able to get its image from the
- // ThemeProvider. It also makes sense to do this, because the size of the
- // new tab button should not need to be calculated dynamically.
- static const int kNewTabButtonWidth = 28;
- static const int kNewTabButtonHeight = 18;
-
- // Valid for the lifetime of a drag over us.
- scoped_ptr<DropInfo> drop_info_;
-
- // To ensure all tabs pulse at the same time they share the same animation
- // container. This is that animation container.
- scoped_refptr<AnimationContainer> animation_container_;
-
- // Used for stage 1 of new tab animation.
- base::OneShotTimer<TabStrip> new_tab_timer_;
-
- scoped_ptr<views::MouseWatcher> mouse_watcher_;
-
- DISALLOW_COPY_AND_ASSIGN(TabStrip);
-};
+#include "chrome/browser/ui/views/tabs/tab_strip.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_H_
+
diff --git a/chrome/browser/views/tabs/tab_strip_controller.h b/chrome/browser/views/tabs/tab_strip_controller.h
index bd52452..b0c7be9 100644
--- a/chrome/browser/views/tabs/tab_strip_controller.h
+++ b/chrome/browser/views/tabs/tab_strip_controller.h
@@ -6,68 +6,8 @@
#define CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_CONTROLLER_H_
#pragma once
-class BaseTab;
-class BaseTabStrip;
-class GURL;
-
-namespace gfx {
-class Point;
-}
-
-// Model/Controller for the TabStrip.
-// NOTE: All indices used by this class are in model coordinates.
-class TabStripController {
- public:
- virtual ~TabStripController() {}
-
- // Returns the number of tabs in the model.
- virtual int GetCount() const = 0;
-
- // Returns true if |index| is a valid model index.
- virtual bool IsValidIndex(int index) const = 0;
-
- // Returns the selected index, in terms of the model.
- virtual int GetSelectedIndex() const = 0;
-
- // Returns true if the selected index is selected.
- virtual bool IsTabSelected(int index) const = 0;
-
- // Returns true if the selected index is pinned.
- virtual bool IsTabPinned(int index) const = 0;
-
- // Returns true if the selected index is closeable.
- virtual bool IsTabCloseable(int index) const = 0;
-
- // Returns true if the selected index is the new tab page.
- virtual bool IsNewTabPage(int index) const = 0;
-
- // Select the tab at the specified index in the model.
- virtual void SelectTab(int index) = 0;
-
- // Closes the tab at the specified index in the model.
- virtual void CloseTab(int index) = 0;
-
- // Shows a context menu for the tab at the specified point in screen coords.
- virtual void ShowContextMenu(BaseTab* tab, const gfx::Point& p) = 0;
-
- // Updates the loading animations of all the tabs.
- virtual void UpdateLoadingAnimations() = 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 int HasAvailableDragActions() const = 0;
-
- // Performans a drop at the specified location.
- virtual void PerformDrop(bool drop_before, int index, const GURL& url) = 0;
-
- // Return true if this tab strip is compatible with the provided tab strip.
- // Compatible tab strips can transfer tabs during drag and drop.
- virtual bool IsCompatibleWith(BaseTabStrip* other) const = 0;
-
- // Creates the new tab.
- virtual void CreateNewTab() = 0;
-};
+#include "chrome/browser/ui/views/tabs/tab_strip_controller.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_CONTROLLER_H_
+
diff --git a/chrome/browser/views/textfield_views.h b/chrome/browser/views/textfield_views.h
index 506a2e6..3b699f0 100644
--- a/chrome/browser/views/textfield_views.h
+++ b/chrome/browser/views/textfield_views.h
@@ -6,22 +6,8 @@
#define CHROME_BROWSER_VIEWS_TEXTFIELD_VIEWS_H_
#pragma once
-#include <string>
-
-#include "chrome/browser/views/dom_view.h"
-
-class TextfieldsUI;
-
-class TextfieldViews : public DOMView {
- public:
- TextfieldViews();
- std::wstring GetText();
- void SetText(const std::wstring& text);
-
- private:
- TextfieldsUI* dom_ui();
-
- DISALLOW_COPY_AND_ASSIGN(TextfieldViews);
-};
+#include "chrome/browser/ui/views/textfield_views.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TEXTFIELD_VIEWS_H_
+
diff --git a/chrome/browser/views/theme_background.h b/chrome/browser/views/theme_background.h
index b904a71..98ce8f6 100644
--- a/chrome/browser/views/theme_background.h
+++ b/chrome/browser/views/theme_background.h
@@ -6,36 +6,8 @@
#define CHROME_BROWSER_VIEWS_THEME_BACKGROUND_H_
#pragma once
-#include "views/background.h"
-
-class BrowserView;
-
-namespace views {
-class View;
-};
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// ThemeBackground class.
-//
-// A ThemeBackground is used to paint the background theme image in a
-// view in such a way that it's consistent with the frame's theme
-// image. It takes care of active/inactive state, incognito state and
-// the offset from the frame view.
-//
-////////////////////////////////////////////////////////////////////////////////
-class ThemeBackground : public views::Background {
- public:
- explicit ThemeBackground(BrowserView* browser);
- virtual ~ThemeBackground() {}
-
- // Overridden from views:;Background.
- virtual void Paint(gfx::Canvas* canvas, views::View* view) const;
-
- private:
- BrowserView* browser_view_;
-
- DISALLOW_COPY_AND_ASSIGN(ThemeBackground);
-};
+#include "chrome/browser/ui/views/theme_background.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_THEME_BACKGROUND_H_
+
diff --git a/chrome/browser/views/theme_helpers.h b/chrome/browser/views/theme_helpers.h
index 68ea077..b7bd4f2 100644
--- a/chrome/browser/views/theme_helpers.h
+++ b/chrome/browser/views/theme_helpers.h
@@ -1,30 +1,13 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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_VIEWS_THEME_HELPERS_H__
-#define CHROME_BROWSER_VIEWS_THEME_HELPERS_H__
+#ifndef CHROME_BROWSER_VIEWS_THEME_HELPERS_H_
+#define CHROME_BROWSER_VIEWS_THEME_HELPERS_H_
#pragma once
-#include <windows.h>
+#include "chrome/browser/ui/views/theme_helpers.h"
+// TODO(beng): remove this file once all includes have been updated.
-#include "third_party/skia/include/core/SkColor.h"
+#endif // CHROME_BROWSER_VIEWS_THEME_HELPERS_H_
-// Get the colors at two points on a Rebar background gradient. This is for
-// drawing Rebar like backgrounds in Views. The reason not to just use
-// DrawThemeBackground is that it only draws horizontally, but by extracting
-// the colors at two points on the X axis of a background drawn
-// by DrawThemeBackground, we can construct a LinearGradientBrush and draw
-// such a gradient in any direction.
-//
-// The width parameter is the width of horizontal gradient that will be
-// created to calculate the two colors. x1 and x2 are the two pixel positions
-// along the X axis.
-void GetRebarGradientColors(int width, int x1, int x2,
- SkColor* c1, SkColor* c2);
-
-
-// Gets the color used to draw dark (inset beveled) lines.
-void GetDarkLineColor(SkColor* dark_color);
-
-#endif // CHROME_BROWSER_VIEWS_THEME_HELPERS_H__
diff --git a/chrome/browser/views/theme_install_bubble_view.h b/chrome/browser/views/theme_install_bubble_view.h
index dfe9dc4..b0eddec 100644
--- a/chrome/browser/views/theme_install_bubble_view.h
+++ b/chrome/browser/views/theme_install_bubble_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,74 +6,8 @@
#define CHROME_BROWSER_VIEWS_THEME_INSTALL_BUBBLE_VIEW_H_
#pragma once
-#include <string>
-
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "chrome/common/notification_service.h"
-#include "gfx/canvas.h"
-#include "views/controls/label.h"
-
-class TabContents;
-
-namespace views {
-class Widget;
-}
-
-// ThemeInstallBubbleView is a view that provides a "Loading..." bubble in the
-// center of a browser window for use when an extension or theme is loaded.
-// (The Browser class only calls it to install itself into the currently active
-// browser window.) If an extension is being applied, the bubble goes away
-// immediately. If a theme is being applied, it disappears when the theme has
-// been loaded. The purpose of this bubble is to warn the user that the browser
-// may be unresponsive while the theme is being installed.
-//
-// Edge case: note that if one installs a theme in one window and then switches
-// rapidly to another window to install a theme there as well (in the short time
-// between install begin and theme caching seizing the UI thread), the loading
-// bubble will only appear over the first window, as there is only ever one
-// instance of the bubble.
-class ThemeInstallBubbleView : public NotificationObserver,
- public views::Label {
- public:
- ~ThemeInstallBubbleView();
-
- // NotificationObserver
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Show the loading bubble.
- static void Show(TabContents* tab_contents);
-
- private:
- explicit ThemeInstallBubbleView(TabContents* tab_contents);
-
- // Put the popup in the correct place on the tab.
- void Reposition();
-
- // Inherited from views.
- gfx::Size GetPreferredSize();
-
- // Shut down the popup and remove our notifications.
- void Close();
-
- virtual void Paint(gfx::Canvas* canvas);
-
- // The content area at the start of the animation.
- gfx::Rect tab_contents_bounds_;
-
- // Widget containing us.
- views::Widget* popup_;
-
- // Text to show warning that theme is being installed.
- std::wstring text_;
-
- // A scoped container for notification registries.
- NotificationRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(ThemeInstallBubbleView);
-};
+#include "chrome/browser/ui/views/theme_install_bubble_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_THEME_INSTALL_BUBBLE_VIEW_H_
diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h
index c9b92bd..da47f0f 100644
--- a/chrome/browser/views/toolbar_view.h
+++ b/chrome/browser/views/toolbar_view.h
@@ -6,231 +6,8 @@
#define CHROME_BROWSER_VIEWS_TOOLBAR_VIEW_H_
#pragma once
-#include <vector>
-
-#include "app/menus/accelerator.h"
-#include "app/slide_animation.h"
-#include "base/ref_counted.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/back_forward_menu_model.h"
-#include "chrome/browser/command_updater.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/browser/views/accessible_pane_view.h"
-#include "chrome/browser/views/location_bar/location_bar_view.h"
-#include "chrome/browser/views/reload_button.h"
-#include "views/controls/button/menu_button.h"
-#include "views/controls/menu/menu.h"
-#include "views/controls/menu/menu_wrapper.h"
-#include "views/controls/menu/view_menu_delegate.h"
-#include "views/view.h"
-
-class BrowserActionsContainer;
-class Browser;
-class Profile;
-#if defined(OS_CHROMEOS)
-namespace views {
-class Menu2;
-} // namespace views
-#endif
-class WrenchMenu;
-
-// The Browser Window's toolbar.
-class ToolbarView : public AccessiblePaneView,
- public views::ViewMenuDelegate,
- public menus::AcceleratorProvider,
- public LocationBarView::Delegate,
- public AnimationDelegate,
- public NotificationObserver,
- public CommandUpdater::CommandObserver,
- public views::ButtonListener {
- public:
- explicit ToolbarView(Browser* browser);
- virtual ~ToolbarView();
-
- // Create the contents of the Browser Toolbar
- void Init(Profile* profile);
-
- // Sets the profile which is active on the currently-active tab.
- void SetProfile(Profile* profile);
- Profile* profile() { return profile_; }
-
- // Updates the toolbar (and transitively the location bar) with the states of
- // the specified |tab|. If |should_restore_state| is true, we're switching
- // (back?) to this tab and should restore any previous location bar state
- // (such as user editing) as well.
- void Update(TabContents* tab, bool should_restore_state);
-
- // Set focus to the toolbar with complete keyboard access, with the
- // focus initially set to the location bar. Focus will be restored
- // to the ViewStorage with id |view_storage_id| if the user escapes.
- void SetPaneFocusAndFocusLocationBar(int view_storage_id);
-
- // Set focus to the toolbar with complete keyboard access, with the
- // focus initially set to the app menu. Focus will be restored
- // to the ViewStorage with id |view_storage_id| if the user escapes.
- void SetPaneFocusAndFocusAppMenu(int view_storage_id);
-
- // Returns true if the app menu is focused.
- bool IsAppMenuFocused();
-
- // Add a listener to receive a callback when the menu opens.
- void AddMenuListener(views::MenuListener* listener);
-
- // Remove a menu listener.
- void RemoveMenuListener(views::MenuListener* listener);
-
- // Accessors...
- Browser* browser() const { return browser_; }
- BrowserActionsContainer* browser_actions() const { return browser_actions_; }
- ReloadButton* reload_button() const { return reload_; }
- LocationBarView* location_bar() const { return location_bar_; }
- views::MenuButton* app_menu() const { return app_menu_; }
-
- // Overridden from AccessiblePaneView
- virtual bool SetPaneFocus(int view_storage_id, View* initial_focus);
- virtual AccessibilityTypes::Role GetAccessibleRole();
-
- // Overridden from Menu::BaseControllerDelegate:
- virtual bool GetAcceleratorInfo(int id, menus::Accelerator* accel);
-
- // Overridden from views::MenuDelegate:
- virtual void RunMenu(views::View* source, const gfx::Point& pt);
-
- // Overridden from LocationBarView::Delegate:
- virtual TabContents* GetTabContents();
- virtual InstantController* GetInstant();
- virtual void OnInputInProgress(bool in_progress);
-
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
-
- // Overridden from CommandUpdater::CommandObserver:
- virtual void EnabledStateChangedForCommand(int id, bool enabled);
-
- // Overridden from views::BaseButton::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Overridden from menus::AcceleratorProvider:
- virtual bool GetAcceleratorForCommandId(int command_id,
- menus::Accelerator* accelerator);
-
- // Overridden from views::View:
- virtual gfx::Size GetPreferredSize();
- virtual void Layout();
- virtual void Paint(gfx::Canvas* canvas);
- virtual void OnThemeChanged();
-
- // The apparent horizontal space between most items, and the vertical padding
- // above and below them.
- static const int kStandardSpacing;
- // The top of the toolbar has an edge we have to skip over in addition to the
- // standard spacing.
- static const int kVertSpacing;
-
- protected:
-
- // Overridden from AccessiblePaneView
- virtual views::View* GetDefaultFocusableChild();
- virtual void RemovePaneFocus();
-
- private:
- // Returns true if we should show the upgrade recommended dot.
- bool IsUpgradeRecommended();
-
- // Returns true if we should show the warning for incompatible software.
- bool ShouldShowIncompatibilityWarning();
-
- // Returns the number of pixels above the location bar in non-normal display.
- int PopupTopSpacing() const;
-
- // Loads the images for all the child views.
- void LoadImages();
-
- // Types of display mode this toolbar can have.
- enum DisplayMode {
- DISPLAYMODE_NORMAL, // Normal toolbar with buttons, etc.
- DISPLAYMODE_LOCATION // Slimline toolbar showing only compact location
- // bar, used for popups.
- };
- bool IsDisplayModeNormal() const {
- return display_mode_ == DISPLAYMODE_NORMAL;
- }
-
- // Starts the recurring timer that periodically asks the notification dot
- // to pulsate.
- void ShowNotificationDot();
-
- // Show the reminder, tempting the user to take a look.
- void PulsateNotificationDot();
-
- // Gets a canvas with the icon for the app menu. It will possibly contain
- // an overlaid badge if an update is recommended.
- SkBitmap GetAppMenuIcon(views::CustomButton::ButtonState state);
-
- scoped_ptr<BackForwardMenuModel> back_menu_model_;
- scoped_ptr<BackForwardMenuModel> forward_menu_model_;
-
- // The model that contains the security level, text, icon to display...
- ToolbarModel* model_;
-
- // Controls
- views::ImageButton* back_;
- views::ImageButton* forward_;
- ReloadButton* reload_;
- views::ImageButton* home_;
- LocationBarView* location_bar_;
- BrowserActionsContainer* browser_actions_;
- views::MenuButton* app_menu_;
- Profile* profile_;
- Browser* browser_;
-
- // Contents of the profiles menu to populate with profile names.
- scoped_ptr<menus::SimpleMenuModel> profiles_menu_contents_;
-
- // Controls whether or not a home button should be shown on the toolbar.
- BooleanPrefMember show_home_button_;
-
- // The display mode used when laying out the toolbar.
- DisplayMode display_mode_;
-
- // The contents of the wrench menu.
- scoped_ptr<menus::SimpleMenuModel> wrench_menu_model_;
-
-#if defined(OS_CHROMEOS)
- // Wrench menu using domui menu.
- // MenuLister is managed by Menu2.
- scoped_ptr<views::Menu2> wrench_menu_2_;
-#endif
-
- // Wrench menu.
- scoped_refptr<WrenchMenu> wrench_menu_;
-
- // Vector of listeners to receive callbacks when the menu opens.
- std::vector<views::MenuListener*> menu_listeners_;
-
- // The animation that makes the notification dot pulse.
- scoped_ptr<SlideAnimation> notification_dot_animation_;
-
- // We periodically restart the animation after it has been showed
- // once, to create a pulsating effect.
- base::RepeatingTimer<ToolbarView> notification_dot_pulse_timer_;
-
- // Used to post tasks to switch to the next/previous menu.
- ScopedRunnableMethodFactory<ToolbarView> method_factory_;
-
- NotificationRegistrar registrar_;
-
- // If non-null the destructor sets this to true. This is set to a non-null
- // while the menu is showing and used to detect if the menu was deleted while
- // running.
- bool* destroyed_flag_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView);
-};
+#include "chrome/browser/ui/views/toolbar_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_TOOLBAR_VIEW_H_
+
diff --git a/chrome/browser/views/unhandled_keyboard_event_handler.h b/chrome/browser/views/unhandled_keyboard_event_handler.h
index 13ac26d..a007663 100644
--- a/chrome/browser/views/unhandled_keyboard_event_handler.h
+++ b/chrome/browser/views/unhandled_keyboard_event_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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,8 @@
#define CHROME_BROWSER_VIEWS_UNHANDLED_KEYBOARD_EVENT_HANDLER_H_
#pragma once
-#include "views/view.h"
-#include "chrome/common/native_web_keyboard_event.h"
-
-namespace views {
-class FocusManager;
-} // namespace views
-
-// This class handles unhandled keyboard messages coming back from the renderer
-// process.
-class UnhandledKeyboardEventHandler {
- public:
- UnhandledKeyboardEventHandler();
- ~UnhandledKeyboardEventHandler();
-
- void HandleKeyboardEvent(const NativeWebKeyboardEvent& event,
- views::FocusManager* focus_manager);
-
- private:
-#if defined(OS_WIN)
- // Whether to ignore the next Char keyboard event.
- // If a RawKeyDown event was handled as a shortcut key, then we're done
- // handling it and should eat any Char event that the translate phase may
- // have produced from it. (Handling this event may cause undesirable effects,
- // such as a beep if DefWindowProc() has no default handling for the given
- // Char.)
- bool ignore_next_char_event_;
-#endif
-
- DISALLOW_COPY_AND_ASSIGN(UnhandledKeyboardEventHandler);
-};
+#include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_UNHANDLED_KEYBOARD_EVENT_HANDLER_H_
+
diff --git a/chrome/browser/views/uninstall_view.h b/chrome/browser/views/uninstall_view.h
index 30a6268..e366791 100644
--- a/chrome/browser/views/uninstall_view.h
+++ b/chrome/browser/views/uninstall_view.h
@@ -6,57 +6,8 @@
#define CHROME_BROWSER_VIEWS_UNINSTALL_VIEW_H_
#pragma once
-#include "app/combobox_model.h"
-#include "base/string16.h"
-#include "views/controls/combobox/combobox.h"
-#include "views/window/dialog_delegate.h"
-
-namespace views {
-class Checkbox;
-class Label;
-}
-
-// UninstallView implements the dialog that confirms Chrome uninstallation
-// and asks whether to delete Chrome profile. Also if currently Chrome is set
-// as default browser, it asks users whether to set another browser as default.
-class UninstallView : public views::View,
- public views::ButtonListener,
- public views::DialogDelegate,
- public ComboboxModel {
- public:
- explicit UninstallView(int& user_selection);
- virtual ~UninstallView();
-
- // Overridden from views::DialogDelegate:
- virtual bool Accept();
- virtual bool Cancel();
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
-
- // Overridden form views::ButtonListener.
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Overridden from views::WindowDelegate:
- virtual std::wstring GetWindowTitle() const;
- virtual views::View* GetContentsView();
-
- // Overridden from views::Combobox::Model.
- virtual int GetItemCount();
- virtual string16 GetItemAt(int index);
-
- private:
- // Initializes the controls on the dialog.
- void SetupControls();
-
- views::Label* confirm_label_;
- views::Checkbox* delete_profile_;
- views::Checkbox* change_default_browser_;
- views::Combobox* browsers_combo_;
- typedef std::map<std::wstring, std::wstring> BrowsersMap;
- scoped_ptr<BrowsersMap> browsers_;
- int& user_selection_;
-
- DISALLOW_COPY_AND_ASSIGN(UninstallView);
-};
+#include "chrome/browser/ui/views/uninstall_view.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_UNINSTALL_VIEW_H_
+
diff --git a/chrome/browser/views/update_recommended_message_box.h b/chrome/browser/views/update_recommended_message_box.h
index 033dc01..a5f589e 100644
--- a/chrome/browser/views/update_recommended_message_box.h
+++ b/chrome/browser/views/update_recommended_message_box.h
@@ -2,45 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_VIEWS_UPDATE_RECOMMENDED_MESSAGE_BOX_H_
-#define CHROME_BROWSER_VIEWS_UPDATE_RECOMMENDED_MESSAGE_BOX_H_
+#ifndef CHROME_BROWSER_UPDATE_RECOMMENDED_MESSAGE_BOX_H_
+#define CHROME_BROWSER_UPDATE_RECOMMENDED_MESSAGE_BOX_H_
#pragma once
-#include "base/basictypes.h"
-#include "gfx/native_widget_types.h"
-#include "views/window/dialog_delegate.h"
+#include "chrome/browser/ui/views/update_recommended_message_box.h"
+// TODO(beng): remove this file once all includes have been updated.
-class MessageBoxView;
+#endif // CHROME_BROWSER_UPDATE_RECOMMENDED_MESSAGE_BOX_H_
-// A dialog box that tells the user that an update is recommended in order for
-// the latest version to be put to use.
-class UpdateRecommendedMessageBox : public views::DialogDelegate {
- public:
- // This box is modal to |parent_window|.
- static void ShowMessageBox(gfx::NativeWindow parent_window);
-
- // Overridden from views::DialogDelegate:
- virtual bool Accept();
-
- protected:
- // Overridden from views::DialogDelegate:
- virtual int GetDialogButtons() const;
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual std::wstring GetWindowTitle() const;
-
- // Overridden from views::WindowDelegate:
- virtual void DeleteDelegate();
- virtual bool IsModal() const;
- virtual views::View* GetContentsView();
-
- private:
- explicit UpdateRecommendedMessageBox(gfx::NativeWindow parent_window);
- virtual ~UpdateRecommendedMessageBox();
-
- MessageBoxView* message_box_view_;
-
- DISALLOW_COPY_AND_ASSIGN(UpdateRecommendedMessageBox);
-};
-
-#endif // CHROME_BROWSER_VIEWS_UPDATE_RECOMMENDED_MESSAGE_BOX_H_
diff --git a/chrome/browser/views/url_picker.h b/chrome/browser/views/url_picker.h
index e08892e..c716ec5 100644
--- a/chrome/browser/views/url_picker.h
+++ b/chrome/browser/views/url_picker.h
@@ -6,105 +6,8 @@
#define CHROME_BROWSER_VIEWS_URL_PICKER_H_
#pragma once
-#include "views/controls/button/native_button.h"
-#include "views/controls/table/table_view_observer.h"
-#include "views/controls/textfield/textfield.h"
-#include "views/view.h"
-#include "views/window/dialog_delegate.h"
-#include "views/window/window.h"
-
-namespace views {
-class Button;
-class Label;
-class TableView;
-}
-
-class PossibleURLModel;
-class Profile;
-class UrlPicker;
-
-// UrlPicker delegate. Notified when the user accepts the entry.
-class UrlPickerDelegate {
- public:
- virtual ~UrlPickerDelegate();
-
- virtual void AddBookmark(UrlPicker* dialog,
- const std::wstring& title,
- const GURL& url) = 0;
-};
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// This class implements the dialog that let the user add a bookmark or page
-// to the list of urls to open on startup.
-// UrlPicker deletes itself when the dialog is closed.
-//
-////////////////////////////////////////////////////////////////////////////////
-class UrlPicker : public views::View,
- public views::DialogDelegate,
- public views::Textfield::Controller,
- public views::TableViewObserver {
- public:
- UrlPicker(UrlPickerDelegate* delegate,
- Profile* profile);
- virtual ~UrlPicker();
-
- // Show the dialog on the provided contents.
- virtual void Show(HWND parent);
-
- // Closes the dialog.
- void Close();
-
- // DialogDelegate.
- virtual std::wstring GetWindowTitle() const;
- virtual bool IsModal() const;
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual bool Accept();
- virtual int GetDefaultDialogButton() const;
- virtual bool IsDialogButtonEnabled(
- MessageBoxFlags::DialogButton button) const;
- virtual views::View* GetContentsView();
-
- // TextField::Controller.
- virtual void ContentsChanged(views::Textfield* sender,
- const std::wstring& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& key) {
- return false;
- }
-
- // Overridden from View.
- virtual gfx::Size GetPreferredSize();
- virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
-
- // TableViewObserver.
- virtual void OnSelectionChanged();
- virtual void OnDoubleClick();
-
- private:
- // Modify the model from the user interface.
- void PerformModelChange();
-
- // Returns the URL the user has typed.
- GURL GetInputURL() const;
-
- // Profile.
- Profile* profile_;
-
- // URL Field.
- views::Textfield* url_field_;
-
- // The table model.
- scoped_ptr<PossibleURLModel> url_table_model_;
-
- // The table of visited urls.
- views::TableView* url_table_;
-
- // The delegate.
- UrlPickerDelegate* delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(UrlPicker);
-};
+#include "chrome/browser/ui/views/url_picker.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_URL_PICKER_H_
+
diff --git a/chrome/browser/views/user_data_dir_dialog.h b/chrome/browser/views/user_data_dir_dialog.h
index 2ada803..3ca925d 100644
--- a/chrome/browser/views/user_data_dir_dialog.h
+++ b/chrome/browser/views/user_data_dir_dialog.h
@@ -1,72 +1,13 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium 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 dialog box that tells the user that we can't write to the specified user
-// data directory. Provides the user a chance to pick a different directory.
#ifndef CHROME_BROWSER_VIEWS_USER_DATA_DIR_DIALOG_H_
#define CHROME_BROWSER_VIEWS_USER_DATA_DIR_DIALOG_H_
#pragma once
-#include "base/basictypes.h"
-#include "base/message_loop.h"
-#include "chrome/browser/shell_dialogs.h"
-#include "views/window/dialog_delegate.h"
-
-class FilePath;
-class MessageBoxView;
-namespace views {
-class Window;
-}
-
-class UserDataDirDialog : public views::DialogDelegate,
- public MessageLoopForUI::Dispatcher,
- public SelectFileDialog::Listener {
- public:
- // Creates and runs a user data directory picker dialog. The method blocks
- // while the dialog is showing. If the user picks a directory, this method
- // returns the chosen directory. |user_data_dir| is the value of the
- // directory we were not able to use.
- static FilePath RunUserDataDirDialog(const FilePath& user_data_dir);
- virtual ~UserDataDirDialog();
-
- FilePath user_data_dir() const { return user_data_dir_; }
-
- // views::DialogDelegate Methods:
- virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual std::wstring GetWindowTitle() const;
- virtual void DeleteDelegate();
- virtual bool Accept();
- virtual bool Cancel();
-
- // views::WindowDelegate Methods:
- virtual bool IsAlwaysOnTop() const { return false; }
- virtual bool IsModal() const { return false; }
- virtual views::View* GetContentsView();
-
- // MessageLoop::Dispatcher Method:
- virtual bool Dispatch(const MSG& msg);
-
- // SelectFileDialog::Listener Methods:
- virtual void FileSelected(const FilePath& path, int index, void* params);
- virtual void FileSelectionCanceled(void* params);
-
- private:
- explicit UserDataDirDialog(const FilePath& user_data_dir);
-
- // Empty until the user picks a directory.
- FilePath user_data_dir_;
-
- MessageBoxView* message_box_view_;
- scoped_refptr<SelectFileDialog> select_file_dialog_;
-
- // Used to keep track of whether or not to block the message loop (still
- // waiting for the user to dismiss the dialog).
- bool is_blocking_;
-
- DISALLOW_COPY_AND_ASSIGN(UserDataDirDialog);
-};
+#include "chrome/browser/ui/views/user_data_dir_dialog.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_USER_DATA_DIR_DIALOG_H_
+
diff --git a/chrome/browser/views/window.h b/chrome/browser/views/window.h
index c2f2bb4..9733676 100644
--- a/chrome/browser/views/window.h
+++ b/chrome/browser/views/window.h
@@ -6,24 +6,8 @@
#define CHROME_BROWSER_VIEWS_WINDOW_H_
#pragma once
-#include "gfx/native_widget_types.h"
-
-namespace gfx {
-class Rect;
-}
-
-namespace views {
-class Window;
-class WindowDelegate;
-}
-
-namespace browser {
-
-// Create a window for given |delegate| using default frame view.
-views::Window* CreateViewsWindow(gfx::NativeWindow parent,
- const gfx::Rect& bounds,
- views::WindowDelegate* delegate);
-
-} // namespace browser
+#include "chrome/browser/ui/views/window.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_WINDOW_H_
+
diff --git a/chrome/browser/views/wrench_menu.h b/chrome/browser/views/wrench_menu.h
index e9aa2fb..1a2c52b 100644
--- a/chrome/browser/views/wrench_menu.h
+++ b/chrome/browser/views/wrench_menu.h
@@ -6,87 +6,8 @@
#define CHROME_BROWSER_VIEWS_WRENCH_MENU_H_
#pragma once
-#include <map>
-#include <utility>
-
-#include "app/menus/menu_model.h"
-#include "base/ref_counted.h"
-#include "base/scoped_ptr.h"
-#include "views/controls/menu/menu_delegate.h"
-
-class Browser;
-
-namespace views {
-class MenuButton;
-class MenuItemView;
-class View;
-} // namespace views
-
-// WrenchMenu adapts the WrenchMenuModel to view's menu related classes.
-class WrenchMenu : public base::RefCounted<WrenchMenu>,
- public views::MenuDelegate {
- public:
- explicit WrenchMenu(Browser* browser);
-
- void Init(menus::MenuModel* model);
-
- // Shows the menu relative to the specified view.
- void RunMenu(views::MenuButton* host);
-
- // MenuDelegate overrides:
- virtual bool IsItemChecked(int id) const;
- virtual bool IsCommandEnabled(int id) const;
- virtual void ExecuteCommand(int id);
- virtual bool GetAccelerator(int id, views::Accelerator* accelerator);
-
- private:
- friend class base::RefCounted<WrenchMenu>;
-
- class CutCopyPasteView;
- class ZoomView;
-
- typedef std::pair<menus::MenuModel*,int> Entry;
- typedef std::map<int,Entry> IDToEntry;
-
- ~WrenchMenu();
-
- // Populates |parent| with all the child menus in |model|. Recursively invokes
- // |PopulateMenu| for any submenu. |next_id| is incremented for every menu
- // that is created.
- void PopulateMenu(views::MenuItemView* parent,
- menus::MenuModel* model,
- int* next_id);
-
- // Adds a new menu to |parent| to represent the MenuModel/index pair passed
- // in.
- views::MenuItemView* AppendMenuItem(views::MenuItemView* parent,
- menus::MenuModel* model,
- int index,
- menus::MenuModel::ItemType menu_type,
- int* next_id);
-
- // Invoked from the cut/copy/paste menus. Cancels the current active menu and
- // activates the menu item in |model| at |index|.
- void CancelAndEvaluate(menus::MenuModel* model, int index);
-
- // The views menu.
- scoped_ptr<views::MenuItemView> root_;
-
- // Maps from the ID as understood by MenuItemView to the model/index pair the
- // item came from.
- IDToEntry id_to_entry_;
-
- // Browser the menu is being shown for.
- Browser* browser_;
-
- // |CancelAndEvaluate| sets |selected_menu_model_| and |selected_index_|.
- // If |selected_menu_model_| is non-null after the menu completes
- // ActivatedAt is invoked. This is done so that ActivatedAt isn't invoked
- // while the message loop is nested.
- menus::MenuModel* selected_menu_model_;
- int selected_index_;
-
- DISALLOW_COPY_AND_ASSIGN(WrenchMenu);
-};
+#include "chrome/browser/ui/views/wrench_menu.h"
+// TODO(beng): remove this file once all includes have been updated.
#endif // CHROME_BROWSER_VIEWS_WRENCH_MENU_H_
+
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 9fc4fb7..e1ff6e3 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -163,7 +163,7 @@
'browser/autofill/autofill_dialog_gtk.cc',
'browser/autofill/autofill_dialog_mac.mm',
# Windows version of autofill dialog is defined in
- # 'browser/views/autofill_profiles_view_win.cc'
+ # 'browser/ui/views/autofill_profiles_view_win.cc'
'browser/autofill/autofill_dialog.h',
'browser/autofill/autofill_download.cc',
'browser/autofill/autofill_download.h',
@@ -743,6 +743,12 @@
'browser/chromeos/system_key_event_listener.h',
'browser/chromeos/tab_closeable_state_watcher.cc',
'browser/chromeos/tab_closeable_state_watcher.h',
+ 'browser/chromeos/ui/views/menu_locator.cc',
+ 'browser/chromeos/ui/views/menu_locator.h',
+ 'browser/chromeos/ui/views/native_menu_domui.cc',
+ 'browser/chromeos/ui/views/native_menu_domui.h',
+ 'browser/chromeos/ui/views/domui_menu_widget.cc',
+ 'browser/chromeos/ui/views/domui_menu_widget.h',
'browser/chromeos/update_observer.cc',
'browser/chromeos/update_observer.h',
'browser/chromeos/usb_mount_observer.cc',
@@ -750,12 +756,6 @@
'browser/chromeos/version_loader.cc',
'browser/chromeos/version_loader.h',
'browser/chromeos/view_ids.h',
- 'browser/chromeos/views/menu_locator.cc',
- 'browser/chromeos/views/menu_locator.h',
- 'browser/chromeos/views/native_menu_domui.cc',
- 'browser/chromeos/views/native_menu_domui.h',
- 'browser/chromeos/views/domui_menu_widget.cc',
- 'browser/chromeos/views/domui_menu_widget.h',
'browser/chromeos/volume_bubble.cc',
'browser/chromeos/volume_bubble.h',
'browser/chromeos/volume_bubble_view.cc',
@@ -2965,6 +2965,360 @@
'browser/ui/browser_navigator.cc',
'browser/ui/browser_navigator.h',
'browser/ui/browser_window.h',
+ 'browser/ui/views/about_chrome_view.cc',
+ 'browser/ui/views/about_chrome_view.h',
+ 'browser/ui/views/about_ipc_dialog.cc',
+ 'browser/ui/views/about_ipc_dialog.h',
+ 'browser/ui/views/accelerator_table_gtk.cc',
+ 'browser/ui/views/accelerator_table_gtk.h',
+ 'browser/ui/views/accessibility_event_router_views.cc',
+ 'browser/ui/views/accessibility_event_router_views.h',
+ 'browser/ui/views/accessible_pane_view.cc',
+ 'browser/ui/views/accessible_pane_view.h',
+ 'browser/ui/views/accessible_view_helper.cc',
+ 'browser/ui/views/accessible_view_helper.h',
+ 'browser/ui/views/app_launched_animation_win.cc',
+ 'browser/ui/views/appcache_info_view.cc',
+ 'browser/ui/views/appcache_info_view.h',
+ 'browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc',
+ 'browser/ui/views/autocomplete/autocomplete_popup_contents_view.h',
+ 'browser/ui/views/autocomplete/autocomplete_popup_win.cc',
+ 'browser/ui/views/autocomplete/autocomplete_popup_win.h',
+ 'browser/ui/views/autocomplete/autocomplete_popup_gtk.cc',
+ 'browser/ui/views/autocomplete/autocomplete_popup_gtk.h',
+ 'browser/ui/views/autofill_profiles_view_win.cc',
+ 'browser/ui/views/autofill_profiles_view_win.h',
+ 'browser/ui/views/bookmark_bar_instructions_view.cc',
+ 'browser/ui/views/bookmark_bar_instructions_view.h',
+ 'browser/ui/views/bookmark_bar_view.cc',
+ 'browser/ui/views/bookmark_bar_view.h',
+ 'browser/ui/views/bookmark_bubble_view.cc',
+ 'browser/ui/views/bookmark_bubble_view.h',
+ 'browser/ui/views/bookmark_context_menu.cc',
+ 'browser/ui/views/bookmark_context_menu.h',
+ 'browser/ui/views/bookmark_context_menu_controller_views.cc',
+ 'browser/ui/views/bookmark_context_menu_controller_views.h',
+ 'browser/ui/views/bookmark_editor_view.cc',
+ 'browser/ui/views/bookmark_editor_view.h',
+ 'browser/ui/views/bookmark_menu_controller_views.cc',
+ 'browser/ui/views/bookmark_menu_controller_views.h',
+ 'browser/ui/views/browser_actions_container.cc',
+ 'browser/ui/views/browser_actions_container.h',
+ 'browser/ui/views/browser_bubble.cc',
+ 'browser/ui/views/browser_bubble.h',
+ 'browser/ui/views/browser_bubble_gtk.cc',
+ 'browser/ui/views/browser_bubble_win.cc',
+ 'browser/ui/views/browser_dialogs.h',
+ 'browser/ui/views/bubble_border.cc',
+ 'browser/ui/views/bubble_border.h',
+ 'browser/ui/views/certificate_viewer_win.cc',
+ 'browser/ui/views/chrome_views_delegate.cc',
+ 'browser/ui/views/chrome_views_delegate.h',
+ 'browser/ui/views/clear_browsing_data.cc',
+ 'browser/ui/views/clear_browsing_data.h',
+ 'browser/ui/views/clear_browsing_data_view.cc',
+ 'browser/ui/views/clear_browsing_data_view.h',
+ 'browser/ui/views/clear_data_view.cc',
+ 'browser/ui/views/clear_data_view.h',
+ 'browser/ui/views/clear_server_data.cc',
+ 'browser/ui/views/clear_server_data.h',
+ 'browser/ui/views/collected_cookies_win.cc',
+ 'browser/ui/views/collected_cookies_win.h',
+ 'browser/ui/views/confirm_message_box_dialog.cc',
+ 'browser/ui/views/confirm_message_box_dialog.h',
+ 'browser/ui/views/constrained_html_delegate_win.cc',
+ 'browser/ui/views/constrained_window_win.cc',
+ 'browser/ui/views/constrained_window_win.h',
+ 'browser/ui/views/content_setting_bubble_contents.cc',
+ 'browser/ui/views/content_setting_bubble_contents.h',
+ 'browser/ui/views/cookie_info_view.cc',
+ 'browser/ui/views/cookie_info_view.h',
+ 'browser/ui/views/create_application_shortcut_view.cc',
+ 'browser/ui/views/create_application_shortcut_view.h',
+ 'browser/ui/views/database_info_view.cc',
+ 'browser/ui/views/database_info_view.h',
+ 'browser/ui/views/database_open_info_view.cc',
+ 'browser/ui/views/database_open_info_view.h',
+ 'browser/ui/views/default_search_view.cc',
+ 'browser/ui/views/default_search_view.h',
+ 'browser/ui/views/detachable_toolbar_view.cc',
+ 'browser/ui/views/detachable_toolbar_view.h',
+ 'browser/ui/views/dialog_stubs_gtk.cc',
+ 'browser/ui/views/dom_view.cc',
+ 'browser/ui/views/dom_view.h',
+ 'browser/ui/views/download_item_view.cc',
+ 'browser/ui/views/download_item_view.h',
+ 'browser/ui/views/download_shelf_view.cc',
+ 'browser/ui/views/download_shelf_view.h',
+ 'browser/ui/views/download_started_animation_win.cc',
+ 'browser/ui/views/dropdown_bar_host.cc',
+ 'browser/ui/views/dropdown_bar_host.h',
+ 'browser/ui/views/dropdown_bar_host_gtk.cc',
+ 'browser/ui/views/dropdown_bar_host_win.cc',
+ 'browser/ui/views/dropdown_bar_view.h',
+ 'browser/ui/views/edit_search_engine_dialog.cc',
+ 'browser/ui/views/edit_search_engine_dialog.h',
+ 'browser/ui/views/event_utils.cc',
+ 'browser/ui/views/event_utils.h',
+ 'browser/ui/views/extensions/browser_action_drag_data.cc',
+ 'browser/ui/views/extensions/browser_action_drag_data.h',
+ 'browser/ui/views/extensions/browser_action_overflow_menu_controller.cc',
+ 'browser/ui/views/extensions/browser_action_overflow_menu_controller.h',
+ 'browser/ui/views/extensions/extension_install_prompt.cc',
+ 'browser/ui/views/extensions/extension_install_prompt2.cc',
+ 'browser/ui/views/extensions/extension_installed_bubble.cc',
+ 'browser/ui/views/extensions/extension_installed_bubble.h',
+ 'browser/ui/views/extensions/extension_popup.cc',
+ 'browser/ui/views/extensions/extension_popup.h',
+ 'browser/ui/views/extensions/extension_view.cc',
+ 'browser/ui/views/extensions/extension_view.h',
+ 'browser/ui/views/external_protocol_dialog.cc',
+ 'browser/ui/views/external_protocol_dialog.h',
+ 'browser/ui/views/find_bar_host.cc',
+ 'browser/ui/views/find_bar_host.h',
+ 'browser/ui/views/find_bar_host_gtk.cc',
+ 'browser/ui/views/find_bar_host_win.cc',
+ 'browser/ui/views/find_bar_view.cc',
+ 'browser/ui/views/find_bar_view.h',
+ 'browser/ui/views/first_run_bubble.cc',
+ 'browser/ui/views/first_run_bubble.h',
+ 'browser/ui/views/first_run_search_engine_view.cc',
+ 'browser/ui/views/first_run_search_engine_view.h',
+ 'browser/ui/views/frame/app_panel_browser_frame_view.cc',
+ 'browser/ui/views/frame/app_panel_browser_frame_view.h',
+ 'browser/ui/views/frame/browser_bubble_host.cc',
+ 'browser/ui/views/frame/browser_bubble_host.h',
+ 'browser/ui/views/frame/browser_frame.h',
+ 'browser/ui/views/frame/browser_frame_gtk.cc',
+ 'browser/ui/views/frame/browser_frame_gtk.h',
+ 'browser/ui/views/frame/browser_frame_win.cc',
+ 'browser/ui/views/frame/browser_frame_win.h',
+ 'browser/ui/views/frame/browser_non_client_frame_view.h',
+ 'browser/ui/views/frame/browser_root_view.cc',
+ 'browser/ui/views/frame/browser_root_view.h',
+ 'browser/ui/views/frame/browser_view.cc',
+ 'browser/ui/views/frame/browser_view.h',
+ 'browser/ui/views/frame/browser_view_layout.cc',
+ 'browser/ui/views/frame/browser_view_layout.h',
+ 'browser/ui/views/frame/contents_container.cc',
+ 'browser/ui/views/frame/contents_container.h',
+ 'browser/ui/views/frame/glass_browser_frame_view.cc',
+ 'browser/ui/views/frame/glass_browser_frame_view.h',
+ 'browser/ui/views/frame/opaque_browser_frame_view.cc',
+ 'browser/ui/views/frame/opaque_browser_frame_view.h',
+ 'browser/ui/views/frame/popup_non_client_frame_view.cc',
+ 'browser/ui/views/frame/popup_non_client_frame_view.h',
+ 'browser/ui/views/fullscreen_exit_bubble.cc',
+ 'browser/ui/views/fullscreen_exit_bubble.h',
+ 'browser/ui/views/generic_info_view.cc',
+ 'browser/ui/views/generic_info_view.h',
+ 'browser/ui/views/html_dialog_view.cc',
+ 'browser/ui/views/html_dialog_view.h',
+ 'browser/ui/views/hung_renderer_view.cc',
+ 'browser/ui/views/importer_lock_view.cc',
+ 'browser/ui/views/importer_lock_view.h',
+ 'browser/ui/views/importer_view.cc',
+ 'browser/ui/views/importer_view.h',
+ 'browser/ui/views/importing_progress_view.cc',
+ 'browser/ui/views/importing_progress_view.h',
+ 'browser/ui/views/indexed_db_info_view.cc',
+ 'browser/ui/views/indexed_db_info_view.h',
+ 'browser/ui/views/info_bubble.cc',
+ 'browser/ui/views/info_bubble.h',
+ 'browser/ui/views/infobars/after_translate_infobar.cc',
+ 'browser/ui/views/infobars/after_translate_infobar.h',
+ 'browser/ui/views/infobars/before_translate_infobar.cc',
+ 'browser/ui/views/infobars/before_translate_infobar.h',
+ 'browser/ui/views/infobars/extension_infobar.cc',
+ 'browser/ui/views/infobars/extension_infobar.h',
+ 'browser/ui/views/infobars/infobar_button_border.cc',
+ 'browser/ui/views/infobars/infobar_button_border.h',
+ 'browser/ui/views/infobars/infobar_container.cc',
+ 'browser/ui/views/infobars/infobar_container.h',
+ 'browser/ui/views/infobars/infobar_text_button.cc',
+ 'browser/ui/views/infobars/infobar_text_button.h',
+ 'browser/ui/views/infobars/infobars.cc',
+ 'browser/ui/views/infobars/infobars.h',
+ 'browser/ui/views/infobars/translate_infobar_base.cc',
+ 'browser/ui/views/infobars/translate_infobar_base.h',
+ 'browser/ui/views/infobars/translate_message_infobar.cc',
+ 'browser/ui/views/infobars/translate_message_infobar.h',
+ 'browser/ui/views/instant_confirm_view.cc',
+ 'browser/ui/views/instant_confirm_view.h',
+ 'browser/ui/views/js_modal_dialog_views.cc',
+ 'browser/ui/views/js_modal_dialog_views.h',
+ 'browser/ui/views/keyword_editor_view.cc',
+ 'browser/ui/views/keyword_editor_view.h',
+ 'browser/ui/views/list_background.h',
+ 'browser/ui/views/local_storage_info_view.cc',
+ 'browser/ui/views/local_storage_info_view.h',
+ 'browser/ui/views/local_storage_set_item_info_view.cc',
+ 'browser/ui/views/local_storage_set_item_info_view.h',
+ 'browser/ui/views/location_bar/click_handler.cc',
+ 'browser/ui/views/location_bar/click_handler.h',
+ 'browser/ui/views/location_bar/content_setting_image_view.cc',
+ 'browser/ui/views/location_bar/content_setting_image_view.h',
+ 'browser/ui/views/location_bar/ev_bubble_view.cc',
+ 'browser/ui/views/location_bar/ev_bubble_view.h',
+ 'browser/ui/views/location_bar/icon_label_bubble_view.h',
+ 'browser/ui/views/location_bar/icon_label_bubble_view.cc',
+ 'browser/ui/views/location_bar/keyword_hint_view.cc',
+ 'browser/ui/views/location_bar/keyword_hint_view.h',
+ 'browser/ui/views/location_bar/location_icon_view.cc',
+ 'browser/ui/views/location_bar/location_icon_view.h',
+ 'browser/ui/views/location_bar/location_bar_view.cc',
+ 'browser/ui/views/location_bar/location_bar_view.h',
+ 'browser/ui/views/location_bar/page_action_image_view.cc',
+ 'browser/ui/views/location_bar/page_action_image_view.h',
+ 'browser/ui/views/location_bar/page_action_with_badge_view.cc',
+ 'browser/ui/views/location_bar/page_action_with_badge_view.h',
+ 'browser/ui/views/location_bar/selected_keyword_view.h',
+ 'browser/ui/views/location_bar/selected_keyword_view.cc',
+ 'browser/ui/views/location_bar/star_view.cc',
+ 'browser/ui/views/location_bar/star_view.h',
+ 'browser/ui/views/login_view.cc',
+ 'browser/ui/views/login_view.h',
+ 'browser/ui/views/modal_dialog_delegate.cc',
+ 'browser/ui/views/modal_dialog_delegate.h',
+ 'browser/ui/views/notifications/balloon_view_host.cc',
+ 'browser/ui/views/notifications/balloon_view_host.h',
+ 'browser/ui/views/notifications/balloon_view.cc',
+ 'browser/ui/views/notifications/balloon_view.h',
+ 'browser/ui/views/options/advanced_contents_view.cc',
+ 'browser/ui/views/options/advanced_contents_view.h',
+ 'browser/ui/views/options/advanced_page_view.cc',
+ 'browser/ui/views/options/advanced_page_view.h',
+ 'browser/ui/views/options/content_exceptions_table_view.cc',
+ 'browser/ui/views/options/content_exceptions_table_view.h',
+ 'browser/ui/views/options/content_page_view.cc',
+ 'browser/ui/views/options/content_page_view.h',
+ 'browser/ui/views/options/content_filter_page_view.cc',
+ 'browser/ui/views/options/content_filter_page_view.h',
+ 'browser/ui/views/options/content_settings_window_view.cc',
+ 'browser/ui/views/options/content_settings_window_view.h',
+ 'browser/ui/views/options/cookie_filter_page_view.cc',
+ 'browser/ui/views/options/cookie_filter_page_view.h',
+ 'browser/ui/views/options/cookies_view.cc',
+ 'browser/ui/views/options/cookies_view.h',
+ 'browser/ui/views/options/exception_editor_view.cc',
+ 'browser/ui/views/options/exception_editor_view.h',
+ 'browser/ui/views/options/exceptions_view.cc',
+ 'browser/ui/views/options/exceptions_view.h',
+ 'browser/ui/views/options/exceptions_page_view.cc',
+ 'browser/ui/views/options/exceptions_page_view.h',
+ 'browser/ui/views/options/fonts_languages_window_view.cc',
+ 'browser/ui/views/options/fonts_languages_window_view.h',
+ 'browser/ui/views/options/fonts_page_view.cc',
+ 'browser/ui/views/options/fonts_page_view.h',
+ 'browser/ui/views/options/general_page_view.cc',
+ 'browser/ui/views/options/general_page_view.h',
+ 'browser/ui/views/options/languages_page_view.cc',
+ 'browser/ui/views/options/languages_page_view.h',
+ 'browser/ui/views/options/managed_prefs_banner_view.cc',
+ 'browser/ui/views/options/managed_prefs_banner_view.h',
+ 'browser/ui/views/options/options_group_view.cc',
+ 'browser/ui/views/options/options_group_view.h',
+ 'browser/ui/views/options/options_page_view.cc',
+ 'browser/ui/views/options/options_page_view.h',
+ 'browser/ui/views/options/options_window_view.cc',
+ 'browser/ui/views/options/passwords_exceptions_window_view.cc',
+ 'browser/ui/views/options/passwords_exceptions_window_view.h',
+ 'browser/ui/views/options/passwords_page_view.cc',
+ 'browser/ui/views/options/passwords_page_view.h',
+ 'browser/ui/views/options/plugin_filter_page_view.cc',
+ 'browser/ui/views/options/plugin_filter_page_view.h',
+ 'browser/ui/views/options/simple_content_exceptions_view.cc',
+ 'browser/ui/views/options/simple_content_exceptions_view.h',
+ 'browser/ui/views/page_info_bubble_view.cc',
+ 'browser/ui/views/page_info_bubble_view.h',
+ 'browser/ui/views/pinned_contents_info_bubble.cc',
+ 'browser/ui/views/pinned_contents_info_bubble.h',
+ 'browser/ui/views/reload_button.cc',
+ 'browser/ui/views/reload_button.h',
+ 'browser/ui/views/repost_form_warning_view.cc',
+ 'browser/ui/views/repost_form_warning_view.h',
+ 'browser/ui/views/restart_message_box.cc',
+ 'browser/ui/views/restart_message_box.h',
+ 'browser/ui/views/sad_tab_view.cc',
+ 'browser/ui/views/sad_tab_view.h',
+ 'browser/ui/views/select_file_dialog.cc',
+ 'browser/ui/views/shell_dialogs_win.cc',
+ 'browser/ui/views/ssl_client_certificate_selector_win.cc',
+ 'browser/ui/views/status_bubble_views.cc',
+ 'browser/ui/views/status_bubble_views.h',
+ 'browser/ui/views/status_icons/status_icon_win.cc',
+ 'browser/ui/views/status_icons/status_icon_win.h',
+ 'browser/ui/views/status_icons/status_tray_gtk.cc',
+ 'browser/ui/views/status_icons/status_tray_win.cc',
+ 'browser/ui/views/status_icons/status_tray_win.h',
+ 'browser/ui/views/tab_icon_view.cc',
+ 'browser/ui/views/tab_icon_view.h',
+ 'browser/ui/views/tab_contents/tab_contents_container.cc',
+ 'browser/ui/views/tab_contents/tab_contents_container.h',
+ 'browser/ui/views/tab_contents/native_tab_contents_container.h',
+ 'browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc',
+ 'browser/ui/views/tab_contents/native_tab_contents_container_gtk.h',
+ 'browser/ui/views/tab_contents/native_tab_contents_container_win.cc',
+ 'browser/ui/views/tab_contents/native_tab_contents_container_win.h',
+ 'browser/ui/views/tab_contents/render_view_context_menu_views.cc',
+ 'browser/ui/views/tab_contents/render_view_context_menu_views.h',
+ 'browser/ui/views/tab_contents/tab_contents_drag_win.cc',
+ 'browser/ui/views/tab_contents/tab_contents_drag_win.h',
+ 'browser/ui/views/tab_contents/tab_contents_view_gtk.cc',
+ 'browser/ui/views/tab_contents/tab_contents_view_gtk.h',
+ 'browser/ui/views/tab_contents/tab_contents_view_win.cc',
+ 'browser/ui/views/tab_contents/tab_contents_view_win.h',
+ 'browser/ui/views/tabs/base_tab.cc',
+ 'browser/ui/views/tabs/base_tab.h',
+ 'browser/ui/views/tabs/base_tab_strip.cc',
+ 'browser/ui/views/tabs/base_tab_strip.h',
+ 'browser/ui/views/tabs/browser_tab_strip_controller.cc',
+ 'browser/ui/views/tabs/browser_tab_strip_controller.h',
+ 'browser/ui/views/tabs/dragged_tab_controller.cc',
+ 'browser/ui/views/tabs/dragged_tab_controller.h',
+ 'browser/ui/views/tabs/dragged_tab_view.cc',
+ 'browser/ui/views/tabs/dragged_tab_view.h',
+ 'browser/ui/views/tabs/native_view_photobooth.h',
+ 'browser/ui/views/tabs/native_view_photobooth_gtk.cc',
+ 'browser/ui/views/tabs/native_view_photobooth_gtk.h',
+ 'browser/ui/views/tabs/native_view_photobooth_win.cc',
+ 'browser/ui/views/tabs/native_view_photobooth_win.h',
+ 'browser/ui/views/tabs/side_tab.cc',
+ 'browser/ui/views/tabs/side_tab.h',
+ 'browser/ui/views/tabs/side_tab_strip.cc',
+ 'browser/ui/views/tabs/side_tab_strip.h',
+ 'browser/ui/views/tabs/tab.cc',
+ 'browser/ui/views/tabs/tab.h',
+ 'browser/ui/views/tabs/tab_controller.h',
+ 'browser/ui/views/tabs/tab_renderer_data.h',
+ 'browser/ui/views/tabs/tab_strip.cc',
+ 'browser/ui/views/tabs/tab_strip.h',
+ 'browser/ui/views/tabs/tab_strip_controller.h',
+ 'browser/ui/views/task_manager_view.cc',
+ 'browser/ui/views/textfield_views.cc',
+ 'browser/ui/views/textfield_views.h',
+ 'browser/ui/views/theme_background.cc',
+ 'browser/ui/views/theme_background.h',
+ 'browser/ui/views/theme_helpers.cc',
+ 'browser/ui/views/theme_helpers.h',
+ 'browser/ui/views/theme_install_bubble_view.cc',
+ 'browser/ui/views/theme_install_bubble_view.h',
+ 'browser/ui/views/toolbar_view.cc',
+ 'browser/ui/views/toolbar_view.h',
+ 'browser/ui/views/uninstall_view.cc',
+ 'browser/ui/views/uninstall_view.h',
+ 'browser/ui/views/url_picker.cc',
+ 'browser/ui/views/url_picker.h',
+ 'browser/ui/views/unhandled_keyboard_event_handler.cc',
+ 'browser/ui/views/unhandled_keyboard_event_handler.h',
+ 'browser/ui/views/update_recommended_message_box.cc',
+ 'browser/ui/views/update_recommended_message_box.h',
+ 'browser/ui/views/user_data_dir_dialog.cc',
+ 'browser/ui/views/user_data_dir_dialog.h',
+ 'browser/ui/views/window.cc',
+ 'browser/ui/views/window.h',
+ 'browser/ui/views/wrench_menu.cc',
+ 'browser/ui/views/wrench_menu.h',
'browser/upgrade_detector.cc',
'browser/upgrade_detector.h',
'browser/user_style_sheet_watcher.cc',
@@ -2972,360 +3326,6 @@
'browser/utility_process_host.cc',
'browser/utility_process_host.h',
'browser/view_ids.h',
- 'browser/views/about_chrome_view.cc',
- 'browser/views/about_chrome_view.h',
- 'browser/views/about_ipc_dialog.cc',
- 'browser/views/about_ipc_dialog.h',
- 'browser/views/accelerator_table_gtk.cc',
- 'browser/views/accelerator_table_gtk.h',
- 'browser/views/accessibility_event_router_views.cc',
- 'browser/views/accessibility_event_router_views.h',
- 'browser/views/accessible_pane_view.cc',
- 'browser/views/accessible_pane_view.h',
- 'browser/views/accessible_view_helper.cc',
- 'browser/views/accessible_view_helper.h',
- 'browser/views/app_launched_animation_win.cc',
- 'browser/views/appcache_info_view.cc',
- 'browser/views/appcache_info_view.h',
- 'browser/views/autocomplete/autocomplete_popup_contents_view.cc',
- 'browser/views/autocomplete/autocomplete_popup_contents_view.h',
- 'browser/views/autocomplete/autocomplete_popup_win.cc',
- 'browser/views/autocomplete/autocomplete_popup_win.h',
- 'browser/views/autocomplete/autocomplete_popup_gtk.cc',
- 'browser/views/autocomplete/autocomplete_popup_gtk.h',
- 'browser/views/autofill_profiles_view_win.cc',
- 'browser/views/autofill_profiles_view_win.h',
- 'browser/views/bookmark_bar_instructions_view.cc',
- 'browser/views/bookmark_bar_instructions_view.h',
- 'browser/views/bookmark_bar_view.cc',
- 'browser/views/bookmark_bar_view.h',
- 'browser/views/bookmark_bubble_view.cc',
- 'browser/views/bookmark_bubble_view.h',
- 'browser/views/bookmark_context_menu.cc',
- 'browser/views/bookmark_context_menu.h',
- 'browser/views/bookmark_context_menu_controller_views.cc',
- 'browser/views/bookmark_context_menu_controller_views.h',
- 'browser/views/bookmark_editor_view.cc',
- 'browser/views/bookmark_editor_view.h',
- 'browser/views/bookmark_menu_controller_views.cc',
- 'browser/views/bookmark_menu_controller_views.h',
- 'browser/views/browser_actions_container.cc',
- 'browser/views/browser_actions_container.h',
- 'browser/views/browser_bubble.cc',
- 'browser/views/browser_bubble.h',
- 'browser/views/browser_bubble_gtk.cc',
- 'browser/views/browser_bubble_win.cc',
- 'browser/views/browser_dialogs.h',
- 'browser/views/bubble_border.cc',
- 'browser/views/bubble_border.h',
- 'browser/views/certificate_viewer_win.cc',
- 'browser/views/chrome_views_delegate.cc',
- 'browser/views/chrome_views_delegate.h',
- 'browser/views/clear_browsing_data.cc',
- 'browser/views/clear_browsing_data.h',
- 'browser/views/clear_browsing_data_view.cc',
- 'browser/views/clear_browsing_data_view.h',
- 'browser/views/clear_data_view.cc',
- 'browser/views/clear_data_view.h',
- 'browser/views/clear_server_data.cc',
- 'browser/views/clear_server_data.h',
- 'browser/views/collected_cookies_win.cc',
- 'browser/views/collected_cookies_win.h',
- 'browser/views/confirm_message_box_dialog.cc',
- 'browser/views/confirm_message_box_dialog.h',
- 'browser/views/constrained_html_delegate_win.cc',
- 'browser/views/constrained_window_win.cc',
- 'browser/views/constrained_window_win.h',
- 'browser/views/content_setting_bubble_contents.cc',
- 'browser/views/content_setting_bubble_contents.h',
- 'browser/views/cookie_info_view.cc',
- 'browser/views/cookie_info_view.h',
- 'browser/views/create_application_shortcut_view.cc',
- 'browser/views/create_application_shortcut_view.h',
- 'browser/views/database_info_view.cc',
- 'browser/views/database_info_view.h',
- 'browser/views/database_open_info_view.cc',
- 'browser/views/database_open_info_view.h',
- 'browser/views/default_search_view.cc',
- 'browser/views/default_search_view.h',
- 'browser/views/detachable_toolbar_view.cc',
- 'browser/views/detachable_toolbar_view.h',
- 'browser/views/dialog_stubs_gtk.cc',
- 'browser/views/dom_view.cc',
- 'browser/views/dom_view.h',
- 'browser/views/download_item_view.cc',
- 'browser/views/download_item_view.h',
- 'browser/views/download_shelf_view.cc',
- 'browser/views/download_shelf_view.h',
- 'browser/views/download_started_animation_win.cc',
- 'browser/views/dropdown_bar_host.cc',
- 'browser/views/dropdown_bar_host.h',
- 'browser/views/dropdown_bar_host_gtk.cc',
- 'browser/views/dropdown_bar_host_win.cc',
- 'browser/views/dropdown_bar_view.h',
- 'browser/views/edit_search_engine_dialog.cc',
- 'browser/views/edit_search_engine_dialog.h',
- 'browser/views/event_utils.cc',
- 'browser/views/event_utils.h',
- 'browser/views/extensions/browser_action_drag_data.cc',
- 'browser/views/extensions/browser_action_drag_data.h',
- 'browser/views/extensions/browser_action_overflow_menu_controller.cc',
- 'browser/views/extensions/browser_action_overflow_menu_controller.h',
- 'browser/views/extensions/extension_install_prompt.cc',
- 'browser/views/extensions/extension_install_prompt2.cc',
- 'browser/views/extensions/extension_installed_bubble.cc',
- 'browser/views/extensions/extension_installed_bubble.h',
- 'browser/views/extensions/extension_popup.cc',
- 'browser/views/extensions/extension_popup.h',
- 'browser/views/extensions/extension_view.cc',
- 'browser/views/extensions/extension_view.h',
- 'browser/views/external_protocol_dialog.cc',
- 'browser/views/external_protocol_dialog.h',
- 'browser/views/find_bar_host.cc',
- 'browser/views/find_bar_host.h',
- 'browser/views/find_bar_host_gtk.cc',
- 'browser/views/find_bar_host_win.cc',
- 'browser/views/find_bar_view.cc',
- 'browser/views/find_bar_view.h',
- 'browser/views/first_run_bubble.cc',
- 'browser/views/first_run_bubble.h',
- 'browser/views/first_run_search_engine_view.cc',
- 'browser/views/first_run_search_engine_view.h',
- 'browser/views/frame/app_panel_browser_frame_view.cc',
- 'browser/views/frame/app_panel_browser_frame_view.h',
- 'browser/views/frame/browser_bubble_host.cc',
- 'browser/views/frame/browser_bubble_host.h',
- 'browser/views/frame/browser_frame.h',
- 'browser/views/frame/browser_frame_gtk.cc',
- 'browser/views/frame/browser_frame_gtk.h',
- 'browser/views/frame/browser_frame_win.cc',
- 'browser/views/frame/browser_frame_win.h',
- 'browser/views/frame/browser_non_client_frame_view.h',
- 'browser/views/frame/browser_root_view.cc',
- 'browser/views/frame/browser_root_view.h',
- 'browser/views/frame/browser_view.cc',
- 'browser/views/frame/browser_view.h',
- 'browser/views/frame/browser_view_layout.cc',
- 'browser/views/frame/browser_view_layout.h',
- 'browser/views/frame/contents_container.cc',
- 'browser/views/frame/contents_container.h',
- 'browser/views/frame/glass_browser_frame_view.cc',
- 'browser/views/frame/glass_browser_frame_view.h',
- 'browser/views/frame/opaque_browser_frame_view.cc',
- 'browser/views/frame/opaque_browser_frame_view.h',
- 'browser/views/frame/popup_non_client_frame_view.cc',
- 'browser/views/frame/popup_non_client_frame_view.h',
- 'browser/views/fullscreen_exit_bubble.cc',
- 'browser/views/fullscreen_exit_bubble.h',
- 'browser/views/generic_info_view.cc',
- 'browser/views/generic_info_view.h',
- 'browser/views/html_dialog_view.cc',
- 'browser/views/html_dialog_view.h',
- 'browser/views/hung_renderer_view.cc',
- 'browser/views/importer_lock_view.cc',
- 'browser/views/importer_lock_view.h',
- 'browser/views/importer_view.cc',
- 'browser/views/importer_view.h',
- 'browser/views/importing_progress_view.cc',
- 'browser/views/importing_progress_view.h',
- 'browser/views/indexed_db_info_view.cc',
- 'browser/views/indexed_db_info_view.h',
- 'browser/views/info_bubble.cc',
- 'browser/views/info_bubble.h',
- 'browser/views/infobars/after_translate_infobar.cc',
- 'browser/views/infobars/after_translate_infobar.h',
- 'browser/views/infobars/before_translate_infobar.cc',
- 'browser/views/infobars/before_translate_infobar.h',
- 'browser/views/infobars/extension_infobar.cc',
- 'browser/views/infobars/extension_infobar.h',
- 'browser/views/infobars/infobar_button_border.cc',
- 'browser/views/infobars/infobar_button_border.h',
- 'browser/views/infobars/infobar_container.cc',
- 'browser/views/infobars/infobar_container.h',
- 'browser/views/infobars/infobar_text_button.cc',
- 'browser/views/infobars/infobar_text_button.h',
- 'browser/views/infobars/infobars.cc',
- 'browser/views/infobars/infobars.h',
- 'browser/views/infobars/translate_infobar_base.cc',
- 'browser/views/infobars/translate_infobar_base.h',
- 'browser/views/infobars/translate_message_infobar.cc',
- 'browser/views/infobars/translate_message_infobar.h',
- 'browser/views/instant_confirm_view.cc',
- 'browser/views/instant_confirm_view.h',
- 'browser/views/js_modal_dialog_views.cc',
- 'browser/views/js_modal_dialog_views.h',
- 'browser/views/keyword_editor_view.cc',
- 'browser/views/keyword_editor_view.h',
- 'browser/views/list_background.h',
- 'browser/views/local_storage_info_view.cc',
- 'browser/views/local_storage_info_view.h',
- 'browser/views/local_storage_set_item_info_view.cc',
- 'browser/views/local_storage_set_item_info_view.h',
- 'browser/views/location_bar/click_handler.cc',
- 'browser/views/location_bar/click_handler.h',
- 'browser/views/location_bar/content_setting_image_view.cc',
- 'browser/views/location_bar/content_setting_image_view.h',
- 'browser/views/location_bar/ev_bubble_view.cc',
- 'browser/views/location_bar/ev_bubble_view.h',
- 'browser/views/location_bar/icon_label_bubble_view.h',
- 'browser/views/location_bar/icon_label_bubble_view.cc',
- 'browser/views/location_bar/keyword_hint_view.cc',
- 'browser/views/location_bar/keyword_hint_view.h',
- 'browser/views/location_bar/location_icon_view.cc',
- 'browser/views/location_bar/location_icon_view.h',
- 'browser/views/location_bar/location_bar_view.cc',
- 'browser/views/location_bar/location_bar_view.h',
- 'browser/views/location_bar/page_action_image_view.cc',
- 'browser/views/location_bar/page_action_image_view.h',
- 'browser/views/location_bar/page_action_with_badge_view.cc',
- 'browser/views/location_bar/page_action_with_badge_view.h',
- 'browser/views/location_bar/selected_keyword_view.h',
- 'browser/views/location_bar/selected_keyword_view.cc',
- 'browser/views/location_bar/star_view.cc',
- 'browser/views/location_bar/star_view.h',
- 'browser/views/login_view.cc',
- 'browser/views/login_view.h',
- 'browser/views/modal_dialog_delegate.cc',
- 'browser/views/modal_dialog_delegate.h',
- 'browser/views/notifications/balloon_view_host.cc',
- 'browser/views/notifications/balloon_view_host.h',
- 'browser/views/notifications/balloon_view.cc',
- 'browser/views/notifications/balloon_view.h',
- 'browser/views/options/advanced_contents_view.cc',
- 'browser/views/options/advanced_contents_view.h',
- 'browser/views/options/advanced_page_view.cc',
- 'browser/views/options/advanced_page_view.h',
- 'browser/views/options/content_exceptions_table_view.cc',
- 'browser/views/options/content_exceptions_table_view.h',
- 'browser/views/options/content_page_view.cc',
- 'browser/views/options/content_page_view.h',
- 'browser/views/options/content_filter_page_view.cc',
- 'browser/views/options/content_filter_page_view.h',
- 'browser/views/options/content_settings_window_view.cc',
- 'browser/views/options/content_settings_window_view.h',
- 'browser/views/options/cookie_filter_page_view.cc',
- 'browser/views/options/cookie_filter_page_view.h',
- 'browser/views/options/cookies_view.cc',
- 'browser/views/options/cookies_view.h',
- 'browser/views/options/exception_editor_view.cc',
- 'browser/views/options/exception_editor_view.h',
- 'browser/views/options/exceptions_view.cc',
- 'browser/views/options/exceptions_view.h',
- 'browser/views/options/exceptions_page_view.cc',
- 'browser/views/options/exceptions_page_view.h',
- 'browser/views/options/fonts_languages_window_view.cc',
- 'browser/views/options/fonts_languages_window_view.h',
- 'browser/views/options/fonts_page_view.cc',
- 'browser/views/options/fonts_page_view.h',
- 'browser/views/options/general_page_view.cc',
- 'browser/views/options/general_page_view.h',
- 'browser/views/options/languages_page_view.cc',
- 'browser/views/options/languages_page_view.h',
- 'browser/views/options/managed_prefs_banner_view.cc',
- 'browser/views/options/managed_prefs_banner_view.h',
- 'browser/views/options/options_group_view.cc',
- 'browser/views/options/options_group_view.h',
- 'browser/views/options/options_page_view.cc',
- 'browser/views/options/options_page_view.h',
- 'browser/views/options/options_window_view.cc',
- 'browser/views/options/passwords_exceptions_window_view.cc',
- 'browser/views/options/passwords_exceptions_window_view.h',
- 'browser/views/options/passwords_page_view.cc',
- 'browser/views/options/passwords_page_view.h',
- 'browser/views/options/plugin_filter_page_view.cc',
- 'browser/views/options/plugin_filter_page_view.h',
- 'browser/views/options/simple_content_exceptions_view.cc',
- 'browser/views/options/simple_content_exceptions_view.h',
- 'browser/views/page_info_bubble_view.cc',
- 'browser/views/page_info_bubble_view.h',
- 'browser/views/pinned_contents_info_bubble.cc',
- 'browser/views/pinned_contents_info_bubble.h',
- 'browser/views/reload_button.cc',
- 'browser/views/reload_button.h',
- 'browser/views/repost_form_warning_view.cc',
- 'browser/views/repost_form_warning_view.h',
- 'browser/views/restart_message_box.cc',
- 'browser/views/restart_message_box.h',
- 'browser/views/sad_tab_view.cc',
- 'browser/views/sad_tab_view.h',
- 'browser/views/select_file_dialog.cc',
- 'browser/views/shell_dialogs_win.cc',
- 'browser/views/ssl_client_certificate_selector_win.cc',
- 'browser/views/status_bubble_views.cc',
- 'browser/views/status_bubble_views.h',
- 'browser/views/status_icons/status_icon_win.cc',
- 'browser/views/status_icons/status_icon_win.h',
- 'browser/views/status_icons/status_tray_gtk.cc',
- 'browser/views/status_icons/status_tray_win.cc',
- 'browser/views/status_icons/status_tray_win.h',
- 'browser/views/tab_icon_view.cc',
- 'browser/views/tab_icon_view.h',
- 'browser/views/tab_contents/tab_contents_container.cc',
- 'browser/views/tab_contents/tab_contents_container.h',
- 'browser/views/tab_contents/native_tab_contents_container.h',
- 'browser/views/tab_contents/native_tab_contents_container_gtk.cc',
- 'browser/views/tab_contents/native_tab_contents_container_gtk.h',
- 'browser/views/tab_contents/native_tab_contents_container_win.cc',
- 'browser/views/tab_contents/native_tab_contents_container_win.h',
- 'browser/views/tab_contents/render_view_context_menu_views.cc',
- 'browser/views/tab_contents/render_view_context_menu_views.h',
- 'browser/views/tab_contents/tab_contents_drag_win.cc',
- 'browser/views/tab_contents/tab_contents_drag_win.h',
- 'browser/views/tab_contents/tab_contents_view_gtk.cc',
- 'browser/views/tab_contents/tab_contents_view_gtk.h',
- 'browser/views/tab_contents/tab_contents_view_win.cc',
- 'browser/views/tab_contents/tab_contents_view_win.h',
- 'browser/views/tabs/base_tab.cc',
- 'browser/views/tabs/base_tab.h',
- 'browser/views/tabs/base_tab_strip.cc',
- 'browser/views/tabs/base_tab_strip.h',
- 'browser/views/tabs/browser_tab_strip_controller.cc',
- 'browser/views/tabs/browser_tab_strip_controller.h',
- 'browser/views/tabs/dragged_tab_controller.cc',
- 'browser/views/tabs/dragged_tab_controller.h',
- 'browser/views/tabs/dragged_tab_view.cc',
- 'browser/views/tabs/dragged_tab_view.h',
- 'browser/views/tabs/native_view_photobooth.h',
- 'browser/views/tabs/native_view_photobooth_gtk.cc',
- 'browser/views/tabs/native_view_photobooth_gtk.h',
- 'browser/views/tabs/native_view_photobooth_win.cc',
- 'browser/views/tabs/native_view_photobooth_win.h',
- 'browser/views/tabs/side_tab.cc',
- 'browser/views/tabs/side_tab.h',
- 'browser/views/tabs/side_tab_strip.cc',
- 'browser/views/tabs/side_tab_strip.h',
- 'browser/views/tabs/tab.cc',
- 'browser/views/tabs/tab.h',
- 'browser/views/tabs/tab_controller.h',
- 'browser/views/tabs/tab_renderer_data.h',
- 'browser/views/tabs/tab_strip.cc',
- 'browser/views/tabs/tab_strip.h',
- 'browser/views/tabs/tab_strip_controller.h',
- 'browser/views/task_manager_view.cc',
- 'browser/views/textfield_views.cc',
- 'browser/views/textfield_views.h',
- 'browser/views/theme_background.cc',
- 'browser/views/theme_background.h',
- 'browser/views/theme_helpers.cc',
- 'browser/views/theme_helpers.h',
- 'browser/views/theme_install_bubble_view.cc',
- 'browser/views/theme_install_bubble_view.h',
- 'browser/views/toolbar_view.cc',
- 'browser/views/toolbar_view.h',
- 'browser/views/uninstall_view.cc',
- 'browser/views/uninstall_view.h',
- 'browser/views/url_picker.cc',
- 'browser/views/url_picker.h',
- 'browser/views/unhandled_keyboard_event_handler.cc',
- 'browser/views/unhandled_keyboard_event_handler.h',
- 'browser/views/update_recommended_message_box.cc',
- 'browser/views/update_recommended_message_box.h',
- 'browser/views/user_data_dir_dialog.cc',
- 'browser/views/user_data_dir_dialog.h',
- 'browser/views/window.cc',
- 'browser/views/window.h',
- 'browser/views/wrench_menu.cc',
- 'browser/views/wrench_menu.h',
'browser/visitedlink_master.cc',
'browser/visitedlink_master.h',
'browser/visitedlink_event_listener.cc',
@@ -3449,8 +3449,8 @@
],
},
'sources!': [
- 'browser/views/extensions/extension_view.cc',
- 'browser/views/extensions/extension_view.h',
+ 'browser/ui/views/extensions/extension_view.cc',
+ 'browser/ui/views/extensions/extension_view.h',
],
'sources': [
'browser/crash_handler_host_linux.h',
@@ -3541,8 +3541,8 @@
'browser/renderer_host/gpu_view_host.h',
'browser/renderer_host/video_layer_proxy.cc',
'browser/renderer_host/video_layer_proxy.h',
- 'browser/views/extensions/extension_view.cc',
- 'browser/views/extensions/extension_view.h',
+ 'browser/ui/views/extensions/extension_view.cc',
+ 'browser/ui/views/extensions/extension_view.h',
],
'sources': [
# Build Apple sample code
@@ -3715,7 +3715,7 @@
'browser/importer/nss_decryptor_system_nss.cc',
'browser/importer/nss_decryptor_system_nss.h',
'browser/power_save_blocker_stub.cc',
- 'browser/views/select_file_dialog.cc',
+ 'browser/ui/views/select_file_dialog.cc',
],
'conditions': [
['win_use_allocator_shim==1', {
@@ -3737,7 +3737,7 @@
['exclude', '^browser/extensions/extension_rlz_module'],
# Exclude all of views.
- ['exclude', '^browser/views/'],
+ ['exclude', '^browser/ui/views/'],
],
'conditions': [
['OS=="linux" and toolkit_views==1',{
@@ -3761,219 +3761,219 @@
['include', 'browser/printing/print_dialog_cloud.cc'],
['include', 'browser/printing/print_dialog_cloud.h'],
['include', '^browser/speech/speech_input_bubble_views.cc'],
- ['include', '^browser/views/about_chrome_view.cc'],
- ['include', '^browser/views/about_chrome_view.h'],
- ['include', '^browser/views/accelerator_table_gtk.cc'],
- ['include', '^browser/views/accelerator_table_gtk.h'],
- ['include', '^browser/views/accessibility_event_router_views.cc'],
- ['include', '^browser/views/accessibility_event_router_views.h'],
- ['include', '^browser/views/accessible_pane_view.cc'],
- ['include', '^browser/views/accessible_pane_view.h'],
- ['include', '^browser/views/accessible_view_helper.cc'],
- ['include', '^browser/views/accessible_view_helper.h'],
- ['include', '^browser/views/autocomplete/autocomplete_popup_contents_view.cc'],
- ['include', '^browser/views/autocomplete/autocomplete_popup_contents_view.h'],
- ['include', '^browser/views/autocomplete/autocomplete_popup_gtk.cc'],
- ['include', '^browser/views/autocomplete/autocomplete_popup_gtk.h'],
- ['include', '^browser/views/bookmark_bar_instructions_view.cc'],
- ['include', '^browser/views/bookmark_bar_instructions_view.h'],
- ['include', '^browser/views/bookmark_bar_view.cc'],
- ['include', '^browser/views/bookmark_bar_view.h'],
- ['include', '^browser/views/bookmark_bubble_view.cc'],
- ['include', '^browser/views/bookmark_bubble_view.h'],
- ['include', '^browser/views/bookmark_context_menu.cc'],
- ['include', '^browser/views/bookmark_context_menu.h'],
- ['include', '^browser/views/bookmark_context_menu_controller_views.cc'],
- ['include', '^browser/views/bookmark_context_menu_controller_views.h'],
- ['include', '^browser/views/bookmark_menu_controller_views.cc'],
- ['include', '^browser/views/browser_actions_container.cc'],
- ['include', '^browser/views/browser_actions_container.h'],
- ['include', '^browser/views/browser_bubble_gtk.cc'],
- ['include', '^browser/views/browser_bubble.cc'],
- ['include', '^browser/views/browser_bubble.h'],
- ['include', '^browser/views/bubble_border.cc'],
- ['include', '^browser/views/bubble_border.h'],
- ['include', '^browser/views/chrome_views_delegate.cc'],
- ['include', '^browser/views/clear_browsing_data.cc'],
- ['include', '^browser/views/clear_browsing_data.h'],
- ['include', '^browser/views/content_setting_bubble_contents.cc'],
- ['include', '^browser/views/content_setting_bubble_contents.h'],
- ['include', '^browser/views/create_application_shortcut_view.cc'],
- ['include', '^browser/views/create_application_shortcut_view.h'],
- ['include', '^browser/views/detachable_toolbar_view.h'],
- ['include', '^browser/views/detachable_toolbar_view.cc'],
- ['include', '^browser/views/dialog_stubs_gtk.cc'],
- ['include', '^browser/views/dom_view.cc'],
- ['include', '^browser/views/dom_view.h'],
- ['include', '^browser/views/download_item_view.cc'],
- ['include', '^browser/views/download_item_view.h'],
- ['include', '^browser/views/download_shelf_view.cc'],
- ['include', '^browser/views/download_shelf_view.h'],
- ['include', '^browser/views/dragged_tab_controller.cc'],
- ['include', '^browser/views/dragged_tab_controller.h'],
- ['include', '^browser/views/dropdown_bar_host.cc'],
- ['include', '^browser/views/dropdown_bar_host.h'],
- ['include', '^browser/views/dropdown_bar_host_gtk.cc'],
- ['include', '^browser/views/dropdown_bar_view.h'],
- ['include', '^browser/views/event_utils.cc'],
- ['include', '^browser/views/event_utils.h'],
- ['include', '^browser/views/extensions/browser_action_drag_data.cc'],
- ['include', '^browser/views/extensions/browser_action_drag_data.h'],
- ['include', '^browser/views/extensions/browser_action_overflow_menu_controller.cc'],
- ['include', '^browser/views/extensions/browser_action_overflow_menu_controller.h'],
- ['include', '^browser/views/extensions/extension_install_prompt.cc'],
- ['include', '^browser/views/extensions/extension_install_prompt2.cc'],
- ['include', '^browser/views/extensions/extension_installed_bubble.cc'],
- ['include', '^browser/views/extensions/extension_installed_bubble.h'],
- ['include', '^browser/views/extensions/extension_popup.cc'],
- ['include', '^browser/views/extensions/extension_popup.h'],
- ['include', '^browser/views/extensions/extension_view.cc'],
- ['include', '^browser/views/extensions/extension_view.h'],
- ['include', '^browser/views/extension_view.cc'],
- ['include', '^browser/views/extension_view.h'],
- ['include', '^browser/views/find_bar_view.cc'],
- ['include', '^browser/views/find_bar_view.h'],
- ['include', '^browser/views/find_bar_host_gtk.cc'],
- ['include', '^browser/views/find_bar_host.cc'],
- ['include', '^browser/views/find_bar_host.h'],
- ['include', '^browser/views/fullscreen_exit_bubble.cc'],
- ['include', '^browser/views/fullscreen_exit_bubble.h'],
- ['include', '^browser/views/html_dialog_view.cc'],
- ['include', '^browser/views/html_dialog_view.h'],
- ['include', '^browser/views/theme_install_bubble_view.cc'],
- ['include', '^browser/views/theme_install_bubble_view.h'],
- ['include', '^browser/views/frame/browser_bubble_host.cc'],
- ['include', '^browser/views/frame/browser_bubble_host.h'],
- ['include', '^browser/views/frame/browser_view_layout.cc'],
- ['include', '^browser/views/frame/browser_view_layout.h'],
- ['include', '^browser/views/frame/browser_view.cc'],
- ['include', '^browser/views/frame/browser_view.h'],
- ['include', '^browser/views/frame/browser_frame_gtk.cc'],
- ['include', '^browser/views/frame/browser_frame_gtk.h'],
- ['include', '^browser/views/frame/browser_root_view.cc'],
- ['include', '^browser/views/frame/browser_root_view.h'],
- ['include', '^browser/views/frame/contents_container.cc'],
- ['include', '^browser/views/frame/contents_container.h'],
- ['include', '^browser/views/frame/opaque_browser_frame_view.cc'],
- ['include', '^browser/views/frame/opaque_browser_frame_view.h'],
- ['include', '^browser/views/frame/popup_non_client_frame_view.cc'],
- ['include', '^browser/views/frame/popup_non_client_frame_view.h'],
- ['include', '^browser/views/infobars/*'],
- ['include', '^browser/views/info_bubble.cc'],
- ['include', '^browser/views/info_bubble.h'],
- ['include', '^browser/views/html_dialog_view.cc'],
- ['include', '^browser/views/html_dialog_view.h'],
- ['include', '^browser/views/instant_confirm_view.cc'],
- ['include', '^browser/views/instant_confirm_view.h'],
- ['include', '^browser/views/js_modal_dialog_views.cc'],
- ['include', '^browser/views/js_modal_dialog_views.h'],
- ['include', '^browser/views/location_bar/click_handler.cc'],
- ['include', '^browser/views/location_bar/click_handler.h'],
- ['include', '^browser/views/location_bar/content_setting_image_view.cc'],
- ['include', '^browser/views/location_bar/content_setting_image_view.h'],
- ['include', '^browser/views/location_bar/ev_bubble_view.cc'],
- ['include', '^browser/views/location_bar/ev_bubble_view.h'],
- ['include', '^browser/views/location_bar/icon_label_bubble_view.h'],
- ['include', '^browser/views/location_bar/icon_label_bubble_view.cc'],
- ['include', '^browser/views/location_bar/keyword_hint_view.cc'],
- ['include', '^browser/views/location_bar/keyword_hint_view.h'],
- ['include', '^browser/views/location_bar/location_icon_view.cc'],
- ['include', '^browser/views/location_bar/location_icon_view.h'],
- ['include', '^browser/views/location_bar/location_bar_view.cc'],
- ['include', '^browser/views/location_bar/location_bar_view.h'],
- ['include', '^browser/views/location_bar/page_action_image_view.cc'],
- ['include', '^browser/views/location_bar/page_action_image_view.h'],
- ['include', '^browser/views/location_bar/page_action_with_badge_view.h'],
- ['include', '^browser/views/location_bar/page_action_with_badge_view.cc'],
- ['include', '^browser/views/location_bar/selected_keyword_view.h'],
- ['include', '^browser/views/location_bar/selected_keyword_view.cc'],
- ['include', '^browser/views/location_bar/star_view.cc'],
- ['include', '^browser/views/location_bar/star_view.h'],
- ['include', '^browser/views/location_bar_view.cc'],
- ['include', '^browser/views/location_bar_view.h'],
- ['include', '^browser/views/modal_dialog_delegate.cc'],
- ['include', '^browser/views/modal_dialog_delegate.h'],
- ['include', '^browser/views/notifications/balloon_view_host.cc'],
- ['include', '^browser/views/notifications/balloon_view_host.h'],
- ['include', '^browser/views/options/options_page_view.cc'],
- ['include', '^browser/views/options/options_page_view.h'],
- ['include', '^browser/views/page_info_bubble_view.cc'],
- ['include', '^browser/views/panel_controller.cc'],
- ['include', '^browser/views/panel_controller.h'],
- ['include', '^browser/views/panels/panel_container.cc'],
- ['include', '^browser/views/panels/panel_container.h'],
- ['include', '^browser/views/panels/panel_scroller.cc'],
- ['include', '^browser/views/panels/panel_scroller.h'],
+ ['include', '^browser/ui/views/about_chrome_view.cc'],
+ ['include', '^browser/ui/views/about_chrome_view.h'],
+ ['include', '^browser/ui/views/accelerator_table_gtk.cc'],
+ ['include', '^browser/ui/views/accelerator_table_gtk.h'],
+ ['include', '^browser/ui/views/accessibility_event_router_views.cc'],
+ ['include', '^browser/ui/views/accessibility_event_router_views.h'],
+ ['include', '^browser/ui/views/accessible_pane_view.cc'],
+ ['include', '^browser/ui/views/accessible_pane_view.h'],
+ ['include', '^browser/ui/views/accessible_view_helper.cc'],
+ ['include', '^browser/ui/views/accessible_view_helper.h'],
+ ['include', '^browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc'],
+ ['include', '^browser/ui/views/autocomplete/autocomplete_popup_contents_view.h'],
+ ['include', '^browser/ui/views/autocomplete/autocomplete_popup_gtk.cc'],
+ ['include', '^browser/ui/views/autocomplete/autocomplete_popup_gtk.h'],
+ ['include', '^browser/ui/views/bookmark_bar_instructions_view.cc'],
+ ['include', '^browser/ui/views/bookmark_bar_instructions_view.h'],
+ ['include', '^browser/ui/views/bookmark_bar_view.cc'],
+ ['include', '^browser/ui/views/bookmark_bar_view.h'],
+ ['include', '^browser/ui/views/bookmark_bubble_view.cc'],
+ ['include', '^browser/ui/views/bookmark_bubble_view.h'],
+ ['include', '^browser/ui/views/bookmark_context_menu.cc'],
+ ['include', '^browser/ui/views/bookmark_context_menu.h'],
+ ['include', '^browser/ui/views/bookmark_context_menu_controller_views.cc'],
+ ['include', '^browser/ui/views/bookmark_context_menu_controller_views.h'],
+ ['include', '^browser/ui/views/bookmark_menu_controller_views.cc'],
+ ['include', '^browser/ui/views/browser_actions_container.cc'],
+ ['include', '^browser/ui/views/browser_actions_container.h'],
+ ['include', '^browser/ui/views/browser_bubble_gtk.cc'],
+ ['include', '^browser/ui/views/browser_bubble.cc'],
+ ['include', '^browser/ui/views/browser_bubble.h'],
+ ['include', '^browser/ui/views/bubble_border.cc'],
+ ['include', '^browser/ui/views/bubble_border.h'],
+ ['include', '^browser/ui/views/chrome_views_delegate.cc'],
+ ['include', '^browser/ui/views/clear_browsing_data.cc'],
+ ['include', '^browser/ui/views/clear_browsing_data.h'],
+ ['include', '^browser/ui/views/content_setting_bubble_contents.cc'],
+ ['include', '^browser/ui/views/content_setting_bubble_contents.h'],
+ ['include', '^browser/ui/views/create_application_shortcut_view.cc'],
+ ['include', '^browser/ui/views/create_application_shortcut_view.h'],
+ ['include', '^browser/ui/views/detachable_toolbar_view.h'],
+ ['include', '^browser/ui/views/detachable_toolbar_view.cc'],
+ ['include', '^browser/ui/views/dialog_stubs_gtk.cc'],
+ ['include', '^browser/ui/views/dom_view.cc'],
+ ['include', '^browser/ui/views/dom_view.h'],
+ ['include', '^browser/ui/views/download_item_view.cc'],
+ ['include', '^browser/ui/views/download_item_view.h'],
+ ['include', '^browser/ui/views/download_shelf_view.cc'],
+ ['include', '^browser/ui/views/download_shelf_view.h'],
+ ['include', '^browser/ui/views/dragged_tab_controller.cc'],
+ ['include', '^browser/ui/views/dragged_tab_controller.h'],
+ ['include', '^browser/ui/views/dropdown_bar_host.cc'],
+ ['include', '^browser/ui/views/dropdown_bar_host.h'],
+ ['include', '^browser/ui/views/dropdown_bar_host_gtk.cc'],
+ ['include', '^browser/ui/views/dropdown_bar_view.h'],
+ ['include', '^browser/ui/views/event_utils.cc'],
+ ['include', '^browser/ui/views/event_utils.h'],
+ ['include', '^browser/ui/views/extensions/browser_action_drag_data.cc'],
+ ['include', '^browser/ui/views/extensions/browser_action_drag_data.h'],
+ ['include', '^browser/ui/views/extensions/browser_action_overflow_menu_controller.cc'],
+ ['include', '^browser/ui/views/extensions/browser_action_overflow_menu_controller.h'],
+ ['include', '^browser/ui/views/extensions/extension_install_prompt.cc'],
+ ['include', '^browser/ui/views/extensions/extension_install_prompt2.cc'],
+ ['include', '^browser/ui/views/extensions/extension_installed_bubble.cc'],
+ ['include', '^browser/ui/views/extensions/extension_installed_bubble.h'],
+ ['include', '^browser/ui/views/extensions/extension_popup.cc'],
+ ['include', '^browser/ui/views/extensions/extension_popup.h'],
+ ['include', '^browser/ui/views/extensions/extension_view.cc'],
+ ['include', '^browser/ui/views/extensions/extension_view.h'],
+ ['include', '^browser/ui/views/extension_view.cc'],
+ ['include', '^browser/ui/views/extension_view.h'],
+ ['include', '^browser/ui/views/find_bar_view.cc'],
+ ['include', '^browser/ui/views/find_bar_view.h'],
+ ['include', '^browser/ui/views/find_bar_host_gtk.cc'],
+ ['include', '^browser/ui/views/find_bar_host.cc'],
+ ['include', '^browser/ui/views/find_bar_host.h'],
+ ['include', '^browser/ui/views/fullscreen_exit_bubble.cc'],
+ ['include', '^browser/ui/views/fullscreen_exit_bubble.h'],
+ ['include', '^browser/ui/views/html_dialog_view.cc'],
+ ['include', '^browser/ui/views/html_dialog_view.h'],
+ ['include', '^browser/ui/views/theme_install_bubble_view.cc'],
+ ['include', '^browser/ui/views/theme_install_bubble_view.h'],
+ ['include', '^browser/ui/views/frame/browser_bubble_host.cc'],
+ ['include', '^browser/ui/views/frame/browser_bubble_host.h'],
+ ['include', '^browser/ui/views/frame/browser_view_layout.cc'],
+ ['include', '^browser/ui/views/frame/browser_view_layout.h'],
+ ['include', '^browser/ui/views/frame/browser_view.cc'],
+ ['include', '^browser/ui/views/frame/browser_view.h'],
+ ['include', '^browser/ui/views/frame/browser_frame_gtk.cc'],
+ ['include', '^browser/ui/views/frame/browser_frame_gtk.h'],
+ ['include', '^browser/ui/views/frame/browser_root_view.cc'],
+ ['include', '^browser/ui/views/frame/browser_root_view.h'],
+ ['include', '^browser/ui/views/frame/contents_container.cc'],
+ ['include', '^browser/ui/views/frame/contents_container.h'],
+ ['include', '^browser/ui/views/frame/opaque_browser_frame_view.cc'],
+ ['include', '^browser/ui/views/frame/opaque_browser_frame_view.h'],
+ ['include', '^browser/ui/views/frame/popup_non_client_frame_view.cc'],
+ ['include', '^browser/ui/views/frame/popup_non_client_frame_view.h'],
+ ['include', '^browser/ui/views/infobars/*'],
+ ['include', '^browser/ui/views/info_bubble.cc'],
+ ['include', '^browser/ui/views/info_bubble.h'],
+ ['include', '^browser/ui/views/html_dialog_view.cc'],
+ ['include', '^browser/ui/views/html_dialog_view.h'],
+ ['include', '^browser/ui/views/instant_confirm_view.cc'],
+ ['include', '^browser/ui/views/instant_confirm_view.h'],
+ ['include', '^browser/ui/views/js_modal_dialog_views.cc'],
+ ['include', '^browser/ui/views/js_modal_dialog_views.h'],
+ ['include', '^browser/ui/views/location_bar/click_handler.cc'],
+ ['include', '^browser/ui/views/location_bar/click_handler.h'],
+ ['include', '^browser/ui/views/location_bar/content_setting_image_view.cc'],
+ ['include', '^browser/ui/views/location_bar/content_setting_image_view.h'],
+ ['include', '^browser/ui/views/location_bar/ev_bubble_view.cc'],
+ ['include', '^browser/ui/views/location_bar/ev_bubble_view.h'],
+ ['include', '^browser/ui/views/location_bar/icon_label_bubble_view.h'],
+ ['include', '^browser/ui/views/location_bar/icon_label_bubble_view.cc'],
+ ['include', '^browser/ui/views/location_bar/keyword_hint_view.cc'],
+ ['include', '^browser/ui/views/location_bar/keyword_hint_view.h'],
+ ['include', '^browser/ui/views/location_bar/location_icon_view.cc'],
+ ['include', '^browser/ui/views/location_bar/location_icon_view.h'],
+ ['include', '^browser/ui/views/location_bar/location_bar_view.cc'],
+ ['include', '^browser/ui/views/location_bar/location_bar_view.h'],
+ ['include', '^browser/ui/views/location_bar/page_action_image_view.cc'],
+ ['include', '^browser/ui/views/location_bar/page_action_image_view.h'],
+ ['include', '^browser/ui/views/location_bar/page_action_with_badge_view.h'],
+ ['include', '^browser/ui/views/location_bar/page_action_with_badge_view.cc'],
+ ['include', '^browser/ui/views/location_bar/selected_keyword_view.h'],
+ ['include', '^browser/ui/views/location_bar/selected_keyword_view.cc'],
+ ['include', '^browser/ui/views/location_bar/star_view.cc'],
+ ['include', '^browser/ui/views/location_bar/star_view.h'],
+ ['include', '^browser/ui/views/location_bar_view.cc'],
+ ['include', '^browser/ui/views/location_bar_view.h'],
+ ['include', '^browser/ui/views/modal_dialog_delegate.cc'],
+ ['include', '^browser/ui/views/modal_dialog_delegate.h'],
+ ['include', '^browser/ui/views/notifications/balloon_view_host.cc'],
+ ['include', '^browser/ui/views/notifications/balloon_view_host.h'],
+ ['include', '^browser/ui/views/options/options_page_view.cc'],
+ ['include', '^browser/ui/views/options/options_page_view.h'],
+ ['include', '^browser/ui/views/page_info_bubble_view.cc'],
+ ['include', '^browser/ui/views/panel_controller.cc'],
+ ['include', '^browser/ui/views/panel_controller.h'],
+ ['include', '^browser/ui/views/panels/panel_container.cc'],
+ ['include', '^browser/ui/views/panels/panel_container.h'],
+ ['include', '^browser/ui/views/panels/panel_scroller.cc'],
+ ['include', '^browser/ui/views/panels/panel_scroller.h'],
# Not necessary unless you're trying to build ChromeOS+views.
- #['include', '^browser/views/panels/panel_scroller_container.cc'],
- #['include', '^browser/views/panels/panel_scroller_container.h'],
- ['include', '^browser/views/panels/panel_scroller_header.cc'],
- ['include', '^browser/views/panels/panel_scroller_header.h'],
- ['include', '^browser/views/pinned_contents_info_bubble.cc'],
- ['include', '^browser/views/pinned_contents_info_bubble.h'],
- ['include', '^browser/views/reload_button.cc'],
- ['include', '^browser/views/reload_button.h'],
- ['include', '^browser/views/restart_message_box.cc'],
- ['include', '^browser/views/restart_message_box.h'],
- ['include', '^browser/views/sad_tab_view.cc'],
- ['include', '^browser/views/sad_tab_view.h'],
- ['include', '^browser/views/select_file_dialog.cc'],
- ['include', '^browser/views/status_bubble_views.cc'],
- ['include', '^browser/views/status_bubble_views.h'],
- ['include', '^browser/views/status_icons/status_tray_gtk.cc'],
- ['include', '^browser/views/tab_contents/native_tab_contents_container_gtk.cc'],
- ['include', '^browser/views/tab_contents/native_tab_contents_container_gtk.h'],
- ['include', '^browser/views/tab_contents/render_view_context_menu_views.cc'],
- ['include', '^browser/views/tab_contents/render_view_context_menu_views.h'],
- ['include', '^browser/views/tab_contents/tab_contents_container.cc'],
- ['include', '^browser/views/tab_contents/tab_contents_container.h'],
- ['include', '^browser/views/tab_contents/tab_contents_view_gtk.cc'],
- ['include', '^browser/views/tab_contents/tab_contents_view_gtk.h'],
- ['include', '^browser/views/tab_icon_view.cc'],
- ['include', '^browser/views/tab_icon_view.h'],
- ['include', '^browser/views/tabs/base_tab.cc'],
- ['include', '^browser/views/tabs/base_tab.h'],
- ['include', '^browser/views/tabs/base_tab_strip.cc'],
- ['include', '^browser/views/tabs/base_tab_strip.h'],
- ['include', '^browser/views/tabs/browser_tab_strip_controller.cc'],
- ['include', '^browser/views/tabs/browser_tab_strip_controller.h'],
- ['include', '^browser/views/tabs/browser_tab_strip.cc'],
- ['include', '^browser/views/tabs/browser_tab_strip.h'],
- ['include', '^browser/views/tabs/dragged_tab_controller.cc'],
- ['include', '^browser/views/tabs/dragged_tab_controller.h'],
- ['include', '^browser/views/tabs/dragged_tab_view.cc'],
- ['include', '^browser/views/tabs/dragged_tab_view.h'],
- ['include', '^browser/views/tabs/native_view_photobooth.h'],
- ['include', '^browser/views/tabs/native_view_photobooth_gtk.cc'],
- ['include', '^browser/views/tabs/native_view_photobooth_gtk.h'],
- ['include', '^browser/views/tabs/side_tab.cc'],
- ['include', '^browser/views/tabs/side_tab.h'],
- ['include', '^browser/views/tabs/side_tab_strip.cc'],
- ['include', '^browser/views/tabs/side_tab_strip.h'],
- ['include', '^browser/views/tabs/tab.cc'],
- ['include', '^browser/views/tabs/tab.h'],
- ['include', '^browser/views/tabs/tab_controller.h'],
- ['include', '^browser/views/tabs/tab_renderer_data.h'],
- ['include', '^browser/views/tabs/tab_strip.cc'],
- ['include', '^browser/views/tabs/tab_strip.h'],
- ['include', '^browser/views/tabs/tab_strip_2.cc'],
- ['include', '^browser/views/tabs/tab_strip_2.h'],
- ['include', '^browser/views/textfield_views.cc'],
- ['include', '^browser/views/textfield_views.h'],
- ['include', '^browser/views/theme_background.cc'],
- ['include', '^browser/views/theme_background.h'],
- ['include', '^browser/views/toolbar_view.cc'],
- ['include', '^browser/views/toolbar_view.h'],
- ['include', '^browser/views/unhandled_keyboard_event_handler.cc'],
- ['include', '^browser/views/unhandled_keyboard_event_handler.h'],
- ['include', '^browser/views/update_recommended_message_box.h'],
- ['include', '^browser/views/update_recommended_message_box.cc'],
- ['include', '^browser/views/view_text_utils.cc'],
- ['include', '^browser/views/view_text_utils.h'],
- ['include', '^browser/views/window.cc'],
- ['include', '^browser/views/window.h'],
- ['include', '^browser/views/wrench_menu.cc'],
- ['include', '^browser/views/wrench_menu.h'],
+ #['include', '^browser/ui/views/panels/panel_scroller_container.cc'],
+ #['include', '^browser/ui/views/panels/panel_scroller_container.h'],
+ ['include', '^browser/ui/views/panels/panel_scroller_header.cc'],
+ ['include', '^browser/ui/views/panels/panel_scroller_header.h'],
+ ['include', '^browser/ui/views/pinned_contents_info_bubble.cc'],
+ ['include', '^browser/ui/views/pinned_contents_info_bubble.h'],
+ ['include', '^browser/ui/views/reload_button.cc'],
+ ['include', '^browser/ui/views/reload_button.h'],
+ ['include', '^browser/ui/views/restart_message_box.cc'],
+ ['include', '^browser/ui/views/restart_message_box.h'],
+ ['include', '^browser/ui/views/sad_tab_view.cc'],
+ ['include', '^browser/ui/views/sad_tab_view.h'],
+ ['include', '^browser/ui/views/select_file_dialog.cc'],
+ ['include', '^browser/ui/views/status_bubble_views.cc'],
+ ['include', '^browser/ui/views/status_bubble_views.h'],
+ ['include', '^browser/ui/views/status_icons/status_tray_gtk.cc'],
+ ['include', '^browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc'],
+ ['include', '^browser/ui/views/tab_contents/native_tab_contents_container_gtk.h'],
+ ['include', '^browser/ui/views/tab_contents/render_view_context_menu_views.cc'],
+ ['include', '^browser/ui/views/tab_contents/render_view_context_menu_views.h'],
+ ['include', '^browser/ui/views/tab_contents/tab_contents_container.cc'],
+ ['include', '^browser/ui/views/tab_contents/tab_contents_container.h'],
+ ['include', '^browser/ui/views/tab_contents/tab_contents_view_gtk.cc'],
+ ['include', '^browser/ui/views/tab_contents/tab_contents_view_gtk.h'],
+ ['include', '^browser/ui/views/tab_icon_view.cc'],
+ ['include', '^browser/ui/views/tab_icon_view.h'],
+ ['include', '^browser/ui/views/tabs/base_tab.cc'],
+ ['include', '^browser/ui/views/tabs/base_tab.h'],
+ ['include', '^browser/ui/views/tabs/base_tab_strip.cc'],
+ ['include', '^browser/ui/views/tabs/base_tab_strip.h'],
+ ['include', '^browser/ui/views/tabs/browser_tab_strip_controller.cc'],
+ ['include', '^browser/ui/views/tabs/browser_tab_strip_controller.h'],
+ ['include', '^browser/ui/views/tabs/browser_tab_strip.cc'],
+ ['include', '^browser/ui/views/tabs/browser_tab_strip.h'],
+ ['include', '^browser/ui/views/tabs/dragged_tab_controller.cc'],
+ ['include', '^browser/ui/views/tabs/dragged_tab_controller.h'],
+ ['include', '^browser/ui/views/tabs/dragged_tab_view.cc'],
+ ['include', '^browser/ui/views/tabs/dragged_tab_view.h'],
+ ['include', '^browser/ui/views/tabs/native_view_photobooth.h'],
+ ['include', '^browser/ui/views/tabs/native_view_photobooth_gtk.cc'],
+ ['include', '^browser/ui/views/tabs/native_view_photobooth_gtk.h'],
+ ['include', '^browser/ui/views/tabs/side_tab.cc'],
+ ['include', '^browser/ui/views/tabs/side_tab.h'],
+ ['include', '^browser/ui/views/tabs/side_tab_strip.cc'],
+ ['include', '^browser/ui/views/tabs/side_tab_strip.h'],
+ ['include', '^browser/ui/views/tabs/tab.cc'],
+ ['include', '^browser/ui/views/tabs/tab.h'],
+ ['include', '^browser/ui/views/tabs/tab_controller.h'],
+ ['include', '^browser/ui/views/tabs/tab_renderer_data.h'],
+ ['include', '^browser/ui/views/tabs/tab_strip.cc'],
+ ['include', '^browser/ui/views/tabs/tab_strip.h'],
+ ['include', '^browser/ui/views/tabs/tab_strip_2.cc'],
+ ['include', '^browser/ui/views/tabs/tab_strip_2.h'],
+ ['include', '^browser/ui/views/textfield_views.cc'],
+ ['include', '^browser/ui/views/textfield_views.h'],
+ ['include', '^browser/ui/views/theme_background.cc'],
+ ['include', '^browser/ui/views/theme_background.h'],
+ ['include', '^browser/ui/views/toolbar_view.cc'],
+ ['include', '^browser/ui/views/toolbar_view.h'],
+ ['include', '^browser/ui/views/unhandled_keyboard_event_handler.cc'],
+ ['include', '^browser/ui/views/unhandled_keyboard_event_handler.h'],
+ ['include', '^browser/ui/views/update_recommended_message_box.h'],
+ ['include', '^browser/ui/views/update_recommended_message_box.cc'],
+ ['include', '^browser/ui/views/view_text_utils.cc'],
+ ['include', '^browser/ui/views/view_text_utils.h'],
+ ['include', '^browser/ui/views/window.cc'],
+ ['include', '^browser/ui/views/window.h'],
+ ['include', '^browser/ui/views/wrench_menu.cc'],
+ ['include', '^browser/ui/views/wrench_menu.h'],
['include', '^browser/window_sizer.cc'],
['include', '^browser/window_sizer.h'],
# Exclude all of browser/gtk, then include the things we want.
@@ -4079,9 +4079,9 @@
['include', '^browser/gtk/dialogs_gtk.cc'],
['include', '^browser/gtk/external_protocol_dialog_gtk.cc'],
['include', '^browser/gtk/external_protocol_dialog_gtk.h'],
- ['include', '^browser/views/notifications/balloon_view.cc'],
- ['include', '^browser/views/notifications/balloon_view.h'],
- ['exclude', '^browser/views/select_file_dialog.cc'],
+ ['include', '^browser/ui/views/notifications/balloon_view.cc'],
+ ['include', '^browser/ui/views/notifications/balloon_view.h'],
+ ['exclude', '^browser/ui/views/select_file_dialog.cc'],
],
}],
# GTK build only
@@ -4091,8 +4091,8 @@
['include', '^browser/printing/print_dialog_gtk.h'],
['exclude', '^browser/ui/browser_list_stub.cc'],
['exclude', '^browser/bookmarks/bookmark_drop_info.cc'],
- ['exclude', '^browser/views/autocomplete/autocomplete_popup_gtk.cc'],
- ['exclude', '^browser/views/autocomplete/autocomplete_popup_gtk.h'],
+ ['exclude', '^browser/ui/views/autocomplete/autocomplete_popup_gtk.cc'],
+ ['exclude', '^browser/ui/views/autocomplete/autocomplete_popup_gtk.h'],
],
}],
['OS=="linux" and chromeos==1',{
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 0961a19..dd1d156 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -301,10 +301,10 @@
'browser/gtk/bookmark_bar_gtk_interactive_uitest.cc',
'browser/instant/instant_browsertest.cc',
'browser/notifications/notifications_interactive_uitest.cc',
- 'browser/views/bookmark_bar_view_test.cc',
- 'browser/views/browser_keyboard_accessibility_test_win.cc',
- 'browser/views/find_bar_host_interactive_uitest.cc',
- 'browser/views/tabs/tab_dragging_test.cc',
+ 'browser/ui/views/bookmark_bar_view_test.cc',
+ 'browser/ui/views/browser_keyboard_accessibility_test_win.cc',
+ 'browser/ui/views/find_bar_host_interactive_uitest.cc',
+ 'browser/ui/views/tabs/tab_dragging_test.cc',
'test/in_process_browser_test.cc',
'test/in_process_browser_test.h',
'test/interactive_ui/fast_shutdown_interactive_uitest.cc',
@@ -328,10 +328,10 @@
['OS=="linux" and toolkit_views==0', {
'sources!': [
# TODO(port)
- 'browser/views/bookmark_bar_view_test.cc',
- 'browser/views/find_bar_host_interactive_uitest.cc',
- 'browser/views/tabs/tab_dragging_test.cc',
- 'browser/views/tabs/tab_strip_interactive_uitest.cc',
+ 'browser/ui/views/bookmark_bar_view_test.cc',
+ 'browser/ui/views/find_bar_host_interactive_uitest.cc',
+ 'browser/ui/views/tabs/tab_dragging_test.cc',
+ 'browser/ui/views/tabs/tab_strip_interactive_uitest.cc',
'test/interactive_ui/npapi_interactive_test.cc',
'test/interactive_ui/view_event_test_base.cc',
'test/interactive_ui/view_event_test_base.h',
@@ -355,10 +355,10 @@
# TODO(port)
'browser/autocomplete/autocomplete_edit_view_browsertest.cc',
'browser/debugger/devtools_sanity_unittest.cc',
- 'browser/views/bookmark_bar_view_test.cc',
- 'browser/views/find_bar_host_interactive_uitest.cc',
- 'browser/views/tabs/tab_dragging_test.cc',
- 'browser/views/tabs/tab_strip_interactive_uitest.cc',
+ 'browser/ui/views/bookmark_bar_view_test.cc',
+ 'browser/ui/views/find_bar_host_interactive_uitest.cc',
+ 'browser/ui/views/tabs/tab_dragging_test.cc',
+ 'browser/ui/views/tabs/tab_strip_interactive_uitest.cc',
'test/interactive_ui/npapi_interactive_test.cc',
'test/interactive_ui/view_event_test_base.cc',
'test/interactive_ui/view_event_test_base.h',
@@ -501,7 +501,7 @@
'browser/tab_contents/view_source_uitest.cc',
'browser/tab_restore_uitest.cc',
'browser/unload_uitest.cc',
- 'browser/views/find_bar_host_uitest.cc',
+ 'browser/ui/views/find_bar_host_uitest.cc',
'common/logging_chrome_uitest.cc',
'renderer/external_extension_uitest.cc',
'test/automation/automation_proxy_uitest.cc',
@@ -1513,16 +1513,16 @@
'browser/themes/browser_theme_provider_unittest.cc',
'browser/translate/translate_manager_unittest.cc',
'browser/user_style_sheet_watcher_unittest.cc',
- 'browser/views/accessibility_event_router_views_unittest.cc',
- 'browser/views/bookmark_bar_view_unittest.cc',
- 'browser/views/bookmark_context_menu_test.cc',
- 'browser/views/bookmark_editor_view_unittest.cc',
- 'browser/views/extensions/browser_action_drag_data_unittest.cc',
- 'browser/views/generic_info_view_unittest.cc',
- 'browser/views/info_bubble_unittest.cc',
- 'browser/views/reload_button_unittest.cc',
- 'browser/views/shell_dialogs_win_unittest.cc',
- 'browser/views/status_icons/status_tray_win_unittest.cc',
+ 'browser/ui/views/accessibility_event_router_views_unittest.cc',
+ 'browser/ui/views/bookmark_bar_view_unittest.cc',
+ 'browser/ui/views/bookmark_context_menu_test.cc',
+ 'browser/ui/views/bookmark_editor_view_unittest.cc',
+ 'browser/ui/views/extensions/browser_action_drag_data_unittest.cc',
+ 'browser/ui/views/generic_info_view_unittest.cc',
+ 'browser/ui/views/info_bubble_unittest.cc',
+ 'browser/ui/views/reload_button_unittest.cc',
+ 'browser/ui/views/shell_dialogs_win_unittest.cc',
+ 'browser/ui/views/status_icons/status_tray_win_unittest.cc',
'browser/visitedlink_unittest.cc',
'browser/web_applications/web_app_unittest.cc',
'browser/webdata/web_data_service_test_util.h',
@@ -1825,11 +1825,11 @@
'browser/login_prompt_unittest.cc',
'browser/rlz/rlz_unittest.cc',
'browser/search_engines/template_url_scraper_unittest.cc',
- 'browser/views/bookmark_editor_view_unittest.cc',
- 'browser/views/extensions/browser_action_drag_data_unittest.cc',
- 'browser/views/find_bar_host_unittest.cc',
- 'browser/views/generic_info_view_unittest.cc',
- 'browser/views/keyword_editor_view_unittest.cc',
+ 'browser/ui/views/bookmark_editor_view_unittest.cc',
+ 'browser/ui/views/extensions/browser_action_drag_data_unittest.cc',
+ 'browser/ui/views/find_bar_host_unittest.cc',
+ 'browser/ui/views/generic_info_view_unittest.cc',
+ 'browser/ui/views/keyword_editor_view_unittest.cc',
'test/data/resource.rc',
],
}],
@@ -1842,8 +1842,8 @@
],
}, { # else: toolkit_views == 0
'sources/': [
- ['exclude', '^browser/views/'],
- ['exclude', '^../views/'],
+ ['exclude', '^browser/ui/views/'],
+ ['exclude', '^../ui/views/'],
],
}],
],
@@ -2039,9 +2039,9 @@
'browser/task_manager/task_manager_browsertest.cc',
'browser/ui/browser_init_browsertest.cc',
'browser/ui/browser_navigator_browsertest.cc',
- 'browser/views/browser_actions_container_browsertest.cc',
- 'browser/views/dom_view_browsertest.cc',
- 'browser/views/html_dialog_view_browsertest.cc',
+ 'browser/ui/views/browser_actions_container_browsertest.cc',
+ 'browser/ui/views/dom_view_browsertest.cc',
+ 'browser/ui/views/html_dialog_view_browsertest.cc',
'renderer/form_autocomplete_browsertest.cc',
'renderer/form_manager_browsertest.cc',
'renderer/password_autocomplete_manager_unittest.cc',
@@ -2195,9 +2195,9 @@
}, { # else: toolkit_views == 0
'sources!': [
'browser/extensions/browser_action_test_util_views.cc',
- 'browser/views/browser_actions_container_browsertest.cc',
- 'browser/views/dom_view_browsertest.cc',
- 'browser/views/html_dialog_view_browsertest.cc',
+ 'browser/ui/views/browser_actions_container_browsertest.cc',
+ 'browser/ui/views/dom_view_browsertest.cc',
+ 'browser/ui/views/html_dialog_view_browsertest.cc',
],
}],
], # conditions