Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 #endif // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 #include "chrome/browser/sessions/session_service.h" | 60 #include "chrome/browser/sessions/session_service.h" |
| 61 #include "chrome/browser/sessions/session_service_factory.h" | 61 #include "chrome/browser/sessions/session_service_factory.h" |
| 62 #include "chrome/browser/sessions/session_types.h" | 62 #include "chrome/browser/sessions/session_types.h" |
| 63 #include "chrome/browser/sessions/tab_restore_service.h" | 63 #include "chrome/browser/sessions/tab_restore_service.h" |
| 64 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 64 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 65 #include "chrome/browser/sync/profile_sync_service.h" | 65 #include "chrome/browser/sync/profile_sync_service.h" |
| 66 #include "chrome/browser/sync/sync_ui_util.h" | 66 #include "chrome/browser/sync/sync_ui_util.h" |
| 67 #include "chrome/browser/tab_closeable_state_watcher.h" | 67 #include "chrome/browser/tab_closeable_state_watcher.h" |
| 68 #include "chrome/browser/tab_contents/background_contents.h" | 68 #include "chrome/browser/tab_contents/background_contents.h" |
| 69 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" | 69 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" |
| 70 #include "chrome/browser/tab_contents/tab_util.h" | |
| 70 #include "chrome/browser/tabs/tab_finder.h" | 71 #include "chrome/browser/tabs/tab_finder.h" |
| 71 #include "chrome/browser/tabs/tab_strip_model.h" | 72 #include "chrome/browser/tabs/tab_strip_model.h" |
| 72 #include "chrome/browser/themes/theme_service.h" | 73 #include "chrome/browser/themes/theme_service.h" |
| 73 #include "chrome/browser/themes/theme_service_factory.h" | 74 #include "chrome/browser/themes/theme_service_factory.h" |
| 74 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" | 75 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
| 75 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 76 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 76 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 77 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 77 #include "chrome/browser/ui/browser_dialogs.h" | 78 #include "chrome/browser/ui/browser_dialogs.h" |
| 78 #include "chrome/browser/ui/browser_list.h" | 79 #include "chrome/browser/ui/browser_list.h" |
| 79 #include "chrome/browser/ui/browser_navigator.h" | 80 #include "chrome/browser/ui/browser_navigator.h" |
| 80 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" | 81 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" |
| 81 #include "chrome/browser/ui/browser_window.h" | 82 #include "chrome/browser/ui/browser_window.h" |
| 82 #include "chrome/browser/ui/find_bar/find_bar.h" | 83 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 83 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 84 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 84 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 85 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 85 #include "chrome/browser/ui/omnibox/location_bar.h" | 86 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 86 #include "chrome/browser/ui/panels/panel.h" | 87 #include "chrome/browser/ui/panels/panel.h" |
| 87 #include "chrome/browser/ui/panels/panel_manager.h" | 88 #include "chrome/browser/ui/panels/panel_manager.h" |
| 88 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | 89 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
| 89 #include "chrome/browser/ui/status_bubble.h" | 90 #include "chrome/browser/ui/status_bubble.h" |
| 90 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 91 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 91 #include "chrome/browser/ui/tabs/dock_info.h" | 92 #include "chrome/browser/ui/tabs/dock_info.h" |
| 92 #include "chrome/browser/ui/tabs/tab_menu_model.h" | 93 #include "chrome/browser/ui/tabs/tab_menu_model.h" |
| 93 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 94 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
| 94 #include "chrome/browser/ui/webui/bug_report_ui.h" | 95 #include "chrome/browser/ui/webui/bug_report_ui.h" |
| 96 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" | |
|
Charlie Reis
2011/07/19 21:38:28
Is this needed?
| |
| 95 #include "chrome/browser/ui/webui/options/content_settings_handler.h" | 97 #include "chrome/browser/ui/webui/options/content_settings_handler.h" |
| 96 #include "chrome/browser/ui/window_sizer.h" | 98 #include "chrome/browser/ui/window_sizer.h" |
| 97 #include "chrome/browser/upgrade_detector.h" | 99 #include "chrome/browser/upgrade_detector.h" |
| 98 #include "chrome/browser/web_applications/web_app.h" | 100 #include "chrome/browser/web_applications/web_app.h" |
| 99 #include "chrome/common/chrome_constants.h" | 101 #include "chrome/common/chrome_constants.h" |
| 100 #include "chrome/common/chrome_notification_types.h" | 102 #include "chrome/common/chrome_notification_types.h" |
| 101 #include "chrome/common/chrome_switches.h" | 103 #include "chrome/common/chrome_switches.h" |
| 102 #include "chrome/common/extensions/extension.h" | 104 #include "chrome/common/extensions/extension.h" |
| 103 #include "chrome/common/extensions/extension_constants.h" | 105 #include "chrome/common/extensions/extension_constants.h" |
| 104 #include "chrome/common/pref_names.h" | 106 #include "chrome/common/pref_names.h" |
| (...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1145 | 1147 |
| 1146 TabContents* Browser::AddRestoredTab( | 1148 TabContents* Browser::AddRestoredTab( |
| 1147 const std::vector<TabNavigation>& navigations, | 1149 const std::vector<TabNavigation>& navigations, |
| 1148 int tab_index, | 1150 int tab_index, |
| 1149 int selected_navigation, | 1151 int selected_navigation, |
| 1150 const std::string& extension_app_id, | 1152 const std::string& extension_app_id, |
| 1151 bool select, | 1153 bool select, |
| 1152 bool pin, | 1154 bool pin, |
| 1153 bool from_last_session, | 1155 bool from_last_session, |
| 1154 SessionStorageNamespace* session_storage_namespace) { | 1156 SessionStorageNamespace* session_storage_namespace) { |
| 1155 TabContentsWrapper* wrapper = TabContentsFactory(profile(), NULL, | 1157 GURL restore_url = navigations.at(selected_navigation).virtual_url(); |
|
Charlie Reis
2011/07/19 21:38:28
Sanity check: do we know this index is safe?
| |
| 1158 TabContentsWrapper* wrapper = TabContentsFactory( | |
| 1159 profile(), | |
| 1160 tab_util::GetSiteInstance(NULL, profile_, restore_url), | |
| 1156 MSG_ROUTING_NONE, | 1161 MSG_ROUTING_NONE, |
| 1157 GetSelectedTabContents(), | 1162 GetSelectedTabContents(), |
| 1158 session_storage_namespace); | 1163 session_storage_namespace); |
| 1159 TabContents* new_tab = wrapper->tab_contents(); | 1164 TabContents* new_tab = wrapper->tab_contents(); |
| 1160 wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); | 1165 wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); |
| 1161 std::vector<NavigationEntry*> entries; | 1166 std::vector<NavigationEntry*> entries; |
| 1162 TabNavigation::CreateNavigationEntriesFromTabNavigations( | 1167 TabNavigation::CreateNavigationEntriesFromTabNavigations( |
| 1163 profile_, navigations, &entries); | 1168 profile_, navigations, &entries); |
| 1164 new_tab->controller().Restore( | 1169 new_tab->controller().Restore( |
| 1165 selected_navigation, from_last_session, &entries); | 1170 selected_navigation, from_last_session, &entries); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 1191 session_service->TabRestored(wrapper, pin); | 1196 session_service->TabRestored(wrapper, pin); |
| 1192 return new_tab; | 1197 return new_tab; |
| 1193 } | 1198 } |
| 1194 | 1199 |
| 1195 void Browser::ReplaceRestoredTab( | 1200 void Browser::ReplaceRestoredTab( |
| 1196 const std::vector<TabNavigation>& navigations, | 1201 const std::vector<TabNavigation>& navigations, |
| 1197 int selected_navigation, | 1202 int selected_navigation, |
| 1198 bool from_last_session, | 1203 bool from_last_session, |
| 1199 const std::string& extension_app_id, | 1204 const std::string& extension_app_id, |
| 1200 SessionStorageNamespace* session_storage_namespace) { | 1205 SessionStorageNamespace* session_storage_namespace) { |
| 1201 TabContentsWrapper* wrapper = TabContentsFactory(profile(), NULL, | 1206 GURL restore_url = navigations.at(selected_navigation).virtual_url(); |
|
Charlie Reis
2011/07/19 21:38:28
Ditto.
| |
| 1207 TabContentsWrapper* wrapper = TabContentsFactory( | |
| 1208 profile(), | |
| 1209 tab_util::GetSiteInstance(NULL, profile_, restore_url), | |
| 1202 MSG_ROUTING_NONE, | 1210 MSG_ROUTING_NONE, |
| 1203 GetSelectedTabContents(), | 1211 GetSelectedTabContents(), |
| 1204 session_storage_namespace); | 1212 session_storage_namespace); |
| 1205 wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); | 1213 wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); |
| 1206 TabContents* replacement = wrapper->tab_contents(); | 1214 TabContents* replacement = wrapper->tab_contents(); |
| 1207 std::vector<NavigationEntry*> entries; | 1215 std::vector<NavigationEntry*> entries; |
| 1208 TabNavigation::CreateNavigationEntriesFromTabNavigations( | 1216 TabNavigation::CreateNavigationEntriesFromTabNavigations( |
| 1209 profile_, navigations, &entries); | 1217 profile_, navigations, &entries); |
| 1210 replacement->controller().Restore( | 1218 replacement->controller().Restore( |
| 1211 selected_navigation, from_last_session, &entries); | 1219 selected_navigation, from_last_session, &entries); |
| (...skipping 3570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4782 window_->BookmarkBarStateChanged(animate_type); | 4790 window_->BookmarkBarStateChanged(animate_type); |
| 4783 } | 4791 } |
| 4784 | 4792 |
| 4785 void Browser::ShowSyncSetup() { | 4793 void Browser::ShowSyncSetup() { |
| 4786 ProfileSyncService* service = profile()->GetProfileSyncService(); | 4794 ProfileSyncService* service = profile()->GetProfileSyncService(); |
| 4787 if (service->HasSyncSetupCompleted()) | 4795 if (service->HasSyncSetupCompleted()) |
| 4788 ShowOptionsTab(chrome::kSyncSetupSubPage); | 4796 ShowOptionsTab(chrome::kSyncSetupSubPage); |
| 4789 else | 4797 else |
| 4790 profile()->GetProfileSyncService()->ShowLoginDialog(); | 4798 profile()->GetProfileSyncService()->ShowLoginDialog(); |
| 4791 } | 4799 } |
| OLD | NEW |