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

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: Rebase 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
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 // gestures. So disable overscroll navigation when the bookmark bar is in the 1125 // gestures. So disable overscroll navigation when the bookmark bar is in the
1126 // detached state and the overscroll effect moves the layers. 1126 // detached state and the overscroll effect moves the layers.
1127 if (value == "1" && bookmark_bar_state_ == BookmarkBar::DETACHED) 1127 if (value == "1" && bookmark_bar_state_ == BookmarkBar::DETACHED)
1128 return false; 1128 return false;
1129 return true; 1129 return true;
1130 #else 1130 #else
1131 return false; 1131 return false;
1132 #endif 1132 #endif
1133 } 1133 }
1134 1134
1135 bool Browser::ShouldPreserveAbortedURLs(WebContents* source) {
1136 // Allow failed URLs to stick around in the omnibox on the NTP, but not when
1137 // other pages have committed.
1138 Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext());
1139 if (!profile || !source->GetController().GetLastCommittedEntry())
1140 return false;
1141 GURL committed_url(source->GetController().GetLastCommittedEntry()->GetURL());
1142 return chrome::IsNTPURL(committed_url, profile);
1143 }
1144
1135 bool Browser::PreHandleKeyboardEvent(content::WebContents* source, 1145 bool Browser::PreHandleKeyboardEvent(content::WebContents* source,
1136 const NativeWebKeyboardEvent& event, 1146 const NativeWebKeyboardEvent& event,
1137 bool* is_keyboard_shortcut) { 1147 bool* is_keyboard_shortcut) {
1138 // Escape exits tabbed fullscreen mode. 1148 // Escape exits tabbed fullscreen mode.
1139 // TODO(koz): Write a test for this http://crbug.com/100441. 1149 // TODO(koz): Write a test for this http://crbug.com/100441.
1140 if (event.windowsKeyCode == 27 && 1150 if (event.windowsKeyCode == 27 &&
1141 fullscreen_controller_->HandleUserPressedEscape()) { 1151 fullscreen_controller_->HandleUserPressedEscape()) {
1142 return true; 1152 return true;
1143 } 1153 }
1144 return window()->PreHandleKeyboardEvent(event, is_keyboard_shortcut); 1154 return window()->PreHandleKeyboardEvent(event, is_keyboard_shortcut);
(...skipping 1267 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
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698