| 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_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_window.h" | 8 #include "chrome/browser/ui/browser_window.h" |
| 9 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" | 9 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
| 10 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 10 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 14 #include "ui/base/dragdrop/gtk_dnd_util.h" | 14 #include "ui/base/dragdrop/gtk_dnd_util.h" |
| 15 | 15 |
| 16 using content::WebContents; | 16 using content::WebContents; |
| 17 | 17 |
| 18 WebDragBookmarkHandlerGtk::WebDragBookmarkHandlerGtk() | 18 WebDragBookmarkHandlerGtk::WebDragBookmarkHandlerGtk() |
| 19 : tab_(NULL) { | 19 : tab_(NULL) { |
| 20 } | 20 } |
| 21 | 21 |
| 22 WebDragBookmarkHandlerGtk::~WebDragBookmarkHandlerGtk() {} | 22 WebDragBookmarkHandlerGtk::~WebDragBookmarkHandlerGtk() {} |
| 23 | 23 |
| 24 void WebDragBookmarkHandlerGtk::DragInitialize(WebContents* contents) { | 24 void WebDragBookmarkHandlerGtk::DragInitialize(WebContents* contents) { |
| 25 bookmark_drag_data_.Clear(); | 25 bookmark_drag_data_.Clear(); |
| 26 | 26 |
| 27 // Ideally we would want to initialize the the TabContentsWrapper member in | 27 // Ideally we would want to initialize the the TabContentsWrapper member in |
| 28 // the constructor. We cannot do that as the WebDragDestGtk object is | 28 // the constructor. We cannot do that as the WebDragDestGtk object is |
| 29 // created during the construction of the TabContents object. The | 29 // created during the construction of the WebContents object. The |
| 30 // TabContentsWrapper is created much later. | 30 // TabContentsWrapper is created much later. |
| 31 DCHECK(tab_ ? (tab_->web_contents() == contents) : true); | 31 DCHECK(tab_ ? (tab_->web_contents() == contents) : true); |
| 32 if (!tab_) | 32 if (!tab_) |
| 33 tab_ = TabContentsWrapper::GetCurrentWrapperForContents(contents); | 33 tab_ = TabContentsWrapper::GetCurrentWrapperForContents(contents); |
| 34 } | 34 } |
| 35 | 35 |
| 36 GdkAtom WebDragBookmarkHandlerGtk::GetBookmarkTargetAtom() const { | 36 GdkAtom WebDragBookmarkHandlerGtk::GetBookmarkTargetAtom() const { |
| 37 // For GTK, bookmark drag data is encoded as pickle and associated with | 37 // For GTK, bookmark drag data is encoded as pickle and associated with |
| 38 // ui::CHROME_BOOKMARK_ITEM. See bookmark_utils::WriteBookmarksToSelection() | 38 // ui::CHROME_BOOKMARK_ITEM. See bookmark_utils::WriteBookmarksToSelection() |
| 39 // for details. | 39 // for details. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 browser->window()->Show(); | 89 browser->window()->Show(); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 void WebDragBookmarkHandlerGtk::OnDragLeave() { | 93 void WebDragBookmarkHandlerGtk::OnDragLeave() { |
| 94 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { | 94 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { |
| 95 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragLeave( | 95 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragLeave( |
| 96 bookmark_drag_data_); | 96 bookmark_drag_data_); |
| 97 } | 97 } |
| 98 } | 98 } |
| OLD | NEW |