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 2609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2620 // switch back to this tab. | 2620 // switch back to this tab. |
2621 window_->GetLocationBar()->SaveStateToContents(contents->tab_contents()); | 2621 window_->GetLocationBar()->SaveStateToContents(contents->tab_contents()); |
2622 } | 2622 } |
2623 | 2623 |
2624 void Browser::TabSelectedAt(TabContentsWrapper* old_contents, | 2624 void Browser::TabSelectedAt(TabContentsWrapper* old_contents, |
2625 TabContentsWrapper* new_contents, | 2625 TabContentsWrapper* new_contents, |
2626 int index, | 2626 int index, |
2627 bool user_gesture) { | 2627 bool user_gesture) { |
2628 DCHECK(old_contents != new_contents); | 2628 DCHECK(old_contents != new_contents); |
2629 | 2629 |
| 2630 // On some platforms we want to automatically reload tabs that are |
| 2631 // killed when the user selects them. |
| 2632 if (user_gesture && new_contents->tab_contents()->crashed_status() == |
| 2633 base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { |
| 2634 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 2635 if (parsed_command_line.HasSwitch(switches::kReloadKilledTabs)) |
| 2636 Reload(CURRENT_TAB); |
| 2637 return; |
| 2638 } |
| 2639 |
2630 // If we have any update pending, do it now. | 2640 // If we have any update pending, do it now. |
2631 if (!chrome_updater_factory_.empty() && old_contents) | 2641 if (!chrome_updater_factory_.empty() && old_contents) |
2632 ProcessPendingUIUpdates(); | 2642 ProcessPendingUIUpdates(); |
2633 | 2643 |
2634 // Propagate the profile to the location bar. | 2644 // Propagate the profile to the location bar. |
2635 UpdateToolbar(true); | 2645 UpdateToolbar(true); |
2636 | 2646 |
2637 // Update reload/stop state. | 2647 // Update reload/stop state. |
2638 UpdateReloadStopState(new_contents->tab_contents()->is_loading(), true); | 2648 UpdateReloadStopState(new_contents->tab_contents()->is_loading(), true); |
2639 | 2649 |
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4237 // The page transition below is only for the purpose of inserting the tab. | 4247 // The page transition below is only for the purpose of inserting the tab. |
4238 browser->AddTab(view_source_contents, PageTransition::LINK); | 4248 browser->AddTab(view_source_contents, PageTransition::LINK); |
4239 } | 4249 } |
4240 | 4250 |
4241 if (profile_->HasSessionService()) { | 4251 if (profile_->HasSessionService()) { |
4242 SessionService* session_service = profile_->GetSessionService(); | 4252 SessionService* session_service = profile_->GetSessionService(); |
4243 if (session_service) | 4253 if (session_service) |
4244 session_service->TabRestored(&view_source_contents->controller(), false); | 4254 session_service->TabRestored(&view_source_contents->controller(), false); |
4245 } | 4255 } |
4246 } | 4256 } |
OLD | NEW |