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 2892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2903 | 2903 |
2904 // Save what the user's currently typing, so it can be restored when we | 2904 // Save what the user's currently typing, so it can be restored when we |
2905 // switch back to this tab. | 2905 // switch back to this tab. |
2906 window_->GetLocationBar()->SaveStateToContents(contents->tab_contents()); | 2906 window_->GetLocationBar()->SaveStateToContents(contents->tab_contents()); |
2907 } | 2907 } |
2908 | 2908 |
2909 void Browser::ActiveTabChanged(TabContentsWrapper* old_contents, | 2909 void Browser::ActiveTabChanged(TabContentsWrapper* old_contents, |
2910 TabContentsWrapper* new_contents, | 2910 TabContentsWrapper* new_contents, |
2911 int index, | 2911 int index, |
2912 bool user_gesture) { | 2912 bool user_gesture) { |
2913 if (old_contents == new_contents) | |
2914 return; | |
2915 | |
2916 // On some platforms we want to automatically reload tabs that are | 2913 // On some platforms we want to automatically reload tabs that are |
2917 // killed when the user selects them. | 2914 // killed when the user selects them. |
2918 if (user_gesture && new_contents->tab_contents()->crashed_status() == | 2915 if (user_gesture && new_contents->tab_contents()->crashed_status() == |
2919 base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { | 2916 base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { |
2920 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 2917 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
2921 if (parsed_command_line.HasSwitch(switches::kReloadKilledTabs)) { | 2918 if (parsed_command_line.HasSwitch(switches::kReloadKilledTabs)) { |
2922 Reload(CURRENT_TAB); | 2919 Reload(CURRENT_TAB); |
2923 return; | 2920 return; |
2924 } | 2921 } |
2925 } | 2922 } |
(...skipping 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4710 TabContents* current_tab = GetSelectedTabContents(); | 4707 TabContents* current_tab = GetSelectedTabContents(); |
4711 if (current_tab) { | 4708 if (current_tab) { |
4712 content_restrictions = current_tab->content_restrictions(); | 4709 content_restrictions = current_tab->content_restrictions(); |
4713 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); | 4710 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); |
4714 // See comment in UpdateCommandsForTabState about why we call url(). | 4711 // See comment in UpdateCommandsForTabState about why we call url(). |
4715 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) | 4712 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) |
4716 content_restrictions |= CONTENT_RESTRICTION_SAVE; | 4713 content_restrictions |= CONTENT_RESTRICTION_SAVE; |
4717 } | 4714 } |
4718 return content_restrictions; | 4715 return content_restrictions; |
4719 } | 4716 } |
OLD | NEW |