| 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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 762 if (url.SchemeIs(chrome::kJavaScriptScheme)) { |
| 763 string16 text(UTF8ToUTF16(url.spec())); |
| 764 StripJavascriptSchema(text, &text); |
| 765 browser_->window()->GetLocationBar()->location_entry()->SetUserText(text); |
| 766 return; |
| 767 } |
| 760 browser_->GetSelectedTabContents()->OpenURL(url, GURL(), CURRENT_TAB, | 768 browser_->GetSelectedTabContents()->OpenURL(url, GURL(), CURRENT_TAB, |
| 761 PageTransition::TYPED); | 769 PageTransition::TYPED); |
| 762 } | 770 } |
| 763 | 771 |
| 764 // (URLDropTargetController protocol) | 772 // (URLDropTargetController protocol) |
| 765 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point { | 773 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point { |
| 766 // TODO(viettrungluu): This code is more or less copied from the code in | 774 // 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 | 775 // |TabStripController|. I'll refactor this soon to make it common and expand |
| 768 // its capabilities (e.g., allow text DnD). | 776 // its capabilities (e.g., allow text DnD). |
| 769 | 777 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 781 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { | 789 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { |
| 782 // Do nothing. | 790 // Do nothing. |
| 783 } | 791 } |
| 784 | 792 |
| 785 // (URLDropTargetController protocol) | 793 // (URLDropTargetController protocol) |
| 786 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 794 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
| 787 // Do nothing. | 795 // Do nothing. |
| 788 } | 796 } |
| 789 | 797 |
| 790 @end | 798 @end |
| OLD | NEW |