| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 #include "chrome/browser/sessions/session_service.h" | 62 #include "chrome/browser/sessions/session_service.h" |
| 63 #include "chrome/browser/sessions/session_service_factory.h" | 63 #include "chrome/browser/sessions/session_service_factory.h" |
| 64 #include "chrome/browser/sessions/session_types.h" | 64 #include "chrome/browser/sessions/session_types.h" |
| 65 #include "chrome/browser/sessions/tab_restore_service.h" | 65 #include "chrome/browser/sessions/tab_restore_service.h" |
| 66 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 66 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 67 #include "chrome/browser/sync/profile_sync_service.h" | 67 #include "chrome/browser/sync/profile_sync_service.h" |
| 68 #include "chrome/browser/sync/sync_ui_util.h" | 68 #include "chrome/browser/sync/sync_ui_util.h" |
| 69 #include "chrome/browser/tab_closeable_state_watcher.h" | 69 #include "chrome/browser/tab_closeable_state_watcher.h" |
| 70 #include "chrome/browser/tab_contents/background_contents.h" | 70 #include "chrome/browser/tab_contents/background_contents.h" |
| 71 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" | 71 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" |
| 72 #include "chrome/browser/tab_contents/tab_util.h" |
| 72 #include "chrome/browser/tabs/tab_finder.h" | 73 #include "chrome/browser/tabs/tab_finder.h" |
| 73 #include "chrome/browser/tabs/tab_strip_model.h" | 74 #include "chrome/browser/tabs/tab_strip_model.h" |
| 74 #include "chrome/browser/themes/theme_service.h" | 75 #include "chrome/browser/themes/theme_service.h" |
| 75 #include "chrome/browser/themes/theme_service_factory.h" | 76 #include "chrome/browser/themes/theme_service_factory.h" |
| 76 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" | 77 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
| 77 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 78 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 78 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 79 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 79 #include "chrome/browser/ui/browser_dialogs.h" | 80 #include "chrome/browser/ui/browser_dialogs.h" |
| 80 #include "chrome/browser/ui/browser_list.h" | 81 #include "chrome/browser/ui/browser_list.h" |
| 81 #include "chrome/browser/ui/browser_navigator.h" | 82 #include "chrome/browser/ui/browser_navigator.h" |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 | 1146 |
| 1146 TabContents* Browser::AddRestoredTab( | 1147 TabContents* Browser::AddRestoredTab( |
| 1147 const std::vector<TabNavigation>& navigations, | 1148 const std::vector<TabNavigation>& navigations, |
| 1148 int tab_index, | 1149 int tab_index, |
| 1149 int selected_navigation, | 1150 int selected_navigation, |
| 1150 const std::string& extension_app_id, | 1151 const std::string& extension_app_id, |
| 1151 bool select, | 1152 bool select, |
| 1152 bool pin, | 1153 bool pin, |
| 1153 bool from_last_session, | 1154 bool from_last_session, |
| 1154 SessionStorageNamespace* session_storage_namespace) { | 1155 SessionStorageNamespace* session_storage_namespace) { |
| 1155 TabContentsWrapper* wrapper = TabContentsFactory(profile(), NULL, | 1156 GURL restore_url = navigations.at(selected_navigation).virtual_url(); |
| 1157 TabContentsWrapper* wrapper = TabContentsFactory( |
| 1158 profile(), |
| 1159 tab_util::GetSiteInstanceForNewTab(NULL, profile_, restore_url), |
| 1156 MSG_ROUTING_NONE, | 1160 MSG_ROUTING_NONE, |
| 1157 GetSelectedTabContents(), | 1161 GetSelectedTabContents(), |
| 1158 session_storage_namespace); | 1162 session_storage_namespace); |
| 1159 TabContents* new_tab = wrapper->tab_contents(); | 1163 TabContents* new_tab = wrapper->tab_contents(); |
| 1160 wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); | 1164 wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); |
| 1161 std::vector<NavigationEntry*> entries; | 1165 std::vector<NavigationEntry*> entries; |
| 1162 TabNavigation::CreateNavigationEntriesFromTabNavigations( | 1166 TabNavigation::CreateNavigationEntriesFromTabNavigations( |
| 1163 profile_, navigations, &entries); | 1167 profile_, navigations, &entries); |
| 1164 new_tab->controller().Restore( | 1168 new_tab->controller().Restore( |
| 1165 selected_navigation, from_last_session, &entries); | 1169 selected_navigation, from_last_session, &entries); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1191 session_service->TabRestored(wrapper, pin); | 1195 session_service->TabRestored(wrapper, pin); |
| 1192 return new_tab; | 1196 return new_tab; |
| 1193 } | 1197 } |
| 1194 | 1198 |
| 1195 void Browser::ReplaceRestoredTab( | 1199 void Browser::ReplaceRestoredTab( |
| 1196 const std::vector<TabNavigation>& navigations, | 1200 const std::vector<TabNavigation>& navigations, |
| 1197 int selected_navigation, | 1201 int selected_navigation, |
| 1198 bool from_last_session, | 1202 bool from_last_session, |
| 1199 const std::string& extension_app_id, | 1203 const std::string& extension_app_id, |
| 1200 SessionStorageNamespace* session_storage_namespace) { | 1204 SessionStorageNamespace* session_storage_namespace) { |
| 1201 TabContentsWrapper* wrapper = TabContentsFactory(profile(), NULL, | 1205 GURL restore_url = navigations.at(selected_navigation).virtual_url(); |
| 1206 TabContentsWrapper* wrapper = TabContentsFactory( |
| 1207 profile(), |
| 1208 tab_util::GetSiteInstanceForNewTab(NULL, profile_, restore_url), |
| 1202 MSG_ROUTING_NONE, | 1209 MSG_ROUTING_NONE, |
| 1203 GetSelectedTabContents(), | 1210 GetSelectedTabContents(), |
| 1204 session_storage_namespace); | 1211 session_storage_namespace); |
| 1205 wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); | 1212 wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); |
| 1206 TabContents* replacement = wrapper->tab_contents(); | 1213 TabContents* replacement = wrapper->tab_contents(); |
| 1207 std::vector<NavigationEntry*> entries; | 1214 std::vector<NavigationEntry*> entries; |
| 1208 TabNavigation::CreateNavigationEntriesFromTabNavigations( | 1215 TabNavigation::CreateNavigationEntriesFromTabNavigations( |
| 1209 profile_, navigations, &entries); | 1216 profile_, navigations, &entries); |
| 1210 replacement->controller().Restore( | 1217 replacement->controller().Restore( |
| 1211 selected_navigation, from_last_session, &entries); | 1218 selected_navigation, from_last_session, &entries); |
| (...skipping 3571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4783 window_->BookmarkBarStateChanged(animate_type); | 4790 window_->BookmarkBarStateChanged(animate_type); |
| 4784 } | 4791 } |
| 4785 | 4792 |
| 4786 void Browser::ShowSyncSetup() { | 4793 void Browser::ShowSyncSetup() { |
| 4787 ProfileSyncService* service = profile()->GetProfileSyncService(); | 4794 ProfileSyncService* service = profile()->GetProfileSyncService(); |
| 4788 if (service->HasSyncSetupCompleted()) | 4795 if (service->HasSyncSetupCompleted()) |
| 4789 ShowOptionsTab(chrome::kSyncSetupSubPage); | 4796 ShowOptionsTab(chrome::kSyncSetupSubPage); |
| 4790 else | 4797 else |
| 4791 profile()->GetProfileSyncService()->ShowLoginDialog(); | 4798 profile()->GetProfileSyncService()->ShowLoginDialog(); |
| 4792 } | 4799 } |
| OLD | NEW |