OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/browser.h" | 5 #include "chrome/browser/browser.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/idle_timer.h" | 9 #include "base/idle_timer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1576 NotificationService::current()->Notify( | 1576 NotificationService::current()->Notify( |
1577 NotificationType::TAB_CLOSING, | 1577 NotificationType::TAB_CLOSING, |
1578 Source<NavigationController>(&contents->controller()), | 1578 Source<NavigationController>(&contents->controller()), |
1579 NotificationService::NoDetails()); | 1579 NotificationService::NoDetails()); |
1580 | 1580 |
1581 // Sever the TabContents' connection back to us. | 1581 // Sever the TabContents' connection back to us. |
1582 contents->set_delegate(NULL); | 1582 contents->set_delegate(NULL); |
1583 } | 1583 } |
1584 | 1584 |
1585 void Browser::TabDetachedAt(TabContents* contents, int index) { | 1585 void Browser::TabDetachedAt(TabContents* contents, int index) { |
| 1586 // Save what the user's currently typing. |
| 1587 window_->GetLocationBar()->SaveStateToContents(contents); |
| 1588 |
1586 contents->set_delegate(NULL); | 1589 contents->set_delegate(NULL); |
1587 if (!tabstrip_model_.closing_all()) | 1590 if (!tabstrip_model_.closing_all()) |
1588 SyncHistoryWithTabs(0); | 1591 SyncHistoryWithTabs(0); |
1589 | 1592 |
1590 RemoveScheduledUpdatesFor(contents); | 1593 RemoveScheduledUpdatesFor(contents); |
1591 | 1594 |
1592 if (find_bar_controller_.get() && index == tabstrip_model_.selected_index()) | 1595 if (find_bar_controller_.get() && index == tabstrip_model_.selected_index()) |
1593 find_bar_controller_->ChangeTabContents(NULL); | 1596 find_bar_controller_->ChangeTabContents(NULL); |
1594 | 1597 |
1595 NotificationService::current()->RemoveObserver( | 1598 NotificationService::current()->RemoveObserver( |
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2639 | 2642 |
2640 // We need to register the window position pref. | 2643 // We need to register the window position pref. |
2641 std::wstring window_pref(prefs::kBrowserWindowPlacement); | 2644 std::wstring window_pref(prefs::kBrowserWindowPlacement); |
2642 window_pref.append(L"_"); | 2645 window_pref.append(L"_"); |
2643 window_pref.append(app_name); | 2646 window_pref.append(app_name); |
2644 PrefService* prefs = g_browser_process->local_state(); | 2647 PrefService* prefs = g_browser_process->local_state(); |
2645 DCHECK(prefs); | 2648 DCHECK(prefs); |
2646 | 2649 |
2647 prefs->RegisterDictionaryPref(window_pref.c_str()); | 2650 prefs->RegisterDictionaryPref(window_pref.c_str()); |
2648 } | 2651 } |
OLD | NEW |