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