| 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 "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 GURL url(URLFixerUpper::FixupURL( | 753 GURL url(URLFixerUpper::FixupURL( |
| 754 base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string())); | 754 base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string())); |
| 755 | 755 |
| 756 if (url.SchemeIs(chrome::kJavaScriptScheme)) { | 756 if (url.SchemeIs(chrome::kJavaScriptScheme)) { |
| 757 browser_->window()->GetLocationBar()->location_entry()->SetUserText( | 757 browser_->window()->GetLocationBar()->location_entry()->SetUserText( |
| 758 OmniboxView::StripJavascriptSchemas(UTF8ToUTF16(url.spec()))); | 758 OmniboxView::StripJavascriptSchemas(UTF8ToUTF16(url.spec()))); |
| 759 return; | 759 return; |
| 760 } | 760 } |
| 761 OpenURLParams params( | 761 OpenURLParams params( |
| 762 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); | 762 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); |
| 763 browser_->GetSelectedTabContents()->OpenURL(params); | 763 browser_->GetSelectedWebContents()->OpenURL(params); |
| 764 } | 764 } |
| 765 | 765 |
| 766 // (URLDropTargetController protocol) | 766 // (URLDropTargetController protocol) |
| 767 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point { | 767 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point { |
| 768 // TODO(viettrungluu): This code is more or less copied from the code in | 768 // TODO(viettrungluu): This code is more or less copied from the code in |
| 769 // |TabStripController|. I'll refactor this soon to make it common and expand | 769 // |TabStripController|. I'll refactor this soon to make it common and expand |
| 770 // its capabilities (e.g., allow text DnD). | 770 // its capabilities (e.g., allow text DnD). |
| 771 | 771 |
| 772 // If the input is plain text, classify the input and make the URL. | 772 // If the input is plain text, classify the input and make the URL. |
| 773 AutocompleteMatch match; | 773 AutocompleteMatch match; |
| 774 browser_->profile()->GetAutocompleteClassifier()->Classify( | 774 browser_->profile()->GetAutocompleteClassifier()->Classify( |
| 775 base::SysNSStringToUTF16(text), string16(), false, false, &match, NULL); | 775 base::SysNSStringToUTF16(text), string16(), false, false, &match, NULL); |
| 776 GURL url(match.destination_url); | 776 GURL url(match.destination_url); |
| 777 | 777 |
| 778 OpenURLParams params( | 778 OpenURLParams params( |
| 779 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); | 779 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); |
| 780 browser_->GetSelectedTabContents()->OpenURL(params); | 780 browser_->GetSelectedWebContents()->OpenURL(params); |
| 781 } | 781 } |
| 782 | 782 |
| 783 // (URLDropTargetController protocol) | 783 // (URLDropTargetController protocol) |
| 784 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { | 784 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { |
| 785 // Do nothing. | 785 // Do nothing. |
| 786 } | 786 } |
| 787 | 787 |
| 788 // (URLDropTargetController protocol) | 788 // (URLDropTargetController protocol) |
| 789 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 789 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
| 790 // Do nothing. | 790 // Do nothing. |
| 791 } | 791 } |
| 792 | 792 |
| 793 // (URLDropTargetController protocol) | 793 // (URLDropTargetController protocol) |
| 794 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { | 794 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { |
| 795 return drag_util::IsUnsupportedDropData(profile_, info); | 795 return drag_util::IsUnsupportedDropData(profile_, info); |
| 796 } | 796 } |
| 797 | 797 |
| 798 @end | 798 @end |
| OLD | NEW |