Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 232463007: Don't leave aborted URLs in the omnibox unless we're on a new tab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix and add tests. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 // defined(OS_WIN) 10 #endif // defined(OS_WIN)
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 // gestures. So disable overscroll navigation when the bookmark bar is in the 1124 // gestures. So disable overscroll navigation when the bookmark bar is in the
1125 // detached state and the overscroll effect moves the layers. 1125 // detached state and the overscroll effect moves the layers.
1126 if (value == "1" && bookmark_bar_state_ == BookmarkBar::DETACHED) 1126 if (value == "1" && bookmark_bar_state_ == BookmarkBar::DETACHED)
1127 return false; 1127 return false;
1128 return true; 1128 return true;
1129 #else 1129 #else
1130 return false; 1130 return false;
1131 #endif 1131 #endif
1132 } 1132 }
1133 1133
1134 bool Browser::ShouldPreserveAbortedURLs(WebContents* source) {
1135 // Allow failed URLs to stick around in the omnibox on the NTP, but not when
1136 // other pages have committed.
1137 Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext());
1138 if (!profile || !source->GetController().GetLastCommittedEntry())
1139 return false;
1140 GURL committed_url(source->GetController().GetLastCommittedEntry()->GetURL());
1141 return chrome::IsNTPURL(committed_url, profile);
1142 }
1143
1134 bool Browser::PreHandleKeyboardEvent(content::WebContents* source, 1144 bool Browser::PreHandleKeyboardEvent(content::WebContents* source,
1135 const NativeWebKeyboardEvent& event, 1145 const NativeWebKeyboardEvent& event,
1136 bool* is_keyboard_shortcut) { 1146 bool* is_keyboard_shortcut) {
1137 // Escape exits tabbed fullscreen mode. 1147 // Escape exits tabbed fullscreen mode.
1138 // TODO(koz): Write a test for this http://crbug.com/100441. 1148 // TODO(koz): Write a test for this http://crbug.com/100441.
1139 if (event.windowsKeyCode == 27 && 1149 if (event.windowsKeyCode == 27 &&
1140 fullscreen_controller_->HandleUserPressedEscape()) { 1150 fullscreen_controller_->HandleUserPressedEscape()) {
1141 return true; 1151 return true;
1142 } 1152 }
1143 return window()->PreHandleKeyboardEvent(event, is_keyboard_shortcut); 1153 return window()->PreHandleKeyboardEvent(event, is_keyboard_shortcut);
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
2412 if (contents && !allow_js_access) { 2422 if (contents && !allow_js_access) {
2413 contents->web_contents()->GetController().LoadURL( 2423 contents->web_contents()->GetController().LoadURL(
2414 target_url, 2424 target_url,
2415 content::Referrer(), 2425 content::Referrer(),
2416 content::PAGE_TRANSITION_LINK, 2426 content::PAGE_TRANSITION_LINK,
2417 std::string()); // No extra headers. 2427 std::string()); // No extra headers.
2418 } 2428 }
2419 2429
2420 return contents != NULL; 2430 return contents != NULL;
2421 } 2431 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698