OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/mac/nsimage_cache.h" | 9 #include "app/mac/nsimage_cache.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
12 #include "base/string_util.h" | |
12 #include "base/sys_string_conversions.h" | 13 #include "base/sys_string_conversions.h" |
14 #include "base/utf_string_conversions.h" | |
13 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
14 #include "chrome/browser/autocomplete/autocomplete.h" | 16 #include "chrome/browser/autocomplete/autocomplete.h" |
15 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 17 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
16 #include "chrome/browser/autocomplete/autocomplete_match.h" | 18 #include "chrome/browser/autocomplete/autocomplete_match.h" |
17 #include "chrome/browser/net/url_fixer_upper.h" | 19 #include "chrome/browser/net/url_fixer_upper.h" |
18 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
19 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/search_engines/template_url_model.h" | 22 #include "chrome/browser/search_engines/template_url_model.h" |
21 #include "chrome/browser/themes/theme_service.h" | 23 #include "chrome/browser/themes/theme_service.h" |
22 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
749 return; | 751 return; |
750 } | 752 } |
751 | 753 |
752 // TODO(viettrungluu): dropping multiple URLs? | 754 // TODO(viettrungluu): dropping multiple URLs? |
753 if ([urls count] > 1) | 755 if ([urls count] > 1) |
754 NOTIMPLEMENTED(); | 756 NOTIMPLEMENTED(); |
755 | 757 |
756 // Get the first URL and fix it up. | 758 // Get the first URL and fix it up. |
757 GURL url(URLFixerUpper::FixupURL( | 759 GURL url(URLFixerUpper::FixupURL( |
758 base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string())); | 760 base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string())); |
759 | 761 if (url.SchemeIs("javascript")) { |
Avi (use Gerrit)
2011/05/10 23:41:06
ditto
Cris Neckar
2011/05/11 21:42:36
Done.
| |
762 string16 text(UTF8ToUTF16(url.spec())); | |
763 StripJavascriptSchema(text, &text); | |
764 browser_->window()->GetLocationBar()->location_entry()->SetUserText(text); | |
765 return; | |
766 } | |
760 browser_->GetSelectedTabContents()->OpenURL(url, GURL(), CURRENT_TAB, | 767 browser_->GetSelectedTabContents()->OpenURL(url, GURL(), CURRENT_TAB, |
761 PageTransition::TYPED); | 768 PageTransition::TYPED); |
762 } | 769 } |
763 | 770 |
764 // (URLDropTargetController protocol) | 771 // (URLDropTargetController protocol) |
765 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point { | 772 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point { |
766 // TODO(viettrungluu): This code is more or less copied from the code in | 773 // TODO(viettrungluu): This code is more or less copied from the code in |
767 // |TabStripController|. I'll refactor this soon to make it common and expand | 774 // |TabStripController|. I'll refactor this soon to make it common and expand |
768 // its capabilities (e.g., allow text DnD). | 775 // its capabilities (e.g., allow text DnD). |
769 | 776 |
(...skipping 11 matching lines...) Expand all Loading... | |
781 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { | 788 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { |
782 // Do nothing. | 789 // Do nothing. |
783 } | 790 } |
784 | 791 |
785 // (URLDropTargetController protocol) | 792 // (URLDropTargetController protocol) |
786 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 793 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
787 // Do nothing. | 794 // Do nothing. |
788 } | 795 } |
789 | 796 |
790 @end | 797 @end |
OLD | NEW |