OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 3520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3531 // switch back to this tab. | 3531 // switch back to this tab. |
3532 window_->GetLocationBar()->SaveStateToContents(contents->web_contents()); | 3532 window_->GetLocationBar()->SaveStateToContents(contents->web_contents()); |
3533 } | 3533 } |
3534 | 3534 |
3535 void Browser::ActiveTabChanged(TabContentsWrapper* old_contents, | 3535 void Browser::ActiveTabChanged(TabContentsWrapper* old_contents, |
3536 TabContentsWrapper* new_contents, | 3536 TabContentsWrapper* new_contents, |
3537 int index, | 3537 int index, |
3538 bool user_gesture) { | 3538 bool user_gesture) { |
3539 // On some platforms we want to automatically reload tabs that are | 3539 // On some platforms we want to automatically reload tabs that are |
3540 // killed when the user selects them. | 3540 // killed when the user selects them. |
| 3541 bool did_reload = false; |
3541 if (user_gesture && new_contents->web_contents()->GetCrashedStatus() == | 3542 if (user_gesture && new_contents->web_contents()->GetCrashedStatus() == |
3542 base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { | 3543 base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { |
3543 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 3544 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
3544 if (parsed_command_line.HasSwitch(switches::kReloadKilledTabs)) { | 3545 if (parsed_command_line.HasSwitch(switches::kReloadKilledTabs)) { |
3545 // Log to track down crash crbug.com/119068 | 3546 // Log to track down crash crbug.com/119068 |
3546 LOG(WARNING) << "Reloading killed tab at " << index; | 3547 LOG(WARNING) << "Reloading killed tab at " << index; |
3547 Reload(CURRENT_TAB); | 3548 Reload(CURRENT_TAB); |
3548 return; | 3549 did_reload = true; |
3549 } | 3550 } |
3550 } | 3551 } |
3551 | 3552 |
3552 // Discarded tabs always get reloaded. | 3553 // Discarded tabs always get reloaded. |
3553 if (IsTabDiscarded(index)) { | 3554 if (!did_reload && IsTabDiscarded(index)) { |
3554 // Log to track down crash crbug.com/119068 | 3555 // Log to track down crash crbug.com/119068 |
3555 LOG(WARNING) << "Reloading discarded tab at " << index | 3556 LOG(WARNING) << "Reloading discarded tab at " << index |
3556 << " gesture " << user_gesture; | 3557 << " gesture " << user_gesture; |
3557 Reload(CURRENT_TAB); | 3558 Reload(CURRENT_TAB); |
3558 return; | |
3559 } | 3559 } |
3560 | 3560 |
3561 // If we have any update pending, do it now. | 3561 // If we have any update pending, do it now. |
3562 if (chrome_updater_factory_.HasWeakPtrs() && old_contents) | 3562 if (chrome_updater_factory_.HasWeakPtrs() && old_contents) |
3563 ProcessPendingUIUpdates(); | 3563 ProcessPendingUIUpdates(); |
3564 | 3564 |
3565 // Propagate the profile to the location bar. | 3565 // Propagate the profile to the location bar. |
3566 UpdateToolbar(true); | 3566 UpdateToolbar(true); |
3567 | 3567 |
3568 // Update reload/stop state. | 3568 // Update reload/stop state. |
(...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5690 ShowSingletonTabOverwritingNTP(params); | 5690 ShowSingletonTabOverwritingNTP(params); |
5691 } else { | 5691 } else { |
5692 LoginUIServiceFactory::GetForProfile( | 5692 LoginUIServiceFactory::GetForProfile( |
5693 profile()->GetOriginalProfile())->ShowLoginUI(false); | 5693 profile()->GetOriginalProfile())->ShowLoginUI(false); |
5694 } | 5694 } |
5695 } | 5695 } |
5696 | 5696 |
5697 void Browser::ToggleSpeechInput() { | 5697 void Browser::ToggleSpeechInput() { |
5698 GetSelectedWebContents()->GetRenderViewHost()->ToggleSpeechInput(); | 5698 GetSelectedWebContents()->GetRenderViewHost()->ToggleSpeechInput(); |
5699 } | 5699 } |
OLD | NEW |