| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #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/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 NOTIMPLEMENTED(); | 1147 NOTIMPLEMENTED(); |
| 1148 | 1148 |
| 1149 // Get the first URL and fix it up. | 1149 // Get the first URL and fix it up. |
| 1150 GURL url(url_formatter::FixupURL( | 1150 GURL url(url_formatter::FixupURL( |
| 1151 base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string())); | 1151 base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string())); |
| 1152 | 1152 |
| 1153 if (url.SchemeIs(url::kJavaScriptScheme)) { | 1153 if (url.SchemeIs(url::kJavaScriptScheme)) { |
| 1154 browser_->window()->GetLocationBar()->GetOmniboxView()->SetUserText( | 1154 browser_->window()->GetLocationBar()->GetOmniboxView()->SetUserText( |
| 1155 OmniboxView::StripJavascriptSchemas(base::UTF8ToUTF16(url.spec()))); | 1155 OmniboxView::StripJavascriptSchemas(base::UTF8ToUTF16(url.spec()))); |
| 1156 } | 1156 } |
| 1157 OpenURLParams params( | 1157 OpenURLParams params(url, Referrer(), WindowOpenDisposition::CURRENT_TAB, |
| 1158 url, Referrer(), CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false); | 1158 ui::PAGE_TRANSITION_TYPED, false); |
| 1159 browser_->tab_strip_model()->GetActiveWebContents()->OpenURL(params); | 1159 browser_->tab_strip_model()->GetActiveWebContents()->OpenURL(params); |
| 1160 } | 1160 } |
| 1161 | 1161 |
| 1162 // (URLDropTargetController protocol) | 1162 // (URLDropTargetController protocol) |
| 1163 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point { | 1163 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point { |
| 1164 // TODO(viettrungluu): This code is more or less copied from the code in | 1164 // TODO(viettrungluu): This code is more or less copied from the code in |
| 1165 // |TabStripController|. I'll refactor this soon to make it common and expand | 1165 // |TabStripController|. I'll refactor this soon to make it common and expand |
| 1166 // its capabilities (e.g., allow text DnD). | 1166 // its capabilities (e.g., allow text DnD). |
| 1167 | 1167 |
| 1168 // If the input is plain text, classify the input and make the URL. | 1168 // If the input is plain text, classify the input and make the URL. |
| 1169 AutocompleteMatch match; | 1169 AutocompleteMatch match; |
| 1170 AutocompleteClassifierFactory::GetForProfile(browser_->profile())->Classify( | 1170 AutocompleteClassifierFactory::GetForProfile(browser_->profile())->Classify( |
| 1171 base::SysNSStringToUTF16(text), false, false, | 1171 base::SysNSStringToUTF16(text), false, false, |
| 1172 metrics::OmniboxEventProto::BLANK, &match, NULL); | 1172 metrics::OmniboxEventProto::BLANK, &match, NULL); |
| 1173 GURL url(match.destination_url); | 1173 GURL url(match.destination_url); |
| 1174 | 1174 |
| 1175 OpenURLParams params( | 1175 OpenURLParams params(url, Referrer(), WindowOpenDisposition::CURRENT_TAB, |
| 1176 url, Referrer(), CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false); | 1176 ui::PAGE_TRANSITION_TYPED, false); |
| 1177 browser_->tab_strip_model()->GetActiveWebContents()->OpenURL(params); | 1177 browser_->tab_strip_model()->GetActiveWebContents()->OpenURL(params); |
| 1178 } | 1178 } |
| 1179 | 1179 |
| 1180 // (URLDropTargetController protocol) | 1180 // (URLDropTargetController protocol) |
| 1181 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { | 1181 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { |
| 1182 // Do nothing. | 1182 // Do nothing. |
| 1183 } | 1183 } |
| 1184 | 1184 |
| 1185 // (URLDropTargetController protocol) | 1185 // (URLDropTargetController protocol) |
| 1186 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 1186 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
| 1187 // Do nothing. | 1187 // Do nothing. |
| 1188 } | 1188 } |
| 1189 | 1189 |
| 1190 // (URLDropTargetController protocol) | 1190 // (URLDropTargetController protocol) |
| 1191 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { | 1191 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { |
| 1192 return drag_util::IsUnsupportedDropData(profile_, info); | 1192 return drag_util::IsUnsupportedDropData(profile_, info); |
| 1193 } | 1193 } |
| 1194 | 1194 |
| 1195 @end | 1195 @end |
| OLD | NEW |