diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-04 17:10:29 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-04 17:10:29 +0000 |
commit | 0a4a3c159a119fd094c805158eb6a55d2c007601 (patch) | |
tree | b3b026ce0b45fc9babc90ecd232bb7805756e1d5 | |
parent | 20142ba1b6c593896a894699d1971c4271456a20 (diff) | |
download | chromium_src-0a4a3c159a119fd094c805158eb6a55d2c007601.zip chromium_src-0a4a3c159a119fd094c805158eb6a55d2c007601.tar.gz chromium_src-0a4a3c159a119fd094c805158eb6a55d2c007601.tar.bz2 |
Reset the omnibox contents when the user reloads the page. Patch by Yusuke Sato (see http://codereview.chromium.org/100198 ), r=me.
BUG=2985
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15211 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser.cc | 5 | ||||
-rw-r--r-- | chrome/browser/cocoa/location_bar_view_mac.h | 1 | ||||
-rw-r--r-- | chrome/browser/cocoa/location_bar_view_mac.mm | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/location_bar_view_gtk.cc | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/location_bar_view_gtk.h | 1 | ||||
-rw-r--r-- | chrome/browser/location_bar.h | 3 | ||||
-rw-r--r-- | chrome/browser/views/location_bar_view.cc | 5 | ||||
-rw-r--r-- | chrome/browser/views/location_bar_view.h | 1 | ||||
-rw-r--r-- | chrome/test/test_location_bar.h | 1 |
9 files changed, 25 insertions, 0 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 53b5c31..145c600 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -685,6 +685,11 @@ void Browser::Reload() { return; } + // Forcibly reset the location bar, since otherwise it won't discard any + // ongoing user edits, since it doesn't realize this is a user-initiated + // action. + window_->GetLocationBar()->Revert(); + // As this is caused by a user action, give the focus to the page. current_tab->Focus(); current_tab->controller().Reload(true); diff --git a/chrome/browser/cocoa/location_bar_view_mac.h b/chrome/browser/cocoa/location_bar_view_mac.h index 7de0d95..5897a8f 100644 --- a/chrome/browser/cocoa/location_bar_view_mac.h +++ b/chrome/browser/cocoa/location_bar_view_mac.h @@ -41,6 +41,7 @@ class LocationBarViewMac : public AutocompleteEditController, virtual void UpdateFeedIcon() { /* http://crbug.com/8832 */ } virtual void UpdatePageActions() { NOTIMPLEMENTED(); } virtual void SaveStateToContents(TabContents* contents); + virtual void Revert(); virtual void OnAutocompleteAccept(const GURL& url, WindowOpenDisposition disposition, diff --git a/chrome/browser/cocoa/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar_view_mac.mm index d9217ec..b8c521f 100644 --- a/chrome/browser/cocoa/location_bar_view_mac.mm +++ b/chrome/browser/cocoa/location_bar_view_mac.mm @@ -108,3 +108,7 @@ std::wstring LocationBarViewMac::GetTitle() const { NOTIMPLEMENTED(); return std::wstring(); } + +void LocationBarViewMac::Revert() { + NOTIMPLEMENTED(); +} diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc index 7ff72c2..3ca70c4 100644 --- a/chrome/browser/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/gtk/location_bar_view_gtk.cc @@ -197,6 +197,10 @@ void LocationBarViewGtk::SaveStateToContents(TabContents* contents) { NOTIMPLEMENTED(); } +void LocationBarViewGtk::Revert() { + NOTIMPLEMENTED(); +} + gboolean LocationBarViewGtk::HandleExpose(GtkWidget* widget, GdkEventExpose* event) { GdkDrawable* drawable = GDK_DRAWABLE(event->window); diff --git a/chrome/browser/gtk/location_bar_view_gtk.h b/chrome/browser/gtk/location_bar_view_gtk.h index 22a7c9c..af472766 100644 --- a/chrome/browser/gtk/location_bar_view_gtk.h +++ b/chrome/browser/gtk/location_bar_view_gtk.h @@ -72,6 +72,7 @@ class LocationBarViewGtk : public AutocompleteEditController, virtual void UpdateFeedIcon(); virtual void UpdatePageActions(); virtual void SaveStateToContents(TabContents* contents); + virtual void Revert(); // Translation between a security level and the background color. Both the // location bar and edit have to manage and match the background color. diff --git a/chrome/browser/location_bar.h b/chrome/browser/location_bar.h index a1f4898..ccb4781 100644 --- a/chrome/browser/location_bar.h +++ b/chrome/browser/location_bar.h @@ -56,6 +56,9 @@ class LocationBar { // Saves the state of the location bar to the specified TabContents, so that // it can be restored later. (Done when switching tabs). virtual void SaveStateToContents(TabContents* contents) = 0; + + // Reverts the location bar. The bar's permanent text will be shown. + virtual void Revert() = 0; }; #endif // CHROME_BROWSER_LOCATION_BAR_H_ diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc index 62c7a8d..bc286f1 100644 --- a/chrome/browser/views/location_bar_view.cc +++ b/chrome/browser/views/location_bar_view.cc @@ -1281,3 +1281,8 @@ void LocationBarView::FocusSearch() { void LocationBarView::SaveStateToContents(TabContents* contents) { location_entry_->SaveStateToTab(contents); } + +void LocationBarView::Revert() { + location_entry_->RevertAll(); +} + diff --git a/chrome/browser/views/location_bar_view.h b/chrome/browser/views/location_bar_view.h index 58be56d..abc3311 100644 --- a/chrome/browser/views/location_bar_view.h +++ b/chrome/browser/views/location_bar_view.h @@ -129,6 +129,7 @@ class LocationBarView : public LocationBar, virtual void UpdateFeedIcon(); virtual void UpdatePageActions(); virtual void SaveStateToContents(TabContents* contents); + virtual void Revert(); static const int kVertMargin; static const COLORREF kBackgroundColorByLevel[]; diff --git a/chrome/test/test_location_bar.h b/chrome/test/test_location_bar.h index f6e94a3..5fa944d 100644 --- a/chrome/test/test_location_bar.h +++ b/chrome/test/test_location_bar.h @@ -40,6 +40,7 @@ class TestLocationBar : public LocationBar { virtual void UpdateFeedIcon() {} virtual void UpdatePageActions() {} virtual void SaveStateToContents(TabContents* contents) {} + virtual void Revert() {} private: |