| 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 <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "chrome/browser/download/download_manager.h" | 40 #include "chrome/browser/download/download_manager.h" |
| 41 #include "chrome/browser/download/download_shelf.h" | 41 #include "chrome/browser/download/download_shelf.h" |
| 42 #include "chrome/browser/download/download_started_animation.h" | 42 #include "chrome/browser/download/download_started_animation.h" |
| 43 #include "chrome/browser/extensions/crashed_extension_infobar.h" | 43 #include "chrome/browser/extensions/crashed_extension_infobar.h" |
| 44 #include "chrome/browser/extensions/crx_installer.h" | 44 #include "chrome/browser/extensions/crx_installer.h" |
| 45 #include "chrome/browser/extensions/extension_browser_event_router.h" | 45 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 46 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" | 46 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" |
| 47 #include "chrome/browser/extensions/extension_host.h" | 47 #include "chrome/browser/extensions/extension_host.h" |
| 48 #include "chrome/browser/extensions/extension_prefs.h" | 48 #include "chrome/browser/extensions/extension_prefs.h" |
| 49 #include "chrome/browser/extensions/extension_service.h" | 49 #include "chrome/browser/extensions/extension_service.h" |
| 50 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 50 #include "chrome/browser/extensions/extension_tabs_module.h" | 51 #include "chrome/browser/extensions/extension_tabs_module.h" |
| 51 #include "chrome/browser/first_run/first_run.h" | 52 #include "chrome/browser/first_run/first_run.h" |
| 52 #include "chrome/browser/google/google_url_tracker.h" | 53 #include "chrome/browser/google/google_url_tracker.h" |
| 53 #include "chrome/browser/google/google_util.h" | 54 #include "chrome/browser/google/google_util.h" |
| 54 #include "chrome/browser/instant/instant_controller.h" | 55 #include "chrome/browser/instant/instant_controller.h" |
| 55 #include "chrome/browser/instant/instant_unload_handler.h" | 56 #include "chrome/browser/instant/instant_unload_handler.h" |
| 56 #include "chrome/browser/metrics/user_metrics.h" | 57 #include "chrome/browser/metrics/user_metrics.h" |
| 57 #include "chrome/browser/net/browser_url_util.h" | 58 #include "chrome/browser/net/browser_url_util.h" |
| 58 #include "chrome/browser/net/url_fixer_upper.h" | 59 #include "chrome/browser/net/url_fixer_upper.h" |
| 59 #include "chrome/browser/platform_util.h" | 60 #include "chrome/browser/platform_util.h" |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 const std::string& extension_app_id, | 1046 const std::string& extension_app_id, |
| 1046 bool select, | 1047 bool select, |
| 1047 bool pin, | 1048 bool pin, |
| 1048 bool from_last_session, | 1049 bool from_last_session, |
| 1049 SessionStorageNamespace* session_storage_namespace) { | 1050 SessionStorageNamespace* session_storage_namespace) { |
| 1050 TabContentsWrapper* wrapper = TabContentsFactory(profile(), NULL, | 1051 TabContentsWrapper* wrapper = TabContentsFactory(profile(), NULL, |
| 1051 MSG_ROUTING_NONE, | 1052 MSG_ROUTING_NONE, |
| 1052 GetSelectedTabContents(), | 1053 GetSelectedTabContents(), |
| 1053 session_storage_namespace); | 1054 session_storage_namespace); |
| 1054 TabContents* new_tab = wrapper->tab_contents(); | 1055 TabContents* new_tab = wrapper->tab_contents(); |
| 1055 new_tab->SetExtensionAppById(extension_app_id); | 1056 wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); |
| 1056 new_tab->controller().RestoreFromState(navigations, selected_navigation, | 1057 new_tab->controller().RestoreFromState(navigations, selected_navigation, |
| 1057 from_last_session); | 1058 from_last_session); |
| 1058 | 1059 |
| 1059 int add_types = select ? TabStripModel::ADD_SELECTED : | 1060 int add_types = select ? TabStripModel::ADD_SELECTED : |
| 1060 TabStripModel::ADD_NONE; | 1061 TabStripModel::ADD_NONE; |
| 1061 if (pin) { | 1062 if (pin) { |
| 1062 tab_index = std::min(tab_index, tabstrip_model()->IndexOfFirstNonMiniTab()); | 1063 tab_index = std::min(tab_index, tabstrip_model()->IndexOfFirstNonMiniTab()); |
| 1063 add_types |= TabStripModel::ADD_PINNED; | 1064 add_types |= TabStripModel::ADD_PINNED; |
| 1064 } | 1065 } |
| 1065 tab_handler_->GetTabStripModel()->InsertTabContentsAt(tab_index, wrapper, | 1066 tab_handler_->GetTabStripModel()->InsertTabContentsAt(tab_index, wrapper, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1087 void Browser::ReplaceRestoredTab( | 1088 void Browser::ReplaceRestoredTab( |
| 1088 const std::vector<TabNavigation>& navigations, | 1089 const std::vector<TabNavigation>& navigations, |
| 1089 int selected_navigation, | 1090 int selected_navigation, |
| 1090 bool from_last_session, | 1091 bool from_last_session, |
| 1091 const std::string& extension_app_id, | 1092 const std::string& extension_app_id, |
| 1092 SessionStorageNamespace* session_storage_namespace) { | 1093 SessionStorageNamespace* session_storage_namespace) { |
| 1093 TabContentsWrapper* wrapper = TabContentsFactory(profile(), NULL, | 1094 TabContentsWrapper* wrapper = TabContentsFactory(profile(), NULL, |
| 1094 MSG_ROUTING_NONE, | 1095 MSG_ROUTING_NONE, |
| 1095 GetSelectedTabContents(), | 1096 GetSelectedTabContents(), |
| 1096 session_storage_namespace); | 1097 session_storage_namespace); |
| 1098 wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); |
| 1097 TabContents* replacement = wrapper->tab_contents(); | 1099 TabContents* replacement = wrapper->tab_contents(); |
| 1098 replacement->SetExtensionAppById(extension_app_id); | |
| 1099 replacement->controller().RestoreFromState(navigations, selected_navigation, | 1100 replacement->controller().RestoreFromState(navigations, selected_navigation, |
| 1100 from_last_session); | 1101 from_last_session); |
| 1101 | 1102 |
| 1102 tab_handler_->GetTabStripModel()->ReplaceNavigationControllerAt( | 1103 tab_handler_->GetTabStripModel()->ReplaceNavigationControllerAt( |
| 1103 tab_handler_->GetTabStripModel()->selected_index(), | 1104 tab_handler_->GetTabStripModel()->selected_index(), |
| 1104 wrapper); | 1105 wrapper); |
| 1105 } | 1106 } |
| 1106 | 1107 |
| 1107 bool Browser::CanRestoreTab() { | 1108 bool Browser::CanRestoreTab() { |
| 1108 return command_updater_.IsCommandEnabled(IDC_RESTORE_TAB); | 1109 return command_updater_.IsCommandEnabled(IDC_RESTORE_TAB); |
| (...skipping 3325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4434 // The page transition below is only for the purpose of inserting the tab. | 4435 // The page transition below is only for the purpose of inserting the tab. |
| 4435 browser->AddTab(view_source_contents, PageTransition::LINK); | 4436 browser->AddTab(view_source_contents, PageTransition::LINK); |
| 4436 } | 4437 } |
| 4437 | 4438 |
| 4438 if (profile_->HasSessionService()) { | 4439 if (profile_->HasSessionService()) { |
| 4439 SessionService* session_service = profile_->GetSessionService(); | 4440 SessionService* session_service = profile_->GetSessionService(); |
| 4440 if (session_service) | 4441 if (session_service) |
| 4441 session_service->TabRestored(&view_source_contents->controller(), false); | 4442 session_service->TabRestored(&view_source_contents->controller(), false); |
| 4442 } | 4443 } |
| 4443 } | 4444 } |
| OLD | NEW |