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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/idle_timer.h" | 8 #include "base/idle_timer.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 WebContents* web_contents = current_tab->AsWebContents(); | 683 WebContents* web_contents = current_tab->AsWebContents(); |
684 if (web_contents && web_contents->showing_interstitial_page()) { | 684 if (web_contents && web_contents->showing_interstitial_page()) { |
685 NavigationEntry* entry = current_tab->controller().GetActiveEntry(); | 685 NavigationEntry* entry = current_tab->controller().GetActiveEntry(); |
686 DCHECK(entry); // Should exist if interstitial is showing. | 686 DCHECK(entry); // Should exist if interstitial is showing. |
687 OpenURL(entry->url(), GURL(), CURRENT_TAB, PageTransition::RELOAD); | 687 OpenURL(entry->url(), GURL(), CURRENT_TAB, PageTransition::RELOAD); |
688 return; | 688 return; |
689 } | 689 } |
690 } | 690 } |
691 | 691 |
692 if (current_tab) { | 692 if (current_tab) { |
| 693 // Forcibly reset the location bar, since otherwise it won't discard any |
| 694 // ongoing user edits, since it doesn't realize this is a user-initiated |
| 695 // action. |
| 696 window_->GetLocationBar()->Revert(); |
693 // As this is caused by a user action, give the focus to the page. | 697 // As this is caused by a user action, give the focus to the page. |
694 current_tab->Focus(); | 698 current_tab->Focus(); |
695 current_tab->controller().Reload(true); | 699 current_tab->controller().Reload(true); |
696 } | 700 } |
697 } | 701 } |
698 | 702 |
699 void Browser::Home(WindowOpenDisposition disposition) { | 703 void Browser::Home(WindowOpenDisposition disposition) { |
700 UserMetrics::RecordAction(L"Home", profile_); | 704 UserMetrics::RecordAction(L"Home", profile_); |
701 OpenURL(GetHomePage(), GURL(), disposition, PageTransition::AUTO_BOOKMARK); | 705 OpenURL(GetHomePage(), GURL(), disposition, PageTransition::AUTO_BOOKMARK); |
702 } | 706 } |
(...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2653 | 2657 |
2654 // We need to register the window position pref. | 2658 // We need to register the window position pref. |
2655 std::wstring window_pref(prefs::kBrowserWindowPlacement); | 2659 std::wstring window_pref(prefs::kBrowserWindowPlacement); |
2656 window_pref.append(L"_"); | 2660 window_pref.append(L"_"); |
2657 window_pref.append(app_name); | 2661 window_pref.append(app_name); |
2658 PrefService* prefs = g_browser_process->local_state(); | 2662 PrefService* prefs = g_browser_process->local_state(); |
2659 DCHECK(prefs); | 2663 DCHECK(prefs); |
2660 | 2664 |
2661 prefs->RegisterDictionaryPref(window_pref.c_str()); | 2665 prefs->RegisterDictionaryPref(window_pref.c_str()); |
2662 } | 2666 } |
OLD | NEW |