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 2889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2900 | 2900 |
2901 // Save what the user's currently typing, so it can be restored when we | 2901 // Save what the user's currently typing, so it can be restored when we |
2902 // switch back to this tab. | 2902 // switch back to this tab. |
2903 window_->GetLocationBar()->SaveStateToContents(contents->tab_contents()); | 2903 window_->GetLocationBar()->SaveStateToContents(contents->tab_contents()); |
2904 } | 2904 } |
2905 | 2905 |
2906 void Browser::ActiveTabChanged(TabContentsWrapper* old_contents, | 2906 void Browser::ActiveTabChanged(TabContentsWrapper* old_contents, |
2907 TabContentsWrapper* new_contents, | 2907 TabContentsWrapper* new_contents, |
2908 int index, | 2908 int index, |
2909 bool user_gesture) { | 2909 bool user_gesture) { |
2910 if (old_contents == new_contents) | |
2911 return; | |
2912 | |
2913 // On some platforms we want to automatically reload tabs that are | 2910 // On some platforms we want to automatically reload tabs that are |
2914 // killed when the user selects them. | 2911 // killed when the user selects them. |
2915 if (user_gesture && new_contents->tab_contents()->crashed_status() == | 2912 if (user_gesture && new_contents->tab_contents()->crashed_status() == |
2916 base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { | 2913 base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { |
2917 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 2914 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
2918 if (parsed_command_line.HasSwitch(switches::kReloadKilledTabs)) { | 2915 if (parsed_command_line.HasSwitch(switches::kReloadKilledTabs)) { |
2919 Reload(CURRENT_TAB); | 2916 Reload(CURRENT_TAB); |
2920 return; | 2917 return; |
2921 } | 2918 } |
2922 } | 2919 } |
(...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4696 TabContents* current_tab = GetSelectedTabContents(); | 4693 TabContents* current_tab = GetSelectedTabContents(); |
4697 if (current_tab) { | 4694 if (current_tab) { |
4698 content_restrictions = current_tab->content_restrictions(); | 4695 content_restrictions = current_tab->content_restrictions(); |
4699 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); | 4696 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); |
4700 // See comment in UpdateCommandsForTabState about why we call url(). | 4697 // See comment in UpdateCommandsForTabState about why we call url(). |
4701 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) | 4698 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) |
4702 content_restrictions |= CONTENT_RESTRICTION_SAVE; | 4699 content_restrictions |= CONTENT_RESTRICTION_SAVE; |
4703 } | 4700 } |
4704 return content_restrictions; | 4701 return content_restrictions; |
4705 } | 4702 } |
OLD | NEW |