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

Unified Diff: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm

Issue 6982011: Strip leading "javascript:" schemas from text pasted or dropped into the omnibox. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
===================================================================
--- chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm (revision 84514)
+++ chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm (working copy)
@@ -9,7 +9,9 @@
#include "app/mac/nsimage_cache.h"
#include "base/mac/mac_util.h"
#include "base/memory/singleton.h"
+#include "base/string_util.h"
#include "base/sys_string_conversions.h"
+#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/autocomplete/autocomplete_classifier.h"
@@ -756,7 +758,12 @@
// Get the first URL and fix it up.
GURL url(URLFixerUpper::FixupURL(
base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string()));
-
+ if (url.SchemeIs("javascript")) {
Avi (use Gerrit) 2011/05/10 23:41:06 ditto
Cris Neckar 2011/05/11 21:42:36 Done.
+ string16 text(UTF8ToUTF16(url.spec()));
+ StripJavascriptSchema(text, &text);
+ browser_->window()->GetLocationBar()->location_entry()->SetUserText(text);
+ return;
+ }
browser_->GetSelectedTabContents()->OpenURL(url, GURL(), CURRENT_TAB,
PageTransition::TYPED);
}

Powered by Google App Engine
This is Rietveld 408576698