OLD | NEW |
1 // Copyright (c) 2011 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 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.h" | 5 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.h" |
6 | 6 |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_finder.h" |
8 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
9 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" | 10 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
10 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 11 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
14 #include "ui/base/dragdrop/gtk_dnd_util.h" | 15 #include "ui/base/dragdrop/gtk_dnd_util.h" |
15 | 16 |
16 using content::WebContents; | 17 using content::WebContents; |
17 | 18 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 void WebDragBookmarkHandlerGtk::OnDrop() { | 77 void WebDragBookmarkHandlerGtk::OnDrop() { |
77 // This is non-null if tab_contents_ is showing an ExtensionWebUI with | 78 // This is non-null if tab_contents_ is showing an ExtensionWebUI with |
78 // support for (at the moment experimental) drag and drop extensions. | 79 // support for (at the moment experimental) drag and drop extensions. |
79 if (tab_) { | 80 if (tab_) { |
80 if (tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { | 81 if (tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { |
81 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDrop( | 82 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDrop( |
82 bookmark_drag_data_); | 83 bookmark_drag_data_); |
83 } | 84 } |
84 | 85 |
85 // Focus the target browser. | 86 // Focus the target browser. |
86 Browser* browser = Browser::GetBrowserForController( | 87 Browser* browser = browser::FindBrowserForController( |
87 &tab_->web_contents()->GetController(), NULL); | 88 &tab_->web_contents()->GetController(), NULL); |
88 if (browser) | 89 if (browser) |
89 browser->window()->Show(); | 90 browser->window()->Show(); |
90 } | 91 } |
91 } | 92 } |
92 | 93 |
93 void WebDragBookmarkHandlerGtk::OnDragLeave() { | 94 void WebDragBookmarkHandlerGtk::OnDragLeave() { |
94 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { | 95 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { |
95 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragLeave( | 96 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragLeave( |
96 bookmark_drag_data_); | 97 bookmark_drag_data_); |
97 } | 98 } |
98 } | 99 } |
OLD | NEW |