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