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 2850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2861 | 2861 |
2862 void Browser::TabDeselected(TabContentsWrapper* contents) { | 2862 void Browser::TabDeselected(TabContentsWrapper* contents) { |
2863 if (instant()) | 2863 if (instant()) |
2864 instant()->DestroyPreviewContents(); | 2864 instant()->DestroyPreviewContents(); |
2865 | 2865 |
2866 // Save what the user's currently typing, so it can be restored when we | 2866 // Save what the user's currently typing, so it can be restored when we |
2867 // switch back to this tab. | 2867 // switch back to this tab. |
2868 window_->GetLocationBar()->SaveStateToContents(contents->tab_contents()); | 2868 window_->GetLocationBar()->SaveStateToContents(contents->tab_contents()); |
2869 } | 2869 } |
2870 | 2870 |
2871 void Browser::TabSelectedAt(TabContentsWrapper* old_contents, | 2871 void Browser::TabActivatedAt(TabContentsWrapper* old_contents, |
2872 TabContentsWrapper* new_contents, | 2872 TabContentsWrapper* new_contents, |
2873 int index, | 2873 int index, |
2874 bool user_gesture) { | 2874 bool user_gesture) { |
2875 if (old_contents == new_contents) | 2875 if (old_contents == new_contents) |
2876 return; | 2876 return; |
2877 | 2877 |
2878 // On some platforms we want to automatically reload tabs that are | 2878 // On some platforms we want to automatically reload tabs that are |
2879 // killed when the user selects them. | 2879 // killed when the user selects them. |
2880 if (user_gesture && new_contents->tab_contents()->crashed_status() == | 2880 if (user_gesture && new_contents->tab_contents()->crashed_status() == |
2881 base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { | 2881 base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { |
2882 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 2882 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
2883 if (parsed_command_line.HasSwitch(switches::kReloadKilledTabs)) { | 2883 if (parsed_command_line.HasSwitch(switches::kReloadKilledTabs)) { |
2884 Reload(CURRENT_TAB); | 2884 Reload(CURRENT_TAB); |
(...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4619 TabContents* current_tab = GetSelectedTabContents(); | 4619 TabContents* current_tab = GetSelectedTabContents(); |
4620 if (current_tab) { | 4620 if (current_tab) { |
4621 content_restrictions = current_tab->content_restrictions(); | 4621 content_restrictions = current_tab->content_restrictions(); |
4622 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); | 4622 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); |
4623 // See comment in UpdateCommandsForTabState about why we call url(). | 4623 // See comment in UpdateCommandsForTabState about why we call url(). |
4624 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) | 4624 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) |
4625 content_restrictions |= CONTENT_RESTRICTION_SAVE; | 4625 content_restrictions |= CONTENT_RESTRICTION_SAVE; |
4626 } | 4626 } |
4627 return content_restrictions; | 4627 return content_restrictions; |
4628 } | 4628 } |
OLD | NEW |