summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/toolbar_controller.mm
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-19 17:20:30 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-19 17:20:30 +0000
commit05f53d7aa8d698bc62126d4fd79a7e398a377443 (patch)
tree95631049e23a842c157b2a04cce1b7d49f0e2b6f /chrome/browser/cocoa/toolbar_controller.mm
parentb13c94927b0e2747ddc9289ae21207c8b296b157 (diff)
downloadchromium_src-05f53d7aa8d698bc62126d4fd79a7e398a377443.zip
chromium_src-05f53d7aa8d698bc62126d4fd79a7e398a377443.tar.gz
chromium_src-05f53d7aa8d698bc62126d4fd79a7e398a377443.tar.bz2
Second half of CL 481012 (reverted at r35038). Will revert if Mac perf turns red.
CL 481012 was: Mac: implement DnD of URLs onto Omnibox. It was reverted due to a startup (perf) regression. The first half was re-committed at r35044. I can't for the life of me reproduce the regression locally, so I'm re-committing and watching the bots. BUG=24631 TEST=Select a URL/link/file from somewhere (a link in a browser, a URL in text, a file from the desktop, etc.) and drag it to the Omnibox in a Chromium browser window; the contents of the Omnibox should be selected to indicate that a drop would replace its contents; dropping should navigate to the appropriate location. TBR=shess@chromium.org Review URL: http://codereview.chromium.org/500153 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35053 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/toolbar_controller.mm')
-rw-r--r--chrome/browser/cocoa/toolbar_controller.mm35
1 files changed, 35 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm
index cb78971..93ec18a 100644
--- a/chrome/browser/cocoa/toolbar_controller.mm
+++ b/chrome/browser/cocoa/toolbar_controller.mm
@@ -25,9 +25,11 @@
#import "chrome/browser/cocoa/menu_button.h"
#import "chrome/browser/cocoa/menu_controller.h"
#import "chrome/browser/cocoa/toolbar_view.h"
+#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/page_menu_model.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url_model.h"
+#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/toolbar_model.h"
#include "chrome/common/notification_details.h"
#include "chrome/common/notification_observer.h"
@@ -680,4 +682,37 @@ class PrefObserverBridge : public NotificationObserver {
stack_bounds.Inset(kLocationStackEdgeWidth, 0);
return stack_bounds;
}
+
+// (URLDropTargetController protocol)
+- (void)dropURLs:(NSArray*)urls inView:(NSView*)view at:(NSPoint)point {
+ // TODO(viettrungluu): This code is more or less copied from the code in
+ // |TabStripController|. I'll refactor this soon to make it common and expand
+ // its capabilities (e.g., allow text DnD).
+ if ([urls count] < 1) {
+ NOTREACHED();
+ return;
+ }
+
+ //TODO(viettrungluu): dropping multiple URLs?
+ if ([urls count] > 1)
+ NOTIMPLEMENTED();
+
+ // Get the first URL and fix it up.
+ GURL url(URLFixerUpper::FixupURL(
+ base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string()));
+
+ browser_->GetSelectedTabContents()->OpenURL(url, GURL(), CURRENT_TAB,
+ PageTransition::TYPED);
+}
+
+// (URLDropTargetController protocol)
+- (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point {
+ // Do nothing.
+}
+
+// (URLDropTargetController protocol)
+- (void)hideDropURLsIndicatorInView:(NSView*)view {
+ // Do nothing.
+}
+
@end