| 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/animation.h" | 7 #include "app/animation.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/idle_timer.h" | 10 #include "base/idle_timer.h" |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 // If we are showing an interstitial, treat this as an OpenURL. | 722 // If we are showing an interstitial, treat this as an OpenURL. |
| 723 TabContents* current_tab = GetSelectedTabContents(); | 723 TabContents* current_tab = GetSelectedTabContents(); |
| 724 if (current_tab) { | 724 if (current_tab) { |
| 725 if (current_tab->showing_interstitial_page()) { | 725 if (current_tab->showing_interstitial_page()) { |
| 726 NavigationEntry* entry = current_tab->controller().GetActiveEntry(); | 726 NavigationEntry* entry = current_tab->controller().GetActiveEntry(); |
| 727 DCHECK(entry); // Should exist if interstitial is showing. | 727 DCHECK(entry); // Should exist if interstitial is showing. |
| 728 OpenURL(entry->url(), GURL(), CURRENT_TAB, PageTransition::RELOAD); | 728 OpenURL(entry->url(), GURL(), CURRENT_TAB, PageTransition::RELOAD); |
| 729 return; | 729 return; |
| 730 } | 730 } |
| 731 | 731 |
| 732 // Forcibly reset the location bar, since otherwise it won't discard any | |
| 733 // ongoing user edits, since it doesn't realize this is a user-initiated | |
| 734 // action. | |
| 735 window_->GetLocationBar()->Revert(); | |
| 736 | |
| 737 // As this is caused by a user action, give the focus to the page. | 732 // As this is caused by a user action, give the focus to the page. |
| 738 current_tab->Focus(); | 733 current_tab->Focus(); |
| 739 current_tab->controller().Reload(true); | 734 current_tab->controller().Reload(true); |
| 740 } | 735 } |
| 741 } | 736 } |
| 742 | 737 |
| 743 void Browser::Home(WindowOpenDisposition disposition) { | 738 void Browser::Home(WindowOpenDisposition disposition) { |
| 744 UserMetrics::RecordAction(L"Home", profile_); | 739 UserMetrics::RecordAction(L"Home", profile_); |
| 745 OpenURL(GetHomePage(), GURL(), disposition, PageTransition::AUTO_BOOKMARK); | 740 OpenURL(GetHomePage(), GURL(), disposition, PageTransition::AUTO_BOOKMARK); |
| 746 } | 741 } |
| (...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2764 /////////////////////////////////////////////////////////////////////////////// | 2759 /////////////////////////////////////////////////////////////////////////////// |
| 2765 // BrowserToolbarModel (private): | 2760 // BrowserToolbarModel (private): |
| 2766 | 2761 |
| 2767 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 2762 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
| 2768 // This |current_tab| can be NULL during the initialization of the | 2763 // This |current_tab| can be NULL during the initialization of the |
| 2769 // toolbar during window creation (i.e. before any tabs have been added | 2764 // toolbar during window creation (i.e. before any tabs have been added |
| 2770 // to the window). | 2765 // to the window). |
| 2771 TabContents* current_tab = browser_->GetSelectedTabContents(); | 2766 TabContents* current_tab = browser_->GetSelectedTabContents(); |
| 2772 return current_tab ? ¤t_tab->controller() : NULL; | 2767 return current_tab ? ¤t_tab->controller() : NULL; |
| 2773 } | 2768 } |
| OLD | NEW |