Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_mac.h" | |
| 6 | |
| 7 #include "chrome/browser/ui/browser.h" | |
| 8 #include "chrome/browser/ui/browser_window.h" | |
| 9 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | |
| 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | |
| 11 | |
| 12 WebDragBookmarkHandlerMac::WebDragBookmarkHandlerMac() | |
| 13 : tab_(NULL) { | |
| 14 } | |
| 15 | |
| 16 WebDragBookmarkHandlerMac::~WebDragBookmarkHandlerMac() {} | |
| 17 | |
| 18 void WebDragBookmarkHandlerMac::DragInitialize(TabContents* contents) { | |
|
jochen (gone - plz use gerrit)
2011/11/01 15:16:07
maybe DCHECK that contents and tab are the same if
Avi (use Gerrit)
2011/11/01 16:01:06
Done.
| |
| 19 if (!tab_) | |
| 20 tab_ = TabContentsWrapper::GetCurrentWrapperForContents(contents); | |
| 21 | |
| 22 bookmark_drag_data_.ReadFromDragClipboard(); | |
| 23 } | |
| 24 | |
| 25 void WebDragBookmarkHandlerMac::OnDragOver() { | |
| 26 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) | |
|
jochen (gone - plz use gerrit)
2011/11/01 15:16:07
brackets since if-body >= 1 line
Avi (use Gerrit)
2011/11/01 16:01:06
will fix in source too
| |
| 27 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragOver( | |
| 28 bookmark_drag_data_); | |
| 29 } | |
| 30 | |
| 31 void WebDragBookmarkHandlerMac::OnDragEnter() { | |
| 32 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) | |
|
jochen (gone - plz use gerrit)
2011/11/01 15:16:07
same here
| |
| 33 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragEnter( | |
| 34 bookmark_drag_data_); | |
| 35 } | |
| 36 | |
| 37 void WebDragBookmarkHandlerMac::OnDrop() { | |
| 38 // This is non-null if tab_contents_ is showing an ExtensionWebUI with | |
| 39 // support for (at the moment experimental) drag and drop extensions. | |
| 40 if (tab_) { | |
| 41 if (tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { | |
| 42 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDrop( | |
| 43 bookmark_drag_data_); | |
| 44 } | |
| 45 | |
| 46 // Focus the target browser. | |
| 47 Browser* browser = Browser::GetBrowserForController( | |
| 48 &tab_->controller(), NULL); | |
| 49 if (browser) | |
| 50 browser->window()->Show(); | |
| 51 } | |
| 52 } | |
| 53 | |
| 54 void WebDragBookmarkHandlerMac::OnDragLeave() { | |
| 55 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) | |
|
jochen (gone - plz use gerrit)
2011/11/01 15:16:07
and here
| |
| 56 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragLeave( | |
| 57 bookmark_drag_data_); | |
| 58 } | |
| OLD | NEW |