| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 46 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 47 #include "chrome/browser/ui/toolbar/wrench_menu_badge_controller.h" | 47 #include "chrome/browser/ui/toolbar/wrench_menu_badge_controller.h" |
| 48 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" | 48 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
| 49 #include "chrome/common/pref_names.h" | 49 #include "chrome/common/pref_names.h" |
| 50 #include "chrome/grit/chromium_strings.h" | 50 #include "chrome/grit/chromium_strings.h" |
| 51 #include "chrome/grit/generated_resources.h" | 51 #include "chrome/grit/generated_resources.h" |
| 52 #include "components/metrics/proto/omnibox_event.pb.h" | 52 #include "components/metrics/proto/omnibox_event.pb.h" |
| 53 #include "components/omnibox/browser/autocomplete_classifier.h" | 53 #include "components/omnibox/browser/autocomplete_classifier.h" |
| 54 #include "components/omnibox/browser/autocomplete_match.h" | 54 #include "components/omnibox/browser/autocomplete_match.h" |
| 55 #include "components/search_engines/template_url_service.h" | 55 #include "components/search_engines/template_url_service.h" |
| 56 #include "components/url_formatter/url_fixer.h" | 56 #include "components/url_fixer/url_fixer.h" |
| 57 #include "content/public/browser/web_contents.h" | 57 #include "content/public/browser/web_contents.h" |
| 58 #include "grit/theme_resources.h" | 58 #include "grit/theme_resources.h" |
| 59 #import "ui/base/cocoa/menu_controller.h" | 59 #import "ui/base/cocoa/menu_controller.h" |
| 60 #include "ui/base/l10n/l10n_util.h" | 60 #include "ui/base/l10n/l10n_util.h" |
| 61 #include "ui/base/l10n/l10n_util_mac.h" | 61 #include "ui/base/l10n/l10n_util_mac.h" |
| 62 #include "ui/gfx/geometry/rect.h" | 62 #include "ui/gfx/geometry/rect.h" |
| 63 #include "ui/gfx/image/image.h" | 63 #include "ui/gfx/image/image.h" |
| 64 | 64 |
| 65 using content::OpenURLParams; | 65 using content::OpenURLParams; |
| 66 using content::Referrer; | 66 using content::Referrer; |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 if ([urls count] < 1) { | 888 if ([urls count] < 1) { |
| 889 NOTREACHED(); | 889 NOTREACHED(); |
| 890 return; | 890 return; |
| 891 } | 891 } |
| 892 | 892 |
| 893 // TODO(viettrungluu): dropping multiple URLs? | 893 // TODO(viettrungluu): dropping multiple URLs? |
| 894 if ([urls count] > 1) | 894 if ([urls count] > 1) |
| 895 NOTIMPLEMENTED(); | 895 NOTIMPLEMENTED(); |
| 896 | 896 |
| 897 // Get the first URL and fix it up. | 897 // Get the first URL and fix it up. |
| 898 GURL url(url_formatter::FixupURL( | 898 GURL url(url_fixer::FixupURL(base::SysNSStringToUTF8([urls objectAtIndex:0]), |
| 899 base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string())); | 899 std::string())); |
| 900 | 900 |
| 901 if (url.SchemeIs(url::kJavaScriptScheme)) { | 901 if (url.SchemeIs(url::kJavaScriptScheme)) { |
| 902 browser_->window()->GetLocationBar()->GetOmniboxView()->SetUserText( | 902 browser_->window()->GetLocationBar()->GetOmniboxView()->SetUserText( |
| 903 OmniboxView::StripJavascriptSchemas(base::UTF8ToUTF16(url.spec()))); | 903 OmniboxView::StripJavascriptSchemas(base::UTF8ToUTF16(url.spec()))); |
| 904 } | 904 } |
| 905 OpenURLParams params( | 905 OpenURLParams params( |
| 906 url, Referrer(), CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false); | 906 url, Referrer(), CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false); |
| 907 browser_->tab_strip_model()->GetActiveWebContents()->OpenURL(params); | 907 browser_->tab_strip_model()->GetActiveWebContents()->OpenURL(params); |
| 908 } | 908 } |
| 909 | 909 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 934 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 934 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
| 935 // Do nothing. | 935 // Do nothing. |
| 936 } | 936 } |
| 937 | 937 |
| 938 // (URLDropTargetController protocol) | 938 // (URLDropTargetController protocol) |
| 939 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { | 939 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { |
| 940 return drag_util::IsUnsupportedDropData(profile_, info); | 940 return drag_util::IsUnsupportedDropData(profile_, info); |
| 941 } | 941 } |
| 942 | 942 |
| 943 @end | 943 @end |
| OLD | NEW |