| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser.h" | 5 #include "chrome/browser/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 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 ToolbarSizeChanged(NULL, is_animating); | 955 ToolbarSizeChanged(NULL, is_animating); |
| 956 } | 956 } |
| 957 | 957 |
| 958 TabContents* Browser::AddRestoredTab( | 958 TabContents* Browser::AddRestoredTab( |
| 959 const std::vector<TabNavigation>& navigations, | 959 const std::vector<TabNavigation>& navigations, |
| 960 int tab_index, | 960 int tab_index, |
| 961 int selected_navigation, | 961 int selected_navigation, |
| 962 const std::string& extension_app_id, | 962 const std::string& extension_app_id, |
| 963 bool select, | 963 bool select, |
| 964 bool pin, | 964 bool pin, |
| 965 bool from_last_session) { | 965 bool from_last_session, |
| 966 TabContents* new_tab = new TabContents(profile(), NULL, | 966 SessionStorageNamespace* session_storage_namespace) { |
| 967 MSG_ROUTING_NONE, tabstrip_model_.GetSelectedTabContents()); | 967 TabContents* new_tab = new TabContents( |
| 968 profile(), NULL, MSG_ROUTING_NONE, |
| 969 tabstrip_model_.GetSelectedTabContents(), session_storage_namespace); |
| 968 new_tab->SetExtensionAppById(extension_app_id); | 970 new_tab->SetExtensionAppById(extension_app_id); |
| 969 new_tab->controller().RestoreFromState(navigations, selected_navigation, | 971 new_tab->controller().RestoreFromState(navigations, selected_navigation, |
| 970 from_last_session); | 972 from_last_session); |
| 971 | 973 |
| 972 bool really_pin = | 974 bool really_pin = |
| 973 (pin && tab_index == tabstrip_model()->IndexOfFirstNonMiniTab()); | 975 (pin && tab_index == tabstrip_model()->IndexOfFirstNonMiniTab()); |
| 974 tabstrip_model_.InsertTabContentsAt( | 976 tabstrip_model_.InsertTabContentsAt( |
| 975 tab_index, new_tab, | 977 tab_index, new_tab, |
| 976 select ? TabStripModel::ADD_SELECTED : TabStripModel::ADD_NONE); | 978 select ? TabStripModel::ADD_SELECTED : TabStripModel::ADD_NONE); |
| 977 if (really_pin) | 979 if (really_pin) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 993 if (session_service) | 995 if (session_service) |
| 994 session_service->TabRestored(&new_tab->controller(), really_pin); | 996 session_service->TabRestored(&new_tab->controller(), really_pin); |
| 995 } | 997 } |
| 996 return new_tab; | 998 return new_tab; |
| 997 } | 999 } |
| 998 | 1000 |
| 999 void Browser::ReplaceRestoredTab( | 1001 void Browser::ReplaceRestoredTab( |
| 1000 const std::vector<TabNavigation>& navigations, | 1002 const std::vector<TabNavigation>& navigations, |
| 1001 int selected_navigation, | 1003 int selected_navigation, |
| 1002 bool from_last_session, | 1004 bool from_last_session, |
| 1003 const std::string& extension_app_id) { | 1005 const std::string& extension_app_id, |
| 1006 SessionStorageNamespace* session_storage_namespace) { |
| 1004 TabContents* replacement = new TabContents(profile(), NULL, | 1007 TabContents* replacement = new TabContents(profile(), NULL, |
| 1005 MSG_ROUTING_NONE, tabstrip_model_.GetSelectedTabContents()); | 1008 MSG_ROUTING_NONE, tabstrip_model_.GetSelectedTabContents(), |
| 1009 session_storage_namespace); |
| 1006 replacement->SetExtensionAppById(extension_app_id); | 1010 replacement->SetExtensionAppById(extension_app_id); |
| 1007 replacement->controller().RestoreFromState(navigations, selected_navigation, | 1011 replacement->controller().RestoreFromState(navigations, selected_navigation, |
| 1008 from_last_session); | 1012 from_last_session); |
| 1009 | 1013 |
| 1010 tabstrip_model_.ReplaceNavigationControllerAt( | 1014 tabstrip_model_.ReplaceNavigationControllerAt( |
| 1011 tabstrip_model_.selected_index(), | 1015 tabstrip_model_.selected_index(), |
| 1012 &replacement->controller()); | 1016 &replacement->controller()); |
| 1013 } | 1017 } |
| 1014 | 1018 |
| 1015 bool Browser::CanRestoreTab() { | 1019 bool Browser::CanRestoreTab() { |
| (...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2267 | 2271 |
| 2268 int Browser::GetDragActions() const { | 2272 int Browser::GetDragActions() const { |
| 2269 return TAB_TEAROFF_ACTION | (tab_count() > 1 ? TAB_MOVE_ACTION : 0); | 2273 return TAB_TEAROFF_ACTION | (tab_count() > 1 ? TAB_MOVE_ACTION : 0); |
| 2270 } | 2274 } |
| 2271 | 2275 |
| 2272 TabContents* Browser::CreateTabContentsForURL( | 2276 TabContents* Browser::CreateTabContentsForURL( |
| 2273 const GURL& url, const GURL& referrer, Profile* profile, | 2277 const GURL& url, const GURL& referrer, Profile* profile, |
| 2274 PageTransition::Type transition, bool defer_load, | 2278 PageTransition::Type transition, bool defer_load, |
| 2275 SiteInstance* instance) const { | 2279 SiteInstance* instance) const { |
| 2276 TabContents* contents = new TabContents(profile, instance, | 2280 TabContents* contents = new TabContents(profile, instance, |
| 2277 MSG_ROUTING_NONE, tabstrip_model_.GetSelectedTabContents()); | 2281 MSG_ROUTING_NONE, tabstrip_model_.GetSelectedTabContents(), NULL); |
| 2278 | 2282 |
| 2279 if (!defer_load) { | 2283 if (!defer_load) { |
| 2280 // Load the initial URL before adding the new tab contents to the tab strip | 2284 // Load the initial URL before adding the new tab contents to the tab strip |
| 2281 // so that the tab contents has navigation state. | 2285 // so that the tab contents has navigation state. |
| 2282 contents->controller().LoadURL(url, referrer, transition); | 2286 contents->controller().LoadURL(url, referrer, transition); |
| 2283 } | 2287 } |
| 2284 | 2288 |
| 2285 return contents; | 2289 return contents; |
| 2286 } | 2290 } |
| 2287 | 2291 |
| (...skipping 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4016 } | 4020 } |
| 4017 | 4021 |
| 4018 void Browser::TabRestoreServiceDestroyed(TabRestoreService* service) { | 4022 void Browser::TabRestoreServiceDestroyed(TabRestoreService* service) { |
| 4019 if (!tab_restore_service_) | 4023 if (!tab_restore_service_) |
| 4020 return; | 4024 return; |
| 4021 | 4025 |
| 4022 DCHECK_EQ(tab_restore_service_, service); | 4026 DCHECK_EQ(tab_restore_service_, service); |
| 4023 tab_restore_service_->RemoveObserver(this); | 4027 tab_restore_service_->RemoveObserver(this); |
| 4024 tab_restore_service_ = NULL; | 4028 tab_restore_service_ = NULL; |
| 4025 } | 4029 } |
| OLD | NEW |