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