| OLD | NEW |
| 1 // Copyright (c) 2012 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_aura.h" | 5 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_aura.h" |
| 6 | 6 |
| 7 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 7 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.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 "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 #include "ui/base/dragdrop/os_exchange_data.h" | 13 #include "ui/base/dragdrop/os_exchange_data.h" |
| 14 #include "ui/base/dragdrop/os_exchange_data_provider_aura.h" | 14 #include "ui/base/dragdrop/os_exchange_data_provider_aura.h" |
| 15 #include "webkit/glue/webdropdata.h" | 15 #include "webkit/glue/webdropdata.h" |
| 16 | 16 |
| 17 using content::WebContents; | 17 using content::WebContents; |
| 18 | 18 |
| 19 WebDragBookmarkHandlerAura::WebDragBookmarkHandlerAura() | 19 WebDragBookmarkHandlerAura::WebDragBookmarkHandlerAura() |
| 20 : tab_(NULL) { | 20 : tab_(NULL) { |
| 21 } | 21 } |
| 22 | 22 |
| 23 WebDragBookmarkHandlerAura::~WebDragBookmarkHandlerAura() { | 23 WebDragBookmarkHandlerAura::~WebDragBookmarkHandlerAura() { |
| 24 } | 24 } |
| 25 | 25 |
| 26 void WebDragBookmarkHandlerAura::DragInitialize(WebContents* contents) { | 26 void WebDragBookmarkHandlerAura::DragInitialize(WebContents* contents) { |
| 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 WebDragDest object is | 28 // the constructor. We cannot do that as the WebDragDest 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 void WebDragBookmarkHandlerAura::OnDragOver() { | 36 void WebDragBookmarkHandlerAura::OnDragOver() { |
| 37 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { | 37 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { |
| 38 if (bookmark_drag_data_.is_valid()) | 38 if (bookmark_drag_data_.is_valid()) |
| 39 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragOver( | 39 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragOver( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 void WebDragBookmarkHandlerAura::OnDragLeave() { | 80 void WebDragBookmarkHandlerAura::OnDragLeave() { |
| 81 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { | 81 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { |
| 82 if (bookmark_drag_data_.is_valid()) | 82 if (bookmark_drag_data_.is_valid()) |
| 83 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragLeave( | 83 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragLeave( |
| 84 bookmark_drag_data_); | 84 bookmark_drag_data_); |
| 85 } | 85 } |
| 86 | 86 |
| 87 bookmark_drag_data_.Clear(); | 87 bookmark_drag_data_.Clear(); |
| 88 } | 88 } |
| OLD | NEW |