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_win.h" | 5 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_win.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_finder.h" |
9 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.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 "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
14 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
15 #include "ui/base/dragdrop/os_exchange_data.h" | 16 #include "ui/base/dragdrop/os_exchange_data.h" |
16 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" | 17 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
17 #include "webkit/glue/webdropdata.h" | 18 #include "webkit/glue/webdropdata.h" |
18 | 19 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 ui::OSExchangeData os_exchange_data( | 68 ui::OSExchangeData os_exchange_data( |
68 new ui::OSExchangeDataProviderWin(data_object)); | 69 new ui::OSExchangeDataProviderWin(data_object)); |
69 BookmarkNodeData bookmark_drag_data; | 70 BookmarkNodeData bookmark_drag_data; |
70 if (bookmark_drag_data.Read(os_exchange_data)) { | 71 if (bookmark_drag_data.Read(os_exchange_data)) { |
71 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDrop( | 72 tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDrop( |
72 bookmark_drag_data); | 73 bookmark_drag_data); |
73 } | 74 } |
74 } | 75 } |
75 | 76 |
76 // Focus the target browser. | 77 // Focus the target browser. |
77 Browser* browser = Browser::GetBrowserForController( | 78 Browser* browser = browser::FindBrowserForController( |
78 &tab_->web_contents()->GetController(), NULL); | 79 &tab_->web_contents()->GetController(), NULL); |
79 if (browser) | 80 if (browser) |
80 browser->window()->Show(); | 81 browser->window()->Show(); |
81 } | 82 } |
82 } | 83 } |
83 | 84 |
84 void WebDragBookmarkHandlerWin::OnDragLeave(IDataObject* data_object) { | 85 void WebDragBookmarkHandlerWin::OnDragLeave(IDataObject* data_object) { |
85 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { | 86 if (tab_ && tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) { |
86 ui::OSExchangeData os_exchange_data( | 87 ui::OSExchangeData os_exchange_data( |
87 new ui::OSExchangeDataProviderWin(data_object)); | 88 new ui::OSExchangeDataProviderWin(data_object)); |
(...skipping 20 matching lines...) Expand all Loading... |
108 | 109 |
109 BookmarkNodeData bm_drag_data; | 110 BookmarkNodeData bm_drag_data; |
110 bm_drag_data.elements.push_back(bm_elt); | 111 bm_drag_data.elements.push_back(bm_elt); |
111 | 112 |
112 // Pass in NULL as the profile so that the bookmark always adds the url | 113 // Pass in NULL as the profile so that the bookmark always adds the url |
113 // rather than trying to move an existing url. | 114 // rather than trying to move an existing url. |
114 bm_drag_data.Write(NULL, data); | 115 bm_drag_data.Write(NULL, data); |
115 | 116 |
116 return true; | 117 return true; |
117 } | 118 } |
OLD | NEW |