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 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_mac.h" | 5 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_mac.h" |
6 | 6 |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/ui/browser_window.h" | 8 #include "chrome/browser/ui/browser_window.h" |
9 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 9 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 11 #include "content/browser/tab_contents/tab_contents.h" |
11 | 12 |
12 WebDragBookmarkHandlerMac::WebDragBookmarkHandlerMac() | 13 WebDragBookmarkHandlerMac::WebDragBookmarkHandlerMac() |
13 : tab_(NULL) { | 14 : tab_(NULL) { |
14 } | 15 } |
15 | 16 |
16 WebDragBookmarkHandlerMac::~WebDragBookmarkHandlerMac() {} | 17 WebDragBookmarkHandlerMac::~WebDragBookmarkHandlerMac() {} |
17 | 18 |
18 void WebDragBookmarkHandlerMac::DragInitialize(TabContents* contents) { | 19 void WebDragBookmarkHandlerMac::DragInitialize(TabContents* contents) { |
19 DCHECK(tab_ ? (tab_->tab_contents() == contents) : true); | 20 DCHECK(tab_ ? (tab_->tab_contents() == contents) : true); |
20 if (!tab_) | 21 if (!tab_) |
(...skipping 20 matching lines...) Expand all Loading... |
41 // This is non-null if tab_contents_ is showing an ExtensionWebUI with | 42 // This is non-null if tab_contents_ is showing an ExtensionWebUI with |
42 // support for (at the moment experimental) drag and drop extensions. | 43 // support for (at the moment experimental) drag and drop extensions. |
43 if (tab_) { | 44 if (tab_) { |
44 if (tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { | 45 if (tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { |
45 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDrop( | 46 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDrop( |
46 bookmark_drag_data_); | 47 bookmark_drag_data_); |
47 } | 48 } |
48 | 49 |
49 // Focus the target browser. | 50 // Focus the target browser. |
50 Browser* browser = Browser::GetBrowserForController( | 51 Browser* browser = Browser::GetBrowserForController( |
51 &tab_->controller(), NULL); | 52 &tab_->tab_contents()->controller(), NULL); |
52 if (browser) | 53 if (browser) |
53 browser->window()->Show(); | 54 browser->window()->Show(); |
54 } | 55 } |
55 } | 56 } |
56 | 57 |
57 void WebDragBookmarkHandlerMac::OnDragLeave() { | 58 void WebDragBookmarkHandlerMac::OnDragLeave() { |
58 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { | 59 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { |
59 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragLeave( | 60 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragLeave( |
60 bookmark_drag_data_); | 61 bookmark_drag_data_); |
61 } | 62 } |
62 } | 63 } |
OLD | NEW |